Skip to content

Commit

Permalink
fix(crashlytics, config): handle new app_data_collection_default_enab…
Browse files Browse the repository at this point in the history
…led key

the crashlytics init provider is a special init case and was not handling the new
default / fallback data collection key correctly.

Now we check for our module-specific key first (since it has precedence), but if it
does not exist then we fall back to the new general key
  • Loading branch information
mikehardy committed Aug 17, 2021
1 parent 4f63a62 commit 81aa17f
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#import "RNFBSharedUtils.h"
#import "RNFBVersion.h"

NSString *const KEY_APP_DATA_COLLECTION_DEFAULT_ENABLED = @"app_data_collection_default_enabled";
NSString *const KEY_CRASHLYTICS_DEBUG_ENABLED = @"crashlytics_debug_enabled";
NSString *const KEY_CRASHLYTICS_AUTO_COLLECTION_ENABLED = @"crashlytics_auto_collection_enabled";
NSString *const KEY_CRASHLYTICS_IS_ERROR_GENERATION_ON_JS_CRASH_ENABLED =
Expand All @@ -50,8 +51,16 @@ + (BOOL)isCrashlyticsCollectionEnabled {
}
#endif

if ([RNFBSharedUtils configContains:KEY_CRASHLYTICS_AUTO_COLLECTION_ENABLED]) {
return [RNFBSharedUtils getConfigBooleanValue:@"RNFBCrashlyticsInit"
key:KEY_CRASHLYTICS_AUTO_COLLECTION_ENABLED
defaultValue:YES];
}
DLog(@"RNFBCrashlyticsInit specific key %@ not set, falling back to general key %@ with default "
@"%d if it does not exist.",
KEY_CRASHLYTICS_AUTO_COLLECTION_ENABLED, KEY_APP_DATA_COLLECTION_DEFAULT_ENABLED, YES);
return [RNFBSharedUtils getConfigBooleanValue:@"RNFBCrashlyticsInit"
key:KEY_CRASHLYTICS_AUTO_COLLECTION_ENABLED
key:KEY_APP_DATA_COLLECTION_DEFAULT_ENABLED
defaultValue:YES];
}

Expand Down

0 comments on commit 81aa17f

Please sign in to comment.