Skip to content
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

Some iOS 16 phones do not save session #5268

Open
sanyappc opened this issue Oct 15, 2023 · 9 comments
Open

Some iOS 16 phones do not save session #5268

sanyappc opened this issue Oct 15, 2023 · 9 comments

Comments

@sanyappc
Copy link

Description:

We have updated our white-label app from version 4.35.1 (or 4.27.1) to version 4.40.0 and now after closing the app users are forced to login every time.

We found two solutions:

  1. Reinstall the application (not suitable due to the large number of users)
  2. Use new instance name for MMKV container (our current solution)

I think the problem is that our users upgraded the iOS 16 first and only then we released a new version of the app and ran into the problem of changing the default accessibility level (and there) or just because of new accessibility level. So we had to migrate the data.

We've changed two files, but we're not sure if that completely solves the problem.

diff --git a/app/lib/methods/userPreferences.ts b/app/lib/methods/userPreferences.ts
index f9b82dec4..c72275356 100644
--- a/app/lib/methods/userPreferences.ts
+++ b/app/lib/methods/userPreferences.ts
@@ -1,9 +1,13 @@
 import { create, MMKVLoader, MMKVInstance, ProcessingModes, IOSAccessibleStates } from 'react-native-mmkv-storage';
 
+import { isIOS } from './helpers';
+
 const MMKV = new MMKVLoader()
 	// MODES.MULTI_PROCESS = ACCESSIBLE BY APP GROUP (iOS)
 	.setProcessingMode(ProcessingModes.MULTI_PROCESS)
 	.setAccessibleIOS(IOSAccessibleStates.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY)
+	// https://github.com/ammarahm-ed/react-native-mmkv-storage/pull/263
+	.withInstanceID(isIOS ? 'encrypted' : 'default') 
 	.withEncryption()
 	.initialize();

diff --git a/ios/Shared/RocketChat/Storage.swift b/ios/Shared/RocketChat/Storage.swift
index 7f2496897..029e22159 100644
--- a/ios/Shared/RocketChat/Storage.swift
+++ b/ios/Shared/RocketChat/Storage.swift
@@ -19,7 +19,7 @@ class Storage {
   final var mmkv: MMKV? = nil
 
   init() {
-    let mmapID = "default"
+    let mmapID = "encrypted" // https://github.com/ammarahm-ed/react-native-mmkv-storage/pull/263
     let instanceID = "com.MMKV.\(mmapID)"
     let secureStorage = SecureStorage()

Can you please tell me how to solve this problem completely?

Environment Information:

  • Rocket.Chat Server Version: 6.4.1
  • Rocket.Chat App Version: 4.40.0
  • Device Name: iOS
  • OS Version: 16
@diegolmello
Copy link
Member

We didn't receive any reports regarding this issue.
Does that happen if they use Rocket.Chat app from App Store?
That might help solve the issue.

@b90g
Copy link

b90g commented Feb 14, 2024

I have at least one Person on Ios16 with stock rocketchat App that reported similar behavior on 4.45. Login on every app use.
Another person where its not confirmed if its Ios16.

Server-Admin confirmed the user has multiple valid sessions, so the server doesnt exclude them from using a session.

@diegolmello
Copy link
Member

@b90g Do you have a rough idea of how many iOS users you have there?
This one person (+ the other one) are the only ones with this issue?

Do they have different Rocket.Chat roles, or different iOS settings, etc?
How many iOS devices they use Rocket.Chat?

@b90g
Copy link

b90g commented Feb 15, 2024

thanks for bringing this back to my attention.

one user is on IOS 17.3.1 the other one on 16.x Users might have custom roles but no admin.

Login is SAML via KeyCloak.

Overall users is a few K, but just heard from about 2 Users from the "phenomena"

but since its different versions and our app is RC stock not white label, i rather open a separate issue/request?

@diegolmello
Copy link
Member

but since its different versions and our app is RC stock not white label, i rather open a separate issue/request?

No need. Let's focus on this one until we have more info.

@sanyappc is it still happening to you?

@sanyappc
Copy link
Author

@diegolmello yeah, I still have to use custom mmkv as there is no way to get everyone to reinstall the app

@diegolmello
Copy link
Member

@sanyappc

We've changed two files, but we're not sure if that completely solves the problem.

How sure you are by this point? 😬
I'm pretty sure it just recreated the whole MMKV db and maybe this might have fixed it.

@b90g
Copy link

b90g commented Feb 16, 2024

today another person contacted us, the number of IOS users is unknown, since its a lot of volunteers who bring their own device. but its only IOS users so far.

@sanyappc
Copy link
Author

sanyappc commented Feb 19, 2024

@diegolmello

How sure you are by this point? 😬

it works

I'm pretty sure it just recreated the whole MMKV db and maybe this might have fixed it.

exactly, I also changed the name of the DB in patches/react-native-webview+11.26.1.patch and patches/rn-fetch-blob+0.12.0.patch. just in case

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

No branches or pull requests

3 participants