Skip to content

Commit

Permalink
Merge pull request #102 from makeen-project/ALS-1806
Browse files Browse the repository at this point in the history
  • Loading branch information
olegfilimonov authored Sep 12, 2024
2 parents 539397d + c027c24 commit 798df88
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1284,8 +1284,12 @@ class MainActivity :
}
}

fun initClient(){
mAWSLocationHelper.locationCredentialsProvider?.clear()
fun initClient(isAfterSignOut:Boolean = false){
if (!isAfterSignOut) {
try {
mAWSLocationHelper.locationCredentialsProvider?.clear()
} catch (_: Exception) { }
}
CoroutineScope(Dispatchers.IO).launch {
async { initMobileClient() }.await()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class AWSCloudInformationFragment :
if (isDisconnectFromAWSRequired) {
mPreferenceManager.setDefaultConfig()
}
checkMapRefreshClient()
checkMapRefreshClient(true)
init()
showError(getString(R.string.sign_out_successfully))
}
Expand Down Expand Up @@ -283,7 +283,7 @@ class AWSCloudInformationFragment :
mPreferenceManager.setValue(KEY_RE_START_APP_WITH_AWS_DISCONNECT, true)
mPreferenceManager.setDefaultConfig()
}
checkMapRefreshClient()
checkMapRefreshClient(false)
(activity as MainActivity).refreshSettings()
init()
dialog.dismiss()
Expand All @@ -294,7 +294,7 @@ class AWSCloudInformationFragment :
}
}

private fun checkMapRefreshClient() {
private fun checkMapRefreshClient(isAfterSignOut: Boolean) {
val mapName = mPreferenceManager.getValue(KEY_MAP_NAME, getString(R.string.map_esri))
val defaultIdentityPoolId: String =
Units.getDefaultIdentityPoolId(
Expand All @@ -313,7 +313,7 @@ class AWSCloudInformationFragment :
mPreferenceManager.setValue(KEY_MAP_NAME, resources.getString(R.string.esri))
}
}
(activity as MainActivity).initClient()
(activity as MainActivity).initClient(isAfterSignOut)
}

private fun validateAWSAccountData() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,16 @@ class SettingFragment : BaseFragment(), SignOutInterface {
}

fun refreshAfterSignOut() {
init()
showError(getString(R.string.sign_out_successfully))
if (this::aWSCloudInformationFragment.isInitialized) {
if (aWSCloudInformationFragment.isVisible) {
aWSCloudInformationFragment.refresh()
if (isTablet) {
if (this::aWSCloudInformationFragment.isInitialized) {
if (aWSCloudInformationFragment.isVisible) {
aWSCloudInformationFragment.refreshAfterSignOut()
}
}
} else {
showError(getString(R.string.sign_out_successfully))
}
init()
}

fun refreshAfterConnection() {
Expand Down

0 comments on commit 798df88

Please sign in to comment.