Skip to content

Fix cannot sync data between mobile and web #3750

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

hoangdat
Copy link
Member

@hoangdat hoangdat commented May 24, 2025

Issue

Data between Mobile and Web is not consistent:

  1. Emails lost on mobile when moving emails from one folder to another on the web
Screen.Recording.2025-05-27.at.16.28.24.mov

Resolved

  1. Demo:
Screen.Recording.2025-05-27.at.16.46.35.mov

Copy link

This PR has been deployed to https://linagora.github.io/tmail-flutter/3750.

@dab246 dab246 force-pushed the hotfix/cannot-sync-data-between-mobile-and-web branch from 4c29be7 to 0d28a19 Compare May 27, 2025 09:48
@dab246 dab246 force-pushed the hotfix/cannot-sync-data-between-mobile-and-web branch from 5dd4205 to 45a5db9 Compare May 30, 2025 03:08
@dab246
Copy link
Member

dab246 commented Jun 11, 2025

  • Use Isar replace to Hive on mobile

@dab246 dab246 force-pushed the hotfix/cannot-sync-data-between-mobile-and-web branch from ff53e6e to f32b891 Compare June 11, 2025 08:45
@dab246 dab246 force-pushed the hotfix/cannot-sync-data-between-mobile-and-web branch from f32b891 to 5e39d06 Compare June 12, 2025 04:51
@dab246 dab246 self-assigned this Jun 13, 2025
@dab246 dab246 force-pushed the hotfix/cannot-sync-data-between-mobile-and-web branch from 5e39d06 to 2327431 Compare June 17, 2025 05:41
@dab246 dab246 self-requested a review June 17, 2025 05:41
@dab246 dab246 changed the title [WIP-TEST] Hotfix/cannot sync data between mobile and web Fix cannot sync data between mobile and web Jun 17, 2025
@dab246 dab246 added the cache label Jun 17, 2025
@dab246 dab246 force-pushed the hotfix/cannot-sync-data-between-mobile-and-web branch from 0b8d9e0 to a9133c3 Compare June 18, 2025 02:44
@dab246 dab246 requested a review from tddang-linagora June 18, 2025 07:14
@override
Future<void> onUpgrade(int oldVersion, int newVersion) async {
if (oldVersion > 0 && oldVersion < newVersion && newVersion == 17) {
await _cachingManager.clearAll();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so app will be totally logout?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right

Comment on lines 176 to +192
Properties? updatedProperties,
List<Email>? emailCacheList
}) async {
if (emailUpdated != null && emailUpdated.isNotEmpty) {
if (updatedProperties == null) {
return null;
}
final newEmailUpdated = emailUpdated
.map((updatedEmail) => _combineUpdatedWithEmailInCache(updatedEmail, emailCacheList))
.where((tuple) => tuple.value2 != null)
.map((tuple) => tuple.value2!.combineEmail(tuple.value1, updatedProperties))
.toList();
if (emailUpdated == null || emailUpdated.isEmpty) return emailUpdated;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should write test to make sure this method work well

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add

Comment on lines 42 to 45
return Properties({
...ThreadConstants.propertiesUpdatedDefault.value,
IndividualHeaderIdentifier.headerCalendarEvent.value,
});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return Properties({
...ThreadConstants.propertiesUpdatedDefault.value,
IndividualHeaderIdentifier.headerCalendarEvent.value,
});
return ThreadConstants.propertiesCalendarEvent;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fcm_isolate_name_server.dart

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated


import 'package:hive_ce/hive.dart';

class FcmIsolateNameServer extends IsolateNameServer {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it uses for what?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a mechanism for sharing ports between isolates. IsolateNameServer allows registering and looking up a SendPort by name, allowing the secondary isolate to connect to the primary isolate or vice versa without passing the port through the constructor.

dab246 added 10 commits June 27, 2025 16:47
Signed-off-by: dab246 <tdvu@linagora.com>
Signed-off-by: dab246 <tdvu@linagora.com>
Signed-off-by: dab246 <tdvu@linagora.com>
Signed-off-by: dab246 <tdvu@linagora.com>
Signed-off-by: dab246 <tdvu@linagora.com>
Signed-off-by: dab246 <tdvu@linagora.com>
Signed-off-by: dab246 <tdvu@linagora.com>
Signed-off-by: dab246 <tdvu@linagora.com>
Signed-off-by: dab246 <tdvu@linagora.com>
Signed-off-by: dab246 <tdvu@linagora.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants