Optimization change
- Spawning a new thread only when actually purging the database
This commit is contained in:
parent
5e4a82a7f6
commit
2ef589526d
1 changed files with 7 additions and 6 deletions
|
@ -179,12 +179,13 @@ abstract class ConnectedActivity : AppCompatActivity(), ServiceConnection {
|
||||||
})
|
})
|
||||||
mCompositeDisposable.add(disposable)
|
mCompositeDisposable.add(disposable)
|
||||||
|
|
||||||
thread {
|
|
||||||
val info = this.packageManager.getPackageInfo(this.packageName, PackageManager.GET_ACTIVITIES)
|
val info = this.packageManager.getPackageInfo(this.packageName, PackageManager.GET_ACTIVITIES)
|
||||||
val versionCode = PackageInfoCompat.getLongVersionCode(info)
|
val versionCode = PackageInfoCompat.getLongVersionCode(info)
|
||||||
val hasPurgedEquivalentValues = PreferenceManager.getDefaultSharedPreferences(this)
|
val hasPurgedEquivalentValues = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
.getBoolean(Constants.KEY_HAS_PURGED_EQUIVALENT_VALUES, false)
|
.getBoolean(Constants.KEY_HAS_PURGED_EQUIVALENT_VALUES, false)
|
||||||
if(versionCode > 11 && !hasPurgedEquivalentValues) {
|
if(versionCode > 11 && !hasPurgedEquivalentValues) {
|
||||||
|
thread {
|
||||||
mConnectedActivityViewModel.purgeEquivalentValues()
|
mConnectedActivityViewModel.purgeEquivalentValues()
|
||||||
PreferenceManager.getDefaultSharedPreferences(this)
|
PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
.edit()
|
.edit()
|
||||||
|
|
Loading…
Reference in a new issue