[Bug] fix issue with multiple activity instances (#286)

This commit is contained in:
Albert Lo 2022-06-30 16:22:07 -07:00 коммит произвёл Mohtasim
Родитель 70b564506e
Коммит e2e4b7d95f
4 изменённых файлов: 12 добавлений и 6 удалений

Просмотреть файл

@ -28,6 +28,7 @@ android {
buildConfigField 'String', 'APP_SECRET', properties.getProperty('APP_SECRET', '""')
buildConfigField 'String', 'REMOTE_PARTICIPANT_AVATAR_TEST_URL', properties.getProperty('REMOTE_PARTICIPANT_AVATAR_TEST_URL', '""')
buildConfigField 'String', 'ACS_TOKEN_EXPIRED', properties.getProperty('ACS_TOKEN_EXPIRED', '""')
buildConfigField 'boolean', 'CHECK_TASK_ROOT', String.valueOf(!shouldNotCheckTaskRoot())
}
signingConfigs {

Просмотреть файл

@ -31,7 +31,10 @@ class CallLauncherActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (shouldFinish()) {
finish()
return
}
if (!AppCenter.isConfigured() && !BuildConfig.DEBUG) {
Distribute.setUpdateTrack(UpdateTrack.PRIVATE)
AppCenter.start(
@ -154,10 +157,6 @@ class CallLauncherActivity : AppCompatActivity() {
}
}
override fun onResume() {
super.onResume()
}
override fun onDestroy() {
callLauncherViewModel.destroy()
super.onDestroy()
@ -167,6 +166,9 @@ class CallLauncherActivity : AppCompatActivity() {
saveState(outState)
super.onSaveInstanceState(outState)
}
// check whether new Activity instance was brought to top of stack,
// so that finishing this will get us to the last viewed screen
private fun shouldFinish() = BuildConfig.CHECK_TASK_ROOT && !isTaskRoot
fun showAlert(message: String) {
runOnUiThread {

Просмотреть файл

@ -41,6 +41,9 @@ buildscript {
mockito_inline_version = '4.3.1'
mockito_kotlin_version = '4.0.0'
shouldNotCheckTaskRoot = {
return rootProject.hasProperty("disableTaskRootCheck") && rootProject.getProperty("disableTaskRootCheck")
}
}
repositories {

Просмотреть файл

@ -19,7 +19,7 @@ setLocalProperty "USER_NAME" "Test User"
setLocalProperty "ACS_TOKEN" "$1"
# run Ui tests with the required parameters
./gradlew clean connectedCallingDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.expiredToken=$1 -Pandroid.testInstrumentationRunnerArguments.teamsUrl="$2" -Pandroid.testInstrumentationRunnerArguments.groupId="$3" -Pandroid.testInstrumentationRunnerArguments.acsToken=$4 -Pandroid.testInstrumentationRunnerArguments.tokenFunctionUrl=$5
./gradlew clean connectedCallingDebugAndroidTest -PdisableTaskRootCheck=true -Pandroid.testInstrumentationRunnerArguments.expiredToken=$1 -Pandroid.testInstrumentationRunnerArguments.teamsUrl="$2" -Pandroid.testInstrumentationRunnerArguments.groupId="$3" -Pandroid.testInstrumentationRunnerArguments.acsToken=$4 -Pandroid.testInstrumentationRunnerArguments.tokenFunctionUrl=$5
# clean up
if [ -z "$DEVICE" ]; then