diff --git a/turms-chat-demo-flutter/.env b/turms-chat-demo-flutter/.env
new file mode 100644
index 0000000000..586ebf8e37
--- /dev/null
+++ b/turms-chat-demo-flutter/.env
@@ -0,0 +1,19 @@
+# App - Appearance
+WINDOW_TITLE="Turms Chat Demo"
+
+# App - Storage
+DATABASE_LOG_STATEMENTS=false
+SECURE_STORAGE=true
+
+# App - Debugger
+SHOW_FOCUS_TRACKER=true
+
+# Business
+MESSAGE_IMAGE_MAX_DOWNLOADABLE_SIZE_BYTES=10485760
+MESSAGE_IMAGE_MAX_CACHED_SIZE_WIDTH=2048.0
+MESSAGE_IMAGE_MAX_CACHED_SIZE_HEIGHT=2048.0
+MESSAGE_IMAGE_THUMBNAIL_SIZE_WIDTH=200.0
+MESSAGE_IMAGE_THUMBNAIL_SIZE_HEIGHT=200.0
+
+# Giphy
+GIPHY_API_KEY=
\ No newline at end of file
diff --git a/turms-chat-demo-flutter/.gitignore b/turms-chat-demo-flutter/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/turms-chat-demo-flutter/.metadata b/turms-chat-demo-flutter/.metadata
new file mode 100644
index 0000000000..ab3e1c09c8
--- /dev/null
+++ b/turms-chat-demo-flutter/.metadata
@@ -0,0 +1,45 @@
+# This file tracks properties of this Flutter project.
+# Used by Flutter tool to assess capabilities and perform upgrades etc.
+#
+# This file should be version controlled and should not be manually edited.
+
+version:
+ revision: "ead455963c12b453cdb2358cad34969c76daf180"
+ channel: "stable"
+
+project_type: app
+
+# Tracks metadata for the flutter migrate command
+migration:
+ platforms:
+ - platform: root
+ create_revision: ead455963c12b453cdb2358cad34969c76daf180
+ base_revision: ead455963c12b453cdb2358cad34969c76daf180
+ - platform: android
+ create_revision: ead455963c12b453cdb2358cad34969c76daf180
+ base_revision: ead455963c12b453cdb2358cad34969c76daf180
+ - platform: ios
+ create_revision: ead455963c12b453cdb2358cad34969c76daf180
+ base_revision: ead455963c12b453cdb2358cad34969c76daf180
+ - platform: linux
+ create_revision: ead455963c12b453cdb2358cad34969c76daf180
+ base_revision: ead455963c12b453cdb2358cad34969c76daf180
+ - platform: macos
+ create_revision: ead455963c12b453cdb2358cad34969c76daf180
+ base_revision: ead455963c12b453cdb2358cad34969c76daf180
+ - platform: web
+ create_revision: ead455963c12b453cdb2358cad34969c76daf180
+ base_revision: ead455963c12b453cdb2358cad34969c76daf180
+ - platform: windows
+ create_revision: ead455963c12b453cdb2358cad34969c76daf180
+ base_revision: ead455963c12b453cdb2358cad34969c76daf180
+
+ # User provided section
+
+ # List of Local paths (relative to this file) that should be
+ # ignored by the migrate tool.
+ #
+ # Files that are not part of the templates will be ignored by default.
+ unmanaged_files:
+ - 'lib/main.dart'
+ - 'ios/Runner.xcodeproj/project.pbxproj'
diff --git a/turms-chat-demo-flutter/analysis_options.yaml b/turms-chat-demo-flutter/analysis_options.yaml
new file mode 100644
index 0000000000..f88bf6a67a
--- /dev/null
+++ b/turms-chat-demo-flutter/analysis_options.yaml
@@ -0,0 +1,133 @@
+# https://dart.dev/guides/language/analysis-options
+# https://dart.dev/tools/linter-rules
+
+include:
+ - package:flutter_lints/flutter.yaml
+
+analyzer:
+ language:
+ strict-casts: true
+ strict-inference: true
+ strict-raw-types: true
+ plugins:
+ - custom_lint
+# exclude:
+# - lib/components/flutter_quill/**
+# - lib/**.g.dart
+
+linter:
+ rules:
+ - always_declare_return_types
+ - always_put_control_body_on_new_line
+ - annotate_overrides
+ - avoid_bool_literals_in_conditional_expressions
+ - avoid_catching_errors
+ # We need to use the utility class as the namespace
+# - avoid_classes_with_only_static_members
+ - avoid_escaping_inner_quotes
+ - avoid_dynamic_calls
+ - avoid_empty_else
+ - avoid_function_literals_in_foreach_calls
+ - avoid_js_rounded_ints
+ - avoid_init_to_null
+ - avoid_null_checks_in_equality_operators
+ - avoid_private_typedef_functions
+ - avoid_redundant_argument_values
+ - avoid_relative_lib_imports
+ - avoid_renaming_method_parameters
+ - avoid_return_types_on_setters
+ - avoid_returning_null_for_void
+ - avoid_returning_this
+ - avoid_shadowing_type_parameters
+ - avoid_single_cascade_in_expression_statements
+ - avoid_type_to_string
+ - avoid_types_as_parameter_names
+ - avoid_unused_constructor_parameters
+ - avoid_void_async
+ - await_only_futures
+ - camel_case_types
+ - cascade_invocations
+ - collection_methods_unrelated_type
+ - comment_references
+ - constant_identifier_names
+ - control_flow_in_finally
+ - curly_braces_in_flow_control_structures
+ - directives_ordering
+ - empty_catches
+ - empty_constructor_bodies
+ - empty_statements
+ - file_names
+ - hash_and_equals
+ - implementation_imports
+ - join_return_with_assignment
+ - library_names
+ - library_prefixes
+ - lines_longer_than_80_chars
+ - missing_whitespace_between_adjacent_strings
+ - no_adjacent_strings_in_list
+ - no_duplicate_case_values
+ - no_runtimeType_toString
+ - non_constant_identifier_names
+ - null_closures
+ - omit_local_variable_types
+ - only_throw_errors
+ - overridden_fields
+ - package_names
+ - package_prefixed_library_names
+ - prefer_adjacent_string_concatenation
+ - prefer_asserts_in_initializer_lists
+ - prefer_collection_literals
+ - prefer_conditional_assignment
+ - prefer_const_constructors
+ - prefer_const_declarations
+ - prefer_contains
+ - prefer_expression_function_bodies
+ - prefer_final_fields
+ - prefer_final_in_for_each
+ - prefer_final_locals
+ - prefer_function_declarations_over_variables
+ - prefer_generic_function_type_aliases
+ - prefer_initializing_formals
+ - prefer_inlined_adds
+ - prefer_interpolation_to_compose_strings
+ - prefer_is_empty
+ - prefer_is_not_empty
+ - prefer_is_not_operator
+ - prefer_null_aware_method_calls
+ - prefer_null_aware_operators
+ - prefer_relative_imports
+ - prefer_single_quotes
+ - prefer_typing_uninitialized_variables
+ - prefer_void_to_null
+ - provide_deprecation_message
+ - recursive_getters
+ - slash_for_doc_comments
+ - sort_constructors_first
+ - sort_pub_dependencies
+ - test_types_in_equals
+ - throw_in_finally
+ - type_annotate_public_apis
+ - type_init_formals
+ - unawaited_futures
+ - unnecessary_await_in_return
+ - unnecessary_brace_in_string_interps
+ - unnecessary_const
+ - unnecessary_getters_setters
+ - unnecessary_lambdas
+ - unnecessary_late
+ - unnecessary_new
+ - unnecessary_null_aware_assignments
+ - unnecessary_null_in_if_null_operators
+ - unnecessary_overrides
+ - unnecessary_parenthesis
+ - unnecessary_statements
+ - unnecessary_string_interpolations
+ - unnecessary_this
+ - unrelated_type_equality_checks
+ - use_is_even_rather_than_modulo
+ - use_named_constants
+ - use_rethrow_when_possible
+ - use_setters_to_change_properties
+ - use_string_buffers
+ - valid_regexps
+ - void_checks
\ No newline at end of file
diff --git a/turms-chat-demo-flutter/devtools_options.yaml b/turms-chat-demo-flutter/devtools_options.yaml
new file mode 100644
index 0000000000..e0b5c91431
--- /dev/null
+++ b/turms-chat-demo-flutter/devtools_options.yaml
@@ -0,0 +1,2 @@
+extensions:
+ - drift: true
\ No newline at end of file
diff --git a/turms-chat-demo-flutter/flutter_launcher_icons.yaml b/turms-chat-demo-flutter/flutter_launcher_icons.yaml
new file mode 100644
index 0000000000..7042b9499f
--- /dev/null
+++ b/turms-chat-demo-flutter/flutter_launcher_icons.yaml
@@ -0,0 +1,12 @@
+flutter_launcher_icons:
+ # TODO: Add support for mobile platforms
+ web:
+ generate: true
+ image_path: "assets/images/icon_1024.png"
+ windows:
+ generate: true
+ image_path: "assets/images/icon_1024.png"
+ icon_size: 256 # min:48, max:256, default: 48
+ macos:
+ generate: true
+ image_path: "assets/images/icon_1024.png"
\ No newline at end of file
diff --git a/turms-chat-demo-flutter/flutter_rust_bridge.yaml b/turms-chat-demo-flutter/flutter_rust_bridge.yaml
new file mode 100644
index 0000000000..4d86d8071c
--- /dev/null
+++ b/turms-chat-demo-flutter/flutter_rust_bridge.yaml
@@ -0,0 +1,4 @@
+# https://cjycode.com/flutter_rust_bridge/v1/command_line.html
+rust_input: crate::api
+rust_root: rust/
+dart_output: lib/infra/rust
\ No newline at end of file
diff --git a/turms-chat-demo-flutter/ios/.gitignore b/turms-chat-demo-flutter/ios/.gitignore
new file mode 100644
index 0000000000..7a7f9873ad
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/.gitignore
@@ -0,0 +1,34 @@
+**/dgph
+*.mode1v3
+*.mode2v3
+*.moved-aside
+*.pbxuser
+*.perspectivev3
+**/*sync/
+.sconsign.dblite
+.tags*
+**/.vagrant/
+**/DerivedData/
+Icon?
+**/Pods/
+**/.symlinks/
+profile
+xcuserdata
+**/.generated/
+Flutter/App.framework
+Flutter/Flutter.framework
+Flutter/Flutter.podspec
+Flutter/Generated.xcconfig
+Flutter/ephemeral/
+Flutter/app.flx
+Flutter/app.zip
+Flutter/flutter_assets/
+Flutter/flutter_export_environment.sh
+ServiceDefinitions.json
+Runner/GeneratedPluginRegistrant.*
+
+# Exceptions to above rules.
+!default.mode1v3
+!default.mode2v3
+!default.pbxuser
+!default.perspectivev3
diff --git a/turms-chat-demo-flutter/ios/Flutter/AppFrameworkInfo.plist b/turms-chat-demo-flutter/ios/Flutter/AppFrameworkInfo.plist
new file mode 100644
index 0000000000..9625e105df
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Flutter/AppFrameworkInfo.plist
@@ -0,0 +1,26 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ App
+ CFBundleIdentifier
+ io.flutter.flutter.app
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ App
+ CFBundlePackageType
+ FMWK
+ CFBundleShortVersionString
+ 1.0
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ 1.0
+ MinimumOSVersion
+ 11.0
+
+
diff --git a/turms-chat-demo-flutter/ios/Flutter/Debug.xcconfig b/turms-chat-demo-flutter/ios/Flutter/Debug.xcconfig
new file mode 100644
index 0000000000..592ceee85b
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Flutter/Debug.xcconfig
@@ -0,0 +1 @@
+#include "Generated.xcconfig"
diff --git a/turms-chat-demo-flutter/ios/Flutter/Release.xcconfig b/turms-chat-demo-flutter/ios/Flutter/Release.xcconfig
new file mode 100644
index 0000000000..592ceee85b
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Flutter/Release.xcconfig
@@ -0,0 +1 @@
+#include "Generated.xcconfig"
diff --git a/turms-chat-demo-flutter/ios/Runner.xcodeproj/project.pbxproj b/turms-chat-demo-flutter/ios/Runner.xcodeproj/project.pbxproj
new file mode 100644
index 0000000000..598d02e5f8
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner.xcodeproj/project.pbxproj
@@ -0,0 +1,614 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 54;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
+ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
+ 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
+ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
+ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
+ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
+ 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 97C146E61CF9000F007C117D /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 97C146ED1CF9000F007C117D;
+ remoteInfo = Runner;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
+ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
+ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
+ 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
+ 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
+ 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
+ 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
+ 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
+ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
+ 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
+ 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; };
+ 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 97C146EB1CF9000F007C117D /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 9740EEB11CF90186004384FC /* Flutter */ = {
+ isa = PBXGroup;
+ children = (
+ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
+ 9740EEB21CF90195004384FC /* Debug.xcconfig */,
+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
+ 9740EEB31CF90195004384FC /* Generated.xcconfig */,
+ );
+ name = Flutter;
+ sourceTree = "";
+ };
+ 331C8082294A63A400263BE5 /* RunnerTests */ = {
+ isa = PBXGroup;
+ children = (
+ 331C807B294A618700263BE5 /* RunnerTests.swift */,
+ );
+ path = RunnerTests;
+ sourceTree = "";
+ };
+ 97C146E51CF9000F007C117D = {
+ isa = PBXGroup;
+ children = (
+ 9740EEB11CF90186004384FC /* Flutter */,
+ 97C146F01CF9000F007C117D /* Runner */,
+ 97C146EF1CF9000F007C117D /* Products */,
+ 331C8082294A63A400263BE5 /* RunnerTests */,
+ );
+ sourceTree = "";
+ };
+ 97C146EF1CF9000F007C117D /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 97C146EE1CF9000F007C117D /* Runner.app */,
+ 331C8081294A63A400263BE5 /* RunnerTests.xctest */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ 97C146F01CF9000F007C117D /* Runner */ = {
+ isa = PBXGroup;
+ children = (
+ 97C146FA1CF9000F007C117D /* Main.storyboard */,
+ 97C146FD1CF9000F007C117D /* Assets.xcassets */,
+ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
+ 97C147021CF9000F007C117D /* Info.plist */,
+ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
+ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
+ 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
+ 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
+ );
+ path = Runner;
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 331C8080294A63A400263BE5 /* RunnerTests */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
+ buildPhases = (
+ 331C807D294A63A400263BE5 /* Sources */,
+ 331C807E294A63A400263BE5 /* Frameworks */,
+ 331C807F294A63A400263BE5 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 331C8086294A63A400263BE5 /* PBXTargetDependency */,
+ );
+ name = RunnerTests;
+ productName = RunnerTests;
+ productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */;
+ productType = "com.apple.product-type.bundle.unit-test";
+ };
+ 97C146ED1CF9000F007C117D /* Runner */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
+ buildPhases = (
+ 9740EEB61CF901F6004384FC /* Run Script */,
+ 97C146EA1CF9000F007C117D /* Sources */,
+ 97C146EB1CF9000F007C117D /* Frameworks */,
+ 97C146EC1CF9000F007C117D /* Resources */,
+ 9705A1C41CF9048500538489 /* Embed Frameworks */,
+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Runner;
+ productName = Runner;
+ productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 97C146E61CF9000F007C117D /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ BuildIndependentTargetsInParallel = YES;
+ LastUpgradeCheck = 1430;
+ ORGANIZATIONNAME = "";
+ TargetAttributes = {
+ 331C8080294A63A400263BE5 = {
+ CreatedOnToolsVersion = 14.0;
+ TestTargetID = 97C146ED1CF9000F007C117D;
+ };
+ 97C146ED1CF9000F007C117D = {
+ CreatedOnToolsVersion = 7.3.1;
+ LastSwiftMigration = 1100;
+ };
+ };
+ };
+ buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
+ compatibilityVersion = "Xcode 9.3";
+ developmentRegion = en;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 97C146E51CF9000F007C117D;
+ productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 97C146ED1CF9000F007C117D /* Runner */,
+ 331C8080294A63A400263BE5 /* RunnerTests */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 331C807F294A63A400263BE5 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 97C146EC1CF9000F007C117D /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
+ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
+ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
+ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
+ isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
+ );
+ name = "Thin Binary";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
+ };
+ 9740EEB61CF901F6004384FC /* Run Script */ = {
+ isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Run Script";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 331C807D294A63A400263BE5 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 97C146EA1CF9000F007C117D /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
+ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 331C8086294A63A400263BE5 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 97C146ED1CF9000F007C117D /* Runner */;
+ targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+ 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 97C146FB1CF9000F007C117D /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "";
+ };
+ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 97C147001CF9000F007C117D /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 249021D3217E4FDB00AE95B9 /* Profile */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ SUPPORTED_PLATFORMS = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Profile;
+ };
+ 249021D4217E4FDB00AE95B9 /* Profile */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ ENABLE_BITCODE = NO;
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = im.turms.turmsChatDemo;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+ SWIFT_VERSION = 5.0;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Profile;
+ };
+ 331C8088294A63A400263BE5 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = AE0B7B92F70575B8D7E0D07E /* Pods-RunnerTests.debug.xcconfig */;
+ buildSettings = {
+ BUNDLE_LOADER = "$(TEST_HOST)";
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ GENERATE_INFOPLIST_FILE = YES;
+ MARKETING_VERSION = 1.0;
+ PRODUCT_BUNDLE_IDENTIFIER = im.turms.turmsChatDemo.RunnerTests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
+ };
+ name = Debug;
+ };
+ 331C8089294A63A400263BE5 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 89B67EB44CE7B6631473024E /* Pods-RunnerTests.release.xcconfig */;
+ buildSettings = {
+ BUNDLE_LOADER = "$(TEST_HOST)";
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ GENERATE_INFOPLIST_FILE = YES;
+ MARKETING_VERSION = 1.0;
+ PRODUCT_BUNDLE_IDENTIFIER = im.turms.turmsChatDemo.RunnerTests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_VERSION = 5.0;
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
+ };
+ name = Release;
+ };
+ 331C808A294A63A400263BE5 /* Profile */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 640959BDD8F10B91D80A66BE /* Pods-RunnerTests.profile.xcconfig */;
+ buildSettings = {
+ BUNDLE_LOADER = "$(TEST_HOST)";
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ GENERATE_INFOPLIST_FILE = YES;
+ MARKETING_VERSION = 1.0;
+ PRODUCT_BUNDLE_IDENTIFIER = im.turms.turmsChatDemo.RunnerTests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_VERSION = 5.0;
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
+ };
+ name = Profile;
+ };
+ 97C147031CF9000F007C117D /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 97C147041CF9000F007C117D /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ SUPPORTED_PLATFORMS = iphoneos;
+ SWIFT_COMPILATION_MODE = wholemodule;
+ SWIFT_OPTIMIZATION_LEVEL = "-O";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 97C147061CF9000F007C117D /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ ENABLE_BITCODE = NO;
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = im.turms.turmsChatDemo;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Debug;
+ };
+ 97C147071CF9000F007C117D /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ ENABLE_BITCODE = NO;
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = im.turms.turmsChatDemo;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+ SWIFT_VERSION = 5.0;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 331C8088294A63A400263BE5 /* Debug */,
+ 331C8089294A63A400263BE5 /* Release */,
+ 331C808A294A63A400263BE5 /* Profile */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 97C147031CF9000F007C117D /* Debug */,
+ 97C147041CF9000F007C117D /* Release */,
+ 249021D3217E4FDB00AE95B9 /* Profile */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 97C147061CF9000F007C117D /* Debug */,
+ 97C147071CF9000F007C117D /* Release */,
+ 249021D4217E4FDB00AE95B9 /* Profile */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 97C146E61CF9000F007C117D /* Project object */;
+}
diff --git a/turms-chat-demo-flutter/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/turms-chat-demo-flutter/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000000..919434a625
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/turms-chat-demo-flutter/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/turms-chat-demo-flutter/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 0000000000..18d981003d
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/turms-chat-demo-flutter/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/turms-chat-demo-flutter/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
new file mode 100644
index 0000000000..f9b0d7c5ea
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -0,0 +1,8 @@
+
+
+
+
+ PreviewsEnabled
+
+
+
diff --git a/turms-chat-demo-flutter/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/turms-chat-demo-flutter/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
new file mode 100644
index 0000000000..87131a09be
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/turms-chat-demo-flutter/ios/Runner.xcworkspace/contents.xcworkspacedata b/turms-chat-demo-flutter/ios/Runner.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000000..1d526a16ed
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/turms-chat-demo-flutter/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/turms-chat-demo-flutter/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 0000000000..18d981003d
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/turms-chat-demo-flutter/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/turms-chat-demo-flutter/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
new file mode 100644
index 0000000000..f9b0d7c5ea
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -0,0 +1,8 @@
+
+
+
+
+ PreviewsEnabled
+
+
+
diff --git a/turms-chat-demo-flutter/ios/Runner/AppDelegate.swift b/turms-chat-demo-flutter/ios/Runner/AppDelegate.swift
new file mode 100644
index 0000000000..70693e4a8c
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner/AppDelegate.swift
@@ -0,0 +1,13 @@
+import UIKit
+import Flutter
+
+@UIApplicationMain
+@objc class AppDelegate: FlutterAppDelegate {
+ override func application(
+ _ application: UIApplication,
+ didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
+ ) -> Bool {
+ GeneratedPluginRegistrant.register(with: self)
+ return super.application(application, didFinishLaunchingWithOptions: launchOptions)
+ }
+}
diff --git a/turms-chat-demo-flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/turms-chat-demo-flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000000..d36b1fab2d
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,122 @@
+{
+ "images" : [
+ {
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-20x20@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-20x20@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-29x29@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-29x29@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-29x29@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-40x40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-40x40@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-60x60@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-60x60@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-20x20@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-20x20@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-29x29@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-29x29@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-40x40@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-40x40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-76x76@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-76x76@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-83.5x83.5@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "1024x1024",
+ "idiom" : "ios-marketing",
+ "filename" : "Icon-App-1024x1024@1x.png",
+ "scale" : "1x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
diff --git a/turms-chat-demo-flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/turms-chat-demo-flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
new file mode 100644
index 0000000000..0bedcf2fd4
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
@@ -0,0 +1,23 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchImage.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchImage@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchImage@3x.png",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
diff --git a/turms-chat-demo-flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/turms-chat-demo-flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
new file mode 100644
index 0000000000..89c2725b70
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
@@ -0,0 +1,5 @@
+# Launch Screen Assets
+
+You can customize the launch screen with your own desired assets by replacing the image files in this directory.
+
+You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
\ No newline at end of file
diff --git a/turms-chat-demo-flutter/ios/Runner/Base.lproj/LaunchScreen.storyboard b/turms-chat-demo-flutter/ios/Runner/Base.lproj/LaunchScreen.storyboard
new file mode 100644
index 0000000000..f2e259c7c9
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner/Base.lproj/LaunchScreen.storyboard
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/turms-chat-demo-flutter/ios/Runner/Base.lproj/Main.storyboard b/turms-chat-demo-flutter/ios/Runner/Base.lproj/Main.storyboard
new file mode 100644
index 0000000000..f3c28516fb
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner/Base.lproj/Main.storyboard
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/turms-chat-demo-flutter/ios/Runner/Info.plist b/turms-chat-demo-flutter/ios/Runner/Info.plist
new file mode 100644
index 0000000000..e2100606e0
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner/Info.plist
@@ -0,0 +1,49 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ $(DEVELOPMENT_LANGUAGE)
+ CFBundleDisplayName
+ Turms Chat Demo
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ turms_chat_demo
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ $(FLUTTER_BUILD_NAME)
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ $(FLUTTER_BUILD_NUMBER)
+ LSRequiresIPhoneOS
+
+ UILaunchStoryboardName
+ LaunchScreen
+ UIMainStoryboardFile
+ Main
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ CADisableMinimumFrameDurationOnPhone
+
+ UIApplicationSupportsIndirectInputEvents
+
+
+
diff --git a/turms-chat-demo-flutter/ios/Runner/Runner-Bridging-Header.h b/turms-chat-demo-flutter/ios/Runner/Runner-Bridging-Header.h
new file mode 100644
index 0000000000..308a2a560b
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/Runner/Runner-Bridging-Header.h
@@ -0,0 +1 @@
+#import "GeneratedPluginRegistrant.h"
diff --git a/turms-chat-demo-flutter/ios/RunnerTests/RunnerTests.swift b/turms-chat-demo-flutter/ios/RunnerTests/RunnerTests.swift
new file mode 100644
index 0000000000..86a7c3b1b6
--- /dev/null
+++ b/turms-chat-demo-flutter/ios/RunnerTests/RunnerTests.swift
@@ -0,0 +1,12 @@
+import Flutter
+import UIKit
+import XCTest
+
+class RunnerTests: XCTestCase {
+
+ func testExample() {
+ // If you add code to the Runner application, consider adding tests here.
+ // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
+ }
+
+}
diff --git a/turms-chat-demo-flutter/l10n.yaml b/turms-chat-demo-flutter/l10n.yaml
new file mode 100644
index 0000000000..de5252a5a1
--- /dev/null
+++ b/turms-chat-demo-flutter/l10n.yaml
@@ -0,0 +1,7 @@
+# https://docs.flutter.dev/ui/accessibility-and-internationalization/internationalization#configuring-the-l10nyaml-file
+arb-dir: lib/ui/l10n/arb
+output-dir: lib/ui/l10n
+output-localization-file: app_localizations.dart
+synthetic-package: false
+template-arb-file: app_en.arb
+nullable-getter: false
\ No newline at end of file
diff --git a/turms-chat-demo-flutter/lib/domain/app/models/app_setting.dart b/turms-chat-demo-flutter/lib/domain/app/models/app_setting.dart
new file mode 100644
index 0000000000..17b79fad05
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/app/models/app_setting.dart
@@ -0,0 +1,9 @@
+enum AppSetting {
+ rememberMe(0);
+
+ const AppSetting(this.id);
+
+ final int id;
+
+ static AppSetting fromId(int id) => values.firstWhere((e) => e.id == id);
+}
diff --git a/turms-chat-demo-flutter/lib/domain/app/models/app_settings.dart b/turms-chat-demo-flutter/lib/domain/app/models/app_settings.dart
new file mode 100644
index 0000000000..c975bb38f8
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/app/models/app_settings.dart
@@ -0,0 +1,31 @@
+import '../../../infra/built_in_types/built_in_type_helpers.dart';
+import '../../../infra/sqlite/app_database.dart';
+import 'app_setting.dart';
+
+class AppSettings {
+ AppSettings(this._settingToValue);
+
+ factory AppSettings.fromTableData(List records) {
+ final entries = records.map((r) => (AppSetting.fromId(r.id), r));
+ final idToSetting = {
+ for (final entry in entries)
+ entry.$1: _parseValue(entry.$1, entry.$2.value.rawSqlValue)
+ };
+ return AppSettings(idToSetting);
+ }
+
+ final Map _settingToValue;
+
+ static Object _parseValue(AppSetting setting, Object value) =>
+ switch (setting) {
+ AppSetting.rememberMe => (value as int).toBool(),
+ };
+
+ bool? getRememberMe() {
+ final value = _settingToValue[AppSetting.rememberMe];
+ if (value == null) {
+ return null;
+ }
+ return value as bool;
+ }
+}
diff --git a/turms-chat-demo-flutter/lib/domain/app/repositories/app_setting_repository.dart b/turms-chat-demo-flutter/lib/domain/app/repositories/app_setting_repository.dart
new file mode 100644
index 0000000000..40cfc8415d
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/app/repositories/app_setting_repository.dart
@@ -0,0 +1,26 @@
+import 'package:drift/drift.dart';
+
+import '../../../infra/sqlite/app_database.dart';
+import '../models/app_setting.dart';
+
+class AppSettingRepository {
+ Future upsertRememberMe(bool rememberMe) async {
+ final now = DateTime.now();
+ final rememberMeValue = DriftAny(rememberMe);
+ await appDatabase.into(appDatabase.appSettingTable).insert(
+ AppSettingTableCompanion.insert(
+ id: AppSetting.rememberMe.id,
+ value: rememberMeValue,
+ createdDate: now,
+ lastModifiedDate: now,
+ ),
+ onConflict: DoUpdate((old) => AppSettingTableCompanion.custom(
+ value: Constant(rememberMeValue),
+ lastModifiedDate: Constant(now))));
+ }
+
+ Future> selectAll() =>
+ appDatabase.select(appDatabase.appSettingTable).get();
+}
+
+final appSettingRepository = AppSettingRepository();
diff --git a/turms-chat-demo-flutter/lib/domain/app/tables/app_setting_table.dart b/turms-chat-demo-flutter/lib/domain/app/tables/app_setting_table.dart
new file mode 100644
index 0000000000..c43932ad6e
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/app/tables/app_setting_table.dart
@@ -0,0 +1,23 @@
+import 'package:drift/drift.dart';
+
+class AppSettingTable extends Table {
+ late final id = integer()();
+
+ late final value = sqliteAny()();
+
+ late final createdDate = dateTime()();
+
+ late final lastModifiedDate = dateTime()();
+
+ @override
+ String get tableName => 'app_setting';
+
+ @override
+ Set get primaryKey => {id};
+
+ @override
+ bool get withoutRowId => true;
+
+ @override
+ bool get isStrict => true;
+}
diff --git a/turms-chat-demo-flutter/lib/domain/app/tables/log_entry_table.dart b/turms-chat-demo-flutter/lib/domain/app/tables/log_entry_table.dart
new file mode 100644
index 0000000000..9e4a7b4ac7
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/app/tables/log_entry_table.dart
@@ -0,0 +1,19 @@
+import 'package:drift/drift.dart';
+
+import 'log_level_converter.dart';
+
+class LogEntryTable extends Table {
+ late final id = integer().autoIncrement()();
+
+ late final level = integer().map(LogLevelConverter())();
+
+ late final createdDate = dateTime()();
+
+ late final message = text()();
+
+ @override
+ String get tableName => 'log_entry';
+
+ @override
+ bool get isStrict => true;
+}
diff --git a/turms-chat-demo-flutter/lib/domain/app/tables/log_level_converter.dart b/turms-chat-demo-flutter/lib/domain/app/tables/log_level_converter.dart
new file mode 100644
index 0000000000..57eec8e1f0
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/app/tables/log_level_converter.dart
@@ -0,0 +1,11 @@
+import 'package:drift/drift.dart';
+
+import '../../../infra/logging/log_level.dart';
+
+class LogLevelConverter extends TypeConverter {
+ @override
+ LogLevel fromSql(int fromDb) => LogLevel.fromInt(fromDb)!;
+
+ @override
+ int toSql(LogLevel value) => value.value;
+}
diff --git a/turms-chat-demo-flutter/lib/domain/app/view_models/app_settings_view_model.dart b/turms-chat-demo-flutter/lib/domain/app/view_models/app_settings_view_model.dart
new file mode 100644
index 0000000000..9298e5f85b
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/app/view_models/app_settings_view_model.dart
@@ -0,0 +1,5 @@
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+
+import '../models/app_settings.dart';
+
+final appSettingsViewModel = StateProvider((ref) => null);
diff --git a/turms-chat-demo-flutter/lib/domain/common/fixtures/fixtures.dart b/turms-chat-demo-flutter/lib/domain/common/fixtures/fixtures.dart
new file mode 100644
index 0000000000..fc8eb66b96
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/common/fixtures/fixtures.dart
@@ -0,0 +1,5 @@
+class Fixtures {
+ Fixtures._();
+
+ static final instance = Fixtures._();
+}
diff --git a/turms-chat-demo-flutter/lib/domain/common/models/new_relationship_request.dart b/turms-chat-demo-flutter/lib/domain/common/models/new_relationship_request.dart
new file mode 100644
index 0000000000..0ef1e1d256
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/common/models/new_relationship_request.dart
@@ -0,0 +1,18 @@
+import 'package:fixnum/fixnum.dart';
+import '../../common/models/request_status.dart';
+import '../../user/models/index.dart';
+
+abstract class NewRelationshipRequest {
+ NewRelationshipRequest(
+ {required this.id,
+ required this.status,
+ required this.sender,
+ required this.creationDate,
+ required this.message});
+
+ final Int64 id;
+ final RequestStatus status;
+ final User sender;
+ final DateTime creationDate;
+ final String message;
+}
diff --git a/turms-chat-demo-flutter/lib/domain/common/models/request_status.dart b/turms-chat-demo-flutter/lib/domain/common/models/request_status.dart
new file mode 100644
index 0000000000..ae442d957b
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/common/models/request_status.dart
@@ -0,0 +1,5 @@
+enum RequestStatus {
+ pending,
+ accepted,
+ // declined,
+}
diff --git a/turms-chat-demo-flutter/lib/domain/conversation/fixtures/conversations.dart b/turms-chat-demo-flutter/lib/domain/conversation/fixtures/conversations.dart
new file mode 100644
index 0000000000..e2a2a40340
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/conversation/fixtures/conversations.dart
@@ -0,0 +1,98 @@
+import 'dart:math';
+
+import 'package:fixnum/fixnum.dart';
+
+import '../../../infra/random/random_utils.dart';
+import '../../../ui/desktop/pages/home_page/chat_page/chat_session_pane/message.dart';
+import '../../common/fixtures/fixtures.dart';
+import '../../message/models/message_delivery_status.dart';
+import '../../user/fixtures/contacts.dart';
+import '../../user/models/index.dart';
+import '../models/conversation.dart';
+
+// We prefer the same output for each run,
+// so we use the same seed.
+final _random = Random(123456789);
+
+const _deliveryStatuses = MessageDeliveryStatus.values;
+
+extension FixturesExtensions on Fixtures {
+ List getConversations(User loggedInUser) {
+ final loggedInUserId = loggedInUser.userId;
+ var messageId = Int64.ZERO;
+ final now = DateTime.now();
+ return getContacts(loggedInUser).map((contact) {
+ switch (contact) {
+ case UserContact():
+ final timestamps = [];
+ final rawMessages = contactIdToMessages[contact.userId]!;
+ final count = rawMessages.length;
+ var date = now;
+ for (var i = 0; i < count; i++) {
+ date = date.subtract(
+ Duration(seconds: _random.nextInt(60 * 60 * 24 * 30)));
+ timestamps.add(date);
+ }
+ return UserConversation(
+ contact: contact,
+ unreadMessageCount:
+ rawMessages.isEmpty ? 0 : _random.nextInt(rawMessages.length),
+ messages: rawMessages.indexed.map((item) {
+ final (messageIndex, message) = item;
+ final sentByMe = _random.nextBool();
+ return ChatMessage.parse(
+ text: message,
+ messageId: --messageId,
+ senderId: sentByMe ? loggedInUserId : contact.userId,
+ sentByMe: sentByMe,
+ recipientId: sentByMe ? contact.userId : loggedInUserId,
+ isGroupMessage: false,
+ timestamp: timestamps[count - messageIndex - 1],
+ status: sentByMe
+ ? _deliveryStatuses[
+ _random.nextInt(_deliveryStatuses.length)]
+ : MessageDeliveryStatus.delivered);
+ }).toList());
+ case GroupContact():
+ final memberIds =
+ contact.members.map((member) => member.userId).toList();
+ final memberCount = memberIds.length;
+ final maxMessageCount = RandomUtils.nextInt() % 20;
+ final messages = [];
+ var date = now;
+ final timestamps = [];
+ for (var i = 0; i < maxMessageCount; i++) {
+ date = date.subtract(
+ Duration(seconds: _random.nextInt(60 * 60 * 24 * 30)));
+ timestamps.add(date);
+ }
+ for (var i = 0; i < maxMessageCount; i++) {
+ final memberId = memberIds[RandomUtils.nextInt() % memberCount];
+ final rawMessages = contactIdToMessages[memberId] ?? [];
+ final messageCount = rawMessages.length;
+ if (messageCount == 0) {
+ continue;
+ }
+ final rawMessage =
+ rawMessages[RandomUtils.nextInt() % messageCount];
+ messages.add(ChatMessage.parse(
+ text: rawMessage,
+ messageId: --messageId,
+ groupId: contact.groupId,
+ senderId: memberId,
+ sentByMe: loggedInUserId == memberId,
+ isGroupMessage: true,
+ timestamp: timestamps[maxMessageCount - i - 1],
+ status: MessageDeliveryStatus.delivered));
+ }
+ return GroupConversation(
+ contact: contact,
+ unreadMessageCount:
+ messages.isEmpty ? 0 : _random.nextInt(messages.length),
+ messages: messages);
+ case SystemContact():
+ throw UnimplementedError();
+ }
+ }).toList();
+ }
+}
diff --git a/turms-chat-demo-flutter/lib/domain/conversation/models/conversation.dart b/turms-chat-demo-flutter/lib/domain/conversation/models/conversation.dart
new file mode 100644
index 0000000000..b118e97464
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/conversation/models/conversation.dart
@@ -0,0 +1,63 @@
+import 'package:fixnum/fixnum.dart';
+
+import '../../../infra/collection/list_holder.dart';
+import '../../../ui/desktop/pages/home_page/chat_page/chat_session_pane/message.dart';
+import '../../user/models/contact.dart';
+
+part './group_conversation.dart';
+
+part './private_conversation.dart';
+
+part './user_conversation.dart';
+
+part './system_conversation.dart';
+
+sealed class Conversation {
+ factory Conversation.from(
+ {required Contact contact, required List messages}) =>
+ switch (contact) {
+ UserContact() => UserConversation(contact: contact, messages: messages),
+ GroupContact() =>
+ GroupConversation(contact: contact, messages: messages),
+ SystemContact() =>
+ SystemConversation(contact: contact, messages: messages),
+ };
+
+ Conversation(
+ {required this.id,
+ required this.messages,
+ this.unreadMessageCount = 0,
+ this.draft});
+
+ final IntListHolder id;
+
+ /// Note that the messages should be sorted by timestamp in ascending order.
+ final List messages;
+ int unreadMessageCount;
+ String? draft;
+
+ abstract final Contact contact;
+
+ bool hasSameContact(Contact contact);
+
+ static IntListHolder generateId(
+ {Int64? userId, Int64? groupId, SystemContactType? systemContactType}) {
+ assert((userId != null) ^ (groupId != null) ^ (systemContactType != null),
+ 'Only one parameter should be not null');
+ final Int64 contactId;
+ final int idFlag;
+ if (userId != null) {
+ contactId = userId;
+ idFlag = 0;
+ } else if (groupId != null) {
+ contactId = groupId;
+ idFlag = 1;
+ } else {
+ contactId = Int64(systemContactType!.id);
+ idFlag = 2;
+ }
+ return ListHolder(List.filled(9, 0)
+ ..setAll(0, contactId.toInt64().toBytes())
+ ..[8] = idFlag);
+ }
+}
diff --git a/turms-chat-demo-flutter/lib/domain/conversation/models/conversation_setting.dart b/turms-chat-demo-flutter/lib/domain/conversation/models/conversation_setting.dart
new file mode 100644
index 0000000000..6e0886b658
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/conversation/models/conversation_setting.dart
@@ -0,0 +1,31 @@
+import '../../../infra/built_in_types/built_in_type_helpers.dart';
+
+/// [D] for the dart value type;
+/// [S] for the SQL value type.
+enum ConversationSetting {
+ pinned(0),
+ enableNewMessageNotification(1);
+
+ const ConversationSetting(this.id);
+
+ final int id;
+
+ static ConversationSetting? fromId(int id) =>
+ _idToSetting[id];
+
+ S? convertValueToSql(D value) => switch (this) {
+ ConversationSetting.pinned => (value as bool).toInt(),
+ ConversationSetting.enableNewMessageNotification =>
+ (value as bool).toInt(),
+ } as S?;
+
+ D? convertSqlToValue(S value) => switch (this) {
+ ConversationSetting.pinned => (value as int).toBool(),
+ ConversationSetting.enableNewMessageNotification =>
+ (value as int).toBool(),
+ } as D?;
+}
+
+final _idToSetting = {
+ for (final record in ConversationSetting.values) record.id: record,
+};
diff --git a/turms-chat-demo-flutter/lib/domain/conversation/models/conversation_settings.dart b/turms-chat-demo-flutter/lib/domain/conversation/models/conversation_settings.dart
new file mode 100644
index 0000000000..d4e06b64c7
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/conversation/models/conversation_settings.dart
@@ -0,0 +1,71 @@
+import '../../../infra/collection/list_holder.dart';
+import '../../../infra/exception/stackful_exception.dart';
+import '../../../infra/sqlite/user_database.dart';
+import '../tables/conversation_setting_table.dart';
+import 'conversation_setting.dart';
+
+class ConversationSettings {
+ const ConversationSettings(this._settingToValue);
+
+ static (Map, StackfulException?)
+ fromTableData(List records) {
+ final idToSettings = {};
+ StackfulException? exception;
+ for (final record in records) {
+ final setting = ConversationSetting.fromId(record.settingId);
+ final recordValue = record.value;
+ if (setting == null) {
+ continue;
+ }
+ final settings = idToSettings.putIfAbsent(
+ record.conversationId,
+ () =>
+ // don't use const as the map should be mutable.
+ // ignore: prefer_const_constructors
+ ConversationSettings({}));
+ try {
+ _setSetting(settings, setting, recordValue.rawSqlValue);
+ } on Exception catch (e, s) {
+ exception ??= StackfulException(
+ cause: Exception('Failed to set the conversation settings'),
+ stackTrace: s,
+ suppressed: []);
+ exception.addSuppressed(StackfulException(
+ cause: Exception(
+ 'Failed to set the conversation setting "${setting.name}" with the value "$recordValue"'),
+ stackTrace: s,
+ suppressed: [e]));
+ }
+ }
+ return (idToSettings, exception);
+ }
+
+ static void _setSetting(ConversationSettings settings,
+ ConversationSetting setting, Object sqlValue) {
+ final value = setting.convertSqlToValue(sqlValue);
+ switch (setting) {
+ case ConversationSetting.pinned:
+ settings.pinned = value as bool;
+ break;
+ case ConversationSetting.enableNewMessageNotification:
+ settings.enableNewMessageNotification = value as bool;
+ break;
+ }
+ }
+
+ final Map, Object?> _settingToValue;
+
+ bool? get pinned => _settingToValue[ConversationSetting.pinned] as bool?;
+
+ set pinned(bool? value) {
+ _settingToValue[ConversationSetting.pinned] = value;
+ }
+
+ bool? get enableNewMessageNotification =>
+ _settingToValue[ConversationSetting.enableNewMessageNotification]
+ as bool?;
+
+ set enableNewMessageNotification(bool? value) {
+ _settingToValue[ConversationSetting.enableNewMessageNotification] = value;
+ }
+}
diff --git a/turms-chat-demo-flutter/lib/domain/conversation/models/group_conversation.dart b/turms-chat-demo-flutter/lib/domain/conversation/models/group_conversation.dart
new file mode 100644
index 0000000000..9c287c3494
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/conversation/models/group_conversation.dart
@@ -0,0 +1,17 @@
+part of './conversation.dart';
+
+class GroupConversation extends Conversation {
+ GroupConversation(
+ {required super.messages,
+ super.unreadMessageCount,
+ super.draft,
+ required this.contact})
+ : super(id: Conversation.generateId(groupId: contact.groupId));
+
+ @override
+ final GroupContact contact;
+
+ @override
+ bool hasSameContact(Contact contact) =>
+ contact is GroupContact && contact.groupId == this.contact.groupId;
+}
diff --git a/turms-chat-demo-flutter/lib/domain/conversation/models/private_conversation.dart b/turms-chat-demo-flutter/lib/domain/conversation/models/private_conversation.dart
new file mode 100644
index 0000000000..cd03e17e8c
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/conversation/models/private_conversation.dart
@@ -0,0 +1,9 @@
+part of './conversation.dart';
+
+sealed class PrivateConversation extends Conversation {
+ PrivateConversation(
+ {required super.id,
+ required super.messages,
+ super.unreadMessageCount,
+ super.draft});
+}
diff --git a/turms-chat-demo-flutter/lib/domain/conversation/models/system_conversation.dart b/turms-chat-demo-flutter/lib/domain/conversation/models/system_conversation.dart
new file mode 100644
index 0000000000..6689d949fc
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/conversation/models/system_conversation.dart
@@ -0,0 +1,17 @@
+part of './conversation.dart';
+
+class SystemConversation extends PrivateConversation {
+ SystemConversation(
+ {required super.messages,
+ super.unreadMessageCount,
+ super.draft,
+ required this.contact})
+ : super(id: Conversation.generateId(systemContactType: contact.type));
+
+ @override
+ final SystemContact contact;
+
+ @override
+ bool hasSameContact(Contact contact) =>
+ contact is SystemContact && contact.id == this.contact.id;
+}
diff --git a/turms-chat-demo-flutter/lib/domain/conversation/models/user_conversation.dart b/turms-chat-demo-flutter/lib/domain/conversation/models/user_conversation.dart
new file mode 100644
index 0000000000..91cdeb2b37
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/conversation/models/user_conversation.dart
@@ -0,0 +1,17 @@
+part of './conversation.dart';
+
+class UserConversation extends PrivateConversation {
+ UserConversation(
+ {required super.messages,
+ super.unreadMessageCount,
+ super.draft,
+ required this.contact})
+ : super(id: Conversation.generateId(userId: contact.userId));
+
+ @override
+ final UserContact contact;
+
+ @override
+ bool hasSameContact(Contact contact) =>
+ contact is UserContact && contact.id == this.contact.id;
+}
diff --git a/turms-chat-demo-flutter/lib/domain/conversation/repositories/conversation_setting_repository.dart b/turms-chat-demo-flutter/lib/domain/conversation/repositories/conversation_setting_repository.dart
new file mode 100644
index 0000000000..fd35148cc4
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/conversation/repositories/conversation_setting_repository.dart
@@ -0,0 +1,56 @@
+import 'package:drift/drift.dart';
+import 'package:fixnum/fixnum.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+
+import '../../../infra/built_in_types/built_in_type_helpers.dart';
+import '../../../infra/sqlite/user_database.dart';
+import '../models/conversation_setting.dart';
+
+class ConversationSettingRepository {
+ ConversationSettingRepository(this._userDatabase);
+
+ final UserDatabase _userDatabase;
+
+ Future upsert(
+ {required Int64 contactId,
+ required bool isGroupConversation,
+ required ConversationSetting setting,
+ required dynamic settingValue}) async {
+ final sqlValue = setting.convertValueToSql(settingValue) as Object;
+ final now = DateTime.now();
+ await _userDatabase.into(_userDatabase.conversationSettingTable).insert(
+ ConversationSettingTableCompanion.insert(
+ contactId: contactId.toBigInt(),
+ isGroupConversation: isGroupConversation,
+ settingId: setting.id,
+ value: DriftAny(sqlValue),
+ createdDate: now,
+ lastModifiedDate: now,
+ ),
+ onConflict: DoUpdate((old) => ConversationSettingTableCompanion.custom(
+ value: Constant(DriftAny(sqlValue)),
+ lastModifiedDate: Constant(now))));
+ }
+
+ Future delete(
+ {required Int64 userId,
+ required Int64 contactId,
+ required bool isGroupConversation,
+ required ConversationSetting setting}) async {
+ final delete = _userDatabase.delete(_userDatabase.conversationSettingTable)
+ ..where((t) => Expression.and([
+ t.contactId.equals(contactId.toBigInt()),
+ t.isGroupConversation.equals(isGroupConversation),
+ t.settingId.equals(setting.id)
+ ]));
+ return delete.go();
+ }
+
+ Future> selectAll() =>
+ _userDatabase.select(_userDatabase.conversationSettingTable).get();
+}
+
+final conversationSettingRepositoryProvider =
+ StateProvider(
+ (ref) => null,
+);
diff --git a/turms-chat-demo-flutter/lib/domain/conversation/services/conversation_service.dart b/turms-chat-demo-flutter/lib/domain/conversation/services/conversation_service.dart
new file mode 100644
index 0000000000..8f68a23fe6
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/conversation/services/conversation_service.dart
@@ -0,0 +1,61 @@
+import 'package:fixnum/fixnum.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+
+import '../../../infra/collection/list_holder.dart';
+import '../../../ui/desktop/pages/app.dart';
+import '../../common/fixtures/fixtures.dart';
+import '../../conversation/fixtures/conversations.dart';
+import '../../user/models/contact.dart';
+import '../../user/models/user.dart';
+import '../models/conversation.dart';
+import '../models/conversation_setting.dart';
+import '../repositories/conversation_setting_repository.dart';
+import '../view_models/id_to_conversation_settings_view_model.dart';
+
+class ConversationService {
+ const ConversationService(this._loggedInUser);
+
+ final User _loggedInUser;
+
+ Future> queryConversations() async {
+ await Future.delayed(const Duration(seconds: 3));
+ return Fixtures.instance.getConversations(_loggedInUser);
+ }
+
+ Future resetSharedUnreadMessageCount({
+ Int64? groupId,
+ Int64? userId,
+ }) =>
+ Future.delayed(const Duration(seconds: 1));
+
+ Future updateSettingPinned({
+ required IntListHolder conversationId,
+ required bool newValue,
+ required Contact contact,
+ }) async {
+ readGlobalState(idToConversationSettingsViewModel.notifier)
+ .update(conversationId, pinned: newValue);
+ await readGlobalState(conversationSettingRepositoryProvider)!.upsert(
+ contactId: contact is SystemContact ? _loggedInUser.userId : contact.id,
+ isGroupConversation: contact is GroupContact,
+ setting: ConversationSetting.pinned,
+ settingValue: newValue);
+ }
+
+ Future updateSettingEnableNewMessageNotification({
+ required IntListHolder conversationId,
+ required bool newValue,
+ required Contact contact,
+ }) async {
+ readGlobalState(idToConversationSettingsViewModel.notifier)
+ .update(conversationId, enableNewMessageNotification: newValue);
+ await readGlobalState(conversationSettingRepositoryProvider)!.upsert(
+ contactId: contact is SystemContact ? _loggedInUser.userId : contact.id,
+ isGroupConversation: contact is GroupContact,
+ setting: ConversationSetting.enableNewMessageNotification,
+ settingValue: newValue);
+ }
+}
+
+final conversationServiceProvider =
+ StateProvider((ref) => null);
diff --git a/turms-chat-demo-flutter/lib/domain/conversation/tables/conversation_setting_table.dart b/turms-chat-demo-flutter/lib/domain/conversation/tables/conversation_setting_table.dart
new file mode 100644
index 0000000000..ea6305dffe
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/conversation/tables/conversation_setting_table.dart
@@ -0,0 +1,70 @@
+import 'package:drift/drift.dart';
+import 'package:fixnum/fixnum.dart';
+
+import '../../../infra/built_in_types/built_in_type_helpers.dart';
+import '../../../infra/collection/list_holder.dart';
+import '../../../infra/sqlite/user_database.dart';
+import '../models/conversation.dart';
+
+/// We don't use the columns: a nullable [groupId] and a nullable [userId]
+/// as the primary key as SQLite doesn't allow a primary key contains a null value,
+/// and you can validate by running the following query:
+/// ```sql
+///create table my_test
+/// (
+/// id1 INT default null,
+/// id2 INT default null,
+/// primary key (id1, id2)
+/// ) without rowid , strict;
+///
+/// -- This query will fail with the following error in SQLite 3.45.1:
+/// -- [19] [SQLITE_CONSTRAINT_NOTNULL] A NOT NULL constraint failed (NOT NULL constraint failed: my_test.id2)
+/// INSERT INTO my_test VALUES (1,null);
+/// ```
+/// The table should only be used for development purposes without the server.
+/// The client should fetch user settings dynamically from the server in
+/// production.
+class ConversationSettingTable extends Table {
+ /// This can be either a group ID or a user (recipient) ID.
+ late final contactId = int64()();
+
+ late final isGroupConversation = boolean()();
+
+ late final settingId = integer()();
+
+ late final value = sqliteAny()();
+
+ late final createdDate = dateTime()();
+
+ late final lastModifiedDate = dateTime()();
+
+ @override
+ String get tableName => 'conversation_setting';
+
+ @override
+ Set get primaryKey => {contactId, isGroupConversation, settingId};
+
+ @override
+ bool get withoutRowId => true;
+
+ @override
+ bool get isStrict => true;
+}
+
+extension ConversationSettingTableDataExtension
+ on ConversationSettingTableData {
+ IntListHolder get conversationId {
+ final id = contactId.toInt64();
+ Int64? userId;
+ Int64? groupId;
+ if (isGroupConversation) {
+ groupId = id;
+ } else {
+ userId = id;
+ }
+ return Conversation.generateId(
+ userId: userId,
+ groupId: groupId,
+ );
+ }
+}
diff --git a/turms-chat-demo-flutter/lib/domain/conversation/view_models/id_to_conversation_settings_view_model.dart b/turms-chat-demo-flutter/lib/domain/conversation/view_models/id_to_conversation_settings_view_model.dart
new file mode 100644
index 0000000000..10360e7c34
--- /dev/null
+++ b/turms-chat-demo-flutter/lib/domain/conversation/view_models/id_to_conversation_settings_view_model.dart
@@ -0,0 +1,40 @@
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+
+import '../../../infra/collection/list_holder.dart';
+import '../models/conversation_setting.dart';
+import '../models/conversation_settings.dart';
+
+class IdToConversationSettingsViewModelNotifier
+ extends Notifier