-
Notifications
You must be signed in to change notification settings - Fork 625
fix: Update server config not working #2435
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
base: kmp-impl
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me ,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes are fine from my side, good to go.
@@ -119,6 +119,7 @@ class UpdateServerConfigViewModel( | |||
).any { it.value != null } | |||
|
|||
if (!hasAnyError) { | |||
prefManager.logOut() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are u sure to clean everything from userpreference
in this operation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling prefManager.logOut()
removes all saved values from persistent storage — this includes:
UserData, UserInfo, ServerConfig, AppTheme etc.
I believe you restart the app cause u updated the url or whatever, but does it mean the user should also lose his other states like selected app theme. I don't think it would be ideal for doing one operation also done in back sth that user didn't ask for. ask @niyajali about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logout should not clear appThemes, I am not sure why its there. Maybe whoever did the UserPreferenceRepository
took reference from mobile wallet
since we don't have apptheme in there.
thanks for pointing it out @HekmatullahAmin
@@ -38,10 +39,16 @@ val NetworkModule = module { | |||
} | |||
} | |||
|
|||
single<String>(named("baseUrl")) { | |||
val preferencesRepository = get<UserPreferencesRepository>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move the named("baseUrl")
in Qualifier.kt
file and here directly call like it is done for MifosClient
@@ -142,7 +133,7 @@ class UserPreferencesDataSource( | |||
|
|||
suspend fun clearInfo() { | |||
withContext(dispatcher) { | |||
settings.clear() | |||
settings.putAuth(User()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this method defined, and just clear the AUTh_USER and other related keys and keep the app specific configured as it is while logging out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@niyajali clearInfo()
is used while logging out and before updating server config.
I tried replacing it with this block of code, but it doesn't work correctly
suspend fun clearInfo() {
withContext(dispatcher) {
settings.remove(AUTH_USER)
}
}
so I had to use settings.putAuth(User())
Fixes - https://mifosforge.jira.com/browse/MIFOSAC-494