File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,13 @@ public extension WPAccount {
15
15
return self . uuid == uuid
16
16
}
17
17
18
+ // This is here in an extension that belongs to the apps target so we can decouple WPAccount from AppConfiguration.
19
+ // Decoupling allows moving the type to WordPressData, see https://github.com/wordpress-mobile/WordPress-iOS/issues/24165.
20
+ @objc
21
+ static func tokenForUsername( _ username: String ) -> String {
22
+ token ( forUsername: username, isJetpack: AppConfiguration . isJetpack)
23
+ }
24
+
18
25
/// Does this `WPAccount` object have any associated blogs?
19
26
///
20
27
@objc
Original file line number Diff line number Diff line change 47
47
- (void )removeBlogsObject : (Blog *)value ;
48
48
- (void )addBlogs : (NSSet *)values ;
49
49
- (void )removeBlogs : (NSSet *)values ;
50
- + (NSString *)tokenForUsername : (NSString *)username ;
50
+ + (NSString *)tokenForUsername : (NSString *)username isJetpack : ( BOOL ) isJetpack ;
51
51
- (BOOL )hasAtomicSite ;
52
52
53
53
@end
Original file line number Diff line number Diff line change @@ -129,10 +129,13 @@ - (BOOL)hasAtomicSite {
129
129
130
130
#pragma mark - Static methods
131
131
132
- + (NSString *)tokenForUsername : (NSString *)username
132
+ + (NSString *)tokenForUsername : (NSString *)username isJetpack : ( BOOL ) isJetpack
133
133
{
134
+ if (isJetpack) {
135
+ [WPAccount migrateAuthKeyForUsername: username];
136
+ }
137
+
134
138
NSError *error = nil ;
135
- [WPAccount migrateAuthKeyForUsername: username];
136
139
NSString *authToken = [SFHFKeychainUtils getPasswordForUsername: username
137
140
andServiceName: [WPAccount authKeychainServiceName ]
138
141
accessGroup: nil
@@ -148,10 +151,8 @@ + (void)migrateAuthKeyForUsername:(NSString *)username
148
151
{
149
152
static dispatch_once_t onceToken;
150
153
dispatch_once (&onceToken, ^{
151
- if ([AppConfiguration isJetpack ]) {
152
- SharedDataIssueSolver *sharedDataIssueSolver = [SharedDataIssueSolver instance ];
153
- [sharedDataIssueSolver migrateAuthKeyFor: username];
154
- }
154
+ SharedDataIssueSolver *sharedDataIssueSolver = [SharedDataIssueSolver instance ];
155
+ [sharedDataIssueSolver migrateAuthKeyFor: username];
155
156
});
156
157
}
157
158
You can’t perform that action at this time.
0 commit comments