From 507b4c20e4442cedfbbae2bee26bcde26e0377d5 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 7 Oct 2020 11:48:16 -0300 Subject: [PATCH] Groups v2 and mentions splash. --- Signal.xcodeproj/project.pbxproj | 4 - .../GroupsV2AndMentionsMegaphone.swift | 159 ------------------ .../translations/en.lproj/Localizable.strings | 6 - .../src/Util/ExperienceUpgradeFinder.swift | 16 +- 4 files changed, 2 insertions(+), 183 deletions(-) delete mode 100644 Signal/src/Experience Upgrades/Upgrade Views/GroupsV2AndMentionsMegaphone.swift diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index f196231bb0..3b4b88ecf7 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -196,7 +196,6 @@ 347B83F92436820C0019A52C /* GroupViewHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347B83F82436820C0019A52C /* GroupViewHelper.swift */; }; 347B83FD24378DDF0019A52C /* GroupMemberRequestsAndInvitesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347B83FC24378DDE0019A52C /* GroupMemberRequestsAndInvitesViewController.swift */; }; 347C37FF2526005800F3D941 /* CloudKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 347C37FE2526005800F3D941 /* CloudKit.framework */; }; - 347C384F252DF50A00F3D941 /* GroupsV2AndMentionsMegaphone.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347C384E252DF50900F3D941 /* GroupsV2AndMentionsMegaphone.swift */; }; 347C3851252DF83E00F3D941 /* GroupsV2AndMentionsSplash.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347C3850252DF83D00F3D941 /* GroupsV2AndMentionsSplash.swift */; }; 347C3854252DF8DC00F3D941 /* splash_groupsv2_iOS_dark.json in Resources */ = {isa = PBXBuildFile; fileRef = 347C3852252DF8DC00F3D941 /* splash_groupsv2_iOS_dark.json */; }; 347C3855252DF8DC00F3D941 /* splash_groupsv2_iOS_light.json in Resources */ = {isa = PBXBuildFile; fileRef = 347C3853252DF8DC00F3D941 /* splash_groupsv2_iOS_light.json */; }; @@ -1132,7 +1131,6 @@ 347B83F82436820C0019A52C /* GroupViewHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupViewHelper.swift; sourceTree = ""; }; 347B83FC24378DDE0019A52C /* GroupMemberRequestsAndInvitesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupMemberRequestsAndInvitesViewController.swift; sourceTree = ""; }; 347C37FE2526005800F3D941 /* CloudKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CloudKit.framework; path = System/Library/Frameworks/CloudKit.framework; sourceTree = SDKROOT; }; - 347C384E252DF50900F3D941 /* GroupsV2AndMentionsMegaphone.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupsV2AndMentionsMegaphone.swift; sourceTree = ""; }; 347C3850252DF83D00F3D941 /* GroupsV2AndMentionsSplash.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupsV2AndMentionsSplash.swift; sourceTree = ""; }; 347C3852252DF8DC00F3D941 /* splash_groupsv2_iOS_dark.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = splash_groupsv2_iOS_dark.json; sourceTree = ""; }; 347C3853252DF8DC00F3D941 /* splash_groupsv2_iOS_light.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = splash_groupsv2_iOS_light.json; sourceTree = ""; }; @@ -3324,7 +3322,6 @@ isa = PBXGroup; children = ( 8806EF1A248DBFC100E764C7 /* ContactPermissionReminderMegaphone.swift */, - 347C384E252DF50900F3D941 /* GroupsV2AndMentionsMegaphone.swift */, 347C3850252DF83D00F3D941 /* GroupsV2AndMentionsSplash.swift */, 88A505F923DBA1360005C012 /* IntroducingPINs.swift */, 323C4FE424EE7B0F00DC94B8 /* LinkPreviewsMegaphone.swift */, @@ -4875,7 +4872,6 @@ 4CFF115523A9C6DC0007F9D7 /* OWSUnreadIndicatorCell.swift in Sources */, 34D99CE4217509C2000AFB39 /* AppEnvironment.swift in Sources */, 34B6A907218B5241007C4606 /* TypingIndicatorCell.swift in Sources */, - 347C384F252DF50A00F3D941 /* GroupsV2AndMentionsMegaphone.swift in Sources */, 4C68FDAE2385F5A4002576B1 /* DebugUIDataStoreViewController.swift in Sources */, 4CD675C522E7CF22008010D2 /* ConversationViewController+OWS.swift in Sources */, 343A65981FC4CFE7000477A1 /* ConversationScrollButton.m in Sources */, diff --git a/Signal/src/Experience Upgrades/Upgrade Views/GroupsV2AndMentionsMegaphone.swift b/Signal/src/Experience Upgrades/Upgrade Views/GroupsV2AndMentionsMegaphone.swift deleted file mode 100644 index 61e63226a1..0000000000 --- a/Signal/src/Experience Upgrades/Upgrade Views/GroupsV2AndMentionsMegaphone.swift +++ /dev/null @@ -1,159 +0,0 @@ -// -// Copyright (c) 2020 Open Whisper Systems. All rights reserved. -// - -import Foundation -import BonMot - -class GroupsV2AndMentionsMegaphone: MegaphoneView { - init(experienceUpgrade: ExperienceUpgrade, fromViewController: UIViewController) { - super.init(experienceUpgrade: experienceUpgrade) - imageName = "researchMegaphone" - - titleText = NSLocalizedString("MEGAPHONE_GROUPS_V2_MENTIONS_TITLE", - comment: "Title for 'groups v2 & mentions' megaphone") - bodyText = NSLocalizedString("MEGAPHONE_GROUPS_V2_MENTIONS_BODY", - comment: "Body for 'groups v2 & mentions' megaphone") - - setButtons( - primary: Button(title: CommonStrings.okayButton) { [weak self] in - self?.markAsComplete() - self?.dismiss() - }, - secondary: Button(title: CommonStrings.learnMore) { [weak self] in - // TODO: - self?.markAsComplete() - self?.dismiss() - } - ) - } - - required init(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } -} - -//private class GroupsV2AndMentionsModal: UIViewController { -// override func loadView() { -// view = UIScrollView() -// view.backgroundColor = Theme.backgroundColor -// -// let heroImageView = UIImageView(image: #imageLiteral(resourceName: "researchModalHero")) -// view.addSubview(heroImageView) -// heroImageView.autoPinWidthToSuperview() -// heroImageView.autoPinEdge(toSuperviewEdge: .top) -// -// let stackView = UIStackView() -// stackView.axis = .vertical -// stackView.isLayoutMarginsRelativeArrangement = true -// stackView.layoutMargins = UIEdgeInsets(top: 16, leading: 32, bottom: 16, trailing: 32) -// -// view.addSubview(stackView) -// stackView.autoPinEdge(.top, to: .bottom, of: heroImageView) -// stackView.autoPinEdge(toSuperviewEdge: .bottom) -// stackView.autoPinWidthToSuperview() -// stackView.autoMatch(.width, to: .width, of: view) -// -// let labelStyle = StringStyle( -// .font(.ows_dynamicTypeBody2), -// .color(Theme.primaryTextColor), -// .xmlRules([ -// .style("bold", StringStyle(.font(UIFont.ows_dynamicTypeBody2.ows_semibold))) -// ]) -// ) -// -// let label = UILabel() -// label.numberOfLines = 0 -// label.lineBreakMode = .byWordWrapping -// label.attributedText = NSLocalizedString( -// "RESEARCH_MODAL_PLEA", -// comment: "Text explaining why the user should take the survey" -// ).styled(with: labelStyle) -// stackView.addArrangedSubview(label) -// -// stackView.addArrangedSubview(.spacer(withHeight: 48)) -// -// let takeTheSurveyButton = OWSFlatButton() -// takeTheSurveyButton.setBackgroundColors(upColor: .ows_accentBlue) -// takeTheSurveyButton.useDefaultCornerRadius() -// takeTheSurveyButton.setAttributedTitle( -// NSAttributedString.composed(of: [ -// NSLocalizedString( -// "RESEARCH_MODAL_TAKE_SURVEY", -// comment: "Button text for taking the research survey" -// ), -// Special.noBreakSpace, -// #imageLiteral(resourceName: "open-20").withRenderingMode(.alwaysTemplate).styled(with: .baselineOffset(-4)) -// ]).styled(with: -// .font(UIFont.ows_dynamicTypeBody.ows_semibold), -// .color(.ows_white) -// ) -// ) -// takeTheSurveyButton.autoSetDimension(.height, toSize: OWSFlatButton.heightForFont(.ows_dynamicTypeBody)) -// takeTheSurveyButton.setPressedBlock { [weak self] in -// ExperienceUpgradeManager.clearExperienceUpgradeWithSneakyTransaction(.researchMegaphone1) -// self?.dismiss(animated: true) -// UIApplication.shared.open( -// URL(string: "https://surveys.signalusers.org/s3")!, -// options: [:], -// completionHandler: nil -// ) -// } -// -// stackView.addArrangedSubview(takeTheSurveyButton) -// -// stackView.addArrangedSubview(.spacer(withHeight: 8)) -// -// let noThanksButton = OWSFlatButton() -// noThanksButton.setBackgroundColors(upColor: Theme.isDarkThemeEnabled ? .ows_gray75 : .ows_gray05) -// noThanksButton.useDefaultCornerRadius() -// noThanksButton.setTitle( -// title: NSLocalizedString( -// "RESEARCH_MODAL_NO_THANKS", -// comment: "Button text for declining the research modal" -// ), -// font: UIFont.ows_dynamicTypeBody.ows_semibold, -// titleColor: Theme.accentBlueColor -// ) -// noThanksButton.autoSetDimension(.height, toSize: OWSFlatButton.heightForFont(.ows_dynamicTypeBody)) -// noThanksButton.setPressedBlock { [weak self] in -// ExperienceUpgradeManager.clearExperienceUpgradeWithSneakyTransaction(.researchMegaphone1) -// self?.dismiss(animated: true) -// } -// -// stackView.addArrangedSubview(noThanksButton) -// -// stackView.addArrangedSubview(.spacer(withHeight: 16)) -// -// let footerLabel = UILabel() -// footerLabel.numberOfLines = 0 -// footerLabel.lineBreakMode = .byWordWrapping -// footerLabel.font = .ows_dynamicTypeCaption1 -// footerLabel.textColor = Theme.secondaryTextAndIconColor -// footerLabel.textAlignment = .center -// footerLabel.text = NSLocalizedString( -// "RESEARCH_MODAL_FOOTER", -// comment: "Text for the research modal footer" -// ) -// stackView.addArrangedSubview(footerLabel) -// } -// -// override func viewDidLoad() { -// super.viewDidLoad() -// -// title = NSLocalizedString( -// "RESEARCH_MODAL_TITLE", -// comment: "Title for the research megaphone modal" -// ) -// navigationItem.leftBarButtonItem = UIBarButtonItem( -// barButtonSystemItem: .stop, -// target: self, -// action: #selector(didPressCloseButton) -// ) -// } -// -// @objc -// func didPressCloseButton() { -// dismiss(animated: true) -// } -//} diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 9184ed44c4..eb3bf5c375 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -2332,12 +2332,6 @@ /* Section header in media gallery collection view */ "MEDIA_GALLERY_THIS_MONTH_HEADER" = "This Month"; -/* Body for 'groups v2 & mentions' megaphone */ -"MEGAPHONE_GROUPS_V2_MENTIONS_BODY" = "MEGAPHONE_GROUPS_V2_MENTIONS_BODY"; - -/* Title for 'groups v2 & mentions' megaphone */ -"MEGAPHONE_GROUPS_V2_MENTIONS_TITLE" = "MEGAPHONE_GROUPS_V2_MENTIONS_TITLE"; - /* button title to snooze a megaphone */ "MEGAPHONE_REMIND_LATER" = "Remind Me Later"; diff --git a/SignalServiceKit/src/Util/ExperienceUpgradeFinder.swift b/SignalServiceKit/src/Util/ExperienceUpgradeFinder.swift index 6125ca9fd7..8d4eccb62a 100644 --- a/SignalServiceKit/src/Util/ExperienceUpgradeFinder.swift +++ b/SignalServiceKit/src/Util/ExperienceUpgradeFinder.swift @@ -60,7 +60,6 @@ public enum ExperienceUpgradeId: String, CaseIterable { case .researchMegaphone1: return RemoteConfig.researchMegaphone case .groupsV2AndMentionsSplash: - // TODO: return RemoteConfig.groupsV2CreateGroups } } @@ -224,8 +223,7 @@ public class ExperienceUpgradeFinder: NSObject { Logger.info("marking experience upgrade as complete \(experienceUpgrade.uniqueId)") - // TODO: -// experienceUpgrade.upsertWith(transaction: transaction.asAnyWrite) { $0.isComplete = true } + experienceUpgrade.upsertWith(transaction: transaction.asAnyWrite) { $0.isComplete = true } } @objc @@ -248,10 +246,6 @@ public class ExperienceUpgradeFinder: NSObject { .filter { $0.hasLaunched(transaction: transaction) && !$0.hasExpired && ($0.showOnLinkedDevices || isPrimaryDevice) } .map { $0.rawValue } - Logger.verbose("activeIds: \(activeIds)") - Logger.flush() - Logger.flush() - // We don't include `isComplete` in the query as we want to initialize // new records for any active ids that haven't had one recorded yet. let cursor = ExperienceUpgrade.grdbFetchCursor( @@ -319,13 +313,7 @@ public extension ExperienceUpgrade { } } - var hasViewed: Bool { - // TODO: - guard id != .groupsV2AndMentionsSplash else { - return false - } - return firstViewedTimestamp > 0 - } + var hasViewed: Bool { firstViewedTimestamp > 0 } func upsertWith(transaction: SDSAnyWriteTransaction, changeBlock: (ExperienceUpgrade) -> Void) { // TODO: