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.
## Types of changes
- [x] I have read the **CONTRIBUTING** document.
- [x] My code follows the code style of this project.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [x] All new and existing tests passed.
- [x] This is **NOT** translation related.
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.
There is a verification done before even logging-in (and saving the settings), so this should never happen.
`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.
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.
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.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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() != "") {getBaseUrlshould 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
runBlockingblock 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: ApappSettingsService.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