Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Update build number and invalidate caches on a new version
Browse files Browse the repository at this point in the history
  • Loading branch information
Garret Yoder committed Oct 8, 2016
1 parent 58e97b6 commit a9d86f2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ android {
buildToolsVersion "24.0.2"

def versionMajor = 0
def versionMinor = 6
def versionMinor = 7
def versionPatch = 0
def versionBuild = 0

Expand Down
14 changes: 13 additions & 1 deletion app/src/main/java/subreddit/android/appstore/AppStoreApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Application;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

import com.squareup.leakcanary.LeakCanary;
Expand Down Expand Up @@ -33,9 +34,20 @@ protected void log(final int priority, final String tag, final String message,
}
});
}
clearCache();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
refWatcher = LeakCanary.install(this);
Injector.INSTANCE.init(this);
theme = Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(this).getString("theme", "0"));
theme = Integer.parseInt(prefs.getString("theme", "0"));
}

private void clearCache() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (prefs.getInt("APP_VERSION",0)<BuildConfig.VERSION_CODE) {
Timber.e("New release on %s, clearing cache database", BuildConfig.VERSION_NAME);
Realm.deleteRealm(new RealmConfiguration.Builder(this, getCacheDir()).build());
prefs.edit().putInt("APP_VERSION",BuildConfig.VERSION_CODE).commit();
}
}

public int getSetTheme() {
Expand Down

0 comments on commit a9d86f2

Please sign in to comment.