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 {
1515 return self . uuid == uuid
1616 }
1717
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+
1825 /// Does this `WPAccount` object have any associated blogs?
1926 ///
2027 @objc
Original file line number Diff line number Diff line change 4949- (void )removeBlogsObject : (Blog *)value ;
5050- (void )addBlogs : (NSSet *)values ;
5151- (void )removeBlogs : (NSSet *)values ;
52- + (NSString *)tokenForUsername : (NSString *)username ;
52+ + (NSString *)tokenForUsername : (NSString *)username isJetpack : ( BOOL ) isJetpack ;
5353- (BOOL )hasAtomicSite ;
5454
5555@end
Original file line number Diff line number Diff line change @@ -128,10 +128,13 @@ - (BOOL)hasAtomicSite {
128128
129129#pragma mark - Static methods
130130
131- + (NSString *)tokenForUsername : (NSString *)username
131+ + (NSString *)tokenForUsername : (NSString *)username isJetpack : ( BOOL ) isJetpack
132132{
133+ if (isJetpack) {
134+ [WPAccount migrateAuthKeyForUsername: username];
135+ }
136+
133137 NSError *error = nil ;
134- [WPAccount migrateAuthKeyForUsername: username];
135138 NSString *authToken = [SFHFKeychainUtils getPasswordForUsername: username
136139 andServiceName: [WPAccount authKeychainServiceName ]
137140 accessGroup: nil
@@ -147,10 +150,8 @@ + (void)migrateAuthKeyForUsername:(NSString *)username
147150{
148151 static dispatch_once_t onceToken;
149152 dispatch_once (&onceToken, ^{
150- if ([AppConfiguration isJetpack ]) {
151- SharedDataIssueSolver *sharedDataIssueSolver = [SharedDataIssueSolver instance ];
152- [sharedDataIssueSolver migrateAuthKeyFor: username];
153- }
153+ SharedDataIssueSolver *sharedDataIssueSolver = [SharedDataIssueSolver instance ];
154+ [sharedDataIssueSolver migrateAuthKeyFor: username];
154155 });
155156}
156157
You can’t perform that action at this time.
0 commit comments