HttpServer| Process URI: '/system/loadallsyncsources' HttpServer| Process URI: '/system/resetDBOnSyncUserChanged' reset_db_on_sync_user_changed database_full_reset : reset_client_info=false, reset_local_models=false
I would like to prevent resetting the DB when user-2 logs in. User-2 can create new content without being logged in and it would all be lost when logging in. User-1 can create new content without loosing it before logging in on new install.
How do I properly logout of Rhoconnect so that the rhomobile does not think that the user has changed? Essentially, I want to completely erase all DB and sessions, etc....
Post by Vladimir Musulainen on Oct 2, 2019 8:19:26 GMT
No way for login to rhoconnect server without reset local db.
It sounds strange the app cleans new contents when user02 logging in. As I see in your log:
database_full_reset : reset_client_info=false, reset_local_models=false reset_local_models=false - it means not synced data shouldn't be erased More about it.
Another possible solution - Create special non-synced model(s) more details - User creates new content - User logging in - Copy data from special models to synced models - Sync data with RhoConnect server
I found the problem. rhoconfig.txt.changes contains the line rho_sync_user='user-1' after calling Rhom::Rhom.database_fullclient_reset_and_logout . My current workaround is to remove this line manually and quit the app. Quitting the app is necessary to refresh the rho_sync_user variable in memory.
Then, when user-2 creates new content not logged in, then logs in, the new content is sent to Rhoconnect as expected. This is how it works on fresh install too.
I think Rhomobile should remove the line rho_sync_user='user-1' in rhoconfig.txt.changes if Rhom::Rhom.database_fullclient_reset_and_logout is called. I tried to find where this is done in the source code, but I could not find any references to rho_sync_user.
rhoconfig = Array.new
File.open(Rho::Application.userFolder + 'rhoconfig.txt.changes').each do |line| if !line.start_with?('rho_sync_user') rhoconfig << line end end
File.open(Rho::Application.userFolder + 'rhoconfig.txt.changes', "w") do |line| rhoconfig.each do |rhoconfig_line| line.puts rhoconfig_line end end
Post by Vladimir Musulainen on Oct 7, 2019 17:44:03 GMT
The team have discussed your pull requests and our conclusion is:
- The changes can break the backward compatibility of existing applications. - Desired behaviour can be implemented in application code.
We suggest the next solution: - reset the database after the user A logging out. It's important, because otherwise the data of user A may be synchronized in the future as the data of user B.; - User B produces new content; - User B logs in. Before the app calls RhoConnectClient.login it must stores new username to Rho::RhoConfig.rho_sync_user. It prevents from resetting database, because the user is not changed.