diff --git a/Config/BWIBuildSettings.swift b/Config/BWIBuildSettings.swift index f1835d3fa..68c55a56f 100644 --- a/Config/BWIBuildSettings.swift +++ b/Config/BWIBuildSettings.swift @@ -591,7 +591,7 @@ class BWIBuildSettings: NSObject { var bwiEnableRegisterInfo = false var bwiShowHappyBirthdayCampaign = false - var bwiHappyBirthdayCampaignIdentifier: String = "2022" + var bwiHappyBirthdayCampaignIdentifier: String = "2024" var bwiDisableSecuritySettingsUntrustedDevices = true diff --git a/Riot/Assets/Images.xcassets/BWI/birthday_cake.imageset/20221027_BwM_Bday_scaled.svg b/Riot/Assets/Images.xcassets/BWI/birthday_cake.imageset/20221027_BwM_Bday_scaled.svg deleted file mode 100644 index 046eb8d06..000000000 --- a/Riot/Assets/Images.xcassets/BWI/birthday_cake.imageset/20221027_BwM_Bday_scaled.svg +++ /dev/null @@ -1,274 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Riot/Assets/Images.xcassets/BWI/birthday_cake.imageset/Contents.json b/Riot/Assets/Images.xcassets/BWI/birthday_cake.imageset/Contents.json index 23da91cb0..8808d0834 100644 --- a/Riot/Assets/Images.xcassets/BWI/birthday_cake.imageset/Contents.json +++ b/Riot/Assets/Images.xcassets/BWI/birthday_cake.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "20221027_BwM_Bday_scaled.svg", + "filename" : "web_dark.svg", "idiom" : "universal" } ], diff --git a/Riot/Assets/Images.xcassets/BWI/birthday_cake.imageset/web_dark.svg b/Riot/Assets/Images.xcassets/BWI/birthday_cake.imageset/web_dark.svg new file mode 100644 index 000000000..a3e7bb135 --- /dev/null +++ b/Riot/Assets/Images.xcassets/BWI/birthday_cake.imageset/web_dark.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Riot/Assets/de.lproj/Localizable.strings b/Riot/Assets/de.lproj/Localizable.strings index 76df430d9..c18980736 100644 --- a/Riot/Assets/de.lproj/Localizable.strings +++ b/Riot/Assets/de.lproj/Localizable.strings @@ -119,8 +119,8 @@ // /* BWI: Happy Birthday Campaign*/ -"HAPPY_BIRTHDAY" = "🎈 HAPPY BIRTHDAY 2.0 🎈"; -"HAPPY_BIRTHDAY_BODY" = "Schon wieder ist ein Jahr vorbei, der BwMessenger wird 2.\nDanke für Deine Treue - jetzt und in Zukunft.\nGratuliere uns zum 2.0 mit Deiner Sterne-Bewertung im App Store."; +"HAPPY_BIRTHDAY" = "🥳 HAPPY BIRTHDAY 🥳"; +"HAPPY_BIRTHDAY_BODY" = "Danke für Deine Treue - jetzt und in Zukunft. Gratuliere dem BwMessenger zum 4. Geburtstag und schenke uns deine Sternebewertung im App Store."; "HAPPY_BIRTHDAY_BUTTON_GIVE_STARS" = "Sterne schenken"; "HAPPY_BIRTHDAY_BUTTON_DISMISS" = "X"; diff --git a/Riot/Assets/en.lproj/Localizable.strings b/Riot/Assets/en.lproj/Localizable.strings index e343edeb6..a1f178927 100644 --- a/Riot/Assets/en.lproj/Localizable.strings +++ b/Riot/Assets/en.lproj/Localizable.strings @@ -186,7 +186,7 @@ "KEY_VERIFICATION_REQUEST_FROM_USER" = "%@ wants to verify"; /* BWI: Happy Birthday Campaign*/ -"HAPPY_BIRTHDAY" = "🎈 HAPPY BIRTHDAY 2.0 🎈"; -"HAPPY_BIRTHDAY_BODY" = "Another year has passed, BwMessenger turns 2.\nThank you for your loyalty - now and in the future.\nMake us present on 2.0 with your star rating in the App Store."; -"HAPPY_BIRTHDAY_BUTTON_GIVE_STARS" = "Donate Stars"; +"HAPPY_BIRTHDAY" = "🥳 HAPPY BIRTHDAY 🥳"; +"HAPPY_BIRTHDAY_BODY" = "Thank you for your loyalty - now and in the future. Congratulate BwMessenger on its 4th anniversary and give us your star rating on the App Store."; +"HAPPY_BIRTHDAY_BUTTON_GIVE_STARS" = "Give Stars"; "HAPPY_BIRTHDAY_BUTTON_DISMISS" = "X"; diff --git a/Riot/Managers/Settings/Shared/RiotSharedSettings.swift b/Riot/Managers/Settings/Shared/RiotSharedSettings.swift index 1de27f6f7..8d8fb7007 100644 --- a/Riot/Managers/Settings/Shared/RiotSharedSettings.swift +++ b/Riot/Managers/Settings/Shared/RiotSharedSettings.swift @@ -277,7 +277,7 @@ class RiotSharedSettings: NSObject { guard let birthdayCampaignDict = notificationsDict["should_show_ios_birthday_campaign"] as? [String : Any] else { return true } - return (birthdayCampaignDict["2022"] as? Bool) ?? true + return (birthdayCampaignDict[campaign] as? Bool) ?? true } @discardableResult diff --git a/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift b/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift index 13876de9f..f0600f5fc 100644 --- a/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift +++ b/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift @@ -711,6 +711,8 @@ class AllChatsCoordinator: NSObject, SplitViewMasterCoordinatorProtocol { self.allChatsViewController.bwiCheckForFederationAnnouncementPromt() // bwi: 5660 introduce federation self.allChatsViewController.presentFederationIntroductionSheet() + // bwi: 6570 Show birthday + self.allChatsViewController.bwiCheckForBirthdayScreen() } } diff --git a/Riot/Modules/Home/AllChats/AllChatsViewController.swift b/Riot/Modules/Home/AllChats/AllChatsViewController.swift index c22524458..ff822090f 100644 --- a/Riot/Modules/Home/AllChats/AllChatsViewController.swift +++ b/Riot/Modules/Home/AllChats/AllChatsViewController.swift @@ -347,6 +347,7 @@ class AllChatsViewController: HomeViewController { let viewController = UIHostingController(rootView: IntroduceFederationView().environmentObject(BWIThemeService.shared)) viewController.isModalInPresentation = true + present(viewController, animated: true) { notificationService.setShowFederationIntroductionFlag(false) } @@ -508,6 +509,8 @@ class AllChatsViewController: HomeViewController { self.bwiCheckForFederationAnnouncementPromt() // bwi: 5660 introduce federation self.presentFederationIntroductionSheet() + // bwi: 6570 Show birthday + self.bwiCheckForBirthdayScreen() })) alert.addAction(UIAlertAction(title: BWIL10n.bwiAnalyticsAlertOkButton, @@ -519,6 +522,8 @@ class AllChatsViewController: HomeViewController { self.bwiCheckForFederationAnnouncementPromt() // bwi: 5660 introduce federation self.presentFederationIntroductionSheet() + // bwi: 6570 Show birthday + self.bwiCheckForBirthdayScreen() })) self.present(alert, animated: true) @@ -545,11 +550,39 @@ class AllChatsViewController: HomeViewController { let viewController = UIHostingController(rootView: FederationAnnouncementView().environmentObject(BWIThemeService.shared)) viewController.isModalInPresentation = true + present(viewController, animated: true) { notificationService.setShowFederationAnnouncementFlag(false) } } + // bwi #6570: check if birthday screen was shown for this session + func bwiCheckForBirthdayScreen() { + guard let session = self.mainSession else { + return + } + + guard BWIBuildSettings.shared.bwiShowHappyBirthdayCampaign else { + return + } + + let sharedSettings = RiotSharedSettings(session: session) + let campaign = BWIBuildSettings.shared.bwiHappyBirthdayCampaignIdentifier + + if sharedSettings.happyBirthdayCampaign(for: campaign) { + let viewController = HappyBirthdayViewController.makeViewController() + + present(viewController, animated: true) + + sharedSettings.setHappyBirthdayCampaign(campaign, enabled: false) { + } failure: { error in + if let error = error { + MXLog.debug("[HappyBirthdayCampaign] could not set flag in account data. Error: \(error)") + } + } + } + } + // MARK: - Actions @objc private func showSpaceSelectorAction(sender: AnyObject) { @@ -1091,10 +1124,18 @@ extension AllChatsViewController { } } +//extension AllChatsViewController: UIPopoverPresentationControllerDelegate { +// func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { +// // bwi: show matomo consent alert again +// MXLog.debug("Dismissed: \(presentationController)") +// } +//} + // MARK: - UIAdaptivePresentationControllerDelegate extension AllChatsViewController: UIAdaptivePresentationControllerDelegate { func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { + // bwi: show matomo consent alert again if showMatomoConsentAlertOnCloseModal { showMatomoConsentAlertOnCloseModal = false diff --git a/bwi/HappyBirthday/HappyBirthdayView.swift b/bwi/HappyBirthday/HappyBirthdayView.swift index 287060826..0a48214be 100644 --- a/bwi/HappyBirthday/HappyBirthdayView.swift +++ b/bwi/HappyBirthday/HappyBirthdayView.swift @@ -84,14 +84,11 @@ struct HappyBirthdayBody: View { Button(action: { presentationMode.wrappedValue.dismiss() SKStoreReviewController.requestReviewInCurrentScene() - }) { + }) + { Text("HAPPY_BIRTHDAY_BUTTON_GIVE_STARS") - .padding(.horizontal, 20) - .padding(.vertical, 8) - .background(Color(ThemeService.shared().theme.tintColor)) - .foregroundColor(.white) - .cornerRadius(6.0) - } + } + .buttonStyle(PrimaryActionButtonStyle()) } .padding() }