Skip to content

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

Open
wants to merge 10 commits into
base: kmp-impl
Choose a base branch
from

Conversation

itsPronay
Copy link
Contributor

@itsPronay itsPronay marked this pull request as draft July 10, 2025 20:40
@itsPronay itsPronay marked this pull request as ready for review July 14, 2025 14:42
Copy link

@revanthkumarJ revanthkumarJ left a 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 ,

Copy link
Contributor

@biplab1 biplab1 left a 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()
Copy link
Member

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?

Copy link
Member

@HekmatullahAmin HekmatullahAmin Jul 14, 2025

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.

Copy link
Contributor Author

@itsPronay itsPronay Jul 15, 2025

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>()
Copy link
Member

@HekmatullahAmin HekmatullahAmin Jul 14, 2025

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())
Copy link
Collaborator

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

Copy link
Contributor Author

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())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants