Prevent crash when logging in #81
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "davidoskky/ReaderForSelfoss-multiplatform:login_crash"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Types of changes
While running on some emulators I have seen that it sometimes crashes on login because it tries to make api calls on localhost.
Preventing those calls if not already logged in solves the problem.
I also moved the definition of dateUtils within the login function so that it gets updated after logging in.
@ -47,3 +46,1 @@
updateApiVersion()
dateUtils = DateUtils(appSettingsService)
reloadBadges()
if (appSettingsService.getBaseUrl() != "") {
getBaseUrl
should never return an empty string.There is a verification done before even logging-in (and saving the settings), so this should never happen.
The repository is initialized before logging in, at that point appSettingsService returns an empty string
Ok, so this is a workaround.
The issue is that the
runBlocking
block is called even when the user is'nt updated. This should be fixed.I could remove this from the init method and make a new public method which is called by the login activity after it checks that the user is correctly set.
that could be better, yes !
@ -408,6 +409,7 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
appSettingsService.updateApiVersion(fetchedVersion.data.getApiMajorVersion())
}
}
dateUtils = DateUtils(appSettingsService)
why was this added ?
If the repository is initialized before the login, this is required to initialize the dateUtils after logging in