diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 5e8c1be..0edf926 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -363,7 +363,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 208; + CURRENT_PROJECT_VERSION = 209; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -494,7 +494,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 208; + CURRENT_PROJECT_VERSION = 209; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -519,7 +519,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 208; + CURRENT_PROJECT_VERSION = 209; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; diff --git a/lib/data/res/build.dart b/lib/data/res/build.dart index 9457b2d..65ae6af 100644 --- a/lib/data/res/build.dart +++ b/lib/data/res/build.dart @@ -2,8 +2,5 @@ class Build { static const String name = "GPTBox"; - static const int build = 208; - static const String engine = "3.22.2"; - static const String buildAt = "2024-06-12 21:35:08"; - static const int modifications = 6; + static const int build = 209; } diff --git a/lib/view/page/home/ctrl.dart b/lib/view/page/home/ctrl.dart index 6a549d0..9f87b22 100644 --- a/lib/view/page/home/ctrl.dart +++ b/lib/view/page/home/ctrl.dart @@ -47,15 +47,29 @@ void _switchChat([String? id]) { } void _switchPreviousChat() { - final idx = _allHistories.keys.toList().indexOf(_curChatId); - if (idx < 0 || idx >= _allHistories.length - 1) return; - _switchChat(_allHistories.keys.elementAt(idx + 1)); + final iter = _allHistories.keys.iterator; + bool next = false; + while (iter.moveNext()) { + if (next) { + _switchChat(iter.current); + return; + } + if (iter.current == _curChatId) next = true; + } } void _switchNextChat() { - final idx = _allHistories.keys.toList().indexOf(_curChatId); - if (idx <= 0) return; - _switchChat(_allHistories.keys.elementAt(idx - 1)); + final iter = _allHistories.keys.iterator; + String? last; + while (iter.moveNext()) { + if (iter.current == _curChatId) { + if (last != null) { + _switchChat(last); + return; + } + } + last = iter.current; + } } void _storeChat( @@ -145,10 +159,10 @@ void _onTapDeleteChat(String chatId, BuildContext context) { void _onDeleteChat(String chatId) { Stores.history.delete(chatId); - _allHistories.remove(chatId); if (_curChatId == chatId) { - _switchChat(); + _switchPreviousChat(); } + _allHistories.remove(chatId); _historyRN.build(); } diff --git a/pubspec.lock b/pubspec.lock index e890cac..3493469 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -406,8 +406,8 @@ packages: dependency: "direct dev" description: path: "." - ref: "v1.0.17" - resolved-ref: bcb7019cc8bb3ab8c9c36653cd13936909c6e075 + ref: "v1.0.24" + resolved-ref: b7e3698aa0ad2fcf0629d140b134276b9e42dac0 url: "https://github.com/lppcg/fl_build.git" source: git version: "1.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index aaa353d..b8279e7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: gpt_box description: "A third-party GPT Client for OpenAI API." publish_to: 'none' -version: 1.0.209+209 +version: 1.0.210+210 environment: sdk: '>=3.3.0 <4.0.0' @@ -45,7 +45,7 @@ dev_dependencies: fl_build: git: url: https://github.com/lppcg/fl_build.git - ref: v1.0.17 + ref: v1.0.24 # path: ../fl_build flutter: