|
Post by fnllc on Sept 30, 2019 18:55:53 GMT
I'm having this issue with Rhomobile 7.1 and Rhoconnect. resetDBOnSyncUserChanged is triggered when user Log In after properly logging off. Here is the process:
# User 1 logs in
Rho::RhoConnectClient.login('user-1', 'some-password', (url_for :action => :login_callback) )
....
# User 1 logs off:
Rhom::Rhom.database_fullclient_reset_and_logout
The device properly clear DB and Client ID.
# User 2 logs in:
Rho::RhoConnectClient.login('user-2', 'some-password', (url_for :action => :login_callback) )
then the log shows:
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
|
|
|
Post by fnllc on Oct 2, 2019 10:47:08 GMT
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.
def logout
Rhom::Rhom.database_fullclient_reset_and_logout
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
Rho::Application.quit
end
|
|
|
Post by Vladimir Musulainen on Oct 2, 2019 23:57:13 GMT
All RhoConnect Client code is located in the separate repositoryHere link to code with check user name in rhoconfig file and database resetting.
|
|
|
Post by fnllc on Oct 3, 2019 13:17:52 GMT
|
|
|
Post by Vladimir Musulainen on Oct 7, 2019 17:44:03 GMT
Hi,
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.
What do you think about it?
|
|
|
Post by fnllc on Oct 7, 2019 21:05:08 GMT
That's fine. It works. I didn't think of this solution.
|
|