Skip to content

Commit 931d7b1

Browse files
authored
Removeonboarding2 (#7052)
Remove obsolete onboarding calls from the SDK.
1 parent 38f2fe4 commit 931d7b1

File tree

10 files changed

+38
-455
lines changed

10 files changed

+38
-455
lines changed

Crashlytics/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Unreleased
22
- [changed] Removed obsolete API calls from upload-symbols
3+
- [changed] Removed obsolete onboarding calls from the SDK.
34
- [changed] Decreased Crashlytics CocoaPods minimum deployment target from iOS 10 to iOS 9
45

56
# v7.1.0

Crashlytics/Crashlytics/Controllers/FIRCLSReportManager.m

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
#import "Crashlytics/Crashlytics/Models/FIRCLSExecutionIdentifierModel.h"
6161
#import "Crashlytics/Crashlytics/Models/FIRCLSInstallIdentifierModel.h"
62-
#import "Crashlytics/Crashlytics/Settings/FIRCLSSettingsOnboardingManager.h"
62+
#import "Crashlytics/Crashlytics/Settings/FIRCLSSettingsManager.h"
6363
#import "Crashlytics/Shared/FIRCLSConstants.h"
6464

6565
#import "Crashlytics/Crashlytics/Controllers/FIRCLSReportManager_Private.h"
@@ -171,8 +171,8 @@ @interface FIRCLSReportManager () <FIRCLSNetworkClientDelegate,
171171
// Settings fetched from the server
172172
@property(nonatomic, strong) FIRCLSSettings *settings;
173173

174-
// Runs the operations that fetch settings and call onboarding endpoints
175-
@property(nonatomic, strong) FIRCLSSettingsOnboardingManager *settingsAndOnboardingManager;
174+
// Runs the operations that fetch settings
175+
@property(nonatomic, strong) FIRCLSSettingsManager *settingsManager;
176176

177177
@property(nonatomic, strong) GDTCORTransport *googleTransport;
178178

@@ -226,12 +226,11 @@ - (instancetype)initWithFileManager:(FIRCLSFileManager *)fileManager
226226
_settings = settings;
227227
_appIDModel = appIDModel;
228228

229-
_settingsAndOnboardingManager =
230-
[[FIRCLSSettingsOnboardingManager alloc] initWithAppIDModel:appIDModel
231-
installIDModel:self.installIDModel
232-
settings:self.settings
233-
fileManager:self.fileManager
234-
googleAppID:self.googleAppID];
229+
_settingsManager = [[FIRCLSSettingsManager alloc] initWithAppIDModel:appIDModel
230+
installIDModel:self.installIDModel
231+
settings:self.settings
232+
fileManager:self.fileManager
233+
googleAppID:self.googleAppID];
235234

236235
return self;
237236
}
@@ -360,7 +359,7 @@ - (FBLPromise *)deleteUnsentReports {
360359
FIRCLSDebugLog(@"Unsent reports will be uploaded at startup");
361360
FIRCLSDataCollectionToken *dataCollectionToken = [FIRCLSDataCollectionToken validToken];
362361

363-
[self beginSettingsAndOnboardingWithToken:dataCollectionToken waitForSettingsRequest:NO];
362+
[self beginSettingsWithToken:dataCollectionToken waitForSettingsRequest:NO];
364363

365364
[self beginReportUploadsWithToken:dataCollectionToken
366365
preexistingReportPaths:preexistingReportPaths
@@ -398,8 +397,8 @@ - (FBLPromise *)deleteUnsentReports {
398397
BOOL waitForSetting =
399398
!self.settings.shouldUseNewReportEndpoint && !self.settings.orgID;
400399

401-
[self beginSettingsAndOnboardingWithToken:dataCollectionToken
402-
waitForSettingsRequest:waitForSetting];
400+
[self beginSettingsWithToken:dataCollectionToken
401+
waitForSettingsRequest:waitForSetting];
403402

404403
[self beginReportUploadsWithToken:dataCollectionToken
405404
preexistingReportPaths:preexistingReportPaths
@@ -454,16 +453,16 @@ - (void)checkAndRotateInstallUUIDIfNeededWithReport:(FIRCLSInternalReport *)repo
454453
}];
455454
}
456455

457-
- (void)beginSettingsAndOnboardingWithToken:(FIRCLSDataCollectionToken *)token
458-
waitForSettingsRequest:(BOOL)waitForSettings {
456+
- (void)beginSettingsWithToken:(FIRCLSDataCollectionToken *)token
457+
waitForSettingsRequest:(BOOL)waitForSettings {
459458
if (self.settings.isCacheExpired) {
460459
// This method can be called more than once if the user calls
461460
// SendUnsentReports again, so don't repeat the settings fetch
462461
static dispatch_once_t settingsFetchOnceToken;
463462
dispatch_once(&settingsFetchOnceToken, ^{
464-
[self.settingsAndOnboardingManager beginSettingsAndOnboardingWithGoogleAppId:self.googleAppID
465-
token:token
466-
waitForCompletion:waitForSettings];
463+
[self.settingsManager beginSettingsWithGoogleAppId:self.googleAppID
464+
token:token
465+
waitForCompletion:waitForSettings];
467466
});
468467
}
469468
}

Crashlytics/Crashlytics/Models/FIRCLSSettings.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,6 @@ NS_ASSUME_NONNULL_BEGIN
7676
*/
7777
@property(nonatomic, nullable, readonly) NSString *fetchedBundleID;
7878

79-
/**
80-
* Indicates whether the app needs onboarding
81-
*/
82-
@property(nonatomic, readonly) BOOL appNeedsOnboarding;
83-
84-
/**
85-
* Indicates whether the app needs an update
86-
*/
87-
@property(nonatomic, readonly) BOOL appUpdateRequired;
88-
8979
/**
9080
* When this is false, Crashlytics will not start up
9181
*/

Crashlytics/Crashlytics/Models/FIRCLSSettings.m

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -261,20 +261,6 @@ - (nullable NSString *)fetchedBundleID {
261261
return self.fabricSettings[@"bundle_id"];
262262
}
263263

264-
#pragma mark - Onboarding / Update
265-
266-
- (NSString *)appStatus {
267-
return self.appSettings[@"status"];
268-
}
269-
270-
- (BOOL)appNeedsOnboarding {
271-
return [self.appStatus isEqualToString:@"new"];
272-
}
273-
274-
- (BOOL)appUpdateRequired {
275-
return [[self.appSettings objectForKey:@"update_required"] boolValue];
276-
}
277-
278264
#pragma mark - On / Off Switches
279265

280266
- (BOOL)errorReportingEnabled {

Crashlytics/Crashlytics/Settings/FIRCLSSettingsOnboardingManager.h renamed to Crashlytics/Crashlytics/Settings/FIRCLSSettingsManager.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@
2929
NS_ASSUME_NONNULL_BEGIN
3030

3131
/**
32-
* Use this class to retrieve remote settings for the application from crashlytics backend, and
33-
* onboard the application on the server.
32+
* Use this class to retrieve remote settings for the application from crashlytics backend.
3433
*/
35-
@interface FIRCLSSettingsOnboardingManager : NSObject
34+
@interface FIRCLSSettingsManager : NSObject
3635

3736
/**
3837
* Designated Initializer.
@@ -46,13 +45,13 @@ NS_ASSUME_NONNULL_BEGIN
4645
+ (instancetype)new NS_UNAVAILABLE;
4746

4847
/**
49-
* This method kicks off downloading settings and onboarding for the app.
48+
* This method kicks off downloading settings for the app.
5049
* @param googleAppID (required) GMP id for the app.
5150
* @param token (required) Data collection token signifying we can make network calls
5251
*/
53-
- (void)beginSettingsAndOnboardingWithGoogleAppId:(NSString *)googleAppID
54-
token:(FIRCLSDataCollectionToken *)token
55-
waitForCompletion:(BOOL)waitForCompletion;
52+
- (void)beginSettingsWithGoogleAppId:(NSString *)googleAppID
53+
token:(FIRCLSDataCollectionToken *)token
54+
waitForCompletion:(BOOL)waitForCompletion;
5655

5756
@end
5857

Crashlytics/Crashlytics/Settings/FIRCLSSettingsOnboardingManager.m renamed to Crashlytics/Crashlytics/Settings/FIRCLSSettingsManager.m

Lines changed: 8 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#import "Crashlytics/Crashlytics/Settings/FIRCLSSettingsOnboardingManager.h"
15+
#import "Crashlytics/Crashlytics/Settings/FIRCLSSettingsManager.h"
1616

1717
#import "Crashlytics/Crashlytics/DataCollection/FIRCLSDataCollectionToken.h"
1818
#import "Crashlytics/Crashlytics/Helpers/FIRCLSDefines.h"
@@ -22,25 +22,19 @@
2222
#import "Crashlytics/Crashlytics/Models/FIRCLSSettings.h"
2323
#import "Crashlytics/Crashlytics/Settings/Models/FIRCLSApplicationIdentifierModel.h"
2424
#import "Crashlytics/Crashlytics/Settings/Operations/FIRCLSDownloadAndSaveSettingsOperation.h"
25-
#import "Crashlytics/Crashlytics/Settings/Operations/FIRCLSOnboardingOperation.h"
2625
#import "Crashlytics/Shared/FIRCLSConstants.h"
2726
#import "Crashlytics/Shared/FIRCLSNetworking/FIRCLSFABNetworkClient.h"
2827
#import "Crashlytics/Shared/FIRCLSNetworking/FIRCLSURLBuilder.h"
2928

30-
@interface FIRCLSSettingsOnboardingManager () <FIRCLSDownloadAndSaveSettingsOperationDelegate,
31-
FIRCLSOnboardingOperationDelegate>
29+
@interface FIRCLSSettingsManager () <FIRCLSDownloadAndSaveSettingsOperationDelegate>
3230

3331
@property(nonatomic, strong) FIRCLSApplicationIdentifierModel *appIDModel;
3432
@property(nonatomic, strong) FIRCLSInstallIdentifierModel *installIDModel;
3533

3634
@property(nonatomic, strong) FIRCLSSettings *settings;
3735

38-
@property(nonatomic, nullable, strong) FIRCLSOnboardingOperation *onboardingOperation;
3936
@property(nonatomic, strong) FIRCLSFileManager *fileManager;
4037

41-
// set to YES once onboarding call has been made.
42-
@property(nonatomic) BOOL hasAttemptedAppConfigure;
43-
4438
@property(nonatomic) NSDictionary *configuration;
4539
@property(nonatomic) NSDictionary *defaultConfiguration;
4640
@property(nonatomic, copy) NSString *googleAppID;
@@ -49,7 +43,7 @@ @interface FIRCLSSettingsOnboardingManager () <FIRCLSDownloadAndSaveSettingsOper
4943

5044
@end
5145

52-
@implementation FIRCLSSettingsOnboardingManager
46+
@implementation FIRCLSSettingsManager
5347

5448
- (instancetype)initWithAppIDModel:(FIRCLSApplicationIdentifierModel *)appIDModel
5549
installIDModel:(FIRCLSInstallIdentifierModel *)installIDModel
@@ -72,9 +66,9 @@ - (instancetype)initWithAppIDModel:(FIRCLSApplicationIdentifierModel *)appIDMode
7266
return self;
7367
}
7468

75-
- (void)beginSettingsAndOnboardingWithGoogleAppId:(NSString *)googleAppID
76-
token:(FIRCLSDataCollectionToken *)token
77-
waitForCompletion:(BOOL)waitForCompletion {
69+
- (void)beginSettingsWithGoogleAppId:(NSString *)googleAppID
70+
token:(FIRCLSDataCollectionToken *)token
71+
waitForCompletion:(BOOL)waitForCompletion {
7872
NSParameterAssert(googleAppID);
7973

8074
self.googleAppID = googleAppID;
@@ -93,10 +87,8 @@ - (void)beginSettingsAndOnboardingWithGoogleAppId:(NSString *)googleAppID
9387
#pragma mark Helper methods
9488

9589
/**
96-
* Makes a settings download request. If the request fails, the error is handled silently(with a log
97-
* statement). If the server response indicates onboarding is needed, an onboarding request is sent
98-
* to the server. If the onboarding request fails, the error is handled silently(with a log
99-
* statement).
90+
* Makes a settings download request. If the request fails, the error is handled silently (with a
91+
* log statement).
10092
*/
10193
- (void)beginSettingsDownload:(FIRCLSDataCollectionToken *)token
10294
waitForCompletion:(BOOL)waitForCompletion {
@@ -126,56 +118,10 @@ - (void)beginSettingsDownload:(FIRCLSDataCollectionToken *)token
126118
}
127119
}
128120

129-
- (void)beginOnboarding:(BOOL)appCreate
130-
endpointString:(NSString *)endpoint
131-
token:(FIRCLSDataCollectionToken *)token {
132-
[self.onboardingOperation cancel];
133-
134-
self.onboardingOperation =
135-
[[FIRCLSOnboardingOperation alloc] initWithDelegate:self
136-
shouldCreate:appCreate
137-
googleAppID:self.googleAppID
138-
kitVersionsByKitBundleIdentifier:self.kitVersionsByKitBundleIdentifier
139-
appIdentifierModel:self.appIDModel
140-
endpointString:endpoint
141-
networkClient:self.networkClient
142-
token:token
143-
settings:self.settings];
144-
145-
[self.onboardingOperation startWithToken:token];
146-
}
147-
148121
- (void)finishNetworkingSession {
149122
[self.networkClient invalidateAndCancel];
150123
}
151124

152-
#pragma mark FIRCLSOnboardingOperationDelegate methods
153-
154-
- (void)onboardingOperation:(FIRCLSOnboardingOperation *)operation
155-
didCompleteAppCreationWithError:(nullable NSError *)error {
156-
if (error) {
157-
FIRCLSErrorLog(@"Unable to complete application configure: %@", error);
158-
[self finishNetworkingSession];
159-
return;
160-
}
161-
self.onboardingOperation = nil;
162-
FIRCLSDebugLog(@"Completed configure");
163-
164-
// now, go get settings, as they can change (and it completes the onboarding process)
165-
[self beginSettingsDownload:operation.token waitForCompletion:NO];
166-
}
167-
168-
- (void)onboardingOperation:(FIRCLSOnboardingOperation *)operation
169-
didCompleteAppUpdateWithError:(nullable NSError *)error {
170-
[self finishNetworkingSession];
171-
if (error) {
172-
FIRCLSErrorLog(@"Unable to complete application update: %@", error);
173-
return;
174-
}
175-
self.onboardingOperation = nil;
176-
FIRCLSDebugLog(@"Completed application update");
177-
}
178-
179125
#pragma mark FIRCLSDownloadAndSaveSettingsOperationDelegate methods
180126

181127
- (void)operation:(FIRCLSDownloadAndSaveSettingsOperation *)operation
@@ -199,32 +145,6 @@ - (void)operation:(FIRCLSDownloadAndSaveSettingsOperation *)operation
199145
NSTimeInterval currentTimestamp = [NSDate timeIntervalSinceReferenceDate];
200146
[self.settings cacheSettingsWithGoogleAppID:self.googleAppID currentTimestamp:currentTimestamp];
201147

202-
// only try this once
203-
if (self.hasAttemptedAppConfigure) {
204-
FIRCLSDebugLog(@"App already onboarded in this run of the app");
205-
[self finishNetworkingSession];
206-
return;
207-
}
208-
209-
// Onboarding is still needed in Firebase, here are the backend app states -
210-
// 1. When the app is created in the Firebase console, app state: built (client settings call
211-
// returns app status: new)
212-
// 2. After onboarding call is made, app state: build_configured
213-
// 3. Another settings call is triggered after onboarding, app state: activated
214-
if ([self.settings appNeedsOnboarding]) {
215-
FIRCLSDebugLog(@"Starting onboarding with app create");
216-
self.hasAttemptedAppConfigure = YES;
217-
[self beginOnboarding:YES endpointString:FIRCLSConfigureEndpoint token:operation.token];
218-
return;
219-
}
220-
221-
if ([self.settings appUpdateRequired]) {
222-
FIRCLSDebugLog(@"Starting onboarding with app update");
223-
self.hasAttemptedAppConfigure = YES;
224-
[self beginOnboarding:NO endpointString:FIRCLSConfigureEndpoint token:operation.token];
225-
return;
226-
}
227-
228148
// we're all set!
229149
[self finishNetworkingSession];
230150
}

Crashlytics/Crashlytics/Settings/Operations/FIRCLSNetworkOperation.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ - (instancetype)initWithGoogleAppID:(NSString *)googleAppID
4444
}
4545

4646
- (void)startWithToken:(FIRCLSDataCollectionToken *)token {
47-
// Settings and Onboarding are considered data collection, so we must only
47+
// Settings is considered data collection, so we must only
4848
// call this with a valid token
4949
if (![token isValid]) {
5050
FIRCLSErrorLog(@"Skipping network operation with invalid data collection token");

0 commit comments

Comments
 (0)