diff --git a/app/src/main/kotlin/com/fox2code/mmm/MainActivity.kt b/app/src/main/kotlin/com/fox2code/mmm/MainActivity.kt index 55fdddd5..458d3c3f 100644 --- a/app/src/main/kotlin/com/fox2code/mmm/MainActivity.kt +++ b/app/src/main/kotlin/com/fox2code/mmm/MainActivity.kt @@ -117,6 +117,7 @@ class MainActivity : AppCompatActivity(), OnRefreshListener, OverScrollHelper { } onMainActivityCreate(this) super.onCreate(savedInstanceState) + INSTANCE = this 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 if (BuildConfig.ENABLE_PROTECTION && !MainApplication.o && !BuildConfig.DEBUG) { @@ -814,6 +815,11 @@ class MainActivity : AppCompatActivity(), OnRefreshListener, OverScrollHelper { return super.dispatchTouchEvent(event) } + override fun onDestroy() { + super.onDestroy() + INSTANCE = null + } + companion object { fun getAppCompatActivity(activity: AppCompatActivity): AppCompatActivity { return activity @@ -831,5 +837,6 @@ class MainActivity : AppCompatActivity(), OnRefreshListener, OverScrollHelper { var localModuleInfoList: List = ArrayList() var onlineModuleInfoList: List = ArrayList() var isShowingWeblateSb = false // race condition + var INSTANCE: MainActivity? = null } } \ No newline at end of file diff --git a/app/src/main/kotlin/com/fox2code/mmm/repo/RepoManager.kt b/app/src/main/kotlin/com/fox2code/mmm/repo/RepoManager.kt index 8a06a39b..0382a0ca 100644 --- a/app/src/main/kotlin/com/fox2code/mmm/repo/RepoManager.kt +++ b/app/src/main/kotlin/com/fox2code/mmm/repo/RepoManager.kt @@ -266,6 +266,10 @@ class RepoManager private constructor(mainApplication: MainApplication) : SyncMa R.string.api_key_removed, Toast.LENGTH_SHORT ).show() + // refresh by faking user pull down + if (MainActivity.INSTANCE != null) { + MainActivity.INSTANCE!!.onRefresh() + } } } builder.show()