auto refresh repos on api key reset

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/89/head v2.3.1
androidacy-user 2 years ago
parent b5d2d96de6
commit 27e0e93a69

@ -117,6 +117,7 @@ class MainActivity : AppCompatActivity(), OnRefreshListener, OverScrollHelper {
} }
onMainActivityCreate(this) onMainActivityCreate(this)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
INSTANCE = this
TrackHelper.track().screen(this).with(MainApplication.INSTANCE!!.tracker) TrackHelper.track().screen(this).with(MainApplication.INSTANCE!!.tracker)
// hide this behind a buildconfig flag for now, but crash the app if it's not an official build and not debug // hide this behind a buildconfig flag for now, but crash the app if it's not an official build and not debug
if (BuildConfig.ENABLE_PROTECTION && !MainApplication.o && !BuildConfig.DEBUG) { if (BuildConfig.ENABLE_PROTECTION && !MainApplication.o && !BuildConfig.DEBUG) {
@ -814,6 +815,11 @@ class MainActivity : AppCompatActivity(), OnRefreshListener, OverScrollHelper {
return super.dispatchTouchEvent(event) return super.dispatchTouchEvent(event)
} }
override fun onDestroy() {
super.onDestroy()
INSTANCE = null
}
companion object { companion object {
fun getAppCompatActivity(activity: AppCompatActivity): AppCompatActivity { fun getAppCompatActivity(activity: AppCompatActivity): AppCompatActivity {
return activity return activity
@ -831,5 +837,6 @@ class MainActivity : AppCompatActivity(), OnRefreshListener, OverScrollHelper {
var localModuleInfoList: List<LocalModuleInfo> = ArrayList() var localModuleInfoList: List<LocalModuleInfo> = ArrayList()
var onlineModuleInfoList: List<RepoModule> = ArrayList() var onlineModuleInfoList: List<RepoModule> = ArrayList()
var isShowingWeblateSb = false // race condition var isShowingWeblateSb = false // race condition
var INSTANCE: MainActivity? = null
} }
} }

@ -266,6 +266,10 @@ class RepoManager private constructor(mainApplication: MainApplication) : SyncMa
R.string.api_key_removed, R.string.api_key_removed,
Toast.LENGTH_SHORT Toast.LENGTH_SHORT
).show() ).show()
// refresh by faking user pull down
if (MainActivity.INSTANCE != null) {
MainActivity.INSTANCE!!.onRefresh()
}
} }
} }
builder.show() builder.show()

Loading…
Cancel
Save