Skip to content

Commit

Permalink
Feature/boost notifications (#1385)
Browse files Browse the repository at this point in the history
* add view and icon

* view implementation

* polish UI

* remove unused spacing

* Update notificationsBoost resources

* bottomSheet implementation

* incapsulate icons

* configure bottom sheet

* Polish UI for PushNotificationBoostView

* Polish NotificationBoost views

* set folder

* fix format

* Configure AllSet view

* refactore viewModel

* reuse view

* fix ui

* Refactore push notification boost views

* isClosable

* close button

* Aligne UI

* Implement layoutMarginsGuide

* improve UI

* rename

* polish configuration

* link action

* refactore

* add demoes

* fix typo

* fix paddings

* fix padding

* revert

* set bg

* fix

* test

* fix color and text size

* Revert "revert"

This reverts commit 0782097.

* fix fonts

* fix VO

* fix accesibility

* ignore emojies

---------

Co-authored-by: Andrii Momot <[email protected]>
  • Loading branch information
AndreyMomot and Andrii Momot authored Nov 12, 2024
1 parent 6338302 commit bf4ca40
Show file tree
Hide file tree
Showing 29 changed files with 570 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Demo/Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@
9BBC904024FD252B0003D2D8 /* UITraitCollection+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BBC903F24FD252B0003D2D8 /* UITraitCollection+Extensions.swift */; };
B26B58342B4BFEFB000E0245 /* InfoboxSwiftUIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B26B58332B4BFEFB000E0245 /* InfoboxSwiftUIViewController.swift */; };
B2B8F16B2B483F2F0090573E /* NMPInfoboxViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2B8F16A2B483F2F0090573E /* NMPInfoboxViewController.swift */; };
B656EA972CC289AB00751289 /* PushNotificationNudgingDemoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B656EA962CC289AB00751289 /* PushNotificationNudgingDemoView.swift */; };
B656EA992CC28A2600751289 /* PushNotificationNudgingBottomSheetDemoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B656EA982CC28A2600751289 /* PushNotificationNudgingBottomSheetDemoView.swift */; };
D75E14D727371692008EB126 /* FrontPageSavedSearchFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = D75E14D627371692008EB126 /* FrontPageSavedSearchFactory.swift */; };
D7C750382731C61A002BDE98 /* FrontPageSavedSearchesDemoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C750372731C61A002BDE98 /* FrontPageSavedSearchesDemoView.swift */; };
D7D514C7272942E10065E2F6 /* PromotionDemoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7D514C6272942E10065E2F6 /* PromotionDemoView.swift */; };
Expand Down Expand Up @@ -386,6 +388,8 @@
9BBC903F24FD252B0003D2D8 /* UITraitCollection+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITraitCollection+Extensions.swift"; sourceTree = "<group>"; };
B26B58332B4BFEFB000E0245 /* InfoboxSwiftUIViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoboxSwiftUIViewController.swift; sourceTree = "<group>"; };
B2B8F16A2B483F2F0090573E /* NMPInfoboxViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NMPInfoboxViewController.swift; sourceTree = "<group>"; };
B656EA962CC289AB00751289 /* PushNotificationNudgingDemoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PushNotificationNudgingDemoView.swift; sourceTree = "<group>"; };
B656EA982CC28A2600751289 /* PushNotificationNudgingBottomSheetDemoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PushNotificationNudgingBottomSheetDemoView.swift; sourceTree = "<group>"; };
D75E14D627371692008EB126 /* FrontPageSavedSearchFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FrontPageSavedSearchFactory.swift; sourceTree = "<group>"; };
D7C750372731C61A002BDE98 /* FrontPageSavedSearchesDemoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FrontPageSavedSearchesDemoView.swift; sourceTree = "<group>"; };
D7D514C6272942E10065E2F6 /* PromotionDemoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromotionDemoView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1595,6 +1599,8 @@
17F8EEC529409FE3000E26C9 /* SwiftUISelectionListDemoView.swift */,
27FAFCB72988FE6100FEDAE0 /* ToastSwiftUIDemoView.swift */,
277307E4298C108800B8E27F /* ResultSwiftUIDemoView.swift */,
B656EA962CC289AB00751289 /* PushNotificationNudgingDemoView.swift */,
B656EA982CC28A2600751289 /* PushNotificationNudgingBottomSheetDemoView.swift */,
);
path = SwiftUI;
sourceTree = "<group>";
Expand Down Expand Up @@ -1847,6 +1853,7 @@
DA083C2E2462BCA800B26235 /* SwiftUIDemoViews.swift in Sources */,
46E77469242CEF0A008A5E93 /* FavoriteFoldersListViewDemoViewHelpers.swift in Sources */,
46E7741F242CEF0A008A5E93 /* ButtonDemoView.swift in Sources */,
B656EA992CC28A2600751289 /* PushNotificationNudgingBottomSheetDemoView.swift in Sources */,
277307E5298C108800B8E27F /* ResultSwiftUIDemoView.swift in Sources */,
46E773D3242CEF0A008A5E93 /* EmptyViewDemoView.swift in Sources */,
46E77459242CEF0A008A5E93 /* AdRecommendationsGridViewDemoViewHelpers.swift in Sources */,
Expand Down Expand Up @@ -1919,6 +1926,7 @@
D7D514C7272942E10065E2F6 /* PromotionDemoView.swift in Sources */,
46E773D7242CEF0A008A5E93 /* FavoriteAdsListDemoViewController.swift in Sources */,
46E77406242CEF0A008A5E93 /* VisibilityDrivenTitleDemoView.swift in Sources */,
B656EA972CC289AB00751289 /* PushNotificationNudgingDemoView.swift in Sources */,
46E773F5242CEF0A008A5E93 /* SelectorTitleViewDemoView.swift in Sources */,
17EE08632AA8ABCC00A623F2 /* FrontPageTransactionListDemoViewController.swift in Sources */,
46E77435242CEF0A008A5E93 /* PhaseListViewDemo.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "bell.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "bellOff.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "bottomSheetBell.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "bottomSheetFeedback.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "bottomSheetSearchFavorites.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
10 changes: 10 additions & 0 deletions Demo/Sources/Assets/ImageAsset.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ enum ImageAsset: String {
case autovex
case avatar
case bapShippable
case bell
case bellOff
case betaImageSearch
case blinkRocketMini
case bottomSheetBell
case bottomSheetFeedback
case bottomSheetSearchFavorites
case cabin
case car
case carFront
Expand Down Expand Up @@ -158,8 +163,13 @@ enum ImageAsset: String {
.autovex,
.avatar,
.bapShippable,
.bell,
.bellOff,
.betaImageSearch,
.blinkRocketMini,
.bottomSheetBell,
.bottomSheetFeedback,
.bottomSheetSearchFavorites,
.cabin,
.car,
.carFront,
Expand Down
6 changes: 6 additions & 0 deletions Demo/Sources/Demo/DemoViews/SwiftUIDemoViews.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ enum SwiftUIDemoViews: String, CaseIterable, DemoGroup, DemoGroupItem {
case textView
case toast
case resultView
case pushNotificationNudging
case pushNotificationNudgingBottomSheet

static var groupTitle: String { "SwiftUI" }
static var numberOfDemos: Int { allCases.count }
Expand Down Expand Up @@ -54,6 +56,10 @@ enum SwiftUIDemoViews: String, CaseIterable, DemoGroup, DemoGroupItem {
return ToastSwiftUIDemoView_Previews()
case .resultView:
return ResultSwiftUIDemoViewController()
case .pushNotificationNudging:
return PushNotificationNudgingDemoView_Previews()
case .pushNotificationNudgingBottomSheet:
return PushNotificationNudgingBottomSheetDemoView_Previews()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import DemoKit
import FinniversKit
import Foundation
import SwiftUI

struct PushNotificationNudgingBottomSheetDemoView_Previews: PreviewProvider, Demoable {
static var previews: some View {
let section1 = PushNotificationNudgingBottomSheetViewModel.Section(
icon: Image(uiImage: UIImage(named: .bottomSheetBell)),
description: "Get real-time alerts when somebody wants to buy your item."
)
let section2 = PushNotificationNudgingBottomSheetViewModel.Section(
icon: Image(uiImage: UIImage(named: .bottomSheetFeedback)),
description: "Reply faster to messages and increase your chances to a quick sale."
)
let section3 = PushNotificationNudgingBottomSheetViewModel.Section(
icon: Image(uiImage: UIImage(named: .bottomSheetSearchFavorites)),
description: "Hear instantly of a new match in your saved search or a price drop on a favourite."
)

let allowButton = PushNotificationNudgingBottomSheetViewModel.Button(
kind: .allow,
title: "Allow Push Notifications"
)
let notNowButton = PushNotificationNudgingBottomSheetViewModel.Button(
kind: .notNow,
title: "Not now"
)

let viewModel = PushNotificationNudgingBottomSheetViewModel(
title: "Don’t miss out on important stuff",
sections: [section1, section2, section3],
buttons: [allowButton, notNowButton]
)

return PushNotificationNudgingBottomSheet(viewModel: viewModel)
}
}
30 changes: 30 additions & 0 deletions Demo/Sources/SwiftUI/PushNotificationNudgingDemoView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import DemoKit
import FinniversKit
import Foundation
import SwiftUI

struct PushNotificationNudgingDemoView_Previews: PreviewProvider, Demoable {
static var previews: some View {
VStack {
PushNotificationNudgingView(viewModel: PushNotificationNudgingViewModel(
icon: Image(uiImage: UIImage(named: .bellOff)),
title: "Boost your chances of a quick sale!",
description: "Get real-time alerts when buyers message you or express interest in your items.",
state: .initialPrompt
))

PushNotificationNudgingView(viewModel: PushNotificationNudgingViewModel(
icon: Image(uiImage: UIImage(named: .bellOff)),
title: "You won’t get notifications for now",
description: "If you change your mind, you can edit your notification settings anytime.",
state: .turnedOff
))

PushNotificationNudgingView(viewModel: PushNotificationNudgingViewModel(
icon: Image(uiImage: UIImage(named: .bell)),
title: "You’re all set!",
state: .allSet
))
}
}
}
40 changes: 40 additions & 0 deletions FinniversKit/FinniversKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@
B2829E2D2C7F054F0032BDFA /* HTMLAttributeStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2829E2C2C7F054F0032BDFA /* HTMLAttributeStack.swift */; };
B2829E2F2C7F05D20032BDFA /* LocalizedStringKey+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2829E2E2C7F05D20032BDFA /* LocalizedStringKey+Extensions.swift */; };
B6801C1C2982ECCA004A0F4F /* SettingsHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6801C1B2982ECCA004A0F4F /* SettingsHeaderView.swift */; };
B6F5ECB12CB56CCA00E24EC3 /* PushNotificationNudgingBottomSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6F5ECAA2CB56CCA00E24EC3 /* PushNotificationNudgingBottomSheet.swift */; };
B6F5ECB22CB56CCA00E24EC3 /* PushNotificationNudgingBottomSheetViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6F5ECAB2CB56CCA00E24EC3 /* PushNotificationNudgingBottomSheetViewModel.swift */; };
B6F5ECB32CB56CCA00E24EC3 /* PushNotificationNudgingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6F5ECAD2CB56CCA00E24EC3 /* PushNotificationNudgingView.swift */; };
B6F5ECB42CB56CCA00E24EC3 /* PushNotificationNudgingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6F5ECAE2CB56CCA00E24EC3 /* PushNotificationNudgingViewModel.swift */; };
CBD2F08D20615990002AA385 /* TextField+State.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBD2F08C20615990002AA385 /* TextField+State.swift */; };
CF05B7E023325968003A7F1C /* FavoriteFolderActionButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF05B7DF23325968003A7F1C /* FavoriteFolderActionButton.swift */; };
CF05BA02233B78BC003A7F1C /* FavoriteSearchEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF05BA01233B78BC003A7F1C /* FavoriteSearchEmptyView.swift */; };
Expand Down Expand Up @@ -736,6 +740,10 @@
B2829E2C2C7F054F0032BDFA /* HTMLAttributeStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTMLAttributeStack.swift; sourceTree = "<group>"; };
B2829E2E2C7F05D20032BDFA /* LocalizedStringKey+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LocalizedStringKey+Extensions.swift"; sourceTree = "<group>"; };
B6801C1B2982ECCA004A0F4F /* SettingsHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsHeaderView.swift; sourceTree = "<group>"; };
B6F5ECAA2CB56CCA00E24EC3 /* PushNotificationNudgingBottomSheet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushNotificationNudgingBottomSheet.swift; sourceTree = "<group>"; };
B6F5ECAB2CB56CCA00E24EC3 /* PushNotificationNudgingBottomSheetViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushNotificationNudgingBottomSheetViewModel.swift; sourceTree = "<group>"; };
B6F5ECAD2CB56CCA00E24EC3 /* PushNotificationNudgingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushNotificationNudgingView.swift; sourceTree = "<group>"; };
B6F5ECAE2CB56CCA00E24EC3 /* PushNotificationNudgingViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushNotificationNudgingViewModel.swift; sourceTree = "<group>"; };
CB3CF1561F73E5870041EF20 /* FinniversKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FinniversKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
CBD2F08C20615990002AA385 /* TextField+State.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TextField+State.swift"; sourceTree = "<group>"; };
CF05B7DF23325968003A7F1C /* FavoriteFolderActionButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteFolderActionButton.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1392,6 +1400,7 @@
CF0F6B902360682100CA62FD /* Priming */,
D7D514C227293F5D0065E2F6 /* PromotionView */,
F2C3E95A22CB634700CED7E0 /* QuestionnaireView */,
B6F5ECB02CB56CCA00E24EC3 /* PushNotificationNudgingView */,
CF8F024321DE0FF9004C4042 /* RefreshControl */,
9A37D8B81C3158FE1373F3E4 /* RemoteImageView */,
F2772F3F2280397E0002D21F /* ReviewButtonView */,
Expand Down Expand Up @@ -2343,6 +2352,33 @@
path = Sources/Components/NMPInfobox;
sourceTree = SOURCE_ROOT;
};
B6F5ECAC2CB56CCA00E24EC3 /* PushNotificationNudgingBottomSheet */ = {
isa = PBXGroup;
children = (
B6F5ECAA2CB56CCA00E24EC3 /* PushNotificationNudgingBottomSheet.swift */,
B6F5ECAB2CB56CCA00E24EC3 /* PushNotificationNudgingBottomSheetViewModel.swift */,
);
path = PushNotificationNudgingBottomSheet;
sourceTree = "<group>";
};
B6F5ECAF2CB56CCA00E24EC3 /* PushNotificationNudgingView */ = {
isa = PBXGroup;
children = (
B6F5ECAD2CB56CCA00E24EC3 /* PushNotificationNudgingView.swift */,
B6F5ECAE2CB56CCA00E24EC3 /* PushNotificationNudgingViewModel.swift */,
);
path = PushNotificationNudgingView;
sourceTree = "<group>";
};
B6F5ECB02CB56CCA00E24EC3 /* PushNotificationNudgingView */ = {
isa = PBXGroup;
children = (
B6F5ECAC2CB56CCA00E24EC3 /* PushNotificationNudgingBottomSheet */,
B6F5ECAF2CB56CCA00E24EC3 /* PushNotificationNudgingView */,
);
path = PushNotificationNudgingView;
sourceTree = "<group>";
};
CF0F6B902360682100CA62FD /* Priming */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3125,12 +3161,14 @@
44D9125F2077AC8A00486848 /* EmptyView.swift in Sources */,
44A557B622E72187001667AE /* CheckboxTableViewCell.swift in Sources */,
CF376C18231D452100ED2B24 /* Array+Step.swift in Sources */,
B6F5ECB32CB56CCA00E24EC3 /* PushNotificationNudgingView.swift in Sources */,
E65085DA292BC03400A43B07 /* SwiftUIRadioButton.swift in Sources */,
CF164CFD230EB0F900250822 /* CheckmarkImageView.swift in Sources */,
9B06096823F14B0A005CB592 /* SafetyElementViewModel.swift in Sources */,
CF164D15230FFB7400250822 /* FavoriteAdActionViewModel.swift in Sources */,
CF136ACD2203211100247B30 /* InfoboxView.swift in Sources */,
4447F6D21FDB2B110033DBC1 /* Label.swift in Sources */,
B6F5ECB12CB56CCA00E24EC3 /* PushNotificationNudgingBottomSheet.swift in Sources */,
179D06A92906A39D00A65E3A /* HTMLStringParser.swift in Sources */,
9B06097023F14BB4005CB592 /* HeaderView.swift in Sources */,
AF91BBA1202C8B72003E6366 /* Broadcast+Style.swift in Sources */,
Expand Down Expand Up @@ -3425,6 +3463,7 @@
E65085D4292BBF7500A43B07 /* StatefulPreviewWrapper.swift in Sources */,
9A37D9EDC4E78EC664D528FE /* FeedbackView.swift in Sources */,
5DCE0882280FDDF100ED7407 /* MonthAndYearPickerView.swift in Sources */,
B6F5ECB42CB56CCA00E24EC3 /* PushNotificationNudgingViewModel.swift in Sources */,
9F213438F5413991D1B3D7CD /* FullscreenGalleryViewModel.swift in Sources */,
9F2138937E903BEA8F7A8C7C /* FullscreenGalleryViewController.swift in Sources */,
CFF54E2E234E192A008E18BE /* FavoriteAdsSubtitleView.swift in Sources */,
Expand Down Expand Up @@ -3457,6 +3496,7 @@
DA083E7324630BC400B26235 /* SettingsSection.swift in Sources */,
494047FE23CDBBA100ECBCFD /* ViewingItemViewModel.swift in Sources */,
CF05B7E023325968003A7F1C /* FavoriteFolderActionButton.swift in Sources */,
B6F5ECB22CB56CCA00E24EC3 /* PushNotificationNudgingBottomSheetViewModel.swift in Sources */,
F253C50E2313F9F5008175FD /* VerificationView.swift in Sources */,
0379D1EE2AB3321300CC1B38 /* UIImage+FinniversKit.swift in Sources */,
9A37DC6E6F0401357C564B93 /* RemoteImageView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "bell.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "bellOff.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "closeCross.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Loading

0 comments on commit bf4ca40

Please sign in to comment.