Merge branch 'charlesmchen/removeMessageRequestsSplash'

This commit is contained in:
Matthew Chen 2020-10-29 13:26:58 -03:00
commit 01595d0bb3
6 changed files with 1 additions and 165 deletions

View File

@ -615,8 +615,6 @@
76EB054018170B33006006FC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB03C318170B33006006FC /* AppDelegate.m */; };
8806EF19248DBD7200E764C7 /* NotificationPermissionReminderMegaphone.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8806EF18248DBD7200E764C7 /* NotificationPermissionReminderMegaphone.swift */; };
8806EF1B248DBFC100E764C7 /* ContactPermissionReminderMegaphone.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8806EF1A248DBFC100E764C7 /* ContactPermissionReminderMegaphone.swift */; };
8806F21B23E90B0B00692638 /* MessageRequests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8806F21A23E90B0B00692638 /* MessageRequests.swift */; };
8806F21D23E90C8300692638 /* messageRequestsSplash.json in Resources */ = {isa = PBXBuildFile; fileRef = 8806F21C23E90C8300692638 /* messageRequestsSplash.json */; };
88081437234D80150004C187 /* UIResponder+OWS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88081436234D80150004C187 /* UIResponder+OWS.swift */; };
8809CE8122F534B200D38867 /* CustomKeyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8809CE8022F534B200D38867 /* CustomKeyboard.swift */; };
8809CE8722F8FE6D00D38867 /* AttachmentKeyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8809CE8622F8FE6D00D38867 /* AttachmentKeyboard.swift */; };
@ -1615,8 +1613,6 @@
80A8593EDA963AA130D319BA /* Pods-NotificationServiceExtension.testable release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationServiceExtension.testable release.xcconfig"; path = "Pods/Target Support Files/Pods-NotificationServiceExtension/Pods-NotificationServiceExtension.testable release.xcconfig"; sourceTree = "<group>"; };
8806EF18248DBD7200E764C7 /* NotificationPermissionReminderMegaphone.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationPermissionReminderMegaphone.swift; sourceTree = "<group>"; };
8806EF1A248DBFC100E764C7 /* ContactPermissionReminderMegaphone.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactPermissionReminderMegaphone.swift; sourceTree = "<group>"; };
8806F21A23E90B0B00692638 /* MessageRequests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageRequests.swift; sourceTree = "<group>"; };
8806F21C23E90C8300692638 /* messageRequestsSplash.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = messageRequestsSplash.json; sourceTree = "<group>"; };
88081436234D80150004C187 /* UIResponder+OWS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIResponder+OWS.swift"; sourceTree = "<group>"; };
8809CE8022F534B200D38867 /* CustomKeyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomKeyboard.swift; sourceTree = "<group>"; };
8809CE8422F8DB2D00D38867 /* AttachmentKeyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentKeyboard.swift; sourceTree = "<group>"; };
@ -3376,7 +3372,6 @@
347C3850252DF83D00F3D941 /* GroupsV2AndMentionsSplash.swift */,
88A505F923DBA1360005C012 /* IntroducingPINs.swift */,
323C4FE424EE7B0F00DC94B8 /* LinkPreviewsMegaphone.swift */,
8806F21A23E90B0B00692638 /* MessageRequests.swift */,
8806EF18248DBD7200E764C7 /* NotificationPermissionReminderMegaphone.swift */,
887EEC1E23F0B20600F8C26D /* PinReminderMegaphone.swift */,
884EFBAB251478D0006B9457 /* ResearchMegaphone.swift */,
@ -3399,7 +3394,6 @@
88A9419324099F6E000E9700 /* Attachment Keyboard */,
887CD48924735D4200FDD265 /* launchApp-iPad.json */,
887CD48824735D4200FDD265 /* launchApp-iPhone.json */,
8806F21C23E90C8300692638 /* messageRequestsSplash.json */,
4C9D34842369EA3E006A4307 /* NotificationPermission */,
888C827F23D795F90059464B /* pinCreationFail.json */,
888C828023D795FA0059464B /* pinCreationInProgress.json */,
@ -4179,7 +4173,6 @@
45B74A742044AAB600CD42F8 /* aurora-quiet.aifc in Resources */,
45B74A852044AAB600CD42F8 /* bamboo.aifc in Resources */,
45B74A782044AAB600CD42F8 /* bamboo-quiet.aifc in Resources */,
8806F21D23E90C8300692638 /* messageRequestsSplash.json in Resources */,
8837F73D23D8DE8500772A32 /* pinCreationSuccess.json in Resources */,
45B74A7B2044AAB600CD42F8 /* chord.aifc in Resources */,
887CD48B24735D4200FDD265 /* launchApp-iPad.json in Resources */,
@ -4916,7 +4909,6 @@
4C8A6DFC22E5499300469AE7 /* MediaZoomAnimationController.swift in Sources */,
341F2C0F1F2B8AE700D07D6B /* DebugUIMisc.m in Sources */,
340FC8AF204DAC8D007AEB0F /* OWSLinkDeviceViewController.m in Sources */,
8806F21B23E90B0B00692638 /* MessageRequests.swift in Sources */,
3434AE1E22AEF5A4002EE04E /* CircularProgressView.swift in Sources */,
348433DF243CA94600C7F64A /* ReplaceAdminViewController.swift in Sources */,
34E3EF0D1EFC235B007F6822 /* DebugUIDiskUsage.m in Sources */,

File diff suppressed because one or more lines are too long

View File

@ -129,9 +129,6 @@ class ExperienceUpgradeManager: NSObject {
private static func hasSplash(forExperienceUpgrade experienceUpgrade: ExperienceUpgrade) -> Bool {
switch experienceUpgrade.id {
case .messageRequests:
// Only use a splash for message requests if the user doesn't have a profile name.
return OWSProfileManager.shared().localFullName()?.isEmpty != false
case .introducingPins:
return true
case .groupsV2AndMentionsSplash2:
@ -145,8 +142,6 @@ class ExperienceUpgradeManager: NSObject {
switch experienceUpgrade.id {
case .introducingPins:
return IntroducingPinsSplash(experienceUpgrade: experienceUpgrade)
case .messageRequests:
return MessageRequestsSplash(experienceUpgrade: experienceUpgrade)
case .groupsV2AndMentionsSplash2:
return GroupsV2AndMentionsSplash(experienceUpgrade: experienceUpgrade)
default:
@ -165,9 +160,6 @@ class ExperienceUpgradeManager: NSObject {
.linkPreviews,
.researchMegaphone1:
return true
case .messageRequests:
// no need to annoy user with banner for message requests. They are self explanatory.
return false
case .groupsV2AndMentionsSplash2:
return false
default:

View File

@ -1,122 +0,0 @@
//
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
//
import Foundation
import Lottie
class MessageRequestsSplash: SplashViewController {
let animationView = AnimationView(name: "messageRequestsSplash")
override var canDismissWithGesture: Bool { return false }
// MARK: - View lifecycle
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
animationView.play()
navigationController?.setNavigationBarHidden(true, animated: false)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
navigationController?.setNavigationBarHidden(false, animated: false)
}
override func loadView() {
self.view = UIView.container()
self.view.backgroundColor = Theme.backgroundColor
animationView.contentMode = .scaleAspectFit
animationView.loopMode = .playOnce
animationView.backgroundBehavior = .forceFinish
view.addSubview(animationView)
animationView.autoPinTopToSuperviewMargin(withInset: 10)
animationView.autoPinWidthToSuperview()
animationView.setContentHuggingLow()
animationView.setCompressionResistanceLow()
let title = NSLocalizedString("MESSAGE_REQUESTS_NAMES_SPLASH_TITLE",
comment: "Header for message requests splash screen")
let body = NSLocalizedString("MESSAGE_REQUESTS_SPLASH_BODY",
comment: "Body text for message requests splash screen")
let hMargin: CGFloat = ScaleFromIPhone5To7Plus(16, 24)
// Title label
let titleLabel = UILabel()
titleLabel.text = title
titleLabel.textAlignment = .center
titleLabel.font = UIFont.ows_dynamicTypeTitle1.ows_semibold
titleLabel.textColor = Theme.primaryTextColor
titleLabel.minimumScaleFactor = 0.5
titleLabel.adjustsFontSizeToFitWidth = true
view.addSubview(titleLabel)
titleLabel.autoPinWidthToSuperview(withMargin: hMargin)
// The title label actually overlaps the hero image because it has a long shadow
// and we want the text to partially sit on top of this.
titleLabel.autoPinEdge(.top, to: .bottom, of: animationView, withOffset: -10)
titleLabel.setContentHuggingVerticalHigh()
// Body label
let bodyLabel = UILabel()
bodyLabel.text = body
bodyLabel.font = UIFont.ows_dynamicTypeBody
bodyLabel.textColor = Theme.primaryTextColor
bodyLabel.numberOfLines = 0
bodyLabel.lineBreakMode = .byWordWrapping
bodyLabel.textAlignment = .center
view.addSubview(bodyLabel)
bodyLabel.autoPinWidthToSuperview(withMargin: hMargin)
bodyLabel.autoPinEdge(.top, to: .bottom, of: titleLabel, withOffset: 6)
bodyLabel.setContentHuggingVerticalHigh()
// Primary button
let primaryButton = OWSFlatButton.button(title: primaryButtonTitle(),
font: UIFont.ows_dynamicTypeBody.ows_semibold,
titleColor: .white,
backgroundColor: .ows_accentBlue,
target: self,
selector: #selector(didTapPrimaryButton))
primaryButton.autoSetHeightUsingFont()
view.addSubview(primaryButton)
primaryButton.autoPinWidthToSuperview(withMargin: hMargin)
primaryButton.autoPinEdge(.top, to: .bottom, of: bodyLabel, withOffset: 28)
primaryButton.setContentHuggingVerticalHigh()
primaryButton.autoPinBottomToSuperviewMargin(withInset: ScaleFromIPhone5(10))
}
@objc
func didTapPrimaryButton(_ sender: UIButton) {
let vc = ProfileViewController(mode: .experienceUpgrade) { [weak self] _ in
self?.dismiss(animated: true)
}
navigationController?.pushViewController(vc, animated: true)
}
func primaryButtonTitle() -> String {
return NSLocalizedString("MESSAGE_REQUESTS_SPLASH_ADD_PROFILE_NAME_BUTTON",
comment: "Button to start a create profile name flow from the one time splash screen that appears after upgrading")
}
override func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) {
guard let fromViewController = presentingViewController else {
return owsFailDebug("Trying to dismiss while not presented.")
}
super.dismiss(animated: flag) { [weak self] in
if let self = self, !self.isDismissWithoutCompleting {
self.presentToast(
text: NSLocalizedString("MESSAGE_REQUESTS_SPLASH_MEGAPHONE_TOAST",
comment: "Toast indicating that a profile name has been created."),
fromViewController: fromViewController
)
}
completion?()
}
}
}

View File

@ -2563,18 +2563,6 @@
/* Indicator that you have requested to join this group. */
"MESSAGE_REQUESTS_CONVERSATION_REQUEST_INDICATOR" = "Your request to join has been sent to the group admin. Youll be notified when they take action.";
/* Header for message requests splash screen */
"MESSAGE_REQUESTS_NAMES_SPLASH_TITLE" = "Introducing Message Requests";
/* Button to start a create profile name flow from the one time splash screen that appears after upgrading */
"MESSAGE_REQUESTS_SPLASH_ADD_PROFILE_NAME_BUTTON" = "Add Profile Name";
/* Body text for message requests splash screen */
"MESSAGE_REQUESTS_SPLASH_BODY" = "You can now choose to ”Accept” or ”Delete“ a new chat. Names let people know whos messaging them.";
/* Toast indicating that a profile name has been created. */
"MESSAGE_REQUESTS_SPLASH_MEGAPHONE_TOAST" = "Your profile name has been saved.";
/* message status for message delivered to their recipient. */
"MESSAGE_STATUS_DELIVERED" = "Delivered";

View File

@ -8,7 +8,6 @@ import Contacts
public enum ExperienceUpgradeId: String, CaseIterable {
case introducingPins = "009"
case messageRequests = "012"
case pinReminder // Never saved, used to periodically prompt the user for their PIN
case notificationPermissionReminder
case contactPermissionReminder
@ -26,8 +25,6 @@ public enum ExperienceUpgradeId: String, CaseIterable {
return RemoteConfig.kbs &&
SSKEnvironment.shared.reachabilityManager.isReachable &&
!KeyBackupService.hasMasterKey(transaction: transaction.asAnyRead)
case .messageRequests:
return !SSKEnvironment.shared.profileManager.hasProfileName
case .pinReminder:
return OWS2FAManager.shared().isDueForV2Reminder(transaction: transaction.asAnyRead)
case .notificationPermissionReminder:
@ -80,8 +77,7 @@ public enum ExperienceUpgradeId: String, CaseIterable {
// If false, this will not be marked complete after registration.
var skipForNewUsers: Bool {
switch self {
case .messageRequests,
.introducingPins,
case .introducingPins,
.researchMegaphone1:
return false
default:
@ -102,8 +98,6 @@ public enum ExperienceUpgradeId: String, CaseIterable {
switch self {
case .introducingPins:
return .high
case .messageRequests:
return .high
case .linkPreviews:
return .medium
case .pinReminder:
@ -125,8 +119,6 @@ public enum ExperienceUpgradeId: String, CaseIterable {
switch self {
case .pinReminder:
return false
case .messageRequests:
return false
default:
return true
}
@ -142,8 +134,6 @@ public enum ExperienceUpgradeId: String, CaseIterable {
return false
case .contactPermissionReminder:
return false
case .messageRequests:
return false
default:
return true
}
@ -174,7 +164,6 @@ public enum ExperienceUpgradeId: String, CaseIterable {
var objcRepresentation: ObjcExperienceUpgradeId {
switch self {
case .introducingPins: return .introducingPins
case .messageRequests: return .messageRequests
case .pinReminder: return .pinReminder
case .notificationPermissionReminder: return .notificationPermissionReminder
case .contactPermissionReminder: return .contactPermissionReminder
@ -336,7 +325,6 @@ public extension ExperienceUpgrade {
@objc(OWSObjcExperienceUpgradeId)
public enum ObjcExperienceUpgradeId: Int {
case introducingPins
case messageRequests
case pinReminder
case notificationPermissionReminder
case contactPermissionReminder
@ -347,7 +335,6 @@ public enum ObjcExperienceUpgradeId: Int {
public var swiftRepresentation: ExperienceUpgradeId {
switch self {
case .introducingPins: return .introducingPins
case .messageRequests: return .messageRequests
case .pinReminder: return .pinReminder
case .notificationPermissionReminder: return .notificationPermissionReminder
case .contactPermissionReminder: return .contactPermissionReminder