Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit 50e1e41

Browse files
authored
Merge pull request #492 from wordpress-mobile/release/1.26.0
Release/1.26.0
2 parents 1d5dbb7 + a348281 commit 50e1e41

20 files changed

+223
-252
lines changed

Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def wordpress_authenticator_pods
1111
##
1212
pod 'Gridicons', '~> 1.0'
1313
pod 'WordPressUI', '~> 1.7.0'
14-
pod 'WordPressKit', '~> 4.16.beta' # Don't change this until we hit 5.0 in WPKit
15-
pod 'WordPressShared', '~> 1.9-beta' # Don't change this until we hit 2.0 in WPShared
14+
pod 'WordPressKit', '~> 4.18-beta' # Don't change this until we hit 5.0 in WPKit
15+
pod 'WordPressShared', '~> 1.12-beta' # Don't change this until we hit 2.0 in WPShared
1616

1717

1818
## Third party libraries

Podfile.lock

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@ PODS:
4848
- Specta (1.0.7)
4949
- SVProgressHUD (2.2.5)
5050
- UIDeviceIdentifier (1.5.0)
51-
- WordPressKit (4.16.0-beta.6):
51+
- WordPressKit (4.18.0):
5252
- Alamofire (~> 4.8.0)
5353
- CocoaLumberjack (~> 3.4)
5454
- NSObject-SafeExpectations (= 0.0.4)
5555
- UIDeviceIdentifier (~> 1)
56-
- WordPressShared (~> 1.10-beta)
57-
- wpxmlrpc (= 0.8.5)
58-
- WordPressShared (1.11.0-beta.1):
56+
- WordPressShared (~> 1.12)
57+
- wpxmlrpc (~> 0.9.0)
58+
- WordPressShared (1.12.0):
5959
- CocoaLumberjack (~> 3.4)
6060
- FormatterKit/TimeIntervalFormatter (= 1.8.2)
6161
- WordPressUI (1.7.0)
62-
- wpxmlrpc (0.8.5)
62+
- wpxmlrpc (0.9.0)
6363

6464
DEPENDENCIES:
6565
- 1PasswordExtension (= 1.8.6)
@@ -75,8 +75,8 @@ DEPENDENCIES:
7575
- OHHTTPStubs/Swift (= 8.0.0)
7676
- Specta (= 1.0.7)
7777
- SVProgressHUD (= 2.2.5)
78-
- WordPressKit (~> 4.16.beta)
79-
- WordPressShared (~> 1.9-beta)
78+
- WordPressKit (~> 4.18-beta)
79+
- WordPressShared (~> 1.12-beta)
8080
- WordPressUI (~> 1.7.0)
8181

8282
SPEC REPOS:
@@ -123,11 +123,11 @@ SPEC CHECKSUMS:
123123
Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66
124124
SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6
125125
UIDeviceIdentifier: a79ccdfc940373835a7d8e9fc7541e6bf61b6319
126-
WordPressKit: 6e1b2953ccb53e5867d22759f219b7991afa1234
127-
WordPressShared: a6fe876744bed80d54f920f5ae6f9dcdad338863
126+
WordPressKit: 1d10fa14ea185600472d31cf25e677c7d938b17d
127+
WordPressShared: 38cb62e9cb998d4dc3c1611f17934c6875a6b3e8
128128
WordPressUI: 1cf47a3b78154faf69caa18569ee7ece1e510fa0
129-
wpxmlrpc: 6a9bdd6ab9d1b159b384b0df0f3f39de9af4fecf
129+
wpxmlrpc: bf55a43a7e710bd2a4fb8c02dfe83b1246f14f13
130130

131-
PODFILE CHECKSUM: 227d3f7f8499c650f92b4171c4b7a5cde085cb65
131+
PODFILE CHECKSUM: dcfabc4bf0a259cb16d29a95a5acdfe5327cb221
132132

133133
COCOAPODS: 1.8.4

WordPressAuthenticator.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "WordPressAuthenticator"
3-
s.version = "1.25.0"
3+
s.version = "1.26.0"
44
s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps."
55

66
s.description = <<-DESC
@@ -43,6 +43,6 @@ Pod::Spec.new do |s|
4343

4444
# Use a loose restriction that allows both production and beta versions, up to the next major version.
4545
# If you want to update which of these is used, specify it in the host app.
46-
s.dependency 'WordPressKit', '~> 4.16-beta' # Don't change this until we hit 5.0 in WPKit
47-
s.dependency 'WordPressShared', '~> 1.11-beta' # Don't change this until we hit 2.0 in WPShared
46+
s.dependency 'WordPressKit', '~> 4.18-beta' # Don't change this until we hit 5.0 in WPKit
47+
s.dependency 'WordPressShared', '~> 1.12-beta' # Don't change this until we hit 2.0 in WPShared
4848
end

WordPressAuthenticator.xcodeproj/project.pbxproj

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
F12F9FB424D8A68E00771BCE /* AuthenticatorAnalyticsTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = F12F9FB324D8A68E00771BCE /* AuthenticatorAnalyticsTracker.swift */; };
159159
F12F9FB824D8A7FC00771BCE /* AnalyticsTrackerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F12F9FB724D8A7FC00771BCE /* AnalyticsTrackerTests.swift */; };
160160
F180B82424F59263000A01F5 /* StoredCredentialsPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = F180B82324F59263000A01F5 /* StoredCredentialsPicker.swift */; };
161+
F18DF0E5252500A600D83AFE /* WordPressAuthenticatorTests-Bridging-Header.h in Sources */ = {isa = PBXBuildFile; fileRef = F18DF0E4252500A600D83AFE /* WordPressAuthenticatorTests-Bridging-Header.h */; };
161162
F1AF1BEF24E4A80F00BA453E /* LoginFacade.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1AF1BEE24E4A80F00BA453E /* LoginFacade.swift */; };
162163
F1C96669250BF53400EB529D /* UIViewController+Dismissal.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1C96668250BF53400EB529D /* UIViewController+Dismissal.swift */; };
163164
F1DE08CC24F4266A007AE6B3 /* StoredCredentialsAuthenticator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1DE08CB24F4266A007AE6B3 /* StoredCredentialsAuthenticator.swift */; };
@@ -356,6 +357,7 @@
356357
F12F9FB324D8A68E00771BCE /* AuthenticatorAnalyticsTracker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthenticatorAnalyticsTracker.swift; sourceTree = "<group>"; };
357358
F12F9FB724D8A7FC00771BCE /* AnalyticsTrackerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsTrackerTests.swift; sourceTree = "<group>"; };
358359
F180B82324F59263000A01F5 /* StoredCredentialsPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoredCredentialsPicker.swift; sourceTree = "<group>"; };
360+
F18DF0E4252500A600D83AFE /* WordPressAuthenticatorTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WordPressAuthenticatorTests-Bridging-Header.h"; sourceTree = "<group>"; };
359361
F1AF1BEE24E4A80F00BA453E /* LoginFacade.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginFacade.swift; sourceTree = "<group>"; };
360362
F1C96668250BF53400EB529D /* UIViewController+Dismissal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Dismissal.swift"; sourceTree = "<group>"; };
361363
F1DE08CB24F4266A007AE6B3 /* StoredCredentialsAuthenticator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoredCredentialsAuthenticator.swift; sourceTree = "<group>"; };
@@ -729,6 +731,7 @@
729731
B5ED7901207E976500A8FD8C /* WordPressAuthenticatorTests */ = {
730732
isa = PBXGroup;
731733
children = (
734+
F18DF0E32525009200D83AFE /* SupportingFiles */,
732735
BA53D64924DFE06C001F1ABF /* Mocks */,
733736
BA53D64424DFDE0B001F1ABF /* Credentials */,
734737
F12F9FB524D8A7DB00771BCE /* Analytics */,
@@ -871,6 +874,14 @@
871874
path = Analytics;
872875
sourceTree = "<group>";
873876
};
877+
F18DF0E32525009200D83AFE /* SupportingFiles */ = {
878+
isa = PBXGroup;
879+
children = (
880+
F18DF0E4252500A600D83AFE /* WordPressAuthenticatorTests-Bridging-Header.h */,
881+
);
882+
path = SupportingFiles;
883+
sourceTree = "<group>";
884+
};
874885
/* End PBXGroup section */
875886

876887
/* Begin PBXHeadersBuildPhase section */
@@ -1265,6 +1276,7 @@
12651276
isa = PBXSourcesBuildPhase;
12661277
buildActionMask = 2147483647;
12671278
files = (
1279+
F18DF0E5252500A600D83AFE /* WordPressAuthenticatorTests-Bridging-Header.h in Sources */,
12681280
B501C045208FC68700D1E58F /* LoginFieldsValidationTests.swift in Sources */,
12691281
BA53D64824DFDF97001F1ABF /* WordPressSourceTagTests.swift in Sources */,
12701282
BA53D64D24DFE4E6001F1ABF /* ModalViewControllerPresentingSpy.swift in Sources */,
@@ -1464,11 +1476,14 @@
14641476
baseConfigurationReference = B0D7D40BC1DE2D367761AD86 /* Pods-WordPressAuthenticatorTests.debug.xcconfig */;
14651477
buildSettings = {
14661478
CODE_SIGN_STYLE = Automatic;
1479+
DEFINES_MODULE = YES;
14671480
DEVELOPMENT_TEAM = PZYM8XX95Q;
14681481
INFOPLIST_FILE = WordPressAuthenticatorTests/Info.plist;
14691482
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
14701483
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticatorTests;
14711484
PRODUCT_NAME = "$(TARGET_NAME)";
1485+
SWIFT_OBJC_BRIDGING_HEADER = "WordPressAuthenticatorTests/SupportingFiles/WordPressAuthenticatorTests-Bridging-Header.h";
1486+
SWIFT_PRECOMPILE_BRIDGING_HEADER = NO;
14721487
SWIFT_VERSION = 4.2;
14731488
TARGETED_DEVICE_FAMILY = "1,2";
14741489
};
@@ -1479,11 +1494,14 @@
14791494
baseConfigurationReference = FF475C5056EB60A277696BA9 /* Pods-WordPressAuthenticatorTests.release.xcconfig */;
14801495
buildSettings = {
14811496
CODE_SIGN_STYLE = Automatic;
1497+
DEFINES_MODULE = YES;
14821498
DEVELOPMENT_TEAM = PZYM8XX95Q;
14831499
INFOPLIST_FILE = WordPressAuthenticatorTests/Info.plist;
14841500
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
14851501
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticatorTests;
14861502
PRODUCT_NAME = "$(TARGET_NAME)";
1503+
SWIFT_OBJC_BRIDGING_HEADER = "WordPressAuthenticatorTests/SupportingFiles/WordPressAuthenticatorTests-Bridging-Header.h";
1504+
SWIFT_PRECOMPILE_BRIDGING_HEADER = NO;
14871505
SWIFT_VERSION = 4.2;
14881506
TARGETED_DEVICE_FAMILY = "1,2";
14891507
};
@@ -1575,11 +1593,14 @@
15751593
baseConfigurationReference = AE612958059F9E80B54138B3 /* Pods-WordPressAuthenticatorTests.release-internal.xcconfig */;
15761594
buildSettings = {
15771595
CODE_SIGN_STYLE = Automatic;
1596+
DEFINES_MODULE = YES;
15781597
DEVELOPMENT_TEAM = PZYM8XX95Q;
15791598
INFOPLIST_FILE = WordPressAuthenticatorTests/Info.plist;
15801599
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
15811600
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticatorTests;
15821601
PRODUCT_NAME = "$(TARGET_NAME)";
1602+
SWIFT_OBJC_BRIDGING_HEADER = "WordPressAuthenticatorTests/SupportingFiles/WordPressAuthenticatorTests-Bridging-Header.h";
1603+
SWIFT_PRECOMPILE_BRIDGING_HEADER = NO;
15831604
SWIFT_VERSION = 4.2;
15841605
TARGETED_DEVICE_FAMILY = "1,2";
15851606
};
@@ -1671,11 +1692,14 @@
16711692
baseConfigurationReference = 37AFD4EF492B00CA7AEC11A3 /* Pods-WordPressAuthenticatorTests.release-alpha.xcconfig */;
16721693
buildSettings = {
16731694
CODE_SIGN_STYLE = Automatic;
1695+
DEFINES_MODULE = YES;
16741696
DEVELOPMENT_TEAM = PZYM8XX95Q;
16751697
INFOPLIST_FILE = WordPressAuthenticatorTests/Info.plist;
16761698
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
16771699
PRODUCT_BUNDLE_IDENTIFIER = com.automattic.WordPressAuthenticatorTests;
16781700
PRODUCT_NAME = "$(TARGET_NAME)";
1701+
SWIFT_OBJC_BRIDGING_HEADER = "WordPressAuthenticatorTests/SupportingFiles/WordPressAuthenticatorTests-Bridging-Header.h";
1702+
SWIFT_PRECOMPILE_BRIDGING_HEADER = NO;
16791703
SWIFT_VERSION = 4.2;
16801704
TARGETED_DEVICE_FAMILY = "1,2";
16811705
};

WordPressAuthenticator/Analytics/AuthenticatorAnalyticsTracker.swift

Lines changed: 18 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class AuthenticatorAnalyticsTracker {
3838

3939
/// Starts when the used adds a site from the site picker
4040
///
41-
case selfHosted
41+
case selfHosted = "self_hosted"
4242
}
4343

4444
public enum Flow: String {
@@ -234,34 +234,9 @@ public class AuthenticatorAnalyticsTracker {
234234
/// Shared Instance.
235235
///
236236
public static var shared: AuthenticatorAnalyticsTracker = {
237-
return AuthenticatorAnalyticsTracker(configuration: defaultConfiguration())
237+
return AuthenticatorAnalyticsTracker()
238238
}()
239239

240-
struct Configuration {
241-
let appleEnabled: Bool
242-
let googleEnabled: Bool
243-
let iCloudKeychainEnabled: Bool
244-
let prologueEnabled: Bool
245-
let siteAddressEnabled: Bool
246-
let wpComEnabled: Bool
247-
}
248-
249-
private class func defaultConfiguration() -> Configuration{
250-
// When unit testing, WordPressAuthenticator is not always initialized.
251-
// The following code ensures we have configuration defaults even if that's the case.
252-
guard WordPressAuthenticator.isInitialized() else {
253-
return Configuration(appleEnabled: false, googleEnabled: false, iCloudKeychainEnabled: false, prologueEnabled: false, siteAddressEnabled: false, wpComEnabled: false)
254-
}
255-
256-
return Configuration(
257-
appleEnabled: WordPressAuthenticator.shared.configuration.enableUnifiedApple,
258-
googleEnabled: WordPressAuthenticator.shared.configuration.enableUnifiedGoogle,
259-
iCloudKeychainEnabled: WordPressAuthenticator.shared.configuration.enableUnifiedKeychainLogin,
260-
prologueEnabled: true,
261-
siteAddressEnabled: WordPressAuthenticator.shared.configuration.enableUnifiedSiteAddress,
262-
wpComEnabled: WordPressAuthenticator.shared.configuration.enableUnifiedWordPress)
263-
}
264-
265240
/// State for the analytics tracker.
266241
///
267242
public class State {
@@ -276,22 +251,23 @@ public class AuthenticatorAnalyticsTracker {
276251
}
277252
}
278253

279-
/// The tracking configuration.
280-
///
281-
private let configuration: Configuration
282-
283254
/// The state of this tracker.
284255
///
285256
public let state = State()
286257

287258
/// The backing analytics tracking method. Can be overridden for testing purposes.
288259
///
289260
let track: TrackerMethod
261+
262+
/// Whether tracking is enabled or not. This is just a convenience configuration to enable this tracker to be turned on and off
263+
/// using a feature flag. It should go away once we remove the legacy tracking.
264+
///
265+
let enabled: Bool
290266

291267
// MARK: - Initializers
292268

293-
init(configuration: Configuration, track: @escaping TrackerMethod = WPAnalytics.track) {
294-
self.configuration = configuration
269+
init(enabled: Bool = WordPressAuthenticator.shared.configuration.enableUnifiedAuth, track: @escaping TrackerMethod = WPAnalytics.track) {
270+
self.enabled = enabled
295271
self.track = track
296272
}
297273

@@ -310,14 +286,8 @@ public class AuthenticatorAnalyticsTracker {
310286
///
311287
/// - Returns: `true` if we can track using the state machine.
312288
///
313-
public func canTrackInCurrentFlow() -> Bool {
314-
return isInSiteAuthenticationFlowAndCanTrack()
315-
|| isInAppleFlowAndCanTrack()
316-
|| isInGoogleFlowAndCanTrack()
317-
|| isInMagicLinkFlowAndCanTrack()
318-
|| isInWPComFlowAndCanTrack()
319-
|| isInPrologueFlowAndCanTrack()
320-
|| isInKeychainFlowAndCanTrack()
289+
public func canTrack() -> Bool {
290+
return enabled
321291
}
322292

323293
/// This is a convenience method, that's useful for cases where we simply want to check if the legacy tracking should be
@@ -326,45 +296,15 @@ public class AuthenticatorAnalyticsTracker {
326296
/// - Returns: `true` if we must use legacy tracking, `false` otherwise.
327297
///
328298
public func shouldUseLegacyTracker() -> Bool {
329-
return !canTrackInCurrentFlow()
330-
}
331-
332-
// MARK: - Legacy vs Unified tracking: Support Methods
333-
334-
private func isInSiteAuthenticationFlowAndCanTrack() -> Bool {
335-
return configuration.siteAddressEnabled && state.lastFlow == .loginWithSiteAddress
336-
}
337-
338-
private func isInAppleFlowAndCanTrack() -> Bool {
339-
return configuration.appleEnabled && [Flow.loginWithApple, .signupWithApple].contains(state.lastFlow)
340-
}
341-
342-
private func isInGoogleFlowAndCanTrack() -> Bool {
343-
return configuration.googleEnabled && [Flow.loginWithGoogle, .signupWithGoogle].contains(state.lastFlow)
344-
}
345-
346-
private func isInMagicLinkFlowAndCanTrack() -> Bool {
347-
return configuration.wpComEnabled && state.lastFlow == .loginWithMagicLink
348-
}
349-
350-
private func isInWPComFlowAndCanTrack() -> Bool {
351-
return configuration.wpComEnabled && [Flow.wpCom, .signup, .loginWithPassword].contains(state.lastFlow)
352-
}
353-
354-
private func isInPrologueFlowAndCanTrack() -> Bool {
355-
return configuration.prologueEnabled && state.lastFlow == .prologue
356-
}
357-
358-
private func isInKeychainFlowAndCanTrack() -> Bool {
359-
return configuration.iCloudKeychainEnabled && state.lastFlow == .loginWithiCloudKeychain
299+
return !canTrack()
360300
}
361301

362302
// MARK: - Tracking
363303

364304
/// Track a step within a flow.
365305
///
366306
public func track(step: Step) {
367-
guard canTrackInCurrentFlow() else {
307+
guard canTrack() else {
368308
return
369309
}
370310

@@ -374,7 +314,7 @@ public class AuthenticatorAnalyticsTracker {
374314
/// Track a click interaction.
375315
///
376316
public func track(click: ClickTarget) {
377-
guard canTrackInCurrentFlow() else {
317+
guard canTrack() else {
378318
return
379319
}
380320

@@ -384,7 +324,7 @@ public class AuthenticatorAnalyticsTracker {
384324
/// Track a failure.
385325
///
386326
public func track(failure: String) {
387-
guard canTrackInCurrentFlow() else {
327+
guard canTrack() else {
388328
return
389329
}
390330

@@ -397,7 +337,7 @@ public class AuthenticatorAnalyticsTracker {
397337
/// for the flow.
398338
///
399339
public func track(step: Step, ifTrackingNotEnabled legacyTracking: () -> ()) {
400-
guard canTrackInCurrentFlow() else {
340+
guard canTrack() else {
401341
legacyTracking()
402342
return
403343
}
@@ -409,7 +349,7 @@ public class AuthenticatorAnalyticsTracker {
409349
/// for the flow.
410350
///
411351
public func track(click: ClickTarget, ifTrackingNotEnabled legacyTracking: () -> ()) {
412-
guard canTrackInCurrentFlow() else {
352+
guard canTrack() else {
413353
legacyTracking()
414354
return
415355
}
@@ -421,7 +361,7 @@ public class AuthenticatorAnalyticsTracker {
421361
/// for the flow.
422362
///
423363
public func track(failure: String, ifTrackingNotEnabled legacyTracking: () -> ()) {
424-
guard canTrackInCurrentFlow() else {
364+
guard canTrack() else {
425365
legacyTracking()
426366
return
427367
}

0 commit comments

Comments
 (0)