[Android] Remove MwmApplication.prefs

This commit is contained in:
velichkomarija 2020-12-01 19:53:34 +03:00 committed by Aleksandr Zatsepin
parent 0d8ba7fd3b
commit be3d79b806
2 changed files with 2 additions and 17 deletions

View file

@ -55,7 +55,6 @@ public class MwmApplication extends Application implements AppBackgroundTracker.
public final static String TAG = "MwmApplication";
private static MwmApplication sSelf;
private SharedPreferences mPrefs;
private AppBackgroundTracker mBackgroundTracker;
@SuppressWarnings("NullableProblems")
@NonNull
@ -147,19 +146,6 @@ public class MwmApplication extends Application implements AppBackgroundTracker.
return ((MwmApplication) context.getApplicationContext()).getBackgroundTracker();
}
/**
*
* Use {@link #prefs(Context)} instead.
*/
@Deprecated
public synchronized static SharedPreferences prefs()
{
if (sSelf.mPrefs == null)
sSelf.mPrefs = sSelf.getSharedPreferences(sSelf.getString(R.string.pref_file_name), MODE_PRIVATE);
return sSelf.mPrefs;
}
@NonNull
public static SharedPreferences prefs(@NonNull Context context)
{
@ -188,8 +174,7 @@ public class MwmApplication extends Application implements AppBackgroundTracker.
mMediator.initSensitiveDataToleranceLibraries();
mMediator.initSensitiveDataStrictLibrariesAsync();
Statistics.INSTANCE.setMediator(mMediator);
mPrefs = getSharedPreferences(getString(R.string.pref_file_name), MODE_PRIVATE);
initNotificationChannels();
mBackgroundTracker = new AppBackgroundTracker();

View file

@ -162,7 +162,7 @@ public enum TrackRecorder implements Initializable<Context>
long getAwaitTimeout()
{
return MwmApplication.prefs().getLong(LOCATION_TIMEOUT_STORED_KEY, LOCATION_TIMEOUT_MIN_MS);
return MwmApplication.prefs(mContext).getLong(LOCATION_TIMEOUT_STORED_KEY, LOCATION_TIMEOUT_MIN_MS);
}
private void setAwaitTimeout(long timeout)