File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed
Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -421,14 +421,7 @@ private extension AuthenticationManager {
421421 let wooAuthError = AuthenticationError . make ( with: error)
422422 switch wooAuthError {
423423 case . notWPSite, . notValidAddress:
424- let notification = LocalNotification ( title: NSLocalizedString ( " Problems with logging in? " ,
425- comment: " Local notification title when the user encounters an error logging in " +
426- " with site address. " ) ,
427- body: NSLocalizedString ( " Get some help! " ,
428- comment: " Local notification body when the user encounters an error logging in " +
429- " with site address. " ) ,
430- scenario: . loginSiteAddressError,
431- actions: . init( category: . loginError, actions: [ . contactSupport] ) )
424+ let notification = LocalNotification ( scenario: . loginSiteAddressError)
432425 ServiceLocator . pushNotesManager. cancelLocalNotification ( scenarios: [ notification. scenario] )
433426 ServiceLocator . pushNotesManager. requestLocalNotification ( notification,
434427 // 24 hours from now.
Original file line number Diff line number Diff line change @@ -37,3 +37,26 @@ struct LocalNotification {
3737 }
3838 }
3939}
40+
41+ extension LocalNotification {
42+ init ( scenario: Scenario ) {
43+ switch scenario {
44+ case . loginSiteAddressError:
45+ self . init ( title: Localization . errorLoggingInTitle,
46+ body: Localization . errorLoggingInBody,
47+ scenario: . loginSiteAddressError,
48+ actions: . init( category: . loginError, actions: [ . contactSupport] ) )
49+ }
50+ }
51+ }
52+
53+ private extension LocalNotification {
54+ enum Localization {
55+ static let errorLoggingInTitle = NSLocalizedString ( " Problems with logging in? " ,
56+ comment: " Local notification title when the user encounters an error logging in " +
57+ " with site address. " )
58+ static let errorLoggingInBody = NSLocalizedString ( " Get some help! " ,
59+ comment: " Local notification body when the user encounters an error logging in " +
60+ " with site address. " )
61+ }
62+ }
You can’t perform that action at this time.
0 commit comments