diff --git a/CHANGELOG.md b/CHANGELOG.md index 2eb43a2..8b080f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,4 +81,6 @@ ### 1.4.0 * fix: Modifying the issue of a large number of offline messages getting stuck during synchronization ### 1.4.1 - * fix: Modifying non JSON serialization errors in extended fields \ No newline at end of file + * fix: Modifying non JSON serialization errors in extended fields + ### 1.4.2 + * fix: Optimize synchronization channel messages \ No newline at end of file diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 9625e10..7c56964 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 11.0 + 12.0 diff --git a/example/ios/Podfile b/example/ios/Podfile index fdcc671..d97f17e 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '11.0' +# platform :ios, '12.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index a396587..522e3f5 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -5,27 +5,23 @@ PODS: - encryptions (0.0.1): - Flutter - Flutter (1.0.0) - - FMDB (2.7.5): - - FMDB/standard (= 2.7.5) - - FMDB/standard (2.7.5) - Reachability (3.2) - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS - - sqflite (0.0.2): + - sqflite (0.0.3): - Flutter - - FMDB (>= 2.7.5) + - FlutterMacOS DEPENDENCIES: - connectivity (from `.symlinks/plugins/connectivity/ios`) - encryptions (from `.symlinks/plugins/encryptions/ios`) - Flutter (from `Flutter`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - - sqflite (from `.symlinks/plugins/sqflite/ios`) + - sqflite (from `.symlinks/plugins/sqflite/darwin`) SPEC REPOS: trunk: - - FMDB - Reachability EXTERNAL SOURCES: @@ -38,17 +34,16 @@ EXTERNAL SOURCES: shared_preferences_foundation: :path: ".symlinks/plugins/shared_preferences_foundation/darwin" sqflite: - :path: ".symlinks/plugins/sqflite/ios" + :path: ".symlinks/plugins/sqflite/darwin" SPEC CHECKSUMS: connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 encryptions: a374d8610fbe88a7f00a14e059ff1df3f100d9e2 - Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 - FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 - sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 + sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec -PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189 +PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 COCOAPODS: 1.11.2 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index fd3390a..6e7cffb 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -214,7 +214,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 331C8080294A63A400263BE5 = { @@ -451,7 +451,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -579,7 +579,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -628,7 +628,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 87131a0..8e3ca5d 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ { getMsgList(int oldestOrderSeq, int pullMode, bool isReset) { WKIM.shared.messageManager.getOrSyncHistoryMessages(channelID, channelType, - oldestOrderSeq, oldestOrderSeq == 0, pullMode, 10, 0, (list) { + oldestOrderSeq, oldestOrderSeq == 0, pullMode, 5, 0, (list) { + print('同步完成${list.length}条消息'); List uiList = []; for (int i = 0; i < list.length; i++) { if (pullMode == 0 && !isReset) { diff --git a/example/lib/http.dart b/example/lib/http.dart index 26ec857..0f4d656 100644 --- a/example/lib/http.dart +++ b/example/lib/http.dart @@ -80,6 +80,7 @@ class HttpUtils { int pullMode, Function(WKSyncChannelMsg) back) async { final dio = Dio(); + print('开始seq: $startMsgSeq 结束seq: $endMsgSeq'); final response = await dio.post('$apiURL/channel/messagesync', data: { "login_uid": UserInfo.uid, // 当前登录用户uid "channel_id": channelID, // 频道ID @@ -96,6 +97,7 @@ class HttpUtils { msg.endMessageSeq = data['end_message_seq']; msg.more = data['more']; var messages = data['messages'] as List; + List msgList = []; for (int i = 0; i < messages.length; i++) { dynamic json = messages[i]; diff --git a/example/pubspec.lock b/example/pubspec.lock index befcaa6..67aaa44 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -232,6 +232,30 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.6.5" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + url: "https://pub.flutter-io.cn" + source: hosted + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.3" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.1" lints: dependency: transitive description: @@ -244,34 +268,34 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.flutter-io.cn" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.flutter-io.cn" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.flutter-io.cn" source: hosted - version: "1.10.0" + version: "1.12.0" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.3" + version: "1.9.0" path_provider_linux: dependency: transitive description: @@ -389,22 +413,30 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.flutter-io.cn" + source: hosted + version: "7.0.0" sqflite: dependency: transitive description: name: sqflite - sha256: b3a8307b9519af28518e271e548594bdc435225fc77e8fb22e71a296c69281cf + sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.3+1" + version: "2.3.3+1" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "8f7603f3f8f126740bc55c4ca2d1027aab4b74a1267a3e31ce51fe40e3b65b8f" + sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4" url: "https://pub.flutter-io.cn" source: hosted - version: "2.4.5+1" + version: "2.5.4" stack_trace: dependency: transitive description: @@ -449,10 +481,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.flutter-io.cn" source: hosted - version: "0.6.1" + version: "0.7.0" typed_data: dependency: transitive description: @@ -465,10 +497,10 @@ packages: dependency: transitive description: name: uuid - sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8" url: "https://pub.flutter-io.cn" source: hosted - version: "3.0.7" + version: "4.4.0" vector_math: dependency: transitive description: @@ -477,14 +509,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.4" - web: + vm_service: dependency: transitive description: - name: web - sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + name: vm_service + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.flutter-io.cn" source: hosted - version: "0.3.0" + version: "14.2.1" web_socket_channel: dependency: transitive description: @@ -507,7 +539,7 @@ packages: path: ".." relative: true source: path - version: "1.2.4" + version: "1.4.1" x25519: dependency: transitive description: @@ -525,5 +557,5 @@ packages: source: hosted version: "1.0.2" sdks: - dart: ">=3.2.0-194.0.dev <4.0.0" - flutter: ">=3.3.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/lib/db/message.dart b/lib/db/message.dart index 458661e..3b5855f 100644 --- a/lib/db/message.dart +++ b/lib/db/message.dart @@ -450,25 +450,22 @@ class MessageDB { //计算最后一页后是否还存在消息 int syncLimit = limit; if (!isSyncMsg && tempList.length < limit) { - if (pullMode == 0) { - //如果下拉获取数据 - isSyncMsg = true; - // startMsgSeq = oldestMsgSeq; - startMsgSeq = minMessageSeq; // 不满足查询数量同步时按查询到的最小seq开始同步 - if (!contain) { - syncLimit = syncLimit + 1; - } - endMsgSeq = 0; + isSyncMsg = true; + if (contain) { + startMsgSeq = oldestMsgSeq; } else { - //如果上拉获取数据 - isSyncMsg = true; - // startMsgSeq = oldestMsgSeq; - startMsgSeq = maxMessageSeq; // 不满足查询数量同步时按查询到的最大seq开始同步 - endMsgSeq = 0; - if (!contain) { - syncLimit = syncLimit + 1; + if (pullMode == 0) { + startMsgSeq = oldestMsgSeq - 1; + } else { + startMsgSeq = oldestMsgSeq + 1; } } + endMsgSeq = 0; + } + if (startMsgSeq == 0 && endMsgSeq == 0 && tempList.length < limit) { + isSyncMsg = true; + endMsgSeq = oldestMsgSeq; + startMsgSeq = 0; } if (isSyncMsg && (startMsgSeq != endMsgSeq || (startMsgSeq == 0 && endMsgSeq == 0)) && diff --git a/pubspec.yaml b/pubspec.yaml index 5bcd887..7acd134 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ description: wukong IM flutter sdk # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.4.1 +version: 1.4.2 homepage: https://github.com/WuKongIM/WuKongIMFlutterSDK environment: