File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -27,12 +27,15 @@ struct LocalNotification {
2727 /// The action type in a local notification.
2828 enum Action : String {
2929 case contactSupport
30+ case loginWithWPCom
3031
3132 /// The title of the action in a local notification.
3233 var title : String {
3334 switch self {
3435 case . contactSupport:
3536 return NSLocalizedString ( " Contact support " , comment: " Local notification action to contact support. " )
37+ case . loginWithWPCom:
38+ return NSLocalizedString ( " Login with WordPress.com " , comment: " Local notification action to log in with WordPress.com. " )
3639 }
3740 }
3841 }
@@ -45,7 +48,7 @@ extension LocalNotification {
4548 self . init ( title: Localization . errorLoggingInTitle,
4649 body: Localization . errorLoggingInBody,
4750 scenario: . loginSiteAddressError,
48- actions: . init( category: . loginError, actions: [ . contactSupport] ) )
51+ actions: . init( category: . loginError, actions: [ . contactSupport, . loginWithWPCom ] ) )
4952 }
5053 }
5154}
Original file line number Diff line number Diff line change 11import Combine
22import Experiments
33import UIKit
4+ import WordPressAuthenticator
45import Yosemite
56import class AutomatticTracks. CrashLogging
67
@@ -253,6 +254,17 @@ private extension AppCoordinator {
253254 " action " : " contact_support " ,
254255 " type " : response. notification. request. identifier
255256 ] )
257+ case LocalNotification . Action. loginWithWPCom. rawValue:
258+ guard let loginNavigationController = window. rootViewController as? LoginNavigationController ,
259+ let viewController = loginNavigationController. topViewController else {
260+ return
261+ }
262+ let command = NavigateToEnterAccount ( )
263+ command. execute ( from: viewController)
264+ analytics. track ( . loginLocalNotificationTapped, withProperties: [
265+ " action " : " login_with_wpcom " ,
266+ " type " : response. notification. request. identifier
267+ ] )
256268 case UNNotificationDefaultActionIdentifier:
257269 // Triggered when the user taps on the notification itself instead of one of the actions.
258270 switch response. notification. request. identifier {
You can’t perform that action at this time.
0 commit comments