Groups v2 and mentions splash.

This commit is contained in:
Matthew Chen 2020-10-07 11:48:16 -03:00
parent f9da2af616
commit 507b4c20e4
4 changed files with 2 additions and 183 deletions

View File

@ -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 = "<group>"; };
347B83FC24378DDE0019A52C /* GroupMemberRequestsAndInvitesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupMemberRequestsAndInvitesViewController.swift; sourceTree = "<group>"; };
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 = "<group>"; };
347C3850252DF83D00F3D941 /* GroupsV2AndMentionsSplash.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupsV2AndMentionsSplash.swift; sourceTree = "<group>"; };
347C3852252DF8DC00F3D941 /* splash_groupsv2_iOS_dark.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = splash_groupsv2_iOS_dark.json; sourceTree = "<group>"; };
347C3853252DF8DC00F3D941 /* splash_groupsv2_iOS_light.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = splash_groupsv2_iOS_light.json; sourceTree = "<group>"; };
@ -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 */,

View File

@ -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)
// }
//}

View File

@ -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";

View File

@ -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: