diff --git a/bruig/flutterui/bruig/lib/models/client.dart b/bruig/flutterui/bruig/lib/models/client.dart index c0929ff1..4fc2ee87 100644 --- a/bruig/flutterui/bruig/lib/models/client.dart +++ b/bruig/flutterui/bruig/lib/models/client.dart @@ -370,15 +370,23 @@ class ClientModel extends ChangeNotifier { gcs.forEach((v) => _newChat(v.id, v.name, true)); StorageManager.readData('gcListOrder').then((value) { - if (value.length > 0) { + if (value != null && value.length > 0) { List sortedGCList = []; var gcSplitList = value.split(','); + for (int i = 0; i < gcSplitList.length; i++) { + for (int j = 0; j < _gcChats.length; j++) { + if (gcSplitList[i] == _gcChats[j].nick) { + sortedGCList.add(_gcChats[j]); + break; + } + } + } for (int i = 0; i < _gcChats.length; i++) { var found = false; for (int j = 0; j < gcSplitList.length; j++) { if (gcSplitList[j] == _gcChats[i].nick) { - sortedGCList.add(_gcChats[i]); found = true; + break; } } if (!found) { @@ -389,15 +397,26 @@ class ClientModel extends ChangeNotifier { } }); StorageManager.readData('userListOrder').then((value) { - if (value.length > 0) { + if (value != null && value.length > 0) { List sortedUserList = []; var userSplitList = value.split(','); + // First order existing users from last saved. + for (int i = 0; i < userSplitList.length; i++) { + for (int j = 0; j < _userChats.length; j++) { + if (userSplitList[i] == _userChats[j].nick) { + sortedUserList.add(_userChats[j]); + break; + } + } + } + // Then try and find any received chats that aren't in the saved list. + // Add them on the end. for (int i = 0; i < _userChats.length; i++) { var found = false; for (int j = 0; j < userSplitList.length; j++) { if (userSplitList[j] == _userChats[i].nick) { - sortedUserList.add(_userChats[i]); found = true; + break; } } if (!found) { diff --git a/bruig/flutterui/bruig/macos/Flutter/GeneratedPluginRegistrant.swift b/bruig/flutterui/bruig/macos/Flutter/GeneratedPluginRegistrant.swift index 93415d77..b6495dbb 100644 --- a/bruig/flutterui/bruig/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/bruig/flutterui/bruig/macos/Flutter/GeneratedPluginRegistrant.swift @@ -6,9 +6,9 @@ import FlutterMacOS import Foundation import golib_plugin -import path_provider_macos +import path_provider_foundation import screen_retriever -import shared_preferences_macos +import shared_preferences_foundation import url_launcher_macos import window_manager import window_size diff --git a/bruig/flutterui/bruig/pubspec.lock b/bruig/flutterui/bruig/pubspec.lock index afee5f92..6e394a0f 100644 --- a/bruig/flutterui/bruig/pubspec.lock +++ b/bruig/flutterui/bruig/pubspec.lock @@ -782,5 +782,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=2.18.0 <4.0.0" + dart: ">=2.18.0 <3.0.0" flutter: ">=3.0.0"