File tree 3 files changed +15
-7
lines changed
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 49
49
- (void )removeBlogsObject : (Blog *)value ;
50
50
- (void )addBlogs : (NSSet *)values ;
51
51
- (void )removeBlogs : (NSSet *)values ;
52
- + (NSString *)tokenForUsername : (NSString *)username ;
52
+ + (NSString *)tokenForUsername : (NSString *)username isJetpack : ( BOOL ) isJetpack ;
53
53
- (BOOL )hasAtomicSite ;
54
54
55
55
@end
Original file line number Diff line number Diff line change @@ -128,10 +128,13 @@ - (BOOL)hasAtomicSite {
128
128
129
129
#pragma mark - Static methods
130
130
131
- + (NSString *)tokenForUsername : (NSString *)username
131
+ + (NSString *)tokenForUsername : (NSString *)username isJetpack : ( BOOL ) isJetpack
132
132
{
133
+ if (isJetpack) {
134
+ [WPAccount migrateAuthKeyForUsername: username];
135
+ }
136
+
133
137
NSError *error = nil ;
134
- [WPAccount migrateAuthKeyForUsername: username];
135
138
NSString *authToken = [SFHFKeychainUtils getPasswordForUsername: username
136
139
andServiceName: [WPAccount authKeychainServiceName ]
137
140
accessGroup: nil
@@ -147,10 +150,8 @@ + (void)migrateAuthKeyForUsername:(NSString *)username
147
150
{
148
151
static dispatch_once_t onceToken;
149
152
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];
154
155
});
155
156
}
156
157
You can’t perform that action at this time.
0 commit comments