Skip to content

Commit

Permalink
Remove string resource from BraintreeSharedPreferences.
Browse files Browse the repository at this point in the history
  • Loading branch information
sshropshire committed Feb 9, 2023
1 parent 2518878 commit 62e7f2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,31 @@

import androidx.annotation.VisibleForTesting;

import com.braintreepayments.api.sharedutils.R;

class BraintreeSharedPreferences {

private static final String PREFERENCES_FILE_KEY =
"com.braintreepayments.api.SHARED_PREFERENCES";
private static volatile BraintreeSharedPreferences INSTANCE;

static BraintreeSharedPreferences getInstance(Context context) {
if (INSTANCE == null) {
synchronized (BraintreeSharedPreferences.class) {
// double check that instance was not created in another thread
if (INSTANCE == null) {
INSTANCE = new BraintreeSharedPreferences(context);
INSTANCE =
new BraintreeSharedPreferences(createSharedPreferencesInstance(context));
}
}
}
return INSTANCE;
}

private static SharedPreferences createSharedPreferencesInstance(Context context) {
String preferenceFileKey = context.getString(R.string.preference_file_key);
return context.getSharedPreferences(preferenceFileKey, Context.MODE_PRIVATE);
return context.getSharedPreferences(PREFERENCES_FILE_KEY, Context.MODE_PRIVATE);
}

private final SharedPreferences sharedPreferences;

BraintreeSharedPreferences(Context context) {
this(createSharedPreferencesInstance(context));
}

@VisibleForTesting
BraintreeSharedPreferences(SharedPreferences sharedPreferences) {
this.sharedPreferences = sharedPreferences;
Expand Down
4 changes: 0 additions & 4 deletions SharedUtils/src/main/res/values/strings.xml

This file was deleted.

0 comments on commit 62e7f2b

Please sign in to comment.