Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALS-1806 AWS Disconnecting from settings bug fix #102

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading