Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add null checks for obtainSharedPreferences #202

Merged
merged 2 commits into from
Aug 29, 2018

Conversation

electrostat
Copy link
Contributor

Add null checks within parent methods for obtainSharedPreferences

Fixes mapbox/mapbox-gl-native#12748

- add null checks
- pass along default values for parent methods to `obtainSharedPreferences`
- switch logic of methods to be more efficient and readable
@electrostat electrostat merged commit 6fa3ce7 into master Aug 29, 2018
@electrostat electrostat deleted the aa-obtainsharedprefs-null-check branch August 29, 2018 15:29
Copy link
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if returning "hardcoded" states when MapboxTelemetry.applicationContext is null could affect the overall behavior somehow. Especially after, when the app is restarted 🤔 Have we thought about that?

@@ -177,6 +177,10 @@ static boolean isEmpty(String string) {
}

static String retrieveVendorId() {
if (MapboxTelemetry.applicationContext == null) {
return updateVendorId();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we considered returning obtainUniversalUniqueIdentifier() here? Doing so, would remove the need for

String uniqueId = obtainUniversalUniqueIdentifier();
if (MapboxTelemetry.applicationContext == null) {
return uniqueId;
}
in updateVendorId() 👇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants