diff --git a/packages/stream_chat_flutter/analysis_options.yaml b/packages/stream_chat_flutter/analysis_options.yaml index 42965ec7..36d1fbb7 100644 --- a/packages/stream_chat_flutter/analysis_options.yaml +++ b/packages/stream_chat_flutter/analysis_options.yaml @@ -1,63 +1,63 @@ -#include: package:pedantic/analysis_options.yaml -# -#analyzer: -# enable-experiment: -# - extension-methods -# exclude: -# - lib/**/*.g.dart -# - example/** -# -#linter: -# rules: -# # these rules are documented on and in the same order as -# # the Dart Lint rules page to make maintenance easier -# # https://github.com/dart-lang/linter/blob/master/example/all.yaml -# # - always_declare_return_types -# # - always_specify_types -# # - annotate_overrides -# # - avoid_as -# - avoid_empty_else -# - avoid_init_to_null -# - avoid_return_types_on_setters -# - avoid_web_libraries_in_flutter -# - await_only_futures -# - camel_case_types -# - cancel_subscriptions -# - close_sinks -# # - comment_references # we do not presume as to what people want to reference in their dartdocs -# # - constant_identifier_names # https://github.com/dart-lang/linter/issues/204 -# - control_flow_in_finally -# - empty_constructor_bodies -# - empty_statements -# - hash_and_equals -# - implementation_imports -# # - invariant_booleans -# # - iterable_contains_unrelated_type -# - library_names -# # - library_prefixes -# # - list_remove_unrelated_type -# # - literal_only_boolean_expressions -# - non_constant_identifier_names -# # - one_member_abstracts -# # - only_throw_errors -# # - overridden_fields -## - package_api_docs -# - package_names -# - package_prefixed_library_names -# - prefer_is_not_empty -# # - prefer_mixin # https://github.com/dart-lang/language/issues/32 -# - public_member_api_docs -# - slash_for_doc_comments -# # - sort_constructors_first -# # - sort_unnamed_constructors_first -# # - super_goes_last # no longer needed w/ Dart 2 -# - test_types_in_equals -# - throw_in_finally -# # - type_annotate_public_apis # subset of always_specify_types -# - type_init_formals -# # - unawaited_futures -# - unnecessary_brace_in_string_interps -# - unnecessary_getters_setters -# - unnecessary_statements +include: package:pedantic/analysis_options.yaml + +analyzer: + enable-experiment: + - extension-methods + exclude: + - lib/**/*.g.dart + - example/** + +linter: + rules: + # these rules are documented on and in the same order as + # the Dart Lint rules page to make maintenance easier + # https://github.com/dart-lang/linter/blob/master/example/all.yaml + # - always_declare_return_types + # - always_specify_types + # - annotate_overrides + # - avoid_as + - avoid_empty_else + - avoid_init_to_null + - avoid_return_types_on_setters + - avoid_web_libraries_in_flutter + - await_only_futures + - camel_case_types + - cancel_subscriptions + - close_sinks + # - comment_references # we do not presume as to what people want to reference in their dartdocs + # - constant_identifier_names # https://github.com/dart-lang/linter/issues/204 + - control_flow_in_finally + - empty_constructor_bodies + - empty_statements + - hash_and_equals + - implementation_imports + # - invariant_booleans + # - iterable_contains_unrelated_type + - library_names + # - library_prefixes + # - list_remove_unrelated_type + # - literal_only_boolean_expressions + - non_constant_identifier_names + # - one_member_abstracts + # - only_throw_errors + # - overridden_fields +# - package_api_docs + - package_names + - package_prefixed_library_names + - prefer_is_not_empty + # - prefer_mixin # https://github.com/dart-lang/language/issues/32 + # - public_member_api_docs + - slash_for_doc_comments + # - sort_constructors_first + # - sort_unnamed_constructors_first + # - super_goes_last # no longer needed w/ Dart 2 + - test_types_in_equals + - throw_in_finally + # - type_annotate_public_apis # subset of always_specify_types + - type_init_formals + # - unawaited_futures + - unnecessary_brace_in_string_interps + - unnecessary_getters_setters + - unnecessary_statements - unrelated_type_equality_checks - valid_regexps diff --git a/packages/stream_chat_flutter/example/.gitignore b/packages/stream_chat_flutter/example/.gitignore index 8011d84b..9d532b18 100644 --- a/packages/stream_chat_flutter/example/.gitignore +++ b/packages/stream_chat_flutter/example/.gitignore @@ -22,6 +22,7 @@ # Flutter/Dart/Pub related **/doc/api/ +**/ios/Flutter/.last_build_id .dart_tool/ .flutter-plugins .flutter-plugins-dependencies @@ -33,7 +34,8 @@ # Web related lib/generated_plugin_registrant.dart -# Exceptions to above rules. -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +# Symbolication related +app.*.symbols -fvm \ No newline at end of file +# Obfuscation related +app.*.map.json diff --git a/packages/stream_chat_flutter/example/.metadata b/packages/stream_chat_flutter/example/.metadata index 01d2dcb9..cd984dd0 100644 --- a/packages/stream_chat_flutter/example/.metadata +++ b/packages/stream_chat_flutter/example/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled and should not be manually edited. version: - revision: 0b8abb4724aa590dd0f429683339b1e045a1594d + revision: 9b2d32b605630f28625709ebd9d78ab3016b2bf6 channel: stable project_type: app diff --git a/packages/stream_chat_flutter/example/android/.gitignore b/packages/stream_chat_flutter/example/android/.gitignore index bc2100d8..0a741cb4 100644 --- a/packages/stream_chat_flutter/example/android/.gitignore +++ b/packages/stream_chat_flutter/example/android/.gitignore @@ -5,3 +5,7 @@ gradle-wrapper.jar /gradlew.bat /local.properties GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties diff --git a/packages/stream_chat_flutter/example/android/app/build.gradle b/packages/stream_chat_flutter/example/android/app/build.gradle index c5ff1b9e..5a4d759a 100644 --- a/packages/stream_chat_flutter/example/android/app/build.gradle +++ b/packages/stream_chat_flutter/example/android/app/build.gradle @@ -27,14 +27,13 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { compileSdkVersion 29 - ndkVersion '21.3.6528147' sourceSets { main.java.srcDirs += 'src/main/kotlin' } + lintOptions { disable 'InvalidPackage' - checkReleaseBuilds false } defaultConfig { @@ -44,7 +43,6 @@ android { targetSdkVersion 29 versionCode flutterVersionCode.toInteger() versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -62,10 +60,4 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' - implementation 'com.google.firebase:firebase-messaging:20.1.2' } - -apply plugin: 'com.google.gms.google-services' diff --git a/packages/stream_chat_flutter/example/android/app/src/main/AndroidManifest.xml b/packages/stream_chat_flutter/example/android/app/src/main/AndroidManifest.xml index 0492c6da..3197993b 100644 --- a/packages/stream_chat_flutter/example/android/app/src/main/AndroidManifest.xml +++ b/packages/stream_chat_flutter/example/android/app/src/main/AndroidManifest.xml @@ -6,14 +6,10 @@ additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> - - + android:name="io.flutter.app.FlutterApplication" + android:label="example" + android:icon="@mipmap/ic_launcher"> - - - - + + + + diff --git a/packages/stream_chat_flutter/example/android/app/src/main/kotlin/com/example/example/Application.kt b/packages/stream_chat_flutter/example/android/app/src/main/kotlin/com/example/example/Application.kt deleted file mode 100644 index dd47a03c..00000000 --- a/packages/stream_chat_flutter/example/android/app/src/main/kotlin/com/example/example/Application.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.example.example - -import com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin -import io.flutter.app.FlutterApplication -import io.flutter.plugin.common.PluginRegistry -import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback -import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin -import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService -import io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin -import io.flutter.plugins.pathprovider.PathProviderPlugin - -class Application : FlutterApplication(), PluginRegistrantCallback { - override fun onCreate() { - super.onCreate() - FlutterFirebaseMessagingService.setPluginRegistrant(this) - } - - override fun registerWith(registry: PluginRegistry?) { - PathProviderPlugin.registerWith(registry?.registrarFor( - "io.flutter.plugins.pathprovider.PathProviderPlugin")) - SharedPreferencesPlugin.registerWith(registry?.registrarFor( - "io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin")) - FlutterLocalNotificationsPlugin.registerWith(registry?.registrarFor( - "com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin")) - FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin")) - } -} \ No newline at end of file diff --git a/packages/stream_chat_flutter/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/packages/stream_chat_flutter/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt index 1656503f..e793a000 100644 --- a/packages/stream_chat_flutter/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt +++ b/packages/stream_chat_flutter/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt @@ -1,12 +1,6 @@ package com.example.example -import androidx.annotation.NonNull; import io.flutter.embedding.android.FlutterActivity -import io.flutter.embedding.engine.FlutterEngine -import io.flutter.plugins.GeneratedPluginRegistrant class MainActivity: FlutterActivity() { - override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { - GeneratedPluginRegistrant.registerWith(flutterEngine); - } } diff --git a/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index 91797672..db77bb4b 100644 Binary files a/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 103da98b..17987b79 100644 Binary files a/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 1718335e..09d43914 100644 Binary files a/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index a111f507..d5f1c8d3 100644 Binary files a/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index fc254c25..4d6372ee 100644 Binary files a/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/packages/stream_chat_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/packages/stream_chat_flutter/example/android/app/src/main/res/values/styles.xml b/packages/stream_chat_flutter/example/android/app/src/main/res/values/styles.xml index 00fa4417..1f83a33f 100644 --- a/packages/stream_chat_flutter/example/android/app/src/main/res/values/styles.xml +++ b/packages/stream_chat_flutter/example/android/app/src/main/res/values/styles.xml @@ -1,8 +1,18 @@ + + + diff --git a/packages/stream_chat_flutter/example/android/build.gradle b/packages/stream_chat_flutter/example/android/build.gradle index 8c57e18a..dc5cdbc9 100644 --- a/packages/stream_chat_flutter/example/android/build.gradle +++ b/packages/stream_chat_flutter/example/android/build.gradle @@ -6,9 +6,8 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.6.2' + classpath 'com.android.tools.build:gradle:4.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.google.gms:google-services:4.3.2' } } diff --git a/packages/stream_chat_flutter/example/android/gradle.properties b/packages/stream_chat_flutter/example/android/gradle.properties index 38c8d454..a6738207 100644 --- a/packages/stream_chat_flutter/example/android/gradle.properties +++ b/packages/stream_chat_flutter/example/android/gradle.properties @@ -1,4 +1,4 @@ org.gradle.jvmargs=-Xmx1536M -android.enableR8=true android.useAndroidX=true android.enableJetifier=true +android.enableR8=true diff --git a/packages/stream_chat_flutter/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/stream_chat_flutter/example/android/gradle/wrapper/gradle-wrapper.properties index 4a4c2043..493072b3 100644 --- a/packages/stream_chat_flutter/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/stream_chat_flutter/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Oct 22 11:03:39 CEST 2020 +#Fri Jun 23 08:50:38 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip diff --git a/packages/stream_chat_flutter/example/android/settings.gradle b/packages/stream_chat_flutter/example/android/settings.gradle index 5a2f14fb..44e62bcf 100644 --- a/packages/stream_chat_flutter/example/android/settings.gradle +++ b/packages/stream_chat_flutter/example/android/settings.gradle @@ -1,15 +1,11 @@ include ':app' -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } -} +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory -} +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/packages/stream_chat_flutter/example/assets/android_icon.png b/packages/stream_chat_flutter/example/assets/android_icon.png deleted file mode 100644 index 3b85d6c3..00000000 Binary files a/packages/stream_chat_flutter/example/assets/android_icon.png and /dev/null differ diff --git a/packages/stream_chat_flutter/example/assets/icon_arrow_right.svg b/packages/stream_chat_flutter/example/assets/icon_arrow_right.svg deleted file mode 100644 index 7cfa0c56..00000000 --- a/packages/stream_chat_flutter/example/assets/icon_arrow_right.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/packages/stream_chat_flutter/example/assets/ios_icon.png b/packages/stream_chat_flutter/example/assets/ios_icon.png deleted file mode 100644 index 314eb1db..00000000 Binary files a/packages/stream_chat_flutter/example/assets/ios_icon.png and /dev/null differ diff --git a/packages/stream_chat_flutter/example/assets/logo.svg b/packages/stream_chat_flutter/example/assets/logo.svg deleted file mode 100644 index 49eecf7c..00000000 --- a/packages/stream_chat_flutter/example/assets/logo.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/stream_chat_flutter/example/ios/Gemfile b/packages/stream_chat_flutter/example/ios/Gemfile deleted file mode 100644 index cdd3a6b3..00000000 --- a/packages/stream_chat_flutter/example/ios/Gemfile +++ /dev/null @@ -1,6 +0,0 @@ -source "https://rubygems.org" - -gem "fastlane" - -plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') -eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/packages/stream_chat_flutter/example/ios/Gemfile.lock b/packages/stream_chat_flutter/example/ios/Gemfile.lock deleted file mode 100644 index dc0ee04f..00000000 --- a/packages/stream_chat_flutter/example/ios/Gemfile.lock +++ /dev/null @@ -1,180 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - CFPropertyList (3.0.2) - addressable (2.7.0) - public_suffix (>= 2.0.2, < 5.0) - atomos (0.1.3) - aws-eventstream (1.1.0) - aws-partitions (1.380.0) - aws-sdk-core (3.109.1) - aws-eventstream (~> 1, >= 1.0.2) - aws-partitions (~> 1, >= 1.239.0) - aws-sigv4 (~> 1.1) - jmespath (~> 1.0) - aws-sdk-kms (1.39.0) - aws-sdk-core (~> 3, >= 3.109.0) - aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.83.0) - aws-sdk-core (~> 3, >= 3.109.0) - aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.1) - aws-sigv4 (1.2.2) - aws-eventstream (~> 1, >= 1.0.2) - babosa (1.0.3) - claide (1.0.3) - colored (1.2) - colored2 (3.1.2) - commander-fastlane (4.4.6) - highline (~> 1.7.2) - declarative (0.0.20) - declarative-option (0.1.0) - digest-crc (0.6.1) - rake (~> 13.0) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) - dotenv (2.7.6) - emoji_regex (3.0.0) - excon (0.76.0) - faraday (1.0.1) - multipart-post (>= 1.2, < 3) - faraday-cookie_jar (0.0.7) - faraday (>= 0.8.0) - http-cookie (~> 1.0.0) - faraday_middleware (1.0.0) - faraday (~> 1.0) - fastimage (2.2.0) - fastlane (2.162.0) - CFPropertyList (>= 2.3, < 4.0.0) - addressable (>= 2.3, < 3.0.0) - aws-sdk-s3 (~> 1.0) - babosa (>= 1.0.3, < 2.0.0) - bundler (>= 1.12.0, < 3.0.0) - colored - commander-fastlane (>= 4.4.6, < 5.0.0) - dotenv (>= 2.1.1, < 3.0.0) - emoji_regex (>= 0.1, < 4.0) - excon (>= 0.71.0, < 1.0.0) - faraday (~> 1.0) - faraday-cookie_jar (~> 0.0.6) - faraday_middleware (~> 1.0) - fastimage (>= 2.1.0, < 3.0.0) - gh_inspector (>= 1.1.2, < 2.0.0) - google-api-client (>= 0.37.0, < 0.39.0) - google-cloud-storage (>= 1.15.0, < 2.0.0) - highline (>= 1.7.2, < 2.0.0) - json (< 3.0.0) - jwt (>= 2.1.0, < 3) - mini_magick (>= 4.9.4, < 5.0.0) - multipart-post (~> 2.0.0) - plist (>= 3.1.0, < 4.0.0) - rubyzip (>= 2.0.0, < 3.0.0) - security (= 0.1.3) - simctl (~> 1.6.3) - slack-notifier (>= 2.0.0, < 3.0.0) - terminal-notifier (>= 2.0.0, < 3.0.0) - terminal-table (>= 1.4.5, < 2.0.0) - tty-screen (>= 0.6.3, < 1.0.0) - tty-spinner (>= 0.8.0, < 1.0.0) - word_wrap (~> 1.0.0) - xcodeproj (>= 1.13.0, < 2.0.0) - xcpretty (~> 0.3.0) - xcpretty-travis-formatter (>= 0.0.3) - fastlane-plugin-firebase_app_distribution (0.2.3) - gh_inspector (1.1.3) - google-api-client (0.38.0) - addressable (~> 2.5, >= 2.5.1) - googleauth (~> 0.9) - httpclient (>= 2.8.1, < 3.0) - mini_mime (~> 1.0) - representable (~> 3.0) - retriable (>= 2.0, < 4.0) - signet (~> 0.12) - google-cloud-core (1.5.0) - google-cloud-env (~> 1.0) - google-cloud-errors (~> 1.0) - google-cloud-env (1.3.3) - faraday (>= 0.17.3, < 2.0) - google-cloud-errors (1.0.1) - google-cloud-storage (1.29.1) - addressable (~> 2.5) - digest-crc (~> 0.4) - google-api-client (~> 0.33) - google-cloud-core (~> 1.2) - googleauth (~> 0.9) - mini_mime (~> 1.0) - googleauth (0.13.1) - faraday (>= 0.17.3, < 2.0) - jwt (>= 1.4, < 3.0) - memoist (~> 0.16) - multi_json (~> 1.11) - os (>= 0.9, < 2.0) - signet (~> 0.14) - highline (1.7.10) - http-cookie (1.0.3) - domain_name (~> 0.5) - httpclient (2.8.3) - jmespath (1.4.0) - json (2.3.1) - jwt (2.2.2) - memoist (0.16.2) - mini_magick (4.10.1) - mini_mime (1.0.2) - multi_json (1.15.0) - multipart-post (2.0.0) - nanaimo (0.3.0) - naturally (2.2.0) - os (1.1.1) - plist (3.5.0) - public_suffix (4.0.6) - rake (13.0.1) - representable (3.0.4) - declarative (< 0.1.0) - declarative-option (< 0.2.0) - uber (< 0.2.0) - retriable (3.1.2) - rouge (2.0.7) - rubyzip (2.3.0) - security (0.1.3) - signet (0.14.0) - addressable (~> 2.3) - faraday (>= 0.17.3, < 2.0) - jwt (>= 1.5, < 3.0) - multi_json (~> 1.10) - simctl (1.6.8) - CFPropertyList - naturally - slack-notifier (2.3.2) - terminal-notifier (2.0.0) - terminal-table (1.8.0) - unicode-display_width (~> 1.1, >= 1.1.1) - tty-cursor (0.7.1) - tty-screen (0.8.1) - tty-spinner (0.9.3) - tty-cursor (~> 0.7) - uber (0.1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.7) - unicode-display_width (1.7.0) - word_wrap (1.0.0) - xcodeproj (1.18.0) - CFPropertyList (>= 2.3.3, < 4.0) - atomos (~> 0.1.3) - claide (>= 1.0.2, < 2.0) - colored2 (~> 3.1) - nanaimo (~> 0.3.0) - xcpretty (0.3.0) - rouge (~> 2.0.7) - xcpretty-travis-formatter (1.0.0) - xcpretty (~> 0.2, >= 0.0.7) - -PLATFORMS - ruby - -DEPENDENCIES - fastlane - fastlane-plugin-firebase_app_distribution - -BUNDLED WITH - 2.0.2 diff --git a/packages/stream_chat_flutter/example/ios/Notifications/Info.plist b/packages/stream_chat_flutter/example/ios/Notifications/Info.plist deleted file mode 100644 index a225b5ca..00000000 --- a/packages/stream_chat_flutter/example/ios/Notifications/Info.plist +++ /dev/null @@ -1,31 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - Notifications - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - NSExtension - - NSExtensionPointIdentifier - com.apple.usernotifications.service - NSExtensionPrincipalClass - $(PRODUCT_MODULE_NAME).NotificationService - - - diff --git a/packages/stream_chat_flutter/example/ios/Notifications/NotificationService.swift b/packages/stream_chat_flutter/example/ios/Notifications/NotificationService.swift deleted file mode 100644 index 976e8d6a..00000000 --- a/packages/stream_chat_flutter/example/ios/Notifications/NotificationService.swift +++ /dev/null @@ -1,182 +0,0 @@ -// -// NotificationService.swift -// Notifications -// -// Created by Salvatore Giordano on 25/03/2020. -// Copyright © 2020 The Chromium Authors. All rights reserved. -// - -import UserNotifications -//import StreamChatClient - -final class NotificationService: UNNotificationServiceExtension { - - var contentHandler: ((UNNotificationContent) -> Void)? - var bestAttemptContent: UNMutableNotificationContent? - - override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { - self.contentHandler = contentHandler - bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) - - guard let sharedDefaults = UserDefaults(suiteName: "group.io.getstream.flutter"), - let apiKey = sharedDefaults.string(forKey: "KEY_API_KEY"), - let userId = sharedDefaults.string(forKey: "KEY_USER_ID"), - let token = sharedDefaults.string(forKey: "KEY_TOKEN"), - let messageId = bestAttemptContent?.userInfo["message_id"] as? String else { - return - } - -// Client.config = .init(apiKey: apiKey, logOptions: .error) -// Client.shared.set(user: User(id: userId), token: token) { res in -// guard res.isConnected else { -// return -// } -// -// Client.shared.message(withId: messageId) { [weak self] res in -// if let message = res.value?.message, -// let channel = res.value?.channel { -// let messageWrapper = MessageWrapper(channel: channel, message: message) -// if let encodedData = try? JSONEncoder.stream.encode(messageWrapper), -// let encodedString = String(data: encodedData, encoding: .utf8) { -// let storedMessages = sharedDefaults.stringArray(forKey: "messageQueue") ?? [] -// sharedDefaults.setValue(storedMessages + [encodedString], forKey: "messageQueue") -// -// // Modify the notification content here... -// self?.bestAttemptContent?.title = "[modified] \(self?.bestAttemptContent?.title ?? "")" -// contentHandler(self?.bestAttemptContent ?? request.content) -// } -// Client.shared.disconnect() -// } -// } -// } - } - - override func serviceExtensionTimeWillExpire() { - if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent { - contentHandler(bestAttemptContent) - } - } -} - -//public struct MessageWrapper: Encodable { -// private enum CodingKeys: String, CodingKey { -// case id -// case channel -// case type -// case user -// case created = "created_at" -// case updated = "updated_at" -// case text -// case command -// case args -// case attachments -// case parentId = "parent_id" -// case showReplyInChannel = "show_in_channel" -// case mentionedUsers = "mentioned_users" -// } -// -// init(channel: Channel, message: Message) { -// id = message.id -// type = message.type -// user = message.user -// created = message.created -// updated = message.updated -// text = message.text -// command = message.command -// args = message.args -// attachments = message.attachments -// parentId = message.parentId -// showReplyInChannel = message.showReplyInChannel -// mentionedUsers = message.mentionedUsers -// extraData = message.extraData -// self.channel = ChannelWrapper(channel: channel) -// } -// -// /// A message id. -// public let id: String -// /// The channel cid. -// public let channel: ChannelWrapper? -// /// A message type (see `MessageType`). -// public let type: MessageType -// /// A user (see `User`). -// public let user: User -// /// A created date. -// public let created: Date -// /// A updated date. -// public let updated: Date -// /// A text. -// public let text: String -// /// A used command name. -// public let command: String? -// /// A used command args. -// public let args: String? -// /// Attachments (see `Attachment`). -// public let attachments: [Attachment] -// /// A parent message id. -// public let parentId: String? -// /// Check if this reply message needs to show in the channel. -// public let showReplyInChannel: Bool -// /// Mentioned users (see `User`). -// public let mentionedUsers: [User] -// /// An extra data for the message. -// public let extraData: Codable? -//} -// -//public struct ChannelWrapper: Encodable { -// /// Coding keys for the encoding. -// private enum CodingKeys: String, CodingKey { -// case id -// case cid -// case type -// case name -// case imageURL = "image" -// case members -// case lastMessageDate = "last_message_at" -// case createdBy = "created_by" -// case created = "created_at" -// case deleted = "deleted_at" -// case frozen -// } -// -// init(channel: Channel) { -// id = channel.id -// cid = channel.cid -// type = channel.type -// name = channel.name -// imageURL = channel.imageURL -// lastMessageDate = channel.lastMessageDate -// created = channel.created -// deleted = channel.deleted -// createdBy = channel.createdBy -// config = channel.config -// frozen = channel.frozen -// extraData = channel.extraData -// } -// -// /// A channel id. -// public let id: String -// /// A channel type + id. -// public let cid: ChannelId -// /// A channel type. -// public let type: ChannelType -// /// A channel name. -// public let name: String? -// /// An image of the channel. -// public let imageURL: URL? -// /// The last message date. -// public let lastMessageDate: Date? -// /// A channel created date. -// public let created: Date -// /// A channel deleted date. -// public let deleted: Date? -// /// A creator of the channel. -// public let createdBy: User? -// /// A config. -// public let config: Channel.Config -// /// Checks if the channel is frozen. -// public let frozen: Bool -// /// A list of user ids of the channel members. -// public let members = Set() -// /// An extra data for the channel. -// public let extraData: Codable? -//} diff --git a/packages/stream_chat_flutter/example/ios/Notifications/Notifications.entitlements b/packages/stream_chat_flutter/example/ios/Notifications/Notifications.entitlements deleted file mode 100644 index e5b71890..00000000 --- a/packages/stream_chat_flutter/example/ios/Notifications/Notifications.entitlements +++ /dev/null @@ -1,10 +0,0 @@ - - - - - com.apple.security.application-groups - - group.io.getstream.flutter - - - diff --git a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj b/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj index 1e7527eb..1aec2aa0 100644 --- a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj @@ -7,39 +7,15 @@ objects = { /* Begin PBXBuildFile section */ - 0BC14C50242B5A7A0028DE94 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BC14C4F242B5A7A0028DE94 /* NotificationService.swift */; }; - 0BC14C54242B5A7A0028DE94 /* Notifications.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 0BC14C4D242B5A7A0028DE94 /* Notifications.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 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 */; }; - 7DEC2743BD66C91B700A3B97 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BB2E5E4E236267EDF0D8817 /* Pods_Runner.framework */; }; 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 */; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - 0BC14C52242B5A7A0028DE94 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 97C146E61CF9000F007C117D /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0BC14C4C242B5A7A0028DE94; - remoteInfo = Notifications; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXCopyFilesBuildPhase section */ - 0BC14C55242B5A7A0028DE94 /* Embed App Extensions */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 13; - files = ( - 0BC14C54242B5A7A0028DE94 /* Notifications.appex in Embed App Extensions */, - ); - name = "Embed App Extensions"; - runOnlyForDeploymentPostprocessing = 0; - }; 9705A1C41CF9048500538489 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -53,21 +29,12 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 0BC14C4D242B5A7A0028DE94 /* Notifications.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Notifications.appex; sourceTree = BUILT_PRODUCTS_DIR; }; - 0BC14C4F242B5A7A0028DE94 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = ""; }; - 0BC14C51242B5A7A0028DE94 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 0BC14C5A242B5ED90028DE94 /* Notifications.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Notifications.entitlements; sourceTree = ""; }; - 0BC14C5B242B5FF50028DE94 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; 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 = ""; }; - 2452A9E77396497EB4CF3072 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 68F846A6DB42D92393F5F7E0 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; 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 = ""; }; - 7BF51EE28C89025F73A5211F /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - 8BB2E5E4E236267EDF0D8817 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 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; }; @@ -78,34 +45,16 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 0BC14C4A242B5A7A0028DE94 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 97C146EB1CF9000F007C117D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 7DEC2743BD66C91B700A3B97 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 0BC14C4E242B5A7A0028DE94 /* Notifications */ = { - isa = PBXGroup; - children = ( - 0BC14C5A242B5ED90028DE94 /* Notifications.entitlements */, - 0BC14C4F242B5A7A0028DE94 /* NotificationService.swift */, - 0BC14C51242B5A7A0028DE94 /* Info.plist */, - ); - path = Notifications; - sourceTree = ""; - }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -120,12 +69,9 @@ 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( - 97C146F01CF9000F007C117D /* Runner */, 9740EEB11CF90186004384FC /* Flutter */, - 0BC14C4E242B5A7A0028DE94 /* Notifications */, + 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - CF168B61BAB91958681C7C21 /* Pods */, - BC09A38346C8B2CD72199469 /* Frameworks */, ); sourceTree = ""; }; @@ -133,7 +79,6 @@ isa = PBXGroup; children = ( 97C146EE1CF9000F007C117D /* Runner.app */, - 0BC14C4D242B5A7A0028DE94 /* Notifications.appex */, ); name = Products; sourceTree = ""; @@ -141,12 +86,10 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( - 0BC14C5B242B5FF50028DE94 /* Runner.entitlements */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97C147021CF9000F007C117D /* Info.plist */, - 97C146F11CF9000F007C117D /* Supporting Files */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, @@ -155,69 +98,23 @@ path = Runner; sourceTree = ""; }; - 97C146F11CF9000F007C117D /* Supporting Files */ = { - isa = PBXGroup; - children = ( - ); - name = "Supporting Files"; - sourceTree = ""; - }; - BC09A38346C8B2CD72199469 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 8BB2E5E4E236267EDF0D8817 /* Pods_Runner.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - CF168B61BAB91958681C7C21 /* Pods */ = { - isa = PBXGroup; - children = ( - 2452A9E77396497EB4CF3072 /* Pods-Runner.debug.xcconfig */, - 7BF51EE28C89025F73A5211F /* Pods-Runner.release.xcconfig */, - 68F846A6DB42D92393F5F7E0 /* Pods-Runner.profile.xcconfig */, - ); - path = Pods; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 0BC14C4C242B5A7A0028DE94 /* Notifications */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0BC14C59242B5A7A0028DE94 /* Build configuration list for PBXNativeTarget "Notifications" */; - buildPhases = ( - 0BC14C49242B5A7A0028DE94 /* Sources */, - 0BC14C4A242B5A7A0028DE94 /* Frameworks */, - 0BC14C4B242B5A7A0028DE94 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Notifications; - productName = Notifications; - productReference = 0BC14C4D242B5A7A0028DE94 /* Notifications.appex */; - productType = "com.apple.product-type.app-extension"; - }; 97C146ED1CF9000F007C117D /* Runner */ = { isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 9E02B5C38D6CC2455D9E48E9 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 5702861DACEDB848A3E454E8 /* [CP] Embed Pods Frameworks */, - 0BC14C55242B5A7A0028DE94 /* Embed App Extensions */, ); buildRules = ( ); dependencies = ( - 0BC14C53242B5A7A0028DE94 /* PBXTargetDependency */, ); name = Runner; productName = Runner; @@ -230,25 +127,17 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 1140; LastUpgradeCheck = 1020; - ORGANIZATIONNAME = "The Chromium Authors"; + ORGANIZATIONNAME = ""; TargetAttributes = { - 0BC14C4C242B5A7A0028DE94 = { - CreatedOnToolsVersion = 11.4; - DevelopmentTeam = EHV7XZLAHA; - ProvisioningStyle = Manual; - }; 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = EHV7XZLAHA; LastSwiftMigration = 1100; - ProvisioningStyle = Manual; }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 3.2"; + compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -261,19 +150,11 @@ projectRoot = ""; targets = ( 97C146ED1CF9000F007C117D /* Runner */, - 0BC14C4C242B5A7A0028DE94 /* Notifications */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 0BC14C4B242B5A7A0028DE94 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 97C146EC1CF9000F007C117D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -302,84 +183,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 5702861DACEDB848A3E454E8 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/Starscream-framework/Starscream.framework", - "${BUILT_PRODUCTS_DIR}/StreamChatClient-framework/StreamChatClient.framework", - "${BUILT_PRODUCTS_DIR}/DKImagePickerController/DKImagePickerController.framework", - "${BUILT_PRODUCTS_DIR}/DKPhotoGallery/DKPhotoGallery.framework", - "${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework", - "${PODS_ROOT}/../Flutter/Flutter.framework", - "${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework", - "${BUILT_PRODUCTS_DIR}/PromisesObjC/FBLPromises.framework", - "${BUILT_PRODUCTS_DIR}/Protobuf/Protobuf.framework", - "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", - "${BUILT_PRODUCTS_DIR}/SwiftyGif/SwiftyGif.framework", - "${BUILT_PRODUCTS_DIR}/esys_flutter_share/esys_flutter_share.framework", - "${BUILT_PRODUCTS_DIR}/file_picker/file_picker.framework", - "${BUILT_PRODUCTS_DIR}/flutter_apns/flutter_apns.framework", - "${BUILT_PRODUCTS_DIR}/flutter_app_badger/flutter_app_badger.framework", - "${BUILT_PRODUCTS_DIR}/flutter_keyboard_visibility/flutter_keyboard_visibility.framework", - "${BUILT_PRODUCTS_DIR}/flutter_local_notifications/flutter_local_notifications.framework", - "${BUILT_PRODUCTS_DIR}/flutter_secure_storage/flutter_secure_storage.framework", - "${BUILT_PRODUCTS_DIR}/image_gallery_saver/image_gallery_saver.framework", - "${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework", - "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", - "${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework", - "${BUILT_PRODUCTS_DIR}/photo_manager/photo_manager.framework", - "${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework", - "${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework", - "${BUILT_PRODUCTS_DIR}/sqlite3/sqlite3.framework", - "${BUILT_PRODUCTS_DIR}/sqlite3_flutter_libs/sqlite3_flutter_libs.framework", - "${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework", - "${BUILT_PRODUCTS_DIR}/video_compress/video_compress.framework", - "${BUILT_PRODUCTS_DIR}/video_player/video_player.framework", - "${BUILT_PRODUCTS_DIR}/wakelock/wakelock.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Starscream.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/StreamChatClient.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DKImagePickerController.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DKPhotoGallery.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBLPromises.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyGif.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/esys_flutter_share.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/file_picker.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_apns.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_app_badger.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_keyboard_visibility.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_local_notifications.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_secure_storage.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_gallery_saver.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/photo_manager.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqlite3.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqlite3_flutter_libs.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_compress.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_player.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/wakelock.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -394,39 +197,9 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - 9E02B5C38D6CC2455D9E48E9 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 0BC14C49242B5A7A0028DE94 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0BC14C50242B5A7A0028DE94 /* NotificationService.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 97C146EA1CF9000F007C117D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -438,14 +211,6 @@ }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - 0BC14C53242B5A7A0028DE94 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0BC14C4C242B5A7A0028DE94 /* Notifications */; - targetProxy = 0BC14C52242B5A7A0028DE94 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - /* Begin PBXVariantGroup section */ 97C146FA1CF9000F007C117D /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -466,90 +231,6 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - 0BC14C56242B5A7A0028DE94 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_ENTITLEMENTS = Notifications/Notifications.entitlements; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = EHV7XZLAHA; - ENABLE_BITCODE = NO; - GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = Notifications/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.3; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = io.getstream.flutter.Notifications; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match AdHoc io.getstream.flutter.Notifications"; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 0BC14C57242B5A7A0028DE94 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_ENTITLEMENTS = Notifications/Notifications.entitlements; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = EHV7XZLAHA; - ENABLE_BITCODE = NO; - GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = Notifications/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.3; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = io.getstream.flutter.Notifications; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match AdHoc io.getstream.flutter.Notifications"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - 0BC14C58242B5A7A0028DE94 /* Profile */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_ENTITLEMENTS = Notifications/Notifications.entitlements; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = EHV7XZLAHA; - ENABLE_BITCODE = NO; - GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = Notifications/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.3; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = io.getstream.flutter.Notifications; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match AdHoc io.getstream.flutter.Notifications"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Profile; - }; 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; buildSettings = { @@ -591,7 +272,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -604,29 +285,22 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = EHV7XZLAHA; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = io.getstream.flutter; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match AdHoc io.getstream.flutter"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; @@ -680,7 +354,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -729,7 +403,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -743,29 +417,22 @@ isa = XCBuildConfiguration; baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = EHV7XZLAHA; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = io.getstream.flutter; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match AdHoc io.getstream.flutter"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -777,29 +444,22 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = EHV7XZLAHA; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = io.getstream.flutter; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match AdHoc io.getstream.flutter"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; @@ -809,16 +469,6 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 0BC14C59242B5A7A0028DE94 /* Build configuration list for PBXNativeTarget "Notifications" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0BC14C56242B5A7A0028DE94 /* Debug */, - 0BC14C57242B5A7A0028DE94 /* Release */, - 0BC14C58242B5A7A0028DE94 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Notifications.xcscheme b/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Notifications.xcscheme deleted file mode 100644 index 9387f0d0..00000000 --- a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Notifications.xcscheme +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index fb2dffc4..a28140cf 100644 --- a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -27,6 +27,8 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + - - + + + + - - diff --git a/packages/stream_chat_flutter/example/ios/Runner/AppDelegate.swift b/packages/stream_chat_flutter/example/ios/Runner/AppDelegate.swift index e024c1ef..70693e4a 100644 --- a/packages/stream_chat_flutter/example/ios/Runner/AppDelegate.swift +++ b/packages/stream_chat_flutter/example/ios/Runner/AppDelegate.swift @@ -3,43 +3,11 @@ import Flutter @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { - let sharedDefaults = UserDefaults(suiteName: "group.io.getstream.flutter") - - override func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? - ) -> Bool { - if let messageQueue = sharedDefaults?.stringArray(forKey: "messageQueue") { - UserDefaults.standard.setValue(messageQueue, forKey: "flutter.messageQueue") - sharedDefaults?.removeObject(forKey: "messageQueue") - } - - if #available(iOS 10.0, *) { - UNUserNotificationCenter.current().delegate = self - } - - GeneratedPluginRegistrant.register(with: self) - return super.application(application, didFinishLaunchingWithOptions: launchOptions) - } - - override func applicationDidEnterBackground(_ application: UIApplication) { - if let apiKey = UserDefaults.standard.string(forKey: "flutter.KEY_API_KEY") { - sharedDefaults?.setValue(apiKey, forKey: "KEY_API_KEY") - } - - if let token = UserDefaults.standard.string(forKey: "flutter.KEY_TOKEN") { - sharedDefaults?.setValue(token, forKey: "KEY_TOKEN") - } - - if let userId = UserDefaults.standard.string(forKey: "flutter.KEY_USER_ID") { - sharedDefaults?.setValue(userId, forKey: "KEY_USER_ID") - } - } - - override func applicationWillEnterForeground(_ application: UIApplication) { - if let messageQueue = sharedDefaults?.stringArray(forKey: "messageQueue") { - UserDefaults.standard.setValue(messageQueue, forKey: "flutter.messageQueue") - sharedDefaults?.removeObject(forKey: "messageQueue") - } - } + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } } diff --git a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png index 6286cc9f..dc9ada47 100644 Binary files a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png index 95d13de0..28c6bf03 100644 Binary files a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png index 5ad80187..2ccbfd96 100644 Binary files a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png index 6e6c85b6..f091b6b0 100644 Binary files a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png index 6f26f228..4cde1211 100644 Binary files a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png index 7fe870d9..d0ef06e7 100644 Binary files a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png index 3ab319af..dcdc2306 100644 Binary files a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png index 5ad80187..2ccbfd96 100644 Binary files a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png index 0a94384d..c8f9ed8f 100644 Binary files a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png index f049762f..a6d6b860 100644 Binary files a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png index f049762f..a6d6b860 100644 Binary files a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png index b51e00a7..75b2d164 100644 Binary files a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png index 8c497308..c4df70d3 100644 Binary files a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png index c59c5739..6a84f41e 100644 Binary files a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png index b29e2f05..d0e1f585 100644 Binary files a/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/packages/stream_chat_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/packages/stream_chat_flutter/example/ios/Runner/Info.plist b/packages/stream_chat_flutter/example/ios/Runner/Info.plist index 7e63f46d..a74aeed0 100644 --- a/packages/stream_chat_flutter/example/ios/Runner/Info.plist +++ b/packages/stream_chat_flutter/example/ios/Runner/Info.plist @@ -11,7 +11,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - ChatSample + example CFBundlePackageType APPL CFBundleShortVersionString @@ -22,19 +22,6 @@ $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS - NSAppleMusicUsageDescription - Used to send message attachments - NSCameraUsageDescription - Used to send message attachments - NSMicrophoneUsageDescription - Used to send message attachments - NSPhotoLibraryUsageDescription - Used to send message attachments - UIBackgroundModes - - fetch - remote-notification - UILaunchStoryboardName LaunchScreen UIMainStoryboardFile @@ -56,9 +43,21 @@ UIBackgroundModes - remote-notification + fetch + remote-notification - UIViewControllerBasedStatusBarAppearance - + NSPhotoLibraryUsageDescription + Explain why your app uses photo library + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + + NSCameraUsageDescription + Explain why your app uses the camera + + NSMicrophoneUsageDescription + Explain why your app uses the mic diff --git a/packages/stream_chat_flutter/example/ios/Runner/Runner-Bridging-Header.h b/packages/stream_chat_flutter/example/ios/Runner/Runner-Bridging-Header.h index 7335fdf9..308a2a56 100644 --- a/packages/stream_chat_flutter/example/ios/Runner/Runner-Bridging-Header.h +++ b/packages/stream_chat_flutter/example/ios/Runner/Runner-Bridging-Header.h @@ -1 +1 @@ -#import "GeneratedPluginRegistrant.h" \ No newline at end of file +#import "GeneratedPluginRegistrant.h" diff --git a/packages/stream_chat_flutter/example/ios/Runner/Runner.entitlements b/packages/stream_chat_flutter/example/ios/Runner/Runner.entitlements deleted file mode 100644 index 433bdfe0..00000000 --- a/packages/stream_chat_flutter/example/ios/Runner/Runner.entitlements +++ /dev/null @@ -1,12 +0,0 @@ - - - - - aps-environment - development - com.apple.security.application-groups - - group.io.getstream.flutter - - - diff --git a/packages/stream_chat_flutter/example/ios/fastlane/Appfile b/packages/stream_chat_flutter/example/ios/fastlane/Appfile deleted file mode 100644 index 18030630..00000000 --- a/packages/stream_chat_flutter/example/ios/fastlane/Appfile +++ /dev/null @@ -1,6 +0,0 @@ -# app_identifier("[[APP_IDENTIFIER]]") # The bundle identifier of your app -# apple_id("[[APPLE_ID]]") # Your Apple email address - - -# For more information about the Appfile, see: -# https://docs.fastlane.tools/advanced/#appfile diff --git a/packages/stream_chat_flutter/example/ios/fastlane/Fastfile b/packages/stream_chat_flutter/example/ios/fastlane/Fastfile deleted file mode 100644 index ec2adc81..00000000 --- a/packages/stream_chat_flutter/example/ios/fastlane/Fastfile +++ /dev/null @@ -1,46 +0,0 @@ -fastlane_version "2.162.0" -default_platform :ios - -before_all do - if is_ci - setup_ci() - end -end - -desc "Installs all Certs and Profiles necessary for development and ad-hoc" -lane :match_me do - match( - type: "adhoc", - app_identifier: [ - "io.getstream.flutter", - "io.getstream.flutter.Notifications" - ], - readonly: is_ci, - force_for_new_devices: true - ) -end - -platform :ios do - desc "Deploy build to Firebase" - lane :deploy_to_firebase do - match_me - - gym( - workspace: "./Runner.xcworkspace", - scheme: "Runner", - export_method: "ad-hoc", - export_options: "./fastlane/beta_gym_export_options.plist", - silent: true, - clean: true, - include_symbols: true, - output_directory: "./dist" - ) - - message = changelog_from_git_commits(commits_count: 10) - - firebase_app_distribution( - app: "1:674907137625:ios:cafb9fb076a453c4d7f348", - groups: "ios-stream-testers" - ) - end -end \ No newline at end of file diff --git a/packages/stream_chat_flutter/example/ios/fastlane/Matchfile b/packages/stream_chat_flutter/example/ios/fastlane/Matchfile deleted file mode 100644 index cc976de1..00000000 --- a/packages/stream_chat_flutter/example/ios/fastlane/Matchfile +++ /dev/null @@ -1,16 +0,0 @@ -git_url("https://github.com/GetStream/ios-certificates") - -storage_mode("git") - -username("salvatore@getstream.io") - -team_id("EHV7XZLAHA") - -# app_identifier(["tools.fastlane.app", "tools.fastlane.app2"]) - -# username("user@fastlane.tools") # Your Apple Developer Portal username - -# For all available options run `fastlane match --help` -# Remove the # in the beginning of the line to enable the other options - -# The docs are available on https://docs.fastlane.tools/actions/match diff --git a/packages/stream_chat_flutter/example/ios/fastlane/Pluginfile b/packages/stream_chat_flutter/example/ios/fastlane/Pluginfile deleted file mode 100644 index b18539bc..00000000 --- a/packages/stream_chat_flutter/example/ios/fastlane/Pluginfile +++ /dev/null @@ -1,5 +0,0 @@ -# Autogenerated by fastlane -# -# Ensure this file is checked in to source control! - -gem 'fastlane-plugin-firebase_app_distribution' diff --git a/packages/stream_chat_flutter/example/ios/fastlane/README.md b/packages/stream_chat_flutter/example/ios/fastlane/README.md deleted file mode 100644 index e464ef24..00000000 --- a/packages/stream_chat_flutter/example/ios/fastlane/README.md +++ /dev/null @@ -1,37 +0,0 @@ -fastlane documentation -================ -# Installation - -Make sure you have the latest version of the Xcode command line tools installed: - -``` -xcode-select --install -``` - -Install _fastlane_ using -``` -[sudo] gem install fastlane -NV -``` -or alternatively using `brew install fastlane` - -# Available Actions -### match_me -``` -fastlane match_me -``` -Installs all Certs and Profiles necessary for development and ad-hoc - ----- - -## iOS -### ios deploy_to_firebase -``` -fastlane ios deploy_to_firebase -``` -Deploy build to Firebase - ----- - -This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run. -More information about fastlane can be found on [fastlane.tools](https://fastlane.tools). -The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools). diff --git a/packages/stream_chat_flutter/example/ios/fastlane/beta_gym_export_options.plist b/packages/stream_chat_flutter/example/ios/fastlane/beta_gym_export_options.plist deleted file mode 100644 index 53c74098..00000000 --- a/packages/stream_chat_flutter/example/ios/fastlane/beta_gym_export_options.plist +++ /dev/null @@ -1,15 +0,0 @@ - - - - - iCloudContainerEnvironment - Development - provisioningProfiles - - io.getstream.flutter - match AdHoc io.getstream.flutter - io.getstream.flutter.Notifications - match AdHoc io.getstream.flutter.Notifications - - - \ No newline at end of file diff --git a/packages/stream_chat_flutter/example/ios/fastlane/report.xml b/packages/stream_chat_flutter/example/ios/fastlane/report.xml deleted file mode 100644 index b6e7bdcb..00000000 --- a/packages/stream_chat_flutter/example/ios/fastlane/report.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/stream_chat_flutter/example/lib/advanced_options_page.dart b/packages/stream_chat_flutter/example/lib/advanced_options_page.dart deleted file mode 100644 index ee505148..00000000 --- a/packages/stream_chat_flutter/example/lib/advanced_options_page.dart +++ /dev/null @@ -1,328 +0,0 @@ -import 'package:example/routes/routes.dart'; -import 'package:example/stream_version.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_secure_storage/flutter_secure_storage.dart'; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; - -import 'choose_user_page.dart'; -import 'main.dart'; - -class AdvancedOptionsPage extends StatefulWidget { - @override - _AdvancedOptionsPageState createState() => _AdvancedOptionsPageState(); -} - -class _AdvancedOptionsPageState extends State { - final _formKey = GlobalKey(); - - final TextEditingController _apiKeyController = TextEditingController(); - String _apiKeyError; - - final TextEditingController _userIdController = TextEditingController(); - String _userIdError; - - final TextEditingController _userTokenController = TextEditingController(); - String _userTokenError; - - final TextEditingController _usernameController = TextEditingController(); - - bool loading = false; - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - resizeToAvoidBottomPadding: false, - appBar: AppBar( - backgroundColor: StreamChatTheme.of(context).colorTheme.white, - elevation: 1, - centerTitle: true, - brightness: Theme.of(context).brightness, - title: Text( - 'Advanced Options', - style: StreamChatTheme.of(context) - .textTheme - .headlineBold - .copyWith(color: StreamChatTheme.of(context).colorTheme.black), - ), - leading: IconButton( - icon: StreamSvgIcon.left( - color: StreamChatTheme.of(context).colorTheme.black, - ), - onPressed: () { - Navigator.pop(context); - }, - ), - ), - body: Builder( - builder: (context) { - return Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 0), - child: Form( - key: _formKey, - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - TextFormField( - controller: _apiKeyController, - onChanged: (_) { - if (_apiKeyError != null) { - setState(() { - _apiKeyError = null; - }); - } - }, - validator: (value) { - if (value.isEmpty) { - setState(() { - _apiKeyError = 'Please enter the Chat API Key'; - }); - return _apiKeyError; - } - return null; - }, - style: TextStyle( - fontSize: 14, - color: StreamChatTheme.of(context).colorTheme.black, - ), - decoration: InputDecoration( - errorStyle: TextStyle(height: 0, fontSize: 0), - labelStyle: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - color: _apiKeyError != null - ? StreamChatTheme.of(context).colorTheme.accentRed - : StreamChatTheme.of(context).colorTheme.grey, - ), - border: UnderlineInputBorder( - borderRadius: BorderRadius.circular(8), - borderSide: BorderSide.none, - ), - fillColor: - StreamChatTheme.of(context).colorTheme.whiteSmoke, - filled: true, - labelText: - 'Chat API Key ${_apiKeyError != null ? ': $_apiKeyError' : ''}', - ), - textInputAction: TextInputAction.next, - ), - SizedBox(height: 8), - TextFormField( - controller: _userIdController, - onChanged: (_) { - if (_userIdError != null) { - setState(() { - _userIdError = null; - }); - } - }, - validator: (value) { - if (value.isEmpty) { - setState(() { - _userIdError = 'Please enter the User ID'; - }); - return _userIdError; - } - return null; - }, - style: TextStyle( - fontSize: 14, - color: StreamChatTheme.of(context).colorTheme.black, - ), - textInputAction: TextInputAction.next, - decoration: InputDecoration( - errorStyle: TextStyle(height: 0, fontSize: 0), - labelStyle: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14, - color: _userIdError != null - ? StreamChatTheme.of(context).colorTheme.accentRed - : StreamChatTheme.of(context).colorTheme.grey, - ), - border: UnderlineInputBorder( - borderRadius: BorderRadius.circular(8), - borderSide: BorderSide.none, - ), - fillColor: - StreamChatTheme.of(context).colorTheme.whiteSmoke, - filled: true, - labelText: - 'User ID ${_userIdError != null ? ': $_userIdError' : ''}', - ), - ), - SizedBox(height: 8), - TextFormField( - onChanged: (_) { - if (_userTokenError != null) { - setState(() { - _userTokenError = null; - }); - } - }, - controller: _userTokenController, - validator: (value) { - if (value.isEmpty) { - setState(() { - _userTokenError = 'Please enter the user token'; - }); - return _userTokenError; - } - return null; - }, - style: TextStyle( - fontSize: 14, - color: StreamChatTheme.of(context).colorTheme.black, - ), - textInputAction: TextInputAction.next, - decoration: InputDecoration( - errorStyle: TextStyle(height: 0, fontSize: 0), - labelStyle: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14, - color: _userTokenError != null - ? StreamChatTheme.of(context).colorTheme.accentRed - : StreamChatTheme.of(context).colorTheme.grey, - ), - border: UnderlineInputBorder( - borderRadius: BorderRadius.circular(8), - borderSide: BorderSide.none, - ), - fillColor: - StreamChatTheme.of(context).colorTheme.whiteSmoke, - filled: true, - labelText: - 'User Token ${_userTokenError != null ? ': $_userTokenError' : ''}', - ), - ), - SizedBox(height: 8), - TextFormField( - controller: _usernameController, - textInputAction: TextInputAction.done, - decoration: InputDecoration( - labelStyle: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - color: StreamChatTheme.of(context).colorTheme.grey, - ), - border: UnderlineInputBorder( - borderRadius: BorderRadius.circular(8), - borderSide: BorderSide.none, - ), - fillColor: - StreamChatTheme.of(context).colorTheme.whiteSmoke, - filled: true, - labelText: 'Username (optional)', - ), - ), - Spacer(), - RaisedButton( - color: Theme.of(context).brightness == Brightness.light - ? StreamChatTheme.of(context).colorTheme.accentBlue - : Colors.white, - elevation: 0, - padding: const EdgeInsets.symmetric(vertical: 16), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(26), - ), - child: Text( - 'Login', - style: TextStyle( - fontSize: 16, - color: Theme.of(context).brightness != Brightness.light - ? StreamChatTheme.of(context).colorTheme.accentBlue - : Colors.white, - ), - ), - onPressed: () async { - if (loading) { - return; - } - if (_formKey.currentState.validate()) { - final apiKey = _apiKeyController.text; - final userId = _userIdController.text; - final userToken = _userTokenController.text; - final username = _usernameController.text; - - loading = true; - showDialog( - barrierDismissible: false, - context: context, - barrierColor: - StreamChatTheme.of(context).colorTheme.overlay, - builder: (context) => Center( - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16), - color: StreamChatTheme.of(context) - .colorTheme - .white, - ), - height: 100, - width: 100, - child: Center( - child: CircularProgressIndicator(), - ), - ), - ), - ); - - final client = StreamChatClient( - apiKey, - logLevel: Level.INFO, - )..chatPersistenceClient = chatPersistentClient; - - try { - await client.setUser( - User(id: userId, extraData: { - 'name': username, - }), - userToken, - ); - - final secureStorage = FlutterSecureStorage(); - secureStorage.write( - key: kStreamApiKey, - value: apiKey, - ); - secureStorage.write( - key: kStreamUserId, - value: userId, - ); - secureStorage.write( - key: kStreamToken, - value: userToken, - ); - } catch (e) { - var errorText = 'Error connecting, retry'; - if (e is Map) { - errorText = e['message'] ?? errorText; - } - Navigator.pop(context); - setState(() { - _apiKeyError = errorText; - }); - loading = false; - await client.disconnect(); - return; - } - loading = false; - await Navigator.pushNamedAndRemoveUntil( - context, - Routes.APP, - ModalRoute.withName(Routes.APP), - arguments: client, - ); - } - }, - ), - StreamVersion(), - ], - ), - ), - ); - }, - ), - ); - } -} diff --git a/packages/stream_chat_flutter/example/lib/chat_info_screen.dart b/packages/stream_chat_flutter/example/lib/chat_info_screen.dart deleted file mode 100644 index a6b14dec..00000000 --- a/packages/stream_chat_flutter/example/lib/chat_info_screen.dart +++ /dev/null @@ -1,600 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:jiffy/jiffy.dart'; - -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; - -import 'main.dart'; -import 'routes/routes.dart'; - -/// Detail screen for a 1:1 chat correspondence -class ChatInfoScreen extends StatefulWidget { - /// User in consideration - final User user; - - const ChatInfoScreen({Key key, this.user}) : super(key: key); - - @override - _ChatInfoScreenState createState() => _ChatInfoScreenState(); -} - -class _ChatInfoScreenState extends State { - @override - Widget build(BuildContext context) { - final channel = StreamChannel.of(context).channel; - return Scaffold( - backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - body: ListView( - children: [ - _buildUserHeader(), - Container( - height: 8.0, - color: StreamChatTheme.of(context).colorTheme.greyGainsboro, - ), - _buildOptionListTiles(), - Container( - height: 8.0, - color: StreamChatTheme.of(context).colorTheme.greyGainsboro, - ), - if ([ - 'admin', - 'owner', - ].contains(channel.state.members - .firstWhere((m) => m.userId == channel.client.state.user.id, - orElse: () => null) - ?.role)) - _buildDeleteListTile(), - ], - ), - ); - } - - Widget _buildUserHeader() { - return Material( - color: StreamChatTheme.of(context).colorTheme.whiteSnow, - child: SafeArea( - child: Stack( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(16.0), - child: UserAvatar( - user: widget.user, - constraints: BoxConstraints( - maxWidth: 72.0, - maxHeight: 72.0, - ), - borderRadius: BorderRadius.circular(36.0), - showOnlineStatus: false, - ), - ), - //SizedBox(height: 4.0), - Text( - widget.user.name, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), - ), - SizedBox(height: 7.0), - _buildConnectedTitleState(), - SizedBox(height: 15.0), - OptionListTile( - title: '@${widget.user.id}', - tileColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - trailing: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Text( - widget.user.name, - style: TextStyle( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5), - fontSize: 16.0), - ), - ), - onTap: () {}, - ), - ], - ), - Positioned( - top: 21, - left: 16, - child: InkWell( - child: StreamSvgIcon.left( - color: StreamChatTheme.of(context).colorTheme.black, - ), - onTap: () { - Navigator.of(context).pop(); - }, - ), - ), - ], - ), - ), - ); - } - - Widget _buildOptionListTiles() { - var channel = StreamChannel.of(context); - - return Column( - children: [ - // _OptionListTile( - // title: 'Notifications', - // leading: StreamSvgIcon.Icon_notification( - // size: 24.0, - // color: StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5), - // ), - // trailing: CupertinoSwitch( - // value: true, - // onChanged: (val) {}, - // ), - // onTap: () {}, - // ), - StreamBuilder( - stream: StreamChannel.of(context).channel.isMutedStream, - builder: (context, snapshot) { - return OptionListTile( - tileColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - title: 'Mute user', - titleTextStyle: StreamChatTheme.of(context).textTheme.body, - leading: Padding( - padding: const EdgeInsets.symmetric(horizontal: 22.0), - child: StreamSvgIcon.mute( - size: 24.0, - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5), - ), - ), - trailing: snapshot.data == null - ? CircularProgressIndicator() - : CupertinoSwitch( - value: snapshot.data, - onChanged: (val) { - if (snapshot.data) { - channel.channel.unmute(); - } else { - channel.channel.mute(); - } - }, - ), - onTap: () {}, - ); - }), - // _OptionListTile( - // title: 'Block User', - // leading: StreamSvgIcon.Icon_user_delete( - // size: 24.0, - // color: StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5), - // ), - // trailing: CupertinoSwitch( - // value: widget.user.banned, - // onChanged: (val) { - // if (widget.user.banned) { - // channel.channel.shadowBan(widget.user.id, {}); - // } else { - // channel.channel.unbanUser(widget.user.id); - // } - // }, - // ), - // onTap: () {}, - // ), - OptionListTile( - title: 'Photos & Videos', - tileColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - titleTextStyle: StreamChatTheme.of(context).textTheme.body, - leading: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: StreamSvgIcon.pictures( - size: 36.0, - color: - StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5), - ), - ), - trailing: StreamSvgIcon.right( - color: StreamChatTheme.of(context).colorTheme.grey, - ), - onTap: () { - final channel = StreamChannel.of(context).channel; - - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => StreamChannel( - channel: channel, - child: MessageSearchBloc( - child: ChannelMediaDisplayScreen( - sortOptions: [ - SortOption( - 'created_at', - direction: SortOption.ASC, - ), - ], - paginationParams: PaginationParams(limit: 20), - onShowMessage: (m, c) async { - final client = StreamChat.of(context).client; - final message = m; - final channel = client.channel( - c.type, - id: c.id, - ); - if (channel.state == null) { - await channel.watch(); - } - Navigator.pushNamed( - context, - Routes.CHANNEL_PAGE, - arguments: ChannelPageArgs( - channel: channel, - initialMessage: message, - ), - ); - }, - ), - ), - ), - ), - ); - }, - ), - OptionListTile( - title: 'Files', - tileColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - titleTextStyle: StreamChatTheme.of(context).textTheme.body, - leading: Padding( - padding: const EdgeInsets.symmetric(horizontal: 18.0), - child: StreamSvgIcon.files( - size: 32.0, - color: - StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5), - ), - ), - trailing: StreamSvgIcon.right( - color: StreamChatTheme.of(context).colorTheme.grey, - ), - onTap: () { - final channel = StreamChannel.of(context).channel; - - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => StreamChannel( - channel: channel, - child: MessageSearchBloc( - child: ChannelFileDisplayScreen( - sortOptions: [ - SortOption( - 'created_at', - direction: SortOption.ASC, - ), - ], - paginationParams: PaginationParams(limit: 20), - ), - ), - ), - ), - ); - }, - ), - OptionListTile( - title: 'Shared groups', - tileColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - titleTextStyle: StreamChatTheme.of(context).textTheme.body, - leading: Padding( - padding: const EdgeInsets.symmetric(horizontal: 22.0), - child: StreamSvgIcon.Icon_group( - size: 24.0, - color: - StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5), - ), - ), - trailing: StreamSvgIcon.right( - color: StreamChatTheme.of(context).colorTheme.grey, - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => _SharedGroupsScreen( - StreamChat.of(context).user, widget.user))); - }, - ), - ], - ); - } - - Widget _buildDeleteListTile() { - return OptionListTile( - title: 'Delete Conversation', - tileColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - titleTextStyle: StreamChatTheme.of(context).textTheme.body.copyWith( - color: StreamChatTheme.of(context).colorTheme.accentRed, - ), - leading: Padding( - padding: const EdgeInsets.symmetric(horizontal: 22.0), - child: StreamSvgIcon.delete( - color: StreamChatTheme.of(context).colorTheme.accentRed, - size: 24.0, - ), - ), - onTap: () { - _showDeleteDialog(); - }, - titleColor: StreamChatTheme.of(context).colorTheme.accentRed, - ); - } - - void _showDeleteDialog() async { - final res = await showConfirmationDialog( - context, - title: 'Delete Conversation', - okText: 'DELETE', - question: 'Are you sure you want to delete this conversation?', - cancelText: 'CANCEL', - icon: StreamSvgIcon.delete( - color: StreamChatTheme.of(context).colorTheme.accentRed, - ), - ); - var channel = StreamChannel.of(context).channel; - if (res == true) { - await channel.delete().then((value) { - Navigator.pop(context); - }); - } - } - - Widget _buildConnectedTitleState() { - var alternativeWidget; - - final otherMember = widget.user; - - if (otherMember != null) { - if (otherMember.online) { - alternativeWidget = Text( - 'Online', - style: TextStyle( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5)), - ); - } else { - alternativeWidget = Text( - 'Last seen ${Jiffy(otherMember.lastActive).fromNow()}', - style: TextStyle( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5)), - ); - } - } - - return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - if (widget.user.online) - Material( - type: MaterialType.circle, - child: Container( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - constraints: BoxConstraints.tightFor( - width: 24, - height: 12, - ), - child: Material( - shape: CircleBorder(), - color: StreamChatTheme.of(context).colorTheme.accentGreen, - ), - ), - color: StreamChatTheme.of(context).colorTheme.white, - ), - alternativeWidget, - if (widget.user.online) - SizedBox( - width: 24.0, - ), - ], - ); - } -} - -class _SharedGroupsScreen extends StatefulWidget { - final User mainUser; - final User otherUser; - - _SharedGroupsScreen(this.mainUser, this.otherUser); - - @override - __SharedGroupsScreenState createState() => __SharedGroupsScreenState(); -} - -class __SharedGroupsScreenState extends State<_SharedGroupsScreen> { - @override - Widget build(BuildContext context) { - var chat = StreamChat.of(context); - - return Scaffold( - backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - appBar: AppBar( - brightness: Theme.of(context).brightness, - elevation: 1, - centerTitle: true, - title: Text( - 'Shared Groups', - style: TextStyle( - color: StreamChatTheme.of(context).colorTheme.black, - fontSize: 16.0), - ), - leading: Center( - child: InkWell( - onTap: () { - Navigator.of(context).pop(); - }, - child: Container( - child: StreamSvgIcon.left( - color: StreamChatTheme.of(context).colorTheme.black, - size: 24.0, - ), - width: 24.0, - height: 24.0, - ), - ), - ), - backgroundColor: StreamChatTheme.of(context).colorTheme.white, - ), - body: FutureBuilder>( - future: chat.client.queryChannels( - filter: { - r'$and': [ - { - 'members': { - r'$in': [widget.otherUser.id], - }, - }, - { - 'members': { - r'$in': [widget.mainUser.id], - }, - } - ], - }, - ), - builder: (context, snapshot) { - if (!snapshot.hasData) { - return Center( - child: CircularProgressIndicator(), - ); - } - - if (snapshot.data.isEmpty) { - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - StreamSvgIcon.message( - size: 136.0, - color: StreamChatTheme.of(context).colorTheme.greyGainsboro, - ), - SizedBox(height: 16.0), - Text( - 'No Shared Groups', - style: TextStyle( - fontSize: 14.0, - color: StreamChatTheme.of(context).colorTheme.black, - ), - ), - SizedBox(height: 8.0), - Text( - 'Group shared with User will appear here.', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 14.0, - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5), - ), - ), - ], - ), - ); - } - - return ListView.builder( - itemCount: snapshot.data.length, - itemBuilder: (context, position) { - return StreamChannel( - channel: snapshot.data[position], - child: _buildListTile(snapshot.data[position]), - ); - }, - ); - }, - ), - ); - } - - Widget _buildListTile(Channel channel) { - var extraData = channel.extraData; - var members = channel.state.members; - - var textStyle = TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold); - - return Container( - height: 64.0, - child: LayoutBuilder(builder: (context, constraints) { - String title; - if (extraData['name'] == null) { - final otherMembers = members.where( - (member) => member.userId != StreamChat.of(context).user.id); - if (otherMembers.isNotEmpty) { - final maxWidth = constraints.maxWidth; - final maxChars = maxWidth / textStyle.fontSize; - var currentChars = 0; - final currentMembers = []; - otherMembers.forEach((element) { - final newLength = currentChars + element.user.name.length; - if (newLength < maxChars) { - currentChars = newLength; - currentMembers.add(element); - } - }); - - final exceedingMembers = - otherMembers.length - currentMembers.length; - title = - '${currentMembers.map((e) => e.user.name).join(', ')} ${exceedingMembers > 0 ? '+ $exceedingMembers' : ''}'; - } else { - title = 'No title'; - } - } else { - title = extraData['name']; - } - - return Column( - children: [ - Expanded( - child: Row( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: ChannelImage( - channel: channel, - constraints: - BoxConstraints(maxWidth: 40.0, maxHeight: 40.0), - ), - ), - Expanded( - child: Text( - title, - style: textStyle, - )), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - '${channel.memberCount} members', - style: TextStyle( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5)), - ), - ) - ], - ), - ), - Container( - height: 1.0, - color: - StreamChatTheme.of(context).colorTheme.black.withOpacity(.08), - ), - ], - ); - }), - ); - } -} diff --git a/packages/stream_chat_flutter/example/lib/chips_input_text_field.dart b/packages/stream_chat_flutter/example/lib/chips_input_text_field.dart deleted file mode 100644 index 7291ef03..00000000 --- a/packages/stream_chat_flutter/example/lib/chips_input_text_field.dart +++ /dev/null @@ -1,169 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; - -typedef ChipBuilder = Widget Function(BuildContext context, T chip); -typedef OnChipAdded = void Function(T chip); -typedef OnChipRemoved = void Function(T chip); - -class ChipsInputTextField extends StatefulWidget { - final TextEditingController controller; - final FocusNode focusNode; - final ValueChanged onInputChanged; - final ChipBuilder chipBuilder; - final OnChipAdded onChipAdded; - final OnChipRemoved onChipRemoved; - final String hint; - - const ChipsInputTextField({ - Key key, - @required this.chipBuilder, - @required this.controller, - this.onInputChanged, - this.focusNode, - this.onChipAdded, - this.onChipRemoved, - this.hint = 'Type a name', - }) : super(key: key); - - @override - ChipInputTextFieldState createState() => ChipInputTextFieldState(); -} - -class ChipInputTextFieldState extends State> { - final _chips = {}; - bool _pauseItemAddition = false; - - void addItem(T item) { - setState(() => _chips.add(item)); - if (widget.onChipAdded != null) widget.onChipAdded(item); - } - - void removeItem(T item) { - setState(() { - _chips.remove(item); - if (_chips.isEmpty) resumeItemAddition(); - }); - if (widget.onChipRemoved != null) widget.onChipRemoved(item); - } - - void pauseItemAddition() { - if (!_pauseItemAddition) { - setState(() => _pauseItemAddition = true); - } - widget.focusNode?.unfocus(); - } - - void resumeItemAddition() { - if (_pauseItemAddition) { - setState(() => _pauseItemAddition = false); - } - widget.focusNode?.requestFocus(); - } - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: _pauseItemAddition ? resumeItemAddition : null, - child: Material( - elevation: 1, - color: StreamChatTheme.of(context).colorTheme.white, - child: Container( - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 16), - child: IntrinsicHeight( - child: Row( - crossAxisAlignment: CrossAxisAlignment.baseline, - children: [ - Padding( - padding: const EdgeInsets.symmetric(vertical: 4.0), - child: Text( - 'TO:', - style: StreamChatTheme.of(context) - .textTheme - .footnote - .copyWith( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(.5)), - ), - ), - SizedBox(width: 12), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Wrap( - spacing: 8.0, - runSpacing: 4.0, - children: _chips.map((item) { - return widget.chipBuilder(context, item); - }).toList(), - ), - if (!_pauseItemAddition) - TextField( - controller: widget.controller, - onChanged: widget.onInputChanged, - focusNode: widget.focusNode, - decoration: InputDecoration( - isDense: true, - border: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, - errorBorder: InputBorder.none, - disabledBorder: InputBorder.none, - contentPadding: const EdgeInsets.only(top: 4.0), - hintText: widget.hint, - hintStyle: StreamChatTheme.of(context) - .textTheme - .body - .copyWith( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(.5)), - ), - ), - ], - ), - ), - SizedBox(width: 12), - Align( - alignment: Alignment.bottomCenter, - child: IconButton( - icon: _chips.isEmpty - ? StreamSvgIcon.user( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5), - size: 24, - ) - : StreamSvgIcon.userAdd( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5), - size: 24, - ), - onPressed: resumeItemAddition, - alignment: Alignment.topRight, - visualDensity: VisualDensity.compact, - padding: const EdgeInsets.all(0), - splashRadius: 24, - constraints: BoxConstraints.tightFor( - height: 24, - width: 24, - ), - ), - ), - ], - ), - ), - ), - ), - ), - ); - } -} diff --git a/packages/stream_chat_flutter/example/lib/choose_user_page.dart b/packages/stream_chat_flutter/example/lib/choose_user_page.dart deleted file mode 100644 index 02852c64..00000000 --- a/packages/stream_chat_flutter/example/lib/choose_user_page.dart +++ /dev/null @@ -1,267 +0,0 @@ -import 'package:example/stream_version.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_secure_storage/flutter_secure_storage.dart'; -import 'package:flutter_svg/flutter_svg.dart'; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; - -import 'routes/routes.dart'; - -const kStreamApiKey = 'STREAM_API_KEY'; -const kStreamUserId = 'STREAM_USER_ID'; -const kStreamToken = 'STREAM_TOKEN'; -const kDefaultStreamApiKey = 'kv7mcsxr24p8'; - -class ChooseUserPage extends StatelessWidget { - @override - Widget build(BuildContext context) { - final users = { - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoic2FsdmF0b3JlIn0.pgiJz7sIc7iP29BHKFwe3nLm5-OaR_1l2P-SlgiC9a8': - User( - id: 'salvatore', - extraData: { - 'name': 'Salvatore Giordano', - 'image': - 'https://ca.slack-edge.com/T02RM6X6B-USKK9FFRT-30c415e207a9-512', - }, - ), - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoic2FoaWwifQ.WnIUoB5gR2kcAsFhiDvkiD6zdHXZ-VSU2aQWWkhsvfo': - User( - id: 'sahil', - extraData: { - 'name': 'Sahil Kumar', - 'image': - 'https://ca.slack-edge.com/T02RM6X6B-U01EYU51M89-bbc152b40321-512', - }, - ), - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiYmVuIn0.nAz2sNFGQwY7rl2Og2z3TGHUsdpnN53tOsUglJFvLmg': - User( - id: 'ben', - extraData: { - 'name': 'Ben Golden', - 'image': - 'https://ca.slack-edge.com/T02RM6X6B-U01AXAF23MG-f57403a3cb0d-512', - }, - ), - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidGhpZXJyeSJ9.lEq6TrZtHzjoNtf7HHRufUPyGo_pa8vg4_XhEBp4ckY': - User( - id: 'thierry', - extraData: { - 'name': 'Thierry Schellenbach', - 'image': - 'https://ca.slack-edge.com/T02RM6X6B-U02RM6X6D-g28a1278a98e-512', - }, - ), - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidG9tbWFzbyJ9.GLSI0ESshERMo2WjUpysD709NEtn1zmGimUN2an7g9o': - User( - id: 'tommaso', - extraData: { - 'name': 'Tommaso Barbugli', - 'image': - 'https://ca.slack-edge.com/T02RM6X6B-U02U7SJP4-0f65a5997877-512', - }, - ), - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiZGV2ZW4ifQ.z3zI4PqJnNhc-1o-VKcmb6BnnQ0oxFNCRHwEulHqcWc': - User( - id: 'deven', - extraData: { - 'name': 'Deven Joshi', - 'image': - 'https://ca.slack-edge.com/T02RM6X6B-U01AM7ELPTL-8a60da32704c-512', - }, - ), - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoibmVldmFzaCJ9.3EdHegTxibrz3A9cTiKmpEyawwcCVB8FXnoFzr4eKvw': - User( - id: 'neevash', - extraData: { - 'name': 'Neevash Ramdial', - 'image': - 'https://ca.slack-edge.com/T02RM6X6B-U01DZ046DS8-b00d321d2880-512', - }, - ), - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoicWF0ZXN0MSJ9.fnelU7HcP7QoEEsCGteNlF1fppofzNlrnpDQuIgeKCU': - User( - id: 'qatest1', - extraData: { - 'name': 'QA test 1', - }, - ), - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoicWF0ZXN0MiJ9.vSCqAEbs2WVmMWsOsa7065Fsjq-rsTih6qsHPynl7XM': - User( - id: 'qatest2', - extraData: { - 'name': 'QA test 2', - }, - ), - }; - - return Scaffold( - backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - body: SafeArea( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.only( - top: 34, - bottom: 20, - ), - child: Center( - child: SvgPicture.asset( - 'assets/logo.svg', - height: 40, - color: StreamChatTheme.of(context).colorTheme.accentBlue, - ), - ), - ), - Padding( - padding: const EdgeInsets.only(bottom: 13.0), - child: Text( - 'Welcome to Stream Chat', - style: StreamChatTheme.of(context).textTheme.title, - ), - ), - Text( - 'Select a user to try the Flutter SDK:', - style: StreamChatTheme.of(context).textTheme.body, - ), - Expanded( - child: Padding( - padding: const EdgeInsets.only(top: 32), - child: ListView.separated( - separatorBuilder: (context, i) { - return Container( - height: 1, - color: StreamChatTheme.of(context).colorTheme.greyWhisper, - ); - }, - itemCount: users.length + 1, - itemBuilder: (context, i) { - return [ - ...users.entries.map((entry) { - final token = entry.key; - final user = entry.value; - return ListTile( - onTap: () async { - showDialog( - barrierDismissible: false, - context: context, - barrierColor: StreamChatTheme.of(context) - .colorTheme - .overlay, - builder: (context) => Center( - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16), - color: StreamChatTheme.of(context) - .colorTheme - .white, - ), - height: 100, - width: 100, - child: Center( - child: CircularProgressIndicator(), - ), - ), - ), - ); - - final secureStorage = FlutterSecureStorage(); - final client = StreamChat.of(context).client; - client.apiKey = kDefaultStreamApiKey; - await client.setUser( - user, - token, - ); - - secureStorage.write( - key: kStreamApiKey, - value: kDefaultStreamApiKey, - ); - secureStorage.write( - key: kStreamUserId, - value: user.id, - ); - secureStorage.write( - key: kStreamToken, - value: token, - ); - Navigator.pushNamedAndRemoveUntil( - context, - Routes.HOME, - ModalRoute.withName(Routes.HOME), - ); - }, - leading: UserAvatar( - user: user, - constraints: BoxConstraints.tight( - Size.fromRadius(20), - ), - ), - title: Text( - user.name, - style: - StreamChatTheme.of(context).textTheme.bodyBold, - ), - subtitle: Text( - 'Stream test account', - style: StreamChatTheme.of(context) - .textTheme - .footnote - .copyWith( - color: StreamChatTheme.of(context) - .colorTheme - .grey, - ), - ), - trailing: StreamSvgIcon.arrow_right( - color: StreamChatTheme.of(context) - .colorTheme - .accentBlue, - ), - ); - }), - ListTile( - onTap: () { - Navigator.pushNamed(context, Routes.ADVANCED_OPTIONS); - }, - leading: CircleAvatar( - child: StreamSvgIcon.settings( - color: StreamChatTheme.of(context).colorTheme.black, - ), - backgroundColor: StreamChatTheme.of(context) - .colorTheme - .greyWhisper, - ), - title: Text( - 'Advanced Options', - style: StreamChatTheme.of(context).textTheme.bodyBold, - ), - subtitle: Text( - 'Custom settings', - style: StreamChatTheme.of(context) - .textTheme - .footnote - .copyWith( - color: - StreamChatTheme.of(context).colorTheme.grey, - ), - ), - trailing: SvgPicture.asset( - 'assets/icon_arrow_right.svg', - height: 24, - width: 24, - clipBehavior: Clip.none, - ), - ), - ][i]; - }, - ), - ), - ), - StreamVersion(), - ], - ), - ), - ); - } -} diff --git a/packages/stream_chat_flutter/example/lib/customize_message_widget.dart b/packages/stream_chat_flutter/example/lib/customize_message_widget.dart deleted file mode 100644 index d19d6023..00000000 --- a/packages/stream_chat_flutter/example/lib/customize_message_widget.dart +++ /dev/null @@ -1,135 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; - -/// Fifth step of the [tutorial](https://getstream.io/chat/flutter/tutorial/) -/// -/// Customizing how messages are rendered is another very common use-case that the SDK supports easily. -/// -/// Replace the built-in message component with your own is done by passing it as a builder function to the [MessageListView] widget. -/// -/// The message builder function will get the usual [BuildContext] argument as well as the [Message] object and its position inside the list. -/// -/// If you look at the code you can see that we use [StreamChat.of] to retrieve the current user so that we can style messages own messages in a different way. -/// -/// Since custom widgets and builders are always children of [StreamChat] or part of a [Channel], -/// you can use [StreamChat.of], [StreamChannel.of] and [StreamChatTheme.of] to use the API client directly -/// or to retrieve outer scope needed such as messages from the [Channel.state]. -void main() async { - final client = StreamChatClient( - 's2dxdhpxd94g', - logLevel: Level.INFO, - ); - - await client.setUser( - User(id: 'super-band-9'), - 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A', - ); - - runApp(MyApp(client)); -} - -class MyApp extends StatelessWidget { - final StreamChatClient client; - - MyApp(this.client); - - @override - Widget build(BuildContext context) { - return MaterialApp( - builder: (context, child) => StreamChat( - child: child, - client: client, - ), - home: Container( - child: ChannelListPage(), - ), - ); - } -} - -class ChannelListPage extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Scaffold( - body: ChannelsBloc( - child: ChannelListView( - filter: { - 'members': { - '\$in': [StreamChat.of(context).user.id], - } - }, - sort: [SortOption('last_message_at')], - pagination: PaginationParams( - limit: 20, - ), - channelWidget: ChannelPage(), - ), - ), - ); - } -} - -class ChannelPage extends StatelessWidget { - const ChannelPage({ - Key key, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: ChannelHeader(), - body: Column( - children: [ - Expanded( - child: MessageListView( - messageBuilder: _messageBuilder, - ), - ), - MessageInput(), - ], - ), - ); - } - - Widget _messageBuilder( - BuildContext context, - MessageDetails details, - List messages, - ) { - final message = details.message; - final color = details.isMyMessage ? Colors.red : Colors.blue; - if (message.isSystem) { - return SizedBox(); - } - return MessageWidget( - message: message, - messageTheme: details.isMyMessage - ? StreamChatTheme.of(context).ownMessageTheme - : StreamChatTheme.of(context).otherMessageTheme, - borderSide: BorderSide( - color: color, - width: 2, - ), - padding: const EdgeInsets.symmetric( - vertical: 2, - horizontal: 4, - ), - attachmentBorderSide: BorderSide( - color: color, - width: 2, - ), - attachmentPadding: EdgeInsets.all(8), - borderRadiusGeometry: BorderRadius.vertical( - top: !details.isLastUser ? Radius.circular(16) : Radius.zero, - bottom: !details.isNextUser ? Radius.circular(16) : Radius.zero, - ), - showSendingIndicator: false, - reverse: false, - showUserAvatar: - details.isNextUser ? DisplayWidget.hide : DisplayWidget.show, - showTimestamp: !details.isNextUser, - showUsername: !details.isNextUser, - showReactions: false, - ); - } -} diff --git a/packages/stream_chat_flutter/example/lib/group_chat_details_screen.dart b/packages/stream_chat_flutter/example/lib/group_chat_details_screen.dart deleted file mode 100644 index afc9d12f..00000000 --- a/packages/stream_chat_flutter/example/lib/group_chat_details_screen.dart +++ /dev/null @@ -1,331 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; -import 'package:uuid/uuid.dart'; - -import 'main.dart'; -import 'routes/routes.dart'; - -class GroupChatDetailsScreen extends StatefulWidget { - final List selectedUsers; - - const GroupChatDetailsScreen({ - Key key, - @required this.selectedUsers, - }) : super(key: key); - - @override - _GroupChatDetailsScreenState createState() => _GroupChatDetailsScreenState(); -} - -class _GroupChatDetailsScreenState extends State { - final _selectedUsers = []; - - TextEditingController _groupNameController; - - bool _isGroupNameEmpty = true; - - int get _totalUsers => _selectedUsers.length; - - void _groupNameListener() { - final name = _groupNameController.text; - if (mounted) { - setState(() { - _isGroupNameEmpty = name.isEmpty; - }); - } - } - - @override - void initState() { - super.initState(); - _selectedUsers.addAll(widget.selectedUsers); - _groupNameController = TextEditingController() - ..addListener(_groupNameListener); - } - - @override - void dispose() { - _groupNameController?.removeListener(_groupNameListener); - _groupNameController?.clear(); - _groupNameController?.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - Navigator.pop(context, _selectedUsers); - return false; - }, - child: Scaffold( - backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - appBar: AppBar( - brightness: Theme.of(context).brightness, - elevation: 1, - backgroundColor: StreamChatTheme.of(context).colorTheme.white, - leading: const StreamBackButton(), - title: Text( - 'Name of Group Chat', - style: TextStyle( - color: StreamChatTheme.of(context).colorTheme.black, - fontSize: 16, - ), - ), - centerTitle: true, - bottom: PreferredSize( - preferredSize: Size.fromHeight(kToolbarHeight), - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 16), - child: Row( - children: [ - Text( - 'NAME', - style: TextStyle( - fontSize: 12, - color: StreamChatTheme.of(context).colorTheme.grey, - ), - ), - SizedBox(width: 16), - Expanded( - child: TextField( - controller: _groupNameController, - decoration: InputDecoration( - isDense: true, - border: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, - errorBorder: InputBorder.none, - disabledBorder: InputBorder.none, - contentPadding: const EdgeInsets.all(0), - hintText: 'Choose a group chat name', - hintStyle: TextStyle( - fontSize: 14, - color: StreamChatTheme.of(context).colorTheme.grey, - ), - ), - ), - ), - ], - ), - ), - ), - actions: [ - StreamNeumorphicButton( - child: IconButton( - padding: const EdgeInsets.all(0), - icon: StreamSvgIcon.check( - size: 24, - color: _isGroupNameEmpty - ? StreamChatTheme.of(context).colorTheme.grey - : StreamChatTheme.of(context).colorTheme.accentBlue, - ), - onPressed: _isGroupNameEmpty - ? null - : () async { - try { - final groupName = _groupNameController.text; - final client = StreamChat.of(context).client; - final channel = client.channel('messaging', - id: Uuid().v4(), - extraData: { - 'members': [ - client.state.user.id, - ..._selectedUsers.map((e) => e.id), - ], - 'name': groupName, - }); - await channel.watch(); - Navigator.pushNamedAndRemoveUntil( - context, - Routes.CHANNEL_PAGE, - ModalRoute.withName(Routes.HOME), - arguments: ChannelPageArgs(channel: channel), - ); - } catch (err) { - _showErrorAlert(); - } - }, - ), - ), - ], - ), - body: ConnectionStatusBuilder( - statusBuilder: (context, status) { - String statusString = ''; - bool showStatus = true; - - switch (status) { - case ConnectionStatus.connected: - statusString = 'Connected'; - showStatus = false; - break; - case ConnectionStatus.connecting: - statusString = 'Reconnecting...'; - break; - case ConnectionStatus.disconnected: - statusString = 'Disconnected'; - break; - } - return InfoTile( - showMessage: showStatus, - tileAnchor: Alignment.topCenter, - childAnchor: Alignment.topCenter, - message: statusString, - child: Column( - children: [ - Container( - width: double.maxFinite, - decoration: BoxDecoration( - gradient: - StreamChatTheme.of(context).colorTheme.bgGradient, - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 8, - horizontal: 8, - ), - child: Text( - '$_totalUsers ${_totalUsers > 1 ? 'Members' : 'Member'}', - style: TextStyle( - color: StreamChatTheme.of(context).colorTheme.grey, - ), - ), - ), - ), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onPanDown: (_) => FocusScope.of(context).unfocus(), - child: ListView.separated( - itemCount: _selectedUsers.length + 1, - separatorBuilder: (_, __) => Container( - height: 1, - color: StreamChatTheme.of(context) - .colorTheme - .greyWhisper, - ), - itemBuilder: (_, index) { - if (index == _selectedUsers.length) { - return Container( - height: 1, - color: StreamChatTheme.of(context) - .colorTheme - .greyWhisper, - ); - } - final user = _selectedUsers[index]; - return ListTile( - key: ObjectKey(user), - leading: UserAvatar( - user: user, - constraints: BoxConstraints.tightFor( - width: 40, - height: 40, - ), - ), - title: Text( - user.name, - style: TextStyle(fontWeight: FontWeight.bold), - ), - contentPadding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - trailing: IconButton( - icon: Icon( - Icons.clear_rounded, - color: StreamChatTheme.of(context) - .colorTheme - .black, - ), - padding: const EdgeInsets.all(0), - splashRadius: 24, - onPressed: () { - setState(() { - _selectedUsers.remove(user); - }); - if (_selectedUsers.isEmpty) { - Navigator.pop(context, _selectedUsers); - } - }, - ), - ); - }, - ), - ), - ), - ], - ), - ); - }, - ), - ), - ); - } - - void _showErrorAlert() { - showModalBottomSheet( - backgroundColor: StreamChatTheme.of(context).colorTheme.white, - context: context, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(16.0), - topRight: Radius.circular(16.0), - )), - builder: (context) { - return Column( - mainAxisSize: MainAxisSize.min, - children: [ - SizedBox( - height: 26.0, - ), - StreamSvgIcon.error( - color: StreamChatTheme.of(context).colorTheme.accentRed, - size: 24.0, - ), - SizedBox( - height: 26.0, - ), - Text( - 'Something went wrong', - style: StreamChatTheme.of(context).textTheme.headlineBold, - ), - SizedBox( - height: 7.0, - ), - Text('The operation couldn\'t be completed.'), - SizedBox( - height: 36.0, - ), - Container( - color: - StreamChatTheme.of(context).colorTheme.black.withOpacity(.08), - height: 1.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FlatButton( - child: Text( - 'OK', - style: StreamChatTheme.of(context) - .textTheme - .bodyBold - .copyWith( - color: StreamChatTheme.of(context) - .colorTheme - .accentBlue), - ), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ], - ), - ], - ); - }, - ); - } -} diff --git a/packages/stream_chat_flutter/example/lib/group_info_screen.dart b/packages/stream_chat_flutter/example/lib/group_info_screen.dart deleted file mode 100644 index 0f200c82..00000000 --- a/packages/stream_chat_flutter/example/lib/group_info_screen.dart +++ /dev/null @@ -1,1023 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:jiffy/jiffy.dart'; -import 'package:stream_chat_flutter/src/option_list_tile.dart'; -import 'package:stream_chat_flutter/src/stream_svg_icon.dart'; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; - -import 'chat_info_screen.dart'; -import 'main.dart'; -import 'routes/routes.dart'; - -class GroupInfoScreen extends StatefulWidget { - @override - _GroupInfoScreenState createState() => _GroupInfoScreenState(); -} - -class _GroupInfoScreenState extends State { - TextEditingController _nameController; - - TextEditingController _searchController; - String _userNameQuery = ''; - - Timer _debounce; - Function modalSetStateCallback; - - final FocusNode _focusNode = FocusNode(); - - bool listExpanded = false; - - void _userNameListener() { - if (_searchController.text == _userNameQuery) { - return; - } - if (_debounce?.isActive ?? false) _debounce.cancel(); - _debounce = Timer(const Duration(milliseconds: 350), () { - if (mounted && modalSetStateCallback != null) { - modalSetStateCallback(() { - _userNameQuery = _searchController.text; - }); - } - }); - } - - @override - void initState() { - super.initState(); - var channel = StreamChannel.of(context); - _nameController = TextEditingController.fromValue( - TextEditingValue(text: channel.channel.extraData['name'] ?? '')); - _searchController = TextEditingController()..addListener(_userNameListener); - - _nameController.addListener(() { - setState(() {}); - }); - } - - @override - Widget build(BuildContext context) { - var channel = StreamChannel.of(context); - - return StreamBuilder>( - stream: channel.channel.state.membersStream, - builder: (context, snapshot) { - if (!snapshot.hasData) { - return Container( - color: StreamChatTheme.of(context).colorTheme.greyGainsboro, - child: Center(child: CircularProgressIndicator()), - ); - } - - var userMember = snapshot.data - .firstWhere((e) => e.user.id == StreamChat.of(context).user.id); - var isOwner = userMember.role == 'owner'; - - return Scaffold( - backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - appBar: AppBar( - brightness: Theme.of(context).brightness, - elevation: 1.0, - toolbarHeight: 56.0, - backgroundColor: StreamChatTheme.of(context).colorTheme.white, - leading: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.only(left: 12.0), - child: StreamSvgIcon.left( - color: StreamChatTheme.of(context).colorTheme.black, - ), - ), - ), - leadingWidth: 36.0, - title: Column( - children: [ - StreamBuilder( - stream: channel.channelStateStream, - builder: (context, state) { - if (!state.hasData) { - return Text( - 'Loading...', - style: TextStyle( - color: - StreamChatTheme.of(context).colorTheme.black, - fontSize: 16, - ), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ); - } - - return Text( - _getChannelName( - 2 * MediaQuery.of(context).size.width / 3, - members: snapshot.data, - extraData: state.data.channel.extraData, - maxFontSize: 16.0), - style: TextStyle( - color: StreamChatTheme.of(context).colorTheme.black, - fontSize: 16, - ), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ); - }), - SizedBox( - height: 3.0, - ), - Text( - '${channel.channel.memberCount} Members, ${snapshot?.data?.where((e) => e.user.online)?.length ?? 0} Online', - style: TextStyle( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5), - fontSize: 12.0, - ), - ), - ], - ), - centerTitle: true, - actions: [ - if (!channel.channel.isDistinct) - StreamNeumorphicButton( - child: InkWell( - onTap: () { - _buildAddUserModal(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: StreamSvgIcon.userAdd( - color: StreamChatTheme.of(context) - .colorTheme - .accentBlue), - ), - ), - ), - ], - ), - body: ListView( - children: [ - _buildMembers(snapshot.data), - Container( - height: 8.0, - color: StreamChatTheme.of(context).colorTheme.greyGainsboro, - ), - if (isOwner) _buildNameTile(), - _buildOptionListTiles(), - ], - ), - ); - }); - } - - Widget _buildMembers(List members) { - final groupMembers = members - ..sort((prev, curr) { - if (curr.role == 'owner') return 1; - return 0; - }); - - int groupMembersLength; - - if (listExpanded) { - groupMembersLength = groupMembers.length; - } else { - groupMembersLength = groupMembers.length > 6 ? 6 : groupMembers.length; - } - - return Column( - children: [ - ListView.builder( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemCount: groupMembersLength, - itemBuilder: (context, index) { - final member = groupMembers[index]; - return Material( - child: InkWell( - onTap: () { - var userMember = groupMembers.firstWhere( - (e) => e.user.id == StreamChat.of(context).user.id); - _showUserInfoModal(member.user, userMember.role == 'owner'); - }, - child: Container( - height: 65.0, - child: Column( - children: [ - Row( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0, vertical: 12.0), - child: UserAvatar( - user: member.user, - constraints: BoxConstraints( - maxHeight: 40.0, maxWidth: 40.0), - ), - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - member.user.name, - style: TextStyle(fontWeight: FontWeight.bold), - ), - SizedBox( - height: 1.0, - ), - Text( - _getLastSeen(member.user), - style: TextStyle( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5)), - ), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - member.role == 'owner' ? 'Owner' : '', - style: TextStyle( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5)), - ), - ), - ], - ), - Container( - height: 1.0, - color: StreamChatTheme.of(context) - .colorTheme - .greyGainsboro, - ), - ], - ), - ), - ), - color: StreamChatTheme.of(context).colorTheme.whiteSnow, - ); - }, - ), - if (groupMembersLength != groupMembers.length) - InkWell( - onTap: () { - setState(() { - listExpanded = true; - }); - }, - child: Material( - color: StreamChatTheme.of(context).colorTheme.whiteSnow, - child: Container( - height: 65.0, - child: Column( - children: [ - Expanded( - child: Row( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 21.0, vertical: 12.0), - child: StreamSvgIcon.down( - color: - StreamChatTheme.of(context).colorTheme.grey, - ), - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - '${members.length - groupMembersLength} more', - style: TextStyle( - color: StreamChatTheme.of(context) - .colorTheme - .grey), - ), - ], - ), - ), - ], - ), - ), - Container( - height: 1.0, - color: - StreamChatTheme.of(context).colorTheme.greyGainsboro, - ), - ], - ), - ), - ), - ), - ], - ); - } - - Widget _buildNameTile() { - var channel = StreamChannel.of(context).channel; - var channelName = channel.extraData['name'] ?? ''; - - return Material( - color: StreamChatTheme.of(context).colorTheme.whiteSnow, - child: Container( - height: 56.0, - alignment: Alignment.center, - child: Row( - children: [ - Padding( - padding: const EdgeInsets.all(7.0), - child: Text( - 'NAME', - style: StreamChatTheme.of(context).textTheme.footnote.copyWith( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5)), - ), - ), - SizedBox( - width: 7.0, - ), - Expanded( - child: TextField( - focusNode: _focusNode, - controller: _nameController, - cursorColor: StreamChatTheme.of(context).colorTheme.black, - decoration: InputDecoration.collapsed( - hintText: 'Add a group name', - hintStyle: StreamChatTheme.of(context) - .textTheme - .bodyBold - .copyWith( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5))), - style: TextStyle( - fontWeight: FontWeight.bold, - height: 0.82, - ), - ), - ), - if ((channelName == null) || - (channelName != _nameController.text.trim())) - Row( - mainAxisSize: MainAxisSize.min, - children: [ - InkWell( - child: StreamSvgIcon.close_small(), - onTap: () { - setState(() { - _nameController.text = - _getChannelName(MediaQuery.of(context).size.width); - _focusNode.unfocus(); - }); - }, - ), - Padding( - padding: const EdgeInsets.only(right: 16.0, left: 8.0), - child: InkWell( - child: StreamSvgIcon.check( - color: - StreamChatTheme.of(context).colorTheme.accentBlue, - size: 24.0, - ), - onTap: () { - StreamChannel.of(context).channel.update({ - 'name': _nameController.text.trim(), - }).catchError((err) { - setState(() { - _nameController.text = channelName; - _focusNode.unfocus(); - }); - }); - }, - ), - ), - ], - ), - ], - ), - ), - ); - } - - Widget _buildOptionListTiles() { - var channel = StreamChannel.of(context); - - return Column( - children: [ - // OptionListTile( - // title: 'Notifications', - // leading: StreamSvgIcon.Icon_notification( - // size: 24.0, - // color: StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5), - // ), - // trailing: CupertinoSwitch( - // value: true, - // onChanged: (val) {}, - // ), - // onTap: () {}, - // ), - StreamBuilder( - stream: StreamChannel.of(context).channel.isMutedStream, - builder: (context, snapshot) { - return OptionListTile( - tileColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - separatorColor: - StreamChatTheme.of(context).colorTheme.greyGainsboro, - title: 'Mute group', - titleTextStyle: StreamChatTheme.of(context).textTheme.body, - leading: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: StreamSvgIcon.mute( - size: 24.0, - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5), - ), - ), - trailing: snapshot.data == null - ? CircularProgressIndicator() - : CupertinoSwitch( - value: snapshot.data, - onChanged: (val) { - if (snapshot.data) { - channel.channel.unmute(); - } else { - channel.channel.mute(); - } - }, - ), - onTap: () {}, - ); - }), - OptionListTile( - tileColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - separatorColor: StreamChatTheme.of(context).colorTheme.greyGainsboro, - title: 'Photos & Videos', - titleTextStyle: StreamChatTheme.of(context).textTheme.body, - leading: Padding( - padding: const EdgeInsets.symmetric(horizontal: 12.0), - child: StreamSvgIcon.pictures( - size: 32.0, - color: - StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5), - ), - ), - trailing: StreamSvgIcon.right( - color: StreamChatTheme.of(context).colorTheme.grey, - ), - onTap: () { - var channel = StreamChannel.of(context).channel; - - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => StreamChannel( - channel: channel, - child: MessageSearchBloc( - child: ChannelMediaDisplayScreen( - sortOptions: [ - SortOption( - 'created_at', - direction: SortOption.ASC, - ), - ], - paginationParams: PaginationParams(limit: 20), - onShowMessage: (m, c) async { - final client = StreamChat.of(context).client; - final message = m; - final channel = client.channel( - c.type, - id: c.id, - ); - if (channel.state == null) { - await channel.watch(); - } - await Navigator.pushNamed( - context, - Routes.CHANNEL_PAGE, - arguments: ChannelPageArgs( - channel: channel, - initialMessage: message, - ), - ); - }, - ), - ), - ), - ), - ); - }, - ), - OptionListTile( - tileColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - separatorColor: StreamChatTheme.of(context).colorTheme.greyGainsboro, - title: 'Files', - titleTextStyle: StreamChatTheme.of(context).textTheme.body, - leading: Padding( - padding: const EdgeInsets.symmetric(horizontal: 12.0), - child: StreamSvgIcon.files( - size: 32.0, - color: - StreamChatTheme.of(context).colorTheme.black.withOpacity(0.5), - ), - ), - trailing: StreamSvgIcon.right( - color: StreamChatTheme.of(context).colorTheme.grey, - ), - onTap: () { - var channel = StreamChannel.of(context).channel; - - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => StreamChannel( - channel: channel, - child: MessageSearchBloc( - child: ChannelFileDisplayScreen( - sortOptions: [ - SortOption( - 'created_at', - direction: SortOption.ASC, - ), - ], - paginationParams: PaginationParams(limit: 20), - ), - ), - ), - ), - ); - }, - ), - if (!channel.channel.isDistinct) - OptionListTile( - tileColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - separatorColor: - StreamChatTheme.of(context).colorTheme.greyGainsboro, - title: 'Leave Group', - titleTextStyle: StreamChatTheme.of(context).textTheme.body, - leading: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: StreamSvgIcon.userRemove( - size: 24.0, - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5), - ), - ), - trailing: Container( - height: 24.0, - width: 24.0, - ), - onTap: () async { - await channel.channel - .removeMembers([StreamChat.of(context).user.id]); - Navigator.pop(context); - Navigator.pop(context); - }, - ), - ], - ); - } - - void _buildAddUserModal(context) { - var channel = StreamChannel.of(context).channel; - - showDialog( - context: context, - barrierColor: StreamChatTheme.of(context).colorTheme.overlay, - builder: (context) { - return StatefulBuilder(builder: (context, modalSetState) { - modalSetStateCallback = modalSetState; - return Padding( - padding: EdgeInsets.only(top: 16.0, left: 8.0, right: 8.0), - child: Material( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(16.0), - topRight: Radius.circular(16.0), - ), - clipBehavior: Clip.antiAlias, - child: Scaffold( - body: UsersBloc( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(16), - child: _buildTextInputSection(modalSetState), - ), - Expanded( - child: UserListView( - selectedUsers: {}, - onUserTap: (user, _) async { - _searchController.clear(); - - await channel.addMembers([user.id]); - Navigator.pop(context); - setState(() {}); - }, - crossAxisCount: 4, - pagination: PaginationParams( - limit: 25, - ), - filter: { - if (_searchController.text.isNotEmpty) - 'name': { - r'$autocomplete': _userNameQuery, - }, - 'id': { - r'$nin': [ - StreamChat.of(context).user.id, - ...channel.state.members.map((e) => e.userId), - ], - }, - }, - sort: [ - SortOption( - 'name', - direction: 1, - ), - ], - emptyBuilder: (_) { - return LayoutBuilder( - builder: (context, viewportConstraints) { - return SingleChildScrollView( - physics: AlwaysScrollableScrollPhysics(), - child: ConstrainedBox( - constraints: BoxConstraints( - minHeight: viewportConstraints.maxHeight, - ), - child: Center( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(24), - child: StreamSvgIcon.search( - size: 96, - color: StreamChatTheme.of(context) - .colorTheme - .grey, - ), - ), - Text( - 'No user matches these keywords...'), - ], - ), - ), - ), - ); - }, - ); - }, - ), - ), - ], - ), - ), - ), - ), - ); - }); - }, - ); - } - - Widget _buildTextInputSection(modalSetState) { - final theme = StreamChatTheme.of(context); - return Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Container( - height: 36, - child: TextField( - controller: _searchController, - cursorColor: theme.colorTheme.black, - autofocus: true, - decoration: InputDecoration( - hintText: 'Search', - hintStyle: theme.textTheme.body.copyWith( - color: theme.colorTheme.grey, - ), - prefixIconConstraints: BoxConstraints.tight(Size(40, 24)), - prefixIcon: StreamSvgIcon.search( - color: theme.colorTheme.black, - size: 24, - ), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(24.0), - borderSide: BorderSide( - color: theme.colorTheme.greyWhisper, - ), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(24.0), - borderSide: BorderSide( - color: theme.colorTheme.greyWhisper, - )), - contentPadding: const EdgeInsets.all(0), - ), - ), - ), - ), - SizedBox(width: 16.0), - IconButton( - icon: StreamSvgIcon.close_small( - color: theme.colorTheme.grey, - ), - constraints: BoxConstraints.tightFor( - height: 24, - width: 24, - ), - padding: EdgeInsets.zero, - splashRadius: 24, - onPressed: () => Navigator.pop(context), - ) - ], - ), - ], - ); - } - - void _showUserInfoModal(User user, bool isUserAdmin) { - var channel = StreamChannel.of(context).channel; - - showModalBottomSheet( - context: context, - clipBehavior: Clip.antiAlias, - isScrollControlled: true, - builder: (context) { - return StreamChannel( - channel: channel, - child: Material( - color: StreamChatTheme.of(context).colorTheme.white, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - SizedBox( - height: 24.0, - ), - Center( - child: Text( - user.name, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold, - ), - ), - ), - SizedBox( - height: 5.0, - ), - _buildConnectedTitleState(user), - Center( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: UserAvatar( - user: user, - constraints: BoxConstraints( - maxHeight: 64.0, - minHeight: 64.0, - ), - borderRadius: BorderRadius.circular(32.0), - ), - ), - ), - if (StreamChat.of(context).user.id != user.id) - _buildModalListTile( - context, - StreamSvgIcon.user( - color: StreamChatTheme.of(context).colorTheme.grey, - size: 24.0, - ), - 'View info', - () async { - var client = StreamChat.of(context).client; - - var c = client.channel('messaging', extraData: { - 'members': [ - user.id, - StreamChat.of(context).user.id, - ], - }); - - await c.watch(); - - await Navigator.push( - context, - MaterialPageRoute( - builder: (context) => StreamChannel( - channel: c, - child: ChatInfoScreen( - user: user, - ), - ), - ), - ); - }, - ), - if (StreamChat.of(context).user.id != user.id) - _buildModalListTile( - context, - StreamSvgIcon.message( - color: StreamChatTheme.of(context).colorTheme.grey, - size: 24.0, - ), - 'Message', - () async { - var client = StreamChat.of(context).client; - - var c = client.channel('messaging', extraData: { - 'members': [ - user.id, - StreamChat.of(context).user.id, - ], - }); - - await c.watch(); - - await Navigator.push( - context, - MaterialPageRoute( - builder: (context) => StreamChannel( - channel: c, - child: ChannelPage(), - ), - ), - ); - }, - ), - if (!channel.isDistinct && - StreamChat.of(context).user.id != user.id && - isUserAdmin) - _buildModalListTile( - context, - StreamSvgIcon.Icon_user_settings( - color: StreamChatTheme.of(context).colorTheme.grey, - size: 24.0, - ), - 'Make Owner', () { - // TODO: Add make owner implementation (Remaining from backend) - }), - if (!channel.isDistinct && - StreamChat.of(context).user.id != user.id && - isUserAdmin) - _buildModalListTile( - context, - StreamSvgIcon.userRemove( - color: StreamChatTheme.of(context).colorTheme.accentRed, - size: 24.0, - ), - 'Remove From Group', () async { - await channel.removeMembers([user.id]); - Navigator.pop(context); - }, color: StreamChatTheme.of(context).colorTheme.accentRed), - _buildModalListTile( - context, - StreamSvgIcon.close_small( - color: StreamChatTheme.of(context).colorTheme.grey, - size: 24.0, - ), - 'Cancel', () { - Navigator.pop(context); - }), - ], - ), - ), - ); - }, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(16.0), - topRight: Radius.circular(16.0), - ), - ), - ); - } - - Widget _buildConnectedTitleState(User user) { - var alternativeWidget; - - final otherMember = user; - - if (otherMember != null) { - if (otherMember.online) { - alternativeWidget = Text( - 'Online', - style: TextStyle( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5)), - ); - } else { - alternativeWidget = Text( - 'Last seen ${Jiffy(otherMember.lastActive).fromNow()}', - style: TextStyle( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(0.5)), - ); - } - } - - return alternativeWidget; - } - - Widget _buildModalListTile( - BuildContext context, Widget leading, String title, VoidCallback onTap, - {Color color}) { - color ??= StreamChatTheme.of(context).colorTheme.black; - - return Material( - color: StreamChatTheme.of(context).colorTheme.white, - child: InkWell( - onTap: onTap, - child: Column( - children: [ - Container( - height: 1.0, - color: StreamChatTheme.of(context).colorTheme.greyGainsboro, - ), - Container( - height: 64.0, - child: Row( - children: [ - Padding( - padding: const EdgeInsets.all(16.0), - child: leading, - ), - Expanded( - child: Text( - title, - style: - TextStyle(color: color, fontWeight: FontWeight.bold), - ), - ) - ], - ), - ), - ], - ), - ), - ); - } - - String _getChannelName(double width, - {List members, Map extraData, double maxFontSize}) { - String title; - var client = StreamChat.of(context); - if (extraData['name'] == null) { - final otherMembers = - members.where((member) => member.user.id != client.user.id); - if (otherMembers.isNotEmpty) { - final maxWidth = width; - final maxChars = maxWidth / maxFontSize; - var currentChars = 0; - final currentMembers = []; - otherMembers.forEach((element) { - final newLength = currentChars + element.user.name.length; - if (newLength < maxChars) { - currentChars = newLength; - currentMembers.add(element); - } - }); - - final exceedingMembers = otherMembers.length - currentMembers.length; - title = - '${currentMembers.map((e) => e.user.name).join(', ')} ${exceedingMembers > 0 ? '+ $exceedingMembers' : ''}'; - } else { - title = 'No title'; - } - } else { - title = extraData['name']; - } - return title; - } - - String _getLastSeen(User user) { - if (user.online) { - return 'Online'; - } else { - return 'Last seen ${Jiffy(user.lastActive).fromNow()}'; - } - } -} diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index 775b1d6e..31ed8711 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -1,832 +1,88 @@ -import 'dart:async'; - -import 'package:example/chat_info_screen.dart'; -import 'package:example/choose_user_page.dart'; -import 'package:example/group_info_screen.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; -import 'package:stream_chat_persistence/stream_chat_persistence.dart'; -import 'package:streaming_shared_preferences/streaming_shared_preferences.dart'; - -import 'notifications_service.dart'; -import 'routes/app_routes.dart'; -import 'routes/routes.dart'; -import 'search_text_field.dart'; - -final chatPersistentClient = StreamChatPersistenceClient( - logLevel: Level.INFO, - connectionMode: ConnectionMode.background, -); void main() async { - WidgetsFlutterBinding.ensureInitialized(); - final secureStorage = FlutterSecureStorage(); - - final apiKey = await secureStorage.read(key: kStreamApiKey); - final userId = await secureStorage.read(key: kStreamUserId); - + /// Create a new instance of [StreamChatClient] passing the apikey obtained from your + /// project dashboard. final client = StreamChatClient( - apiKey ?? kDefaultStreamApiKey, + 's2dxdhpxd94g', logLevel: Level.INFO, - )..chatPersistenceClient = chatPersistentClient; + ); - if (userId != null) { - final token = await secureStorage.read(key: kStreamToken); - await client.setUser( - User(id: userId), - token, - ); - } + /// Set the current user. In a production scenario, this should be done using + /// a backend to generate a user token using our server SDK. + /// Please see the following for more information: + /// https://getstream.io/chat/docs/ios_user_setup_and_tokens/ + await client.setUser( + User(id: 'super-band-9'), + 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A', + ); - runApp(MyApp(client)); + final channel = client.channel('messaging', id: 'godevs'); + + // ignore: unawaited_futures + channel.watch(); + + runApp(MyApp(client, channel)); } +/// Example application using Stream Chat Flutter widgets. +/// Stream Chat Flutter is a set of Flutter widgets which provide full chat functionalities +/// for building Flutter applications using Stream. +/// If you'd prefer using minimal wrapper widgets for your app, please see our other +/// package, `stream_chat_flutter_core`. class MyApp extends StatelessWidget { + /// Instance of Stream Client. + /// Stream's [StreamChatClient] can be used to connect to our servers and set the default + /// user for the application. Performing these actions trigger a websocket connection + /// allowing for real-time updates. final StreamChatClient client; - MyApp(this.client); + /// Instance of the Channel + final Channel channel; + + /// Example using Stream's Flutter package. + /// If you'd prefer using minimal wrapper widgets for your app, please see our other + /// package, `stream_chat_flutter_core`. + MyApp(this.client, this.channel); @override Widget build(BuildContext context) { - return FutureBuilder( - future: StreamingSharedPreferences.instance, - builder: (context, snapshot) { - if (!snapshot.hasData) { - return SizedBox(); - } - return PreferenceBuilder( - preference: snapshot.data.getInt( - 'theme', - defaultValue: 0, - ), - builder: (context, snapshot) => MaterialApp( - builder: (context, child) { - return StreamChat( - client: client, - onBackgroundEventReceived: showLocalNotification, - child: Builder( - builder: (context) => AnnotatedRegion( - child: child, - value: SystemUiOverlayStyle( - systemNavigationBarColor: - StreamChatTheme.of(context).colorTheme.white, - systemNavigationBarIconBrightness: - Theme.of(context).brightness == Brightness.dark - ? Brightness.light - : Brightness.dark, - ), - ), - ), - ); - }, - debugShowCheckedModeBanner: false, - theme: ThemeData.light(), - darkTheme: ThemeData.dark(), - themeMode: { - -1: ThemeMode.dark, - 0: ThemeMode.system, - 1: ThemeMode.light, - }[snapshot], - onGenerateRoute: AppRoutes.generateRoute, - initialRoute: - client.state.user == null ? Routes.CHOOSE_USER : Routes.HOME, - ), + return MaterialApp( + builder: (context, widget) { + return StreamChat( + child: widget, + client: client, ); }, - ); - } -} - -class HomePage extends StatefulWidget { - @override - _HomePageState createState() => _HomePageState(); -} - -class _HomePageState extends State { - int _currentIndex = 0; - - bool _isSelected(int index) => _currentIndex == index; - - List get _navBarItems { - return [ - BottomNavigationBarItem( - icon: Stack( - clipBehavior: Clip.none, - children: [ - StreamSvgIcon.message( - color: _isSelected(0) - ? StreamChatTheme.of(context).colorTheme.black - : Colors.grey, - ), - Positioned( - top: -3, - right: -16, - child: UnreadIndicator(), - ), - ], - ), - label: 'Chats', - ), - BottomNavigationBarItem( - icon: Stack( - clipBehavior: Clip.none, - children: [ - StreamSvgIcon.mentions( - color: _isSelected(1) - ? StreamChatTheme.of(context).colorTheme.black - : Colors.grey, - ), - ], - ), - label: 'Mentions', - ), - ]; - } - - @override - Widget build(BuildContext context) { - final user = StreamChat.of(context).user; - return Scaffold( - backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - appBar: ChannelListHeader( - onNewChatButtonTap: () { - Navigator.pushNamed(context, Routes.NEW_CHAT); - }, - preNavigationCallback: () { - FocusScope.of(context).requestFocus(FocusNode()); - }, - ), - drawer: _buildDrawer(context, user), - drawerEdgeDragWidth: 50, - bottomNavigationBar: BottomNavigationBar( - backgroundColor: StreamChatTheme.of(context).colorTheme.white, - currentIndex: _currentIndex, - items: _navBarItems, - selectedLabelStyle: StreamChatTheme.of(context).textTheme.footnoteBold, - unselectedLabelStyle: - StreamChatTheme.of(context).textTheme.footnoteBold, - type: BottomNavigationBarType.fixed, - selectedItemColor: StreamChatTheme.of(context).colorTheme.black, - unselectedItemColor: Colors.grey, - onTap: (index) { - setState(() => _currentIndex = index); - }, - ), - body: IndexedStack( - index: _currentIndex, - children: [ - ChannelListPage(), - UserMentionPage(), - ], - ), - ); - } - - Drawer _buildDrawer(BuildContext context, User user) { - return Drawer( - child: Container( - color: StreamChatTheme.of(context).colorTheme.white, - child: SafeArea( - child: Padding( - padding: EdgeInsets.only( - top: MediaQuery.of(context).viewPadding.top + 8, - ), - child: Column( - children: [ - Padding( - padding: const EdgeInsets.only( - bottom: 20.0, - left: 8, - ), - child: Row( - children: [ - UserAvatar( - user: user, - showOnlineStatus: false, - constraints: BoxConstraints.tight(Size.fromRadius(20)), - ), - Padding( - padding: const EdgeInsets.only(left: 16.0), - child: Text( - user.name, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - ), - ListTile( - leading: StreamSvgIcon.penWrite( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(.5), - ), - onTap: () { - Navigator.popAndPushNamed( - context, - Routes.NEW_CHAT, - ); - }, - title: Text( - 'New direct message', - style: TextStyle( - fontSize: 14.5, - ), - ), - ), - ListTile( - leading: StreamSvgIcon.contacts( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(.5), - ), - onTap: () { - Navigator.popAndPushNamed( - context, - Routes.NEW_GROUP_CHAT, - ); - }, - title: Text( - 'New group', - style: TextStyle( - fontSize: 14.5, - ), - ), - ), - Expanded( - child: Container( - alignment: Alignment.bottomCenter, - child: ListTile( - onTap: () async { - Navigator.pop(context); - - final secureStorage = FlutterSecureStorage(); - await secureStorage.deleteAll(); - - StreamChat.of(context).client.disconnect( - clearUser: true, - ); - - await Navigator.pushReplacementNamed( - context, - Routes.CHOOSE_USER, - ); - }, - leading: StreamSvgIcon.user( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(.5), - ), - title: Text( - 'Sign out', - style: TextStyle( - fontSize: 14.5, - ), - ), - trailing: IconButton( - icon: StreamSvgIcon.Icon_moon( - size: 24, - ), - color: StreamChatTheme.of(context).colorTheme.grey, - onPressed: () async { - final sp = await StreamingSharedPreferences.instance; - sp.setInt( - 'theme', - Theme.of(context).brightness == Brightness.dark - ? 1 - : -1, - ); - }, - ), - ), - ), - ), - ], - ), - ), - ), + home: StreamChannel( + channel: channel, + child: ChannelPage(), ), ); } } -class UserMentionPage extends StatelessWidget { - @override - Widget build(BuildContext context) { - final user = StreamChat.of(context).user; - return MessageSearchBloc( - child: MessageSearchListView( - filters: { - 'members': { - r'$in': [user.id], - }, - }, - messageFilters: { - 'mentioned_users.id': { - r'$contains': user.id, - }, - }, - sortOptions: [ - SortOption( - 'created_at', - direction: SortOption.ASC, - ), - ], - paginationParams: PaginationParams(limit: 20), - showResultCount: false, - emptyBuilder: (_, __) { - return LayoutBuilder( - builder: (context, viewportConstraints) { - return SingleChildScrollView( - physics: AlwaysScrollableScrollPhysics(), - child: ConstrainedBox( - constraints: BoxConstraints( - minHeight: viewportConstraints.maxHeight, - ), - child: Center( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(24), - child: StreamSvgIcon.mentions( - size: 96, - color: StreamChatTheme.of(context) - .colorTheme - .greyGainsboro, - ), - ), - Text( - 'No mentions exist yet...', - style: StreamChatTheme.of(context) - .textTheme - .body - .copyWith( - color: - StreamChatTheme.of(context).colorTheme.grey, - ), - ), - ], - ), - ), - ), - ); - }, - ); - }, - onItemTap: (messageResponse) async { - final client = StreamChat.of(context).client; - final message = messageResponse.message; - final channel = client.channel( - messageResponse.channel.type, - id: messageResponse.channel.id, - ); - if (channel.state == null) { - await channel.watch(); - } - Navigator.pushNamed( - context, - Routes.CHANNEL_PAGE, - arguments: ChannelPageArgs( - channel: channel, - initialMessage: message, - ), - ); - }, - ), - ); - } -} - -class ChannelListPage extends StatefulWidget { - @override - _ChannelListPageState createState() => _ChannelListPageState(); -} - -class _ChannelListPageState extends State { - TextEditingController _controller; - - String _channelQuery = ''; - - bool _isSearchActive = false; - - Timer _debounce; - - void _channelQueryListener() { - if (_debounce?.isActive ?? false) _debounce.cancel(); - _debounce = Timer(const Duration(milliseconds: 350), () { - if (mounted) { - setState(() { - _channelQuery = _controller.text; - _isSearchActive = _channelQuery.isNotEmpty; - }); - } - }); - } - - @override - void initState() { - super.initState(); - _controller = TextEditingController()..addListener(_channelQueryListener); - } - - @override - void dispose() { - _controller?.removeListener(_channelQueryListener); - _controller?.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - final user = StreamChat.of(context).user; - return WillPopScope( - onWillPop: () async { - if (_isSearchActive) { - _controller.clear(); - setState(() => _isSearchActive = false); - return false; - } - return true; - }, - child: ChannelsBloc( - child: MessageSearchBloc( - child: NestedScrollView( - floatHeaderSlivers: true, - headerSliverBuilder: (_, __) => [ - SliverToBoxAdapter( - child: SearchTextField( - controller: _controller, - showCloseButton: _isSearchActive, - ), - ), - ], - body: AnimatedSwitcher( - duration: const Duration(milliseconds: 350), - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onPanDown: (_) => FocusScope.of(context).unfocus(), - child: _isSearchActive - ? MessageSearchListView( - messageQuery: _channelQuery, - filters: { - 'members': { - r'$in': [user.id] - } - }, - sortOptions: [ - SortOption( - 'created_at', - direction: SortOption.ASC, - ), - ], - pullToRefresh: false, - paginationParams: PaginationParams(limit: 20), - emptyBuilder: (_, query) { - return LayoutBuilder( - builder: (context, viewportConstraints) { - return SingleChildScrollView( - physics: AlwaysScrollableScrollPhysics(), - child: ConstrainedBox( - constraints: BoxConstraints( - minHeight: viewportConstraints.maxHeight, - ), - child: Center( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(24), - child: StreamSvgIcon.search( - size: 96, - color: Colors.grey, - ), - ), - Text( - 'No results for \"$query\"...', - ), - ], - ), - ), - ), - ); - }, - ); - }, - onItemTap: (messageResponse) async { - FocusScope.of(context).requestFocus(FocusNode()); - final client = StreamChat.of(context).client; - final message = messageResponse.message; - final channel = client.channel( - messageResponse.channel.type, - id: messageResponse.channel.id, - ); - if (channel.state == null) { - await channel.watch(); - } - Navigator.pushNamed( - context, - Routes.CHANNEL_PAGE, - arguments: ChannelPageArgs( - channel: channel, - initialMessage: message, - ), - ); - }, - ) - : ChannelListView( - onStartChatPressed: () { - Navigator.pushNamed(context, Routes.NEW_CHAT); - }, - swipeToAction: true, - filter: { - 'members': { - r'$in': [user.id], - }, - }, - options: { - 'presence': true, - }, - pagination: PaginationParams( - limit: 20, - ), - channelWidget: ChannelPage(), - onViewInfoTap: (channel) { - if (channel.memberCount == 2 && channel.isDistinct) { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => StreamChannel( - channel: channel, - child: ChatInfoScreen( - user: channel.state.members.first.user, - ), - ), - ), - ); - } else { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => StreamChannel( - channel: channel, - child: GroupInfoScreen(), - ), - ), - ); - } - }, - ), - ), - ), - ), - ), - ), - ); - } -} - -class ChannelPageArgs { - final Channel channel; - final Message initialMessage; - - const ChannelPageArgs({ - this.channel, - this.initialMessage, - }); -} - -class ChannelPage extends StatefulWidget { - final int initialScrollIndex; - final double initialAlignment; - final bool highlightInitialMessage; - +/// A list of messages sent in the current channel. +/// +/// This is implemented using [MessageListView], a widget that provides query functionalities +/// fetching the messages from the api and showing them in a listView +class ChannelPage extends StatelessWidget { + /// Creates the page that shows the list of messages const ChannelPage({ Key key, - this.initialScrollIndex, - this.initialAlignment, - this.highlightInitialMessage = false, }) : super(key: key); - @override - _ChannelPageState createState() => _ChannelPageState(); -} - -class _ChannelPageState extends State { - Message _quotedMessage; - FocusNode _focusNode; - - @override - void initState() { - _focusNode = FocusNode(); - super.initState(); - } - - @override - void dispose() { - _focusNode.dispose(); - super.dispose(); - } - - void _reply(Message message) { - setState(() => _quotedMessage = message); - WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - _focusNode.requestFocus(); - }); - } - @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - appBar: ChannelHeader( - showTypingIndicator: false, - onImageTap: () async { - var channel = StreamChannel.of(context).channel; - - if (channel.memberCount == 2 && channel.isDistinct) { - final currentUser = StreamChat.of(context).user; - final otherUser = channel.state.members.firstWhere( - (element) => element.user.id != currentUser.id, - orElse: () => null, - ); - if (otherUser != null) { - final pop = await Navigator.push( - context, - MaterialPageRoute( - builder: (context) => StreamChannel( - child: ChatInfoScreen( - user: otherUser.user, - ), - channel: channel, - ), - ), - ); - - if (pop == true) { - Navigator.pop(context); - } - } - } else { - await Navigator.push( - context, - MaterialPageRoute( - builder: (context) => StreamChannel( - child: GroupInfoScreen(), - channel: channel, - ), - ), - ); - } - }, - ), + appBar: ChannelHeader(), body: Column( children: [ Expanded( - child: Stack( - children: [ - MessageListView( - initialScrollIndex: widget.initialScrollIndex, - initialAlignment: widget.initialAlignment, - highlightInitialMessage: widget.highlightInitialMessage, - onMessageSwiped: _reply, - onReplyTap: _reply, - threadBuilder: (_, parentMessage) { - return ThreadPage( - parent: parentMessage, - ); - }, - onShowMessage: (m, c) async { - final client = StreamChat.of(context).client; - final message = m; - final channel = client.channel( - c.type, - id: c.id, - ); - if (channel.state == null) { - await channel.watch(); - } - Navigator.pushReplacementNamed( - context, - Routes.CHANNEL_PAGE, - arguments: ChannelPageArgs( - channel: channel, - initialMessage: message, - ), - ); - }, - ), - Positioned( - bottom: 0, - left: 0, - right: 0, - child: Container( - alignment: Alignment.centerLeft, - color: StreamChatTheme.of(context) - .colorTheme - .whiteSnow - .withOpacity(.9), - child: TypingIndicator( - alignment: Alignment.centerLeft, - padding: const EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - style: StreamChatTheme.of(context) - .textTheme - .footnote - .copyWith( - color: - StreamChatTheme.of(context).colorTheme.grey), - ), - ), - ), - ], - ), - ), - MessageInput( - focusNode: _focusNode, - quotedMessage: _quotedMessage, - onQuotedMessageCleared: () { - setState(() => _quotedMessage = null); - _focusNode.unfocus(); - }, + child: MessageListView(), ), - ], - ), - ); - } -} - -class ThreadPage extends StatefulWidget { - final Message parent; - final int initialScrollIndex; - final double initialAlignment; - - ThreadPage({ - Key key, - this.parent, - this.initialScrollIndex, - this.initialAlignment, - }) : super(key: key); - - @override - _ThreadPageState createState() => _ThreadPageState(); -} - -class _ThreadPageState extends State { - Message _quotedMessage; - FocusNode _focusNode = FocusNode(); - - @override - void dispose() { - _focusNode.dispose(); - super.dispose(); - } - - void _reply(Message message) { - setState(() => _quotedMessage = message); - WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - _focusNode.requestFocus(); - }); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - appBar: ThreadHeader( - parent: widget.parent, - ), - body: Column( - children: [ - Expanded( - child: MessageListView( - parentMessage: widget.parent, - initialScrollIndex: widget.initialScrollIndex, - initialAlignment: widget.initialAlignment, - onMessageSwiped: _reply, - onReplyTap: _reply, - ), - ), - if (widget.parent.type != 'deleted') - MessageInput( - parentMessage: widget.parent, - focusNode: _focusNode, - quotedMessage: _quotedMessage, - onQuotedMessageCleared: () { - setState(() => _quotedMessage = null); - _focusNode.unfocus(); - }, - ), + MessageInput(), ], ), ); diff --git a/packages/stream_chat_flutter/example/lib/new_chat_screen.dart b/packages/stream_chat_flutter/example/lib/new_chat_screen.dart deleted file mode 100644 index 7f47e871..00000000 --- a/packages/stream_chat_flutter/example/lib/new_chat_screen.dart +++ /dev/null @@ -1,417 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; - -import 'chips_input_text_field.dart'; -import 'main.dart'; -import 'routes/routes.dart'; - -class NewChatScreen extends StatefulWidget { - @override - _NewChatScreenState createState() => _NewChatScreenState(); -} - -class _NewChatScreenState extends State { - final _chipInputTextFieldStateKey = - GlobalKey>(); - - TextEditingController _controller; - - ChipInputTextFieldState get _chipInputTextFieldState => - _chipInputTextFieldStateKey.currentState; - - String _userNameQuery = ''; - - final _selectedUsers = {}; - - final _searchFocusNode = FocusNode(); - final _messageInputFocusNode = FocusNode(); - - bool _isSearchActive = false; - - Channel channel; - - Timer _debounce; - - bool _showUserList = true; - - void _userNameListener() { - if (_debounce?.isActive ?? false) _debounce.cancel(); - _debounce = Timer(const Duration(milliseconds: 350), () { - if (mounted) - setState(() { - _userNameQuery = _controller.text; - _isSearchActive = _userNameQuery.isNotEmpty; - }); - }); - } - - @override - void initState() { - super.initState(); - channel = StreamChat.of(context).client.channel('messaging'); - _controller = TextEditingController()..addListener(_userNameListener); - - _searchFocusNode.addListener(() async { - if (_searchFocusNode.hasFocus && !_showUserList) { - setState(() { - _showUserList = true; - }); - } - }); - - _messageInputFocusNode.addListener(() async { - if (_messageInputFocusNode.hasFocus && _selectedUsers.isNotEmpty) { - final chatState = StreamChat.of(context); - - final res = await chatState.client.queryChannels( - options: { - 'state': false, - 'watch': false, - }, - filter: { - 'members': [ - ..._selectedUsers.map((e) => e.id), - chatState.user.id, - ], - 'distinct': true, - }, - messageLimit: 0, - paginationParams: PaginationParams( - limit: 1, - ), - ); - - final _channelExisted = res.length == 1; - if (_channelExisted) { - channel = res.first; - await channel.watch(); - } else { - channel = chatState.client.channel( - 'messaging', - extraData: { - 'members': [ - ..._selectedUsers.map((e) => e.id), - chatState.user.id, - ], - }, - ); - } - - setState(() { - _showUserList = false; - }); - } - }); - } - - @override - void dispose() { - _searchFocusNode.dispose(); - _messageInputFocusNode.dispose(); - _controller?.clear(); - _controller?.removeListener(_userNameListener); - _controller?.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - appBar: AppBar( - brightness: Theme.of(context).brightness, - elevation: 0, - backgroundColor: StreamChatTheme.of(context).colorTheme.white, - leading: const StreamBackButton(), - title: Text( - 'New Chat', - style: StreamChatTheme.of(context) - .textTheme - .headlineBold - .copyWith(color: StreamChatTheme.of(context).colorTheme.black), - ), - centerTitle: true, - ), - body: ConnectionStatusBuilder( - statusBuilder: (context, status) { - String statusString = ''; - bool showStatus = true; - - switch (status) { - case ConnectionStatus.connected: - statusString = 'Connected'; - showStatus = false; - break; - case ConnectionStatus.connecting: - statusString = 'Reconnecting...'; - break; - case ConnectionStatus.disconnected: - statusString = 'Disconnected'; - break; - } - return InfoTile( - showMessage: showStatus, - tileAnchor: Alignment.topCenter, - childAnchor: Alignment.topCenter, - message: statusString, - child: StreamChannel( - showLoading: false, - channel: channel, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ChipsInputTextField( - key: _chipInputTextFieldStateKey, - controller: _controller, - focusNode: _searchFocusNode, - chipBuilder: (context, user) { - return GestureDetector( - onTap: () { - _chipInputTextFieldState.removeItem(user); - _searchFocusNode.requestFocus(); - }, - child: Stack( - alignment: AlignmentDirectional.centerStart, - children: [ - Container( - decoration: BoxDecoration( - color: StreamChatTheme.of(context) - .colorTheme - .greyGainsboro, - borderRadius: BorderRadius.circular(12), - ), - padding: const EdgeInsets.only(left: 24), - child: Padding( - padding: const EdgeInsets.fromLTRB(8, 4, 12, 4), - child: Text( - user.name, - maxLines: 1, - style: TextStyle( - color: StreamChatTheme.of(context) - .colorTheme - .black, - ), - ), - ), - ), - Container( - foregroundDecoration: BoxDecoration( - color: StreamChatTheme.of(context) - .colorTheme - .overlay, - shape: BoxShape.circle, - ), - child: UserAvatar( - showOnlineStatus: false, - user: user, - constraints: BoxConstraints.tightFor( - height: 24, - width: 24, - ), - ), - ), - StreamSvgIcon.close(), - ], - ), - ); - }, - onChipAdded: (user) { - setState(() => _selectedUsers.add(user)); - }, - onChipRemoved: (user) { - setState(() => _selectedUsers.remove(user)); - }, - ), - if (!_isSearchActive && !_selectedUsers.isNotEmpty) - Container( - child: InkWell( - onTap: () { - Navigator.pushNamed( - context, - Routes.NEW_GROUP_CHAT, - ); - }, - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 8), - child: Row( - children: [ - StreamNeumorphicButton( - child: Center( - child: StreamSvgIcon.contacts( - color: StreamChatTheme.of(context) - .colorTheme - .accentBlue, - size: 24, - ), - ), - ), - SizedBox(width: 8), - Text( - 'Create a Group', - style: StreamChatTheme.of(context) - .textTheme - .bodyBold, - ), - ], - ), - ), - ), - ), - if (_showUserList) - Container( - width: double.maxFinite, - decoration: BoxDecoration( - gradient: - StreamChatTheme.of(context).colorTheme.bgGradient, - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 8, - horizontal: 8, - ), - child: Text( - _isSearchActive - ? "Matches for \"$_userNameQuery\"" - : 'On the platform', - style: StreamChatTheme.of(context) - .textTheme - .footnote - .copyWith( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(.5))), - ), - ), - Expanded( - child: _showUserList - ? GestureDetector( - behavior: HitTestBehavior.opaque, - onPanDown: (_) => FocusScope.of(context).unfocus(), - child: UsersBloc( - child: UserListView( - selectedUsers: _selectedUsers, - groupAlphabetically: - _isSearchActive ? false : true, - onUserTap: (user, _) { - _controller.clear(); - if (!_selectedUsers.contains(user)) { - _chipInputTextFieldState - ..addItem(user) - ..pauseItemAddition(); - } else { - _chipInputTextFieldState.removeItem(user); - } - }, - pagination: PaginationParams( - limit: 25, - ), - filter: { - if (_userNameQuery.isNotEmpty) - 'name': { - r'$autocomplete': _userNameQuery, - }, - 'id': { - r'$ne': StreamChat.of(context).user.id, - }, - }, - sort: [ - SortOption( - 'name', - direction: 1, - ), - ], - emptyBuilder: (_) { - return LayoutBuilder( - builder: (context, viewportConstraints) { - return SingleChildScrollView( - physics: - AlwaysScrollableScrollPhysics(), - child: ConstrainedBox( - constraints: BoxConstraints( - minHeight: - viewportConstraints.maxHeight, - ), - child: Center( - child: Column( - children: [ - Padding( - padding: - const EdgeInsets.all(24), - child: StreamSvgIcon.search( - size: 96, - color: Colors.grey, - ), - ), - Text( - 'No user matches these keywords...', - style: StreamChatTheme.of( - context) - .textTheme - .footnote - .copyWith( - color: StreamChatTheme - .of(context) - .colorTheme - .black - .withOpacity(.5)), - ), - ], - ), - ), - ), - ); - }, - ); - }, - ), - ), - ) - : FutureBuilder( - future: channel.initialized, - builder: (context, snapshot) { - if (snapshot.data == true) { - return MessageListView(); - } - - return Center( - child: Text( - 'No chats here yet...', - style: TextStyle( - fontSize: 12, - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(.5), - ), - ), - ); - }, - ), - ), - MessageInput( - focusNode: _messageInputFocusNode, - preMessageSending: (message) async { - await channel.watch(); - return message; - }, - onMessageSent: (m) { - Navigator.pushNamedAndRemoveUntil( - context, - Routes.CHANNEL_PAGE, - ModalRoute.withName(Routes.HOME), - arguments: ChannelPageArgs(channel: channel), - ); - }, - ), - ], - ), - ), - ); - }, - ), - ); - } -} diff --git a/packages/stream_chat_flutter/example/lib/new_group_chat_screen.dart b/packages/stream_chat_flutter/example/lib/new_group_chat_screen.dart deleted file mode 100644 index 4e924d86..00000000 --- a/packages/stream_chat_flutter/example/lib/new_group_chat_screen.dart +++ /dev/null @@ -1,339 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; - -import 'routes/routes.dart'; -import 'search_text_field.dart'; - -class NewGroupChatScreen extends StatefulWidget { - @override - _NewGroupChatScreenState createState() => _NewGroupChatScreenState(); -} - -class _NewGroupChatScreenState extends State { - TextEditingController _controller; - - String _userNameQuery = ''; - - final _selectedUsers = {}; - - bool _isSearchActive = false; - - Timer _debounce; - - void _userNameListener() { - if (_debounce?.isActive ?? false) _debounce.cancel(); - _debounce = Timer(const Duration(milliseconds: 350), () { - if (mounted) { - setState(() { - _userNameQuery = _controller.text; - _isSearchActive = _userNameQuery.isNotEmpty; - }); - } - }); - } - - @override - void initState() { - super.initState(); - _controller = TextEditingController()..addListener(_userNameListener); - } - - @override - void dispose() { - _controller?.clear(); - _controller?.removeListener(_userNameListener); - _controller?.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: StreamChatTheme.of(context).colorTheme.whiteSnow, - appBar: AppBar( - elevation: 1, - backgroundColor: StreamChatTheme.of(context).colorTheme.white, - leading: const StreamBackButton(), - title: Text( - 'Add Group Members', - style: TextStyle( - color: StreamChatTheme.of(context).colorTheme.black, - fontSize: 16, - ), - ), - centerTitle: true, - actions: [ - if (_selectedUsers.isNotEmpty) - IconButton( - icon: StreamSvgIcon.arrow_right( - color: StreamChatTheme.of(context).colorTheme.accentBlue, - ), - onPressed: () async { - final updatedList = await Navigator.pushNamed( - context, - Routes.NEW_GROUP_CHAT_DETAILS, - arguments: _selectedUsers.toList(growable: false), - ); - if (updatedList != null) { - setState(() { - _selectedUsers - ..clear() - ..addAll(updatedList); - }); - } - }, - ) - ], - ), - body: ConnectionStatusBuilder( - statusBuilder: (context, status) { - String statusString = ''; - bool showStatus = true; - - switch (status) { - case ConnectionStatus.connected: - statusString = 'Connected'; - showStatus = false; - break; - case ConnectionStatus.connecting: - statusString = 'Reconnecting...'; - break; - case ConnectionStatus.disconnected: - statusString = 'Disconnected'; - break; - } - return InfoTile( - showMessage: showStatus, - tileAnchor: Alignment.topCenter, - childAnchor: Alignment.topCenter, - message: statusString, - child: NestedScrollView( - floatHeaderSlivers: true, - headerSliverBuilder: - (BuildContext context, bool innerBoxIsScrolled) { - return [ - SliverToBoxAdapter( - child: SearchTextField( - controller: _controller, - ), - ), - if (_selectedUsers.isNotEmpty) - SliverToBoxAdapter( - child: Container( - height: 104, - child: ListView.separated( - scrollDirection: Axis.horizontal, - itemCount: _selectedUsers.length, - padding: const EdgeInsets.all(8), - separatorBuilder: (_, __) => SizedBox(width: 16), - itemBuilder: (_, index) { - final user = _selectedUsers.elementAt(index); - return Column( - children: [ - Stack( - children: [ - UserAvatar( - onlineIndicatorAlignment: - Alignment(0.9, 0.9), - user: user, - showOnlineStatus: true, - borderRadius: BorderRadius.circular(32), - constraints: BoxConstraints.tightFor( - height: 64, - width: 64, - ), - ), - Positioned( - top: -4, - right: -4, - child: GestureDetector( - onTap: () { - if (_selectedUsers.contains(user)) { - setState(() => - _selectedUsers.remove(user)); - } - }, - child: Container( - decoration: BoxDecoration( - color: StreamChatTheme.of(context) - .colorTheme - .white, - shape: BoxShape.circle, - border: Border.all( - color: StreamChatTheme.of(context) - .colorTheme - .whiteSnow, - ), - ), - child: StreamSvgIcon.close( - color: StreamChatTheme.of(context) - .colorTheme - .black, - size: 24, - ), - ), - ), - ) - ], - ), - SizedBox(height: 4), - Text( - user.name.split(' ')[0], - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 12, - ), - ), - ], - ); - }, - ), - ), - ), - SliverPersistentHeader( - pinned: true, - delegate: _HeaderDelegate( - height: 30, - child: Container( - width: double.maxFinite, - decoration: BoxDecoration( - gradient: - StreamChatTheme.of(context).colorTheme.bgGradient, - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 8, - horizontal: 8, - ), - child: Text( - _isSearchActive - ? 'Matches for \"$_userNameQuery\"' - : 'On the platform', - style: TextStyle( - color: - StreamChatTheme.of(context).colorTheme.grey, - ), - ), - ), - ), - ), - ), - ]; - }, - body: GestureDetector( - behavior: HitTestBehavior.opaque, - onPanDown: (_) => FocusScope.of(context).unfocus(), - child: UsersBloc( - child: UserListView( - selectedUsers: _selectedUsers, - pullToRefresh: false, - groupAlphabetically: _isSearchActive ? false : true, - onUserTap: (user, _) { - if (!_selectedUsers.contains(user)) { - setState(() { - _selectedUsers.add(user); - }); - } else { - setState(() { - _selectedUsers.remove(user); - }); - } - }, - pagination: PaginationParams( - limit: 25, - ), - filter: { - if (_userNameQuery.isNotEmpty) - 'name': { - r'$autocomplete': _userNameQuery, - }, - 'id': { - r'$ne': StreamChat.of(context).user.id, - } - }, - sort: [ - SortOption( - 'name', - direction: 1, - ), - ], - emptyBuilder: (_) { - return LayoutBuilder( - builder: (context, viewportConstraints) { - return SingleChildScrollView( - physics: AlwaysScrollableScrollPhysics(), - child: ConstrainedBox( - constraints: BoxConstraints( - minHeight: viewportConstraints.maxHeight, - ), - child: Center( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(24), - child: StreamSvgIcon.search( - size: 96, - color: StreamChatTheme.of(context) - .colorTheme - .grey, - ), - ), - Text( - 'No user matches these keywords...', - style: StreamChatTheme.of(context) - .textTheme - .footnote - .copyWith( - color: StreamChatTheme.of(context) - .colorTheme - .grey, - ), - ), - ], - ), - ), - ), - ); - }, - ); - }, - ), - ), - ), - ), - ); - }, - ), - ); - } -} - -class _HeaderDelegate extends SliverPersistentHeaderDelegate { - final Widget child; - final double height; - - const _HeaderDelegate({ - @required this.child, - @required this.height, - }); - - @override - Widget build( - BuildContext context, double shrinkOffset, bool overlapsContent) { - return Container( - color: StreamChatTheme.of(context).colorTheme.white, - child: child, - ); - } - - @override - double get maxExtent => height; - - @override - double get minExtent => height; - - @override - bool shouldRebuild(_HeaderDelegate oldDelegate) => true; -} diff --git a/packages/stream_chat_flutter/example/lib/notifications_service.dart b/packages/stream_chat_flutter/example/lib/notifications_service.dart deleted file mode 100644 index 246923df..00000000 --- a/packages/stream_chat_flutter/example/lib/notifications_service.dart +++ /dev/null @@ -1,31 +0,0 @@ -import 'package:flutter_local_notifications/flutter_local_notifications.dart' - hide Message; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; - -void showLocalNotification(Event event) async { - if (event.message == null) return; - final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); - final initializationSettingsAndroid = - AndroidInitializationSettings('launch_background'); - final initializationSettingsIOS = IOSInitializationSettings(); - final initializationSettings = InitializationSettings( - android: initializationSettingsAndroid, - iOS: initializationSettingsIOS, - ); - await flutterLocalNotificationsPlugin.initialize(initializationSettings); - await flutterLocalNotificationsPlugin.show( - event.message.id.hashCode, - event.message.user.name, - event.message.text, - NotificationDetails( - android: AndroidNotificationDetails( - 'message channel', - 'Message channel', - 'Channel used for showing messages', - priority: Priority.high, - importance: Importance.high, - ), - iOS: IOSNotificationDetails(), - ), - ); -} diff --git a/packages/stream_chat_flutter/example/lib/routes/app_routes.dart b/packages/stream_chat_flutter/example/lib/routes/app_routes.dart deleted file mode 100644 index e7c7e318..00000000 --- a/packages/stream_chat_flutter/example/lib/routes/app_routes.dart +++ /dev/null @@ -1,93 +0,0 @@ -import 'routes.dart'; -import 'package:flutter/material.dart'; -import '../choose_user_page.dart'; -import '../advanced_options_page.dart'; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; -import '../main.dart'; -import '../group_chat_details_screen.dart'; -import '../new_group_chat_screen.dart'; -import '../new_chat_screen.dart'; -import '../chat_info_screen.dart'; -import '../group_info_screen.dart'; - -class AppRoutes { - /// Add entry for new route here - static Route generateRoute(RouteSettings settings) { - final args = settings.arguments; - switch (settings.name) { - case Routes.APP: - return MaterialPageRoute( - settings: const RouteSettings(name: Routes.APP), - builder: (_) { - return MyApp(args); - }); - case Routes.HOME: - return MaterialPageRoute( - settings: const RouteSettings(name: Routes.HOME), - builder: (_) { - return HomePage(); - }); - case Routes.CHOOSE_USER: - return MaterialPageRoute( - settings: const RouteSettings(name: Routes.CHOOSE_USER), - builder: (_) { - return ChooseUserPage(); - }); - case Routes.ADVANCED_OPTIONS: - return MaterialPageRoute( - settings: const RouteSettings(name: Routes.ADVANCED_OPTIONS), - builder: (_) => AdvancedOptionsPage(), - ); - case Routes.CHANNEL_PAGE: - return MaterialPageRoute( - settings: const RouteSettings(name: Routes.CHANNEL_PAGE), - builder: (_) { - final arg = args as ChannelPageArgs; - return StreamChannel( - channel: arg.channel, - initialMessageId: arg.initialMessage?.id, - child: ChannelPage( - highlightInitialMessage: arg.initialMessage != null, - ), - ); - }); - case Routes.NEW_CHAT: - return MaterialPageRoute( - settings: const RouteSettings(name: Routes.NEW_CHAT), - builder: (_) { - return NewChatScreen(); - }); - case Routes.NEW_GROUP_CHAT: - return MaterialPageRoute( - settings: const RouteSettings(name: Routes.NEW_GROUP_CHAT), - builder: (_) { - return NewGroupChatScreen(); - }); - case Routes.NEW_GROUP_CHAT_DETAILS: - return MaterialPageRoute( - settings: const RouteSettings(name: Routes.NEW_GROUP_CHAT_DETAILS), - builder: (_) { - return GroupChatDetailsScreen( - selectedUsers: args, - ); - }); - case Routes.CHAT_INFO_SCREEN: - return MaterialPageRoute( - settings: const RouteSettings(name: Routes.CHAT_INFO_SCREEN), - builder: (_) { - return ChatInfoScreen( - user: args, - ); - }); - case Routes.GROUP_INFO_SCREEN: - return MaterialPageRoute( - settings: const RouteSettings(name: Routes.GROUP_INFO_SCREEN), - builder: (_) { - return GroupInfoScreen(); - }); - // Default case, should not reach here. - default: - return null; - } - } -} diff --git a/packages/stream_chat_flutter/example/lib/routes/routes.dart b/packages/stream_chat_flutter/example/lib/routes/routes.dart deleted file mode 100644 index 2280ca30..00000000 --- a/packages/stream_chat_flutter/example/lib/routes/routes.dart +++ /dev/null @@ -1,13 +0,0 @@ -/// Define all the route names here -class Routes { - static const String APP = '/app'; - static const String HOME = '/home'; - static const String CHOOSE_USER = '/choose_user'; - static const String ADVANCED_OPTIONS = '/advance_options'; - static const String CHANNEL_PAGE = '/channel_page'; - static const String NEW_CHAT = '/new_chat'; - static const String NEW_GROUP_CHAT = '/new_group_chat'; - static const String NEW_GROUP_CHAT_DETAILS = '/new_group_chat_details'; - static const String CHAT_INFO_SCREEN = '/chat_info_screen'; - static const String GROUP_INFO_SCREEN = '/group_info_screen'; -} diff --git a/packages/stream_chat_flutter/example/lib/search_text_field.dart b/packages/stream_chat_flutter/example/lib/search_text_field.dart deleted file mode 100644 index ff34e8a9..00000000 --- a/packages/stream_chat_flutter/example/lib/search_text_field.dart +++ /dev/null @@ -1,94 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; - -class SearchTextField extends StatelessWidget { - final TextEditingController controller; - final ValueChanged onChanged; - final String hintText; - final VoidCallback onTap; - final bool showCloseButton; - - const SearchTextField({ - Key key, - @required this.controller, - this.onChanged, - this.onTap, - this.hintText = 'Search', - this.showCloseButton = true, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - return Container( - height: 36, - decoration: BoxDecoration( - color: StreamChatTheme.of(context).colorTheme.white, - border: Border.all( - color: StreamChatTheme.of(context).colorTheme.greyWhisper, - ), - borderRadius: BorderRadius.circular(24), - ), - margin: const EdgeInsets.symmetric( - vertical: 8, - horizontal: 8, - ), - child: Row( - children: [ - Expanded( - child: TextField( - onTap: onTap, - controller: controller, - onChanged: onChanged, - decoration: InputDecoration( - prefixText: ' ', - prefixIconConstraints: BoxConstraints.tight(Size(40, 24)), - prefixIcon: Padding( - padding: const EdgeInsets.only( - left: 8, - right: 8, - ), - child: StreamSvgIcon.search( - color: StreamChatTheme.of(context).colorTheme.black, - size: 24, - ), - ), - hintText: hintText, - hintStyle: StreamChatTheme.of(context).textTheme.body.copyWith( - color: StreamChatTheme.of(context) - .colorTheme - .black - .withOpacity(.5)), - contentPadding: const EdgeInsets.all(0), - border: OutlineInputBorder( - borderSide: BorderSide.none, - borderRadius: BorderRadius.circular(24), - ), - ), - ), - ), - if (showCloseButton) - Material( - color: Colors.transparent, - child: IconButton( - padding: const EdgeInsets.all(0), - icon: StreamSvgIcon.close_small( - color: Colors.grey, - ), - splashRadius: 24, - onPressed: () { - if (controller.text.isNotEmpty) { - Future.microtask( - () => [ - controller.clear(), - if (onChanged != null) onChanged(''), - ], - ); - } - }, - ), - ), - ], - ), - ); - } -} diff --git a/packages/stream_chat_flutter/example/lib/split_view.dart b/packages/stream_chat_flutter/example/lib/split_view.dart index 08324759..dbece419 100644 --- a/packages/stream_chat_flutter/example/lib/split_view.dart +++ b/packages/stream_chat_flutter/example/lib/split_view.dart @@ -1,3 +1,4 @@ +// ignore_for_file: public_member_api_docs import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; diff --git a/packages/stream_chat_flutter/example/lib/stream_version.dart b/packages/stream_chat_flutter/example/lib/stream_version.dart deleted file mode 100644 index b3f926be..00000000 --- a/packages/stream_chat_flutter/example/lib/stream_version.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:yaml/yaml.dart'; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; - -class StreamVersion extends StatelessWidget { - const StreamVersion({ - Key key, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - return Container( - padding: const EdgeInsets.symmetric(vertical: 16), - alignment: Alignment.bottomCenter, - child: FutureBuilder( - future: rootBundle.loadString('pubspec.lock'), - builder: (context, snapshot) { - if (!snapshot.hasData) { - return SizedBox(); - } - - final pubspec = snapshot.data; - final yaml = loadYaml(pubspec); - final streamChatDep = - yaml['packages']['stream_chat_flutter']['version']; - - return Text( - 'Stream SDK v ${streamChatDep}', - style: TextStyle( - fontSize: 14, - color: StreamChatTheme.of(context).colorTheme.greyGainsboro, - ), - ); - }, - ), - ); - } -} diff --git a/packages/stream_chat_flutter/example/lib/single_conversation.dart b/packages/stream_chat_flutter/example/lib/tutorial-part-1.dart similarity index 98% rename from packages/stream_chat_flutter/example/lib/single_conversation.dart rename to packages/stream_chat_flutter/example/lib/tutorial-part-1.dart index 66a1091c..8fda6029 100644 --- a/packages/stream_chat_flutter/example/lib/single_conversation.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial-part-1.dart @@ -1,3 +1,4 @@ +// ignore_for_file: public_member_api_docs import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; diff --git a/packages/stream_chat_flutter/example/lib/multiple_conversation.dart b/packages/stream_chat_flutter/example/lib/tutorial-part-2.dart similarity index 98% rename from packages/stream_chat_flutter/example/lib/multiple_conversation.dart rename to packages/stream_chat_flutter/example/lib/tutorial-part-2.dart index f810231c..411b9475 100644 --- a/packages/stream_chat_flutter/example/lib/multiple_conversation.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial-part-2.dart @@ -1,3 +1,4 @@ +// ignore_for_file: public_member_api_docs import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; diff --git a/packages/stream_chat_flutter/example/lib/customize_channel_preview.dart b/packages/stream_chat_flutter/example/lib/tutorial-part-3.dart similarity index 97% rename from packages/stream_chat_flutter/example/lib/customize_channel_preview.dart rename to packages/stream_chat_flutter/example/lib/tutorial-part-3.dart index 2f28fa80..5c309d48 100644 --- a/packages/stream_chat_flutter/example/lib/customize_channel_preview.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial-part-3.dart @@ -1,3 +1,4 @@ +// ignore_for_file: public_member_api_docs import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; @@ -76,7 +77,7 @@ class ChannelListPage extends StatelessWidget { final lastMessage = channel.state.messages.reversed .firstWhere((message) => !message.isDeleted); - final subtitle = (lastMessage == null ? "nothing yet" : lastMessage.text); + final subtitle = (lastMessage == null ? 'nothing yet' : lastMessage.text); final opacity = channel.state.unreadCount > .0 ? 1.0 : 0.5; return ListTile( diff --git a/packages/stream_chat_flutter/example/lib/threads.dart b/packages/stream_chat_flutter/example/lib/tutorial-part-4.dart similarity index 98% rename from packages/stream_chat_flutter/example/lib/threads.dart rename to packages/stream_chat_flutter/example/lib/tutorial-part-4.dart index 6a3c7766..2b46d46b 100644 --- a/packages/stream_chat_flutter/example/lib/threads.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial-part-4.dart @@ -1,3 +1,4 @@ +// ignore_for_file: public_member_api_docs import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; diff --git a/packages/stream_chat_flutter/example/lib/custom_message.dart b/packages/stream_chat_flutter/example/lib/tutorial-part-5.dart similarity index 98% rename from packages/stream_chat_flutter/example/lib/custom_message.dart rename to packages/stream_chat_flutter/example/lib/tutorial-part-5.dart index e2756430..4d9133ee 100644 --- a/packages/stream_chat_flutter/example/lib/custom_message.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial-part-5.dart @@ -1,3 +1,4 @@ +// ignore_for_file: public_member_api_docs import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; diff --git a/packages/stream_chat_flutter/example/lib/custom_theme.dart b/packages/stream_chat_flutter/example/lib/tutorial-part-6.dart similarity index 98% rename from packages/stream_chat_flutter/example/lib/custom_theme.dart rename to packages/stream_chat_flutter/example/lib/tutorial-part-6.dart index a7ad5ba0..69e0f26a 100644 --- a/packages/stream_chat_flutter/example/lib/custom_theme.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial-part-6.dart @@ -1,3 +1,4 @@ +// ignore_for_file: public_member_api_docs import 'package:flutter/material.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; diff --git a/packages/stream_chat_flutter/example/pubspec.yaml b/packages/stream_chat_flutter/example/pubspec.yaml index 9b387e39..7a1863b0 100644 --- a/packages/stream_chat_flutter/example/pubspec.yaml +++ b/packages/stream_chat_flutter/example/pubspec.yaml @@ -1,10 +1,24 @@ name: example description: A new Flutter project. -publish_to: 'none' -version: 1.2.0+1 + +# The following line prevents the package from being accidentally published to +# pub.dev using `pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +version: 1.0.0+1 environment: - sdk: ">=2.2.2 <3.0.0" + sdk: ">=2.7.0 <3.0.0" dependencies: flutter: @@ -13,30 +27,53 @@ dependencies: path: ../ stream_chat_persistence: path: ../../stream_chat_persistence - flutter_apns: ^1.4.1 - flutter_local_notifications: ^2.0.2 - flutter_svg: ^0.19.1 - flutter_secure_storage: ^3.3.5 - yaml: ^2.2.1 - uuid: ^2.2.2 - streaming_shared_preferences: ^1.0.2 + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.0 dev_dependencies: flutter_test: sdk: flutter - flutter_driver: - sdk: flutter - flutter_launcher_icons: ^0.8.1 - test: any +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter. flutter: - assets: - - assets/ - - pubspec.lock + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. uses-material-design: true -flutter_icons: - android: true - ios: true - image_path_android: "assets/android_icon.png" - image_path_ios: "assets/ios_icon.png" + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware. + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/packages/stream_chat_flutter/example/test_driver/single_conversation.dart b/packages/stream_chat_flutter/example/test_driver/single_conversation.dart deleted file mode 100644 index 28ec8e56..00000000 --- a/packages/stream_chat_flutter/example/test_driver/single_conversation.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'package:flutter_driver/driver_extension.dart'; - -import '../lib/single_conversation.dart' as app; - -void main() async { - enableFlutterDriverExtension(); - - await app.main(); -} diff --git a/packages/stream_chat_flutter/example/test_driver/single_conversation_test.dart b/packages/stream_chat_flutter/example/test_driver/single_conversation_test.dart deleted file mode 100644 index c4f7b991..00000000 --- a/packages/stream_chat_flutter/example/test_driver/single_conversation_test.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'dart:io'; - -import 'package:flutter_driver/flutter_driver.dart'; -import 'package:test/test.dart'; - -void main() { - test('Single conversation', () async { - final inputFinder = find.byValueKey('messageInputText'); - final sendButtonFinder = find.byValueKey('sendButton'); - final messageListViewFinder = find.byValueKey('messageListView'); - - FlutterDriver driver = await FlutterDriver.connect(); - // Connect to the Flutter driver before running any tests. - - sleep(Duration(seconds: 5)); - - await driver.waitFor(inputFinder); - - await driver.tap(inputFinder); - - sleep(Duration(seconds: 1)); - - await driver.enterText('hey'); - - sleep(Duration(seconds: 1)); - - await driver.tap(sendButtonFinder); - - sleep(Duration(seconds: 1)); - - await driver.scroll( - messageListViewFinder, - 0, - 2000, - Duration(seconds: 1), - ); - - sleep(Duration(seconds: 1)); - - // Close the connection to the driver after the tests have completed. - sleep(Duration(seconds: 5)); - if (driver != null) { - await driver.close(); - } - }); -} diff --git a/packages/stream_chat_flutter/example/web/favicon.png b/packages/stream_chat_flutter/example/web/favicon.png deleted file mode 100644 index 8aaa46ac..00000000 Binary files a/packages/stream_chat_flutter/example/web/favicon.png and /dev/null differ diff --git a/packages/stream_chat_flutter/example/web/icons/Icon-192.png b/packages/stream_chat_flutter/example/web/icons/Icon-192.png deleted file mode 100644 index b749bfef..00000000 Binary files a/packages/stream_chat_flutter/example/web/icons/Icon-192.png and /dev/null differ diff --git a/packages/stream_chat_flutter/example/web/icons/Icon-512.png b/packages/stream_chat_flutter/example/web/icons/Icon-512.png deleted file mode 100644 index 88cfd48d..00000000 Binary files a/packages/stream_chat_flutter/example/web/icons/Icon-512.png and /dev/null differ diff --git a/packages/stream_chat_flutter/example/web/index.html b/packages/stream_chat_flutter/example/web/index.html deleted file mode 100644 index c9fb7275..00000000 --- a/packages/stream_chat_flutter/example/web/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - example - - - - - - - - - diff --git a/packages/stream_chat_flutter/example/web/manifest.json b/packages/stream_chat_flutter/example/web/manifest.json deleted file mode 100644 index 8c012917..00000000 --- a/packages/stream_chat_flutter/example/web/manifest.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "example", - "short_name": "example", - "start_url": ".", - "display": "standalone", - "background_color": "#0175C2", - "theme_color": "#0175C2", - "description": "A new Flutter project.", - "orientation": "portrait-primary", - "prefer_related_applications": false, - "icons": [ - { - "src": "icons/Icon-192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "icons/Icon-512.png", - "sizes": "512x512", - "type": "image/png" - } - ] -} diff --git a/packages/stream_chat_flutter/example/web/sql-wasm.js b/packages/stream_chat_flutter/example/web/sql-wasm.js deleted file mode 100644 index 9ef1837d..00000000 --- a/packages/stream_chat_flutter/example/web/sql-wasm.js +++ /dev/null @@ -1,207 +0,0 @@ -// We are modularizing this manually because the current modularize setting in Emscripten has some issues: -// https://github.com/kripken/emscripten/issues/5820 -// In addition, When you use emcc's modularization, it still expects to export a global object called `Module`, -// which is able to be used/called before the WASM is loaded. -// The modularization below exports a promise that loads and resolves to the actual sql.js module. -// That way, this module can't be used before the WASM is finished loading. - -// We are going to define a function that a user will call to start loading initializing our Sql.js library -// However, that function might be called multiple times, and on subsequent calls, we don't actually want it to instantiate a new instance of the Module -// Instead, we want to return the previously loaded module - -// TODO: Make this not declare a global if used in the browser -var initSqlJsPromise = undefined; - -var initSqlJs = function (moduleConfig) { - -if (initSqlJsPromise){ -return initSqlJsPromise; -} -// If we're here, we've never called this function before -initSqlJsPromise = new Promise((resolveModule, reject) => { - -// We are modularizing this manually because the current modularize setting in Emscripten has some issues: -// https://github.com/kripken/emscripten/issues/5820 - -// The way to affect the loading of emcc compiled modules is to create a variable called `Module` and add -// properties to it, like `preRun`, `postRun`, etc -// We are using that to get notified when the WASM has finished loading. -// Only then will we return our promise - -// If they passed in a moduleConfig object, use that -// Otherwise, initialize Module to the empty object -var Module = typeof moduleConfig !== 'undefined' ? moduleConfig : {}; - -// EMCC only allows for a single onAbort function (not an array of functions) -// So if the user defined their own onAbort function, we remember it and call it -var originalOnAbortFunction = Module['onAbort']; -Module['onAbort'] = function (errorThatCausedAbort) { -reject(new Error(errorThatCausedAbort)); -if (originalOnAbortFunction){ -originalOnAbortFunction(errorThatCausedAbort); -} -}; - -Module['postRun'] = Module['postRun'] || []; -Module['postRun'].push(function () { -// When Emscripted calls postRun, this promise resolves with the built Module -resolveModule(Module); -}); - -// There is a section of code in the emcc-generated code below that looks like this: -// (Note that this is lowercase `module`) -// if (typeof module !== 'undefined') { -// module['exports'] = Module; -// } -// When that runs, it's going to overwrite our own modularization export efforts in shell-post.js! -// The only way to tell emcc not to emit it is to pass the MODULARIZE=1 or MODULARIZE_INSTANCE=1 flags, -// but that carries with it additional unnecessary baggage/bugs we don't want either. -// So, we have three options: -// 1) We undefine `module` -// 2) We remember what `module['exports']` was at the beginning of this function and we restore it later -// 3) We write a script to remove those lines of code as part of the Make process. -// -// Since those are the only lines of code that care about module, we will undefine it. It's the most straightforward -// of the options, and has the side effect of reducing emcc's efforts to modify the module if its output were to change in the future. -// That's a nice side effect since we're handling the modularization efforts ourselves -module = undefined; - -// The emcc-generated code and shell-post.js code goes below, -// meaning that all of it runs inside of this promise. If anything throws an exception, our promise will abort -var aa;var f;f||(f=typeof Module !== 'undefined' ? Module : {}); -var va=function(){var a;var b=h(4);var c={};var d=function(){function a(a,b){this.fb=a;this.db=b;this.nb=1;this.Eb=[]}a.prototype.bind=function(a){if(!this.fb)throw"Statement closed";this.reset();return Array.isArray(a)?this.lc(a):this.mc(a)};a.prototype.step=function(){var a;if(!this.fb)throw"Statement closed";this.nb=1;switch(a=Tb(this.fb)){case c.hc:return!0;case c.DONE:return!1;default:return this.db.handleError(a)}};a.prototype.sc=function(a){null==a&&(a=this.nb++);return Ub(this.fb,a)};a.prototype.tc= -function(a){null==a&&(a=this.nb++);return Vb(this.fb,a)};a.prototype.getBlob=function(a){var b;null==a&&(a=this.nb++);var c=Wb(this.fb,a);var d=Xb(this.fb,a);var e=new Uint8Array(c);for(a=b=0;0<=c?bc;a=0<=c?++b:--b)e[a]=l[d+a];return e};a.prototype.get=function(a){var b,d;null!=a&&this.bind(a)&&this.step();var e=[];a=b=0;for(d=ib(this.fb);0<=d?bd;a=0<=d?++b:--b)switch(Yb(this.fb,a)){case c.fc:case c.FLOAT:e.push(this.sc(a));break;case c.ic:e.push(this.tc(a));break;case c.Zb:e.push(this.getBlob(a)); -break;default:e.push(null)}return e};a.prototype.getColumnNames=function(){var a,b;var c=[];var d=a=0;for(b=ib(this.fb);0<=b?ab;d=0<=b?++a:--a)c.push(Zb(this.fb,d));return c};a.prototype.getAsObject=function(a){var b,c;var d=this.get(a);var e=this.getColumnNames();var g={};a=b=0;for(c=e.length;b>>0);if(null!=a){var c=this.filename,d=c?n("/",c):"/";c=ia(!0,!0);d=ja(d,(void 0!==c?c:438)&4095|32768,0);if(a){if("string"===typeof a){for(var e=Array(a.length),k=0,m=a.length;kc;e=0<=c?++g:--g){var m=q(d+4*e,"i32");var z=jc(m);e=function(){switch(!1){case 1!==z:return kc; -case 2!==z:return lc;case 3!==z:return mc;case 4!==z:return function(a){var b,c;var d=nc(a);var e=oc(a);a=new Uint8Array(d);for(b=c=0;0<=d?cd;b=0<=d?++c:--c)a[b]=l[e+b];return a};default:return function(){return null}}}();e=e(m);k.push(e)}if(c=b.apply(null,k))switch(typeof c){case "number":return pc(a,c);case "string":return qc(a,c,-1,-1)}else return rc(a)});this.handleError(sc(this.db,a,b.length,c.jc,0,d,0,0,0));return this};return a}();var g=f.cwrap("sqlite3_open","number",["string","number"]); -var k=f.cwrap("sqlite3_close_v2","number",["number"]);var m=f.cwrap("sqlite3_exec","number",["number","string","number","number","number"]);f.cwrap("sqlite3_free","",["number"]);var y=f.cwrap("sqlite3_changes","number",["number"]);var z=f.cwrap("sqlite3_prepare_v2","number",["number","string","number","number","number"]);var fa=f.cwrap("sqlite3_prepare_v2","number",["number","number","number","number","number"]);var ca=f.cwrap("sqlite3_bind_text","number",["number","number","number","number","number"]); -var Ia=f.cwrap("sqlite3_bind_blob","number",["number","number","number","number","number"]);var ac=f.cwrap("sqlite3_bind_double","number",["number","number","number"]);var $b=f.cwrap("sqlite3_bind_int","number",["number","number","number"]);var bc=f.cwrap("sqlite3_bind_parameter_index","number",["number","string"]);var Tb=f.cwrap("sqlite3_step","number",["number"]);var hc=f.cwrap("sqlite3_errmsg","string",["number"]);var ib=f.cwrap("sqlite3_data_count","number",["number"]);var Ub=f.cwrap("sqlite3_column_double", -"number",["number","number"]);var Vb=f.cwrap("sqlite3_column_text","string",["number","number"]);var Xb=f.cwrap("sqlite3_column_blob","number",["number","number"]);var Wb=f.cwrap("sqlite3_column_bytes","number",["number","number"]);var Yb=f.cwrap("sqlite3_column_type","number",["number","number"]);var Zb=f.cwrap("sqlite3_column_name","string",["number","number"]);var dc=f.cwrap("sqlite3_reset","number",["number"]);var cc=f.cwrap("sqlite3_clear_bindings","number",["number"]);var ec=f.cwrap("sqlite3_finalize", -"number",["number"]);var sc=f.cwrap("sqlite3_create_function_v2","number","number string number number number number number number number".split(" "));var jc=f.cwrap("sqlite3_value_type","number",["number"]);var nc=f.cwrap("sqlite3_value_bytes","number",["number"]);var mc=f.cwrap("sqlite3_value_text","string",["number"]);var kc=f.cwrap("sqlite3_value_int","number",["number"]);var oc=f.cwrap("sqlite3_value_blob","number",["number"]);var lc=f.cwrap("sqlite3_value_double","number",["number"]);var pc= -f.cwrap("sqlite3_result_double","",["number","number"]);var rc=f.cwrap("sqlite3_result_null","",["number"]);var qc=f.cwrap("sqlite3_result_text","",["number","string","number","number"]);var fc=f.cwrap("RegisterExtensionFunctions","number",["number"]);this.SQL={Database:e};for(a in this.SQL)f[a]=this.SQL[a];var da=0;c.xb=0;c.we=1;c.Pe=2;c.Ze=3;c.Cc=4;c.Ec=5;c.Se=6;c.NOMEM=7;c.bf=8;c.Qe=9;c.Re=10;c.Hc=11;c.NOTFOUND=12;c.Oe=13;c.Fc=14;c.$e=15;c.EMPTY=16;c.cf=17;c.df=18;c.Gc=19;c.Te=20;c.Ue=21;c.Ve= -22;c.Dc=23;c.Ne=24;c.af=25;c.We=26;c.Xe=27;c.ef=28;c.hc=100;c.DONE=101;c.fc=1;c.FLOAT=2;c.ic=3;c.Zb=4;c.Ye=5;c.jc=1}.bind(this);f.preRun=f.preRun||[];f.preRun.push(va);var wa={},u;for(u in f)f.hasOwnProperty(u)&&(wa[u]=f[u]);f.arguments=[];f.thisProgram="./this.program";f.quit=function(a,b){throw b;};f.preRun=[];f.postRun=[];var v=!1,w=!1,x=!1,xa=!1;v="object"===typeof window;w="function"===typeof importScripts;x="object"===typeof process&&"function"===typeof require&&!v&&!w;xa=!v&&!x&&!w;var A=""; -if(x){A=__dirname+"/";var ya,za;f.read=function(a,b){ya||(ya=require("fs"));za||(za=require("path"));a=za.normalize(a);a=ya.readFileSync(a);return b?a:a.toString()};f.readBinary=function(a){a=f.read(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a};1>2];a=b+a+15&-16;if(a<=Da())D[Ca>>2]=a;else if(!Ea(a))return 0;return b} -var Fa={"f64-rem":function(a,b){return a%b},"debugger":function(){debugger}},Ga=1,E=Array(64);function ua(a){for(var b=0;64>b;b++)if(!E[b])return E[b]=a,Ga+b;throw"Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.";}"object"!==typeof WebAssembly&&C("no native wasm support detected"); -function q(a,b){b=b||"i8";"*"===b.charAt(b.length-1)&&(b="i32");switch(b){case "i1":return l[a>>0];case "i8":return l[a>>0];case "i16":return Ha[a>>1];case "i32":return D[a>>2];case "i64":return D[a>>2];case "float":return Ja[a>>2];case "double":return Ka[a>>3];default:B("invalid type for getValue: "+b)}return null}var La,Ma=!1;function assert(a,b){a||B("Assertion failed: "+b)}function Na(a){var b=f["_"+a];assert(b,"Cannot call unknown function "+a+", make sure it is exported");return b} -function Oa(a,b,c,d){var e={string:function(a){var b=0;if(null!==a&&void 0!==a&&0!==a){var c=(a.length<<2)+1;b=h(c);r(a,F,b,c)}return b},array:function(a){var b=h(a.length);l.set(a,b);return b}},g=Na(a),k=[];a=0;if(d)for(var m=0;m>0]=0;break;case "i8":l[a>>0]=0;break;case "i16":Ha[a>>1]=0;break;case "i32":D[a>>2]=0;break;case "i64":aa=[0,1<=+Pa(0)?~~+Qa(0)>>>0:0];D[a>>2]=aa[0];D[a+4>>2]=aa[1];break;case "float":Ja[a>>2]=0;break;case "double":Ka[a>>3]=0;break;default:B("invalid type for setValue: "+b)}}var Ra=0,Sa=3; -function ea(a){var b=Ra;if("number"===typeof a){var c=!0;var d=a}else c=!1,d=a.length;b=b==Sa?e:[Ta,h,Ba][b](Math.max(d,1));if(c){var e=b;assert(0==(b&3));for(a=b+(d&-4);e>2]=0;for(a=b+d;e>0]=0;return b}a.subarray||a.slice?F.set(a,b):F.set(new Uint8Array(a),b);return b}var Ua="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0; -function t(a,b,c){var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d}function G(a){return a?t(F,a,void 0):""} -function r(a,b,c,d){if(!(0=k){var m=a.charCodeAt(++g);k=65536+((k&1023)<<10)|m&1023}if(127>=k){if(c>=d)break;b[c++]=k}else{if(2047>=k){if(c+1>=d)break;b[c++]=192|k>>6}else{if(65535>=k){if(c+2>=d)break;b[c++]=224|k>>12}else{if(c+3>=d)break;b[c++]=240|k>>18;b[c++]=128|k>>12&63}b[c++]=128|k>>6&63}b[c++]=128|k&63}}b[c]=0;return c-e} -function oa(a){for(var b=0,c=0;c=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}"undefined"!==typeof TextDecoder&&new TextDecoder("utf-16le");function Va(a){return a.replace(/__Z[\w\d_]+/g,function(a){return a===a?a:a+" ["+a+"]"})}function Wa(a){0Ya&&C("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+Ya+"! (TOTAL_STACK=5242880)"); -f.buffer?buffer=f.buffer:"object"===typeof WebAssembly&&"function"===typeof WebAssembly.Memory?(La=new WebAssembly.Memory({initial:Ya/65536}),buffer=La.buffer):buffer=new ArrayBuffer(Ya);Xa();D[Ca>>2]=5303264;function Za(a){for(;0>2];var c=D[b>>2]}else ob.rb=!0,J.USER=J.LOGNAME="web_user",J.PATH="/",J.PWD="/",J.HOME="/home/web_user",J.LANG="C.UTF-8",J._=f.thisProgram,c=db?Ta(1024):Ba(1024),b=db?Ta(256):Ba(256),D[b>>2]=c,D[a>>2]=b;a=[];var d=0,e;for(e in J)if("string"===typeof J[e]){var g=e+"="+J[e];a.push(g);d+=g.length}if(1024>0]=d.charCodeAt(m);l[k>>0]=0;D[b+ -4*e>>2]=c;c+=g.length+1}D[b+4*a.length>>2]=0}function pb(a){f.___errno_location&&(D[f.___errno_location()>>2]=a);return a}function qb(a,b){for(var c=0,d=a.length-1;0<=d;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a}function rb(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=qb(a.split("/").filter(function(a){return!!a}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a} -function sb(a){var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b}function tb(a){if("/"===a)return"/";var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)}function ub(){var a=Array.prototype.slice.call(arguments,0);return rb(a.join("/"))}function n(a,b){return rb(a+"/"+b)} -function vb(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=qb(a.split("/").filter(function(a){return!!a}),!b).join("/");return(b?"/":"")+a||"."}var wb=[];function xb(a,b){wb[a]={input:[],output:[],ub:b};yb(a,zb)} -var zb={open:function(a){var b=wb[a.node.rdev];if(!b)throw new K(L.Cb);a.tty=b;a.seekable=!1},close:function(a){a.tty.ub.flush(a.tty)},flush:function(a){a.tty.ub.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.ub.Xb)throw new K(L.Ob);for(var e=0,g=0;g=b||(b=Math.max(b,c*(1048576>c?2:1.125)|0),0!=c&&(b=Math.max(b,256)),c=a.bb,a.bb=new Uint8Array(b),0b)a.bb.length=b;else for(;a.bb.length=a.node.gb)return 0;a=Math.min(a.node.gb-e,d);if(8b)throw new K(L.ib);return b},Pb:function(a,b,c){M.Tb(a.node,b+c);a.node.gb=Math.max(a.node.gb,b+c)},zb:function(a,b,c,d,e,g,k){if(32768!== -(a.node.mode&61440))throw new K(L.Cb);c=a.node.bb;if(k&2||c.buffer!==b&&c.buffer!==b.buffer){if(0>2)}catch(c){if(!c.code)throw c; -throw new K(L[c.code]);}return b.mode},kb:function(a){for(var b=[];a.parent!==a;)b.push(a.name),a=a.parent;b.push(a.jb.Hb.root);b.reverse();return ub.apply(null,b)},qc:function(a){a&=-2656257;var b=0,c;for(c in P.Ub)a&c&&(b|=P.Ub[c],a^=c);if(a)throw new K(L.ib);return b},ab:{lb:function(a){a=P.kb(a);try{var b=fs.lstatSync(a)}catch(c){if(!c.code)throw c;throw new K(L[c.code]);}P.yb&&!b.pb&&(b.pb=4096);P.yb&&!b.blocks&&(b.blocks=(b.size+b.pb-1)/b.pb|0);return{dev:b.dev,ino:b.ino,mode:b.mode,nlink:b.nlink, -uid:b.uid,gid:b.gid,rdev:b.rdev,size:b.size,atime:b.atime,mtime:b.mtime,ctime:b.ctime,pb:b.pb,blocks:b.blocks}},hb:function(a,b){var c=P.kb(a);try{void 0!==b.mode&&(fs.chmodSync(c,b.mode),a.mode=b.mode),void 0!==b.size&&fs.truncateSync(c,b.size)}catch(d){if(!d.code)throw d;throw new K(L[d.code]);}},lookup:function(a,b){var c=n(P.kb(a),b);c=P.Wb(c);return P.createNode(a,b,c)},vb:function(a,b,c,d){a=P.createNode(a,b,c,d);b=P.kb(a);try{N(a.mode)?fs.mkdirSync(b,a.mode):fs.writeFileSync(b,"",{mode:a.mode})}catch(e){if(!e.code)throw e; -throw new K(L[e.code]);}return a},rename:function(a,b,c){a=P.kb(a);b=n(P.kb(b),c);try{fs.renameSync(a,b)}catch(d){if(!d.code)throw d;throw new K(L[d.code]);}},unlink:function(a,b){a=n(P.kb(a),b);try{fs.unlinkSync(a)}catch(c){if(!c.code)throw c;throw new K(L[c.code]);}},rmdir:function(a,b){a=n(P.kb(a),b);try{fs.rmdirSync(a)}catch(c){if(!c.code)throw c;throw new K(L[c.code]);}},readdir:function(a){a=P.kb(a);try{return fs.readdirSync(a)}catch(b){if(!b.code)throw b;throw new K(L[b.code]);}},symlink:function(a, -b,c){a=n(P.kb(a),b);try{fs.symlinkSync(c,a)}catch(d){if(!d.code)throw d;throw new K(L[d.code]);}},readlink:function(a){var b=P.kb(a);try{return b=fs.readlinkSync(b),b=Fb.relative(Fb.resolve(a.jb.Hb.root),b)}catch(c){if(!c.code)throw c;throw new K(L[c.code]);}}},cb:{open:function(a){var b=P.kb(a.node);try{32768===(a.node.mode&61440)&&(a.wb=fs.openSync(b,P.qc(a.flags)))}catch(c){if(!c.code)throw c;throw new K(L[c.code]);}},close:function(a){try{32768===(a.node.mode&61440)&&a.wb&&fs.closeSync(a.wb)}catch(b){if(!b.code)throw b; -throw new K(L[b.code]);}},read:function(a,b,c,d,e){if(0===d)return 0;try{return fs.readSync(a.wb,P.Rb(b.buffer),c,d,e)}catch(g){throw new K(L[g.code]);}},write:function(a,b,c,d,e){try{return fs.writeSync(a.wb,P.Rb(b.buffer),c,d,e)}catch(g){throw new K(L[g.code]);}},ob:function(a,b,c){if(1===c)b+=a.position;else if(2===c&&32768===(a.node.mode&61440))try{b+=fs.fstatSync(a.wb).size}catch(d){throw new K(L[d.code]);}if(0>b)throw new K(L.ib);return b}}},Gb=null,Hb={},Q=[],Ib=1,R=null,Jb=!0,S={},K=null, -Eb={};function T(a,b){a=vb("/",a);b=b||{};if(!a)return{path:"",node:null};var c={Vb:!0,Jb:0},d;for(d in c)void 0===b[d]&&(b[d]=c[d]);if(8>>0)%R.length}function Nb(a){var b=Mb(a.parent.id,a.name);a.tb=R[b];R[b]=a}function Ob(a){var b=Mb(a.parent.id,a.name);if(R[b]===a)R[b]=a.tb;else for(b=R[b];b;){if(b.tb===a){b.tb=a.tb;break}b=b.tb}} -function O(a,b){var c;if(c=(c=Pb(a,"x"))?c:a.ab.lookup?0:13)throw new K(c,a);for(c=R[Mb(a.id,b)];c;c=c.tb){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.ab.lookup(a,b)} -function Db(a,b,c,d){Qb||(Qb=function(a,b,c,d){a||(a=this);this.parent=a;this.jb=a.jb;this.sb=null;this.id=Ib++;this.name=b;this.mode=c;this.ab={};this.cb={};this.rdev=d},Qb.prototype={},Object.defineProperties(Qb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}}));a=new Qb(a,b,c,d);Nb(a);return a} -function N(a){return 16384===(a&61440)}var Rb={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function ic(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}function Pb(a,b){if(Jb)return 0;if(-1===b.indexOf("r")||a.mode&292){if(-1!==b.indexOf("w")&&!(a.mode&146)||-1!==b.indexOf("x")&&!(a.mode&73))return 13}else return 13;return 0}function tc(a,b){try{return O(a,b),17}catch(c){}return Pb(a,"wx")} -function uc(a,b,c){try{var d=O(a,b)}catch(e){return e.eb}if(a=Pb(a,"wx"))return a;if(c){if(!N(d.mode))return 20;if(d===d.parent||"/"===Lb(d))return 16}else if(N(d.mode))return 21;return 0}function vc(a){var b=4096;for(a=a||0;a<=b;a++)if(!Q[a])return a;throw new K(24);} -function wc(a,b){xc||(xc=function(){},xc.prototype={},Object.defineProperties(xc.prototype,{object:{get:function(){return this.node},set:function(a){this.node=a}}}));var c=new xc,d;for(d in a)c[d]=a[d];a=c;b=vc(b);a.fd=b;return Q[b]=a}var Cb={open:function(a){a.cb=Hb[a.node.rdev].cb;a.cb.open&&a.cb.open(a)},ob:function(){throw new K(29);}};function yb(a,b){Hb[a]={cb:b}} -function yc(a,b){var c="/"===b,d=!b;if(c&&Gb)throw new K(16);if(!c&&!d){var e=T(b,{Vb:!1});b=e.path;e=e.node;if(e.sb)throw new K(16);if(!N(e.mode))throw new K(20);}b={type:a,Hb:{},Yb:b,wc:[]};a=a.jb(b);a.jb=b;b.root=a;c?Gb=a:e&&(e.sb=b,e.jb&&e.jb.wc.push(b))}function ja(a,b,c){var d=T(a,{parent:!0}).node;a=tb(a);if(!a||"."===a||".."===a)throw new K(22);var e=tc(d,a);if(e)throw new K(e);if(!d.ab.vb)throw new K(1);return d.ab.vb(d,a,b,c)}function U(a,b){ja(a,(void 0!==b?b:511)&1023|16384,0)} -function zc(a,b,c){"undefined"===typeof c&&(c=b,b=438);ja(a,b|8192,c)}function Ac(a,b){if(!vb(a))throw new K(2);var c=T(b,{parent:!0}).node;if(!c)throw new K(2);b=tb(b);var d=tc(c,b);if(d)throw new K(d);if(!c.ab.symlink)throw new K(1);c.ab.symlink(c,b,a)} -function ta(a){var b=T(a,{parent:!0}).node,c=tb(a),d=O(b,c),e=uc(b,c,!1);if(e)throw new K(e);if(!b.ab.unlink)throw new K(1);if(d.sb)throw new K(16);try{S.willDeletePath&&S.willDeletePath(a)}catch(g){console.log("FS.trackingDelegate['willDeletePath']('"+a+"') threw an exception: "+g.message)}b.ab.unlink(b,c);Ob(d);try{if(S.onDeletePath)S.onDeletePath(a)}catch(g){console.log("FS.trackingDelegate['onDeletePath']('"+a+"') threw an exception: "+g.message)}} -function Kb(a){a=T(a).node;if(!a)throw new K(2);if(!a.ab.readlink)throw new K(22);return vb(Lb(a.parent),a.ab.readlink(a))}function ra(a,b){a=T(a,{qb:!b}).node;if(!a)throw new K(2);if(!a.ab.lb)throw new K(1);return a.ab.lb(a)}function Bc(a){return ra(a,!0)}function ka(a,b){var c;"string"===typeof a?c=T(a,{qb:!0}).node:c=a;if(!c.ab.hb)throw new K(1);c.ab.hb(c,{mode:b&4095|c.mode&-4096,timestamp:Date.now()})} -function Cc(a){var b;"string"===typeof a?b=T(a,{qb:!0}).node:b=a;if(!b.ab.hb)throw new K(1);b.ab.hb(b,{timestamp:Date.now()})}function Dc(a,b){if(0>b)throw new K(22);var c;"string"===typeof a?c=T(a,{qb:!0}).node:c=a;if(!c.ab.hb)throw new K(1);if(N(c.mode))throw new K(21);if(32768!==(c.mode&61440))throw new K(22);if(a=Pb(c,"w"))throw new K(a);c.ab.hb(c,{size:b,timestamp:Date.now()})} -function p(a,b,c,d){if(""===a)throw new K(2);if("string"===typeof b){var e=Rb[b];if("undefined"===typeof e)throw Error("Unknown file open mode: "+b);b=e}c=b&64?("undefined"===typeof c?438:c)&4095|32768:0;if("object"===typeof a)var g=a;else{a=rb(a);try{g=T(a,{qb:!(b&131072)}).node}catch(k){}}e=!1;if(b&64)if(g){if(b&128)throw new K(17);}else g=ja(a,c,0),e=!0;if(!g)throw new K(2);8192===(g.mode&61440)&&(b&=-513);if(b&65536&&!N(g.mode))throw new K(20);if(!e&&(c=g?40960===(g.mode&61440)?40:N(g.mode)&& -("r"!==ic(b)||b&512)?21:Pb(g,ic(b)):2))throw new K(c);b&512&&Dc(g,0);b&=-641;d=wc({node:g,path:Lb(g),flags:b,seekable:!0,position:0,cb:g.cb,Bc:[],error:!1},d);d.cb.open&&d.cb.open(d);!f.logReadFiles||b&1||(Ec||(Ec={}),a in Ec||(Ec[a]=1,console.log("FS.trackingDelegate error on read file: "+a)));try{S.onOpenFile&&(g=0,1!==(b&2097155)&&(g|=1),0!==(b&2097155)&&(g|=2),S.onOpenFile(a,g))}catch(k){console.log("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+k.message)}return d} -function ma(a){if(null===a.fd)throw new K(9);a.Gb&&(a.Gb=null);try{a.cb.close&&a.cb.close(a)}catch(b){throw b;}finally{Q[a.fd]=null}a.fd=null}function Fc(a,b,c){if(null===a.fd)throw new K(9);if(!a.seekable||!a.cb.ob)throw new K(29);if(0!=c&&1!=c&&2!=c)throw new K(22);a.position=a.cb.ob(a,b,c);a.Bc=[]} -function sa(a,b,c,d,e){if(0>d||0>e)throw new K(22);if(null===a.fd)throw new K(9);if(1===(a.flags&2097155))throw new K(9);if(N(a.node.mode))throw new K(21);if(!a.cb.read)throw new K(22);var g="undefined"!==typeof e;if(!g)e=a.position;else if(!a.seekable)throw new K(29);b=a.cb.read(a,b,c,d,e);g||(a.position+=b);return b} -function la(a,b,c,d,e,g){if(0>d||0>e)throw new K(22);if(null===a.fd)throw new K(9);if(0===(a.flags&2097155))throw new K(9);if(N(a.node.mode))throw new K(21);if(!a.cb.write)throw new K(22);a.flags&1024&&Fc(a,0,2);var k="undefined"!==typeof e;if(!k)e=a.position;else if(!a.seekable)throw new K(29);b=a.cb.write(a,b,c,d,e,g);k||(a.position+=b);try{if(a.path&&S.onWriteToFile)S.onWriteToFile(a.path)}catch(m){console.log("FS.trackingDelegate['onWriteToFile']('"+a.path+"') threw an exception: "+m.message)}return b} -function Gc(){K||(K=function(a,b){this.node=b;this.zc=function(a){this.eb=a};this.zc(a);this.message="FS error";this.stack&&Object.defineProperty(this,"stack",{value:Error().stack,writable:!0})},K.prototype=Error(),K.prototype.constructor=K,[2].forEach(function(a){Eb[a]=new K(a);Eb[a].stack=""}))}var Hc;function ia(a,b){var c=0;a&&(c|=365);b&&(c|=146);return c} -function Ic(a,b,c){a=n("/dev",a);var d=ia(!!b,!!c);Jc||(Jc=64);var e=Jc++<<8|0;yb(e,{open:function(a){a.seekable=!1},close:function(){c&&c.buffer&&c.buffer.length&&c(10)},read:function(a,c,d,e){for(var g=0,k=0;k>2]=d.dev;D[c+4>>2]=0;D[c+8>>2]=d.ino;D[c+12>>2]=d.mode;D[c+16>>2]=d.nlink;D[c+20>>2]=d.uid;D[c+24>>2]=d.gid;D[c+28>>2]=d.rdev;D[c+32>>2]=0;D[c+36>>2]=d.size;D[c+40>>2]=4096;D[c+44>>2]=d.blocks;D[c+48>>2]=d.atime.getTime()/1E3|0;D[c+52>>2]=0;D[c+56>>2]=d.mtime.getTime()/1E3|0;D[c+60>>2]=0;D[c+64>>2]=d.ctime.getTime()/1E3|0;D[c+68>>2]=0;D[c+72>>2]=d.ino;return 0}var W=0; -function X(){W+=4;return D[W-4>>2]}function Y(){return G(X())}function Z(){var a=Q[X()];if(!a)throw new K(L.Kb);return a}function Da(){return l.length}function Ea(a){if(2147418112=b?b=Wa(2*b):b=Math.min(Wa((3*b+2147483648)/4),2147418112);a=Wa(b);var c=buffer.byteLength;try{var d=-1!==La.grow((a-c)/65536)?buffer=La.buffer:null}catch(e){d=null}if(!d||d.byteLength!=b)return!1;Xa();return!0} -function Mc(a){if(0===a)return 0;a=G(a);if(!J.hasOwnProperty(a))return 0;Mc.rb&&ha(Mc.rb);a=J[a];var b=oa(a)+1,c=Ta(b);c&&r(a,l,c,b);Mc.rb=c;return Mc.rb}r("GMT",F,60272,4); -function Nc(){function a(a){return(a=a.toTimeString().match(/\(([A-Za-z ]+)\)$/))?a[1]:"GMT"}if(!Oc){Oc=!0;D[Pc()>>2]=60*(new Date).getTimezoneOffset();var b=new Date(2E3,0,1),c=new Date(2E3,6,1);D[Qc()>>2]=Number(b.getTimezoneOffset()!=c.getTimezoneOffset());var d=a(b),e=a(c);d=ea(ba(d));e=ea(ba(e));c.getTimezoneOffset()>2]=d,D[Rc()+4>>2]=e):(D[Rc()>>2]=e,D[Rc()+4>>2]=d)}}var Oc; -function Sc(a){a/=1E3;if((v||w)&&self.performance&&self.performance.now)for(var b=self.performance.now();self.performance.now()-b>2]=c.position;c.Gb&&0===d&&0===g&&(c.Gb=null);return 0}catch(k){return"undefined"!==typeof V&&k instanceof K||B(k),-k.eb}},ca:function(a,b){W=b;try{var c=Y(),d=X();ka(c,d);return 0}catch(e){return"undefined"!==typeof V&&e instanceof K||B(e),-e.eb}},ba:function(a,b){W=b;try{var c=X(),d=X();if(0===d)return-L.ib;if(dd?-L.ib:p(c.path,c.flags,0,d).fd;case 1:case 2:return 0; -case 3:return c.flags;case 4:return d=X(),c.flags|=d,0;case 12:return d=X(),Ha[d+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-L.ib;case 9:return pb(L.ib),-1;default:return-L.ib}}catch(e){return"undefined"!==typeof V&&e instanceof K||B(e),-e.eb}},U:function(a,b){W=b;try{var c=Z(),d=X(),e=X();return sa(c,l,d,e)}catch(g){return"undefined"!==typeof V&&g instanceof K||B(g),-g.eb}},T:function(a,b){W=b;try{var c=Y();var d=X();if(d&-8)var e=-L.ib;else{var g=T(c,{qb:!0}).node;a="";d&4&&(a+="r"); -d&2&&(a+="w");d&1&&(a+="x");e=a&&Pb(g,a)?-L.$b:0}return e}catch(k){return"undefined"!==typeof V&&k instanceof K||B(k),-k.eb}},S:function(a,b){W=b;try{var c=Y(),d=X();a=c;a=rb(a);"/"===a[a.length-1]&&(a=a.substr(0,a.length-1));U(a,d);return 0}catch(e){return"undefined"!==typeof V&&e instanceof K||B(e),-e.eb}},R:function(a,b){W=b;try{var c=Z(),d=X(),e=X();return la(c,l,d,e)}catch(g){return"undefined"!==typeof V&&g instanceof K||B(g),-g.eb}},Q:function(a,b){W=b;try{var c=Y(),d=T(c,{parent:!0}).node, -e=tb(c),g=O(d,e),k=uc(d,e,!0);if(k)throw new K(k);if(!d.ab.rmdir)throw new K(1);if(g.sb)throw new K(16);try{S.willDeletePath&&S.willDeletePath(c)}catch(m){console.log("FS.trackingDelegate['willDeletePath']('"+c+"') threw an exception: "+m.message)}d.ab.rmdir(d,e);Ob(g);try{if(S.onDeletePath)S.onDeletePath(c)}catch(m){console.log("FS.trackingDelegate['onDeletePath']('"+c+"') threw an exception: "+m.message)}return 0}catch(m){return"undefined"!==typeof V&&m instanceof K||B(m),-m.eb}},P:function(a,b){W= -b;try{var c=Y(),d=X(),e=X();return p(c,d,e).fd}catch(g){return"undefined"!==typeof V&&g instanceof K||B(g),-g.eb}},s:function(a,b){W=b;try{var c=Z();ma(c);return 0}catch(d){return"undefined"!==typeof V&&d instanceof K||B(d),-d.eb}},O:function(a,b){W=b;try{var c=Y(),d=X();var e=X();if(0>=e)var g=-L.ib;else{var k=Kb(c),m=Math.min(e,oa(k)),y=l[d+m];r(k,F,d,e+1);l[d+m]=y;g=m}return g}catch(z){return"undefined"!==typeof V&&z instanceof K||B(z),-z.eb}},N:function(a,b){W=b;try{var c=X(),d=X(),e=Kc[c];if(!e)return 0; -if(d===e.uc){var g=Q[e.fd],k=e.flags,m=new Uint8Array(F.subarray(c,c+d));g&&g.cb.Ab&&g.cb.Ab(g,m,0,d,k);Kc[c]=null;e.Db&&ha(e.vc)}return 0}catch(y){return"undefined"!==typeof V&&y instanceof K||B(y),-y.eb}},M:function(a,b){W=b;try{var c=X(),d=X(),e=Q[c];if(!e)throw new K(9);ka(e.node,d);return 0}catch(g){return"undefined"!==typeof V&&g instanceof K||B(g),-g.eb}},L:Da,K:function(a,b,c){F.set(F.subarray(b,b+c),a)},J:Ea,r:Mc,q:function(a){var b=Date.now();D[a>>2]=b/1E3|0;D[a+4>>2]=b%1E3*1E3|0;return 0}, -I:function(a){return Math.log(a)/Math.LN10},p:function(){B("trap!")},H:function(a){Nc();a=new Date(1E3*D[a>>2]);D[15056]=a.getSeconds();D[15057]=a.getMinutes();D[15058]=a.getHours();D[15059]=a.getDate();D[15060]=a.getMonth();D[15061]=a.getFullYear()-1900;D[15062]=a.getDay();var b=new Date(a.getFullYear(),0,1);D[15063]=(a.getTime()-b.getTime())/864E5|0;D[15065]=-(60*a.getTimezoneOffset());var c=(new Date(2E3,6,1)).getTimezoneOffset();b=b.getTimezoneOffset();a=(c!=b&&a.getTimezoneOffset()==Math.min(b, -c))|0;D[15064]=a;a=D[Rc()+(a?4:0)>>2];D[15066]=a;return 60224},G:function(a,b){var c=D[a>>2];a=D[a+4>>2];0!==b&&(D[b>>2]=0,D[b+4>>2]=0);return Sc(1E6*c+a/1E3)},F:function(a){switch(a){case 30:return 16384;case 85:return 131068;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809; -case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32; -case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1E3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"===typeof navigator?navigator.hardwareConcurrency||1:1}pb(22);return-1}, -E:function(a){var b=Date.now()/1E3|0;a&&(D[a>>2]=b);return b},D:function(a,b){if(b){var c=1E3*D[b+8>>2];c+=D[b+12>>2]/1E3}else c=Date.now();a=G(a);try{b=c;var d=T(a,{qb:!0}).node;d.ab.hb(d,{timestamp:Math.max(b,c)});return 0}catch(e){a=e;if(!(a instanceof K)){a+=" : ";a:{d=Error();if(!d.stack){try{throw Error(0);}catch(g){d=g}if(!d.stack){d="(no stack trace available)";break a}}d=d.stack.toString()}f.extraStackTrace&&(d+="\n"+f.extraStackTrace());d=Va(d);throw a+d;}pb(a.eb);return-1}},C:function(){B("OOM")}, -a:Ca},buffer);f.asm=Vc;f._RegisterExtensionFunctions=function(){return f.asm.ha.apply(null,arguments)};var nb=f.___emscripten_environ_constructor=function(){return f.asm.ia.apply(null,arguments)};f.___errno_location=function(){return f.asm.ja.apply(null,arguments)}; -var Qc=f.__get_daylight=function(){return f.asm.ka.apply(null,arguments)},Pc=f.__get_timezone=function(){return f.asm.la.apply(null,arguments)},Rc=f.__get_tzname=function(){return f.asm.ma.apply(null,arguments)},ha=f._free=function(){return f.asm.na.apply(null,arguments)},Ta=f._malloc=function(){return f.asm.oa.apply(null,arguments)},Tc=f._memalign=function(){return f.asm.pa.apply(null,arguments)},Uc=f._memset=function(){return f.asm.qa.apply(null,arguments)}; -f._sqlite3_bind_blob=function(){return f.asm.ra.apply(null,arguments)};f._sqlite3_bind_double=function(){return f.asm.sa.apply(null,arguments)};f._sqlite3_bind_int=function(){return f.asm.ta.apply(null,arguments)};f._sqlite3_bind_parameter_index=function(){return f.asm.ua.apply(null,arguments)};f._sqlite3_bind_text=function(){return f.asm.va.apply(null,arguments)};f._sqlite3_changes=function(){return f.asm.wa.apply(null,arguments)};f._sqlite3_clear_bindings=function(){return f.asm.xa.apply(null,arguments)}; -f._sqlite3_close_v2=function(){return f.asm.ya.apply(null,arguments)};f._sqlite3_column_blob=function(){return f.asm.za.apply(null,arguments)};f._sqlite3_column_bytes=function(){return f.asm.Aa.apply(null,arguments)};f._sqlite3_column_double=function(){return f.asm.Ba.apply(null,arguments)};f._sqlite3_column_name=function(){return f.asm.Ca.apply(null,arguments)};f._sqlite3_column_text=function(){return f.asm.Da.apply(null,arguments)};f._sqlite3_column_type=function(){return f.asm.Ea.apply(null,arguments)}; -f._sqlite3_create_function_v2=function(){return f.asm.Fa.apply(null,arguments)};f._sqlite3_data_count=function(){return f.asm.Ga.apply(null,arguments)};f._sqlite3_errmsg=function(){return f.asm.Ha.apply(null,arguments)};f._sqlite3_exec=function(){return f.asm.Ia.apply(null,arguments)};f._sqlite3_finalize=function(){return f.asm.Ja.apply(null,arguments)};f._sqlite3_free=function(){return f.asm.Ka.apply(null,arguments)};f._sqlite3_open=function(){return f.asm.La.apply(null,arguments)}; -f._sqlite3_prepare_v2=function(){return f.asm.Ma.apply(null,arguments)};f._sqlite3_reset=function(){return f.asm.Na.apply(null,arguments)};f._sqlite3_result_double=function(){return f.asm.Oa.apply(null,arguments)};f._sqlite3_result_null=function(){return f.asm.Pa.apply(null,arguments)};f._sqlite3_result_text=function(){return f.asm.Qa.apply(null,arguments)};f._sqlite3_step=function(){return f.asm.Ra.apply(null,arguments)};f._sqlite3_value_blob=function(){return f.asm.Sa.apply(null,arguments)}; -f._sqlite3_value_bytes=function(){return f.asm.Ta.apply(null,arguments)};f._sqlite3_value_double=function(){return f.asm.Ua.apply(null,arguments)};f._sqlite3_value_int=function(){return f.asm.Va.apply(null,arguments)};f._sqlite3_value_text=function(){return f.asm.Wa.apply(null,arguments)};f._sqlite3_value_type=function(){return f.asm.Xa.apply(null,arguments)}; -var h=f.stackAlloc=function(){return f.asm.Za.apply(null,arguments)},qa=f.stackRestore=function(){return f.asm._a.apply(null,arguments)},na=f.stackSave=function(){return f.asm.$a.apply(null,arguments)};f.dynCall_vi=function(){return f.asm.Ya.apply(null,arguments)};f.asm=Vc;f.cwrap=function(a,b,c,d){c=c||[];var e=c.every(function(a){return"number"===a});return"string"!==b&&e&&!d?Na(a):function(){return Oa(a,b,c,arguments)}};f.stackSave=na;f.stackRestore=qa;f.stackAlloc=h; -function Wc(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}Wc.prototype=Error();Wc.prototype.constructor=Wc;gb=function Xc(){f.calledRun||Yc();f.calledRun||(gb=Xc)}; -function Yc(){function a(){if(!f.calledRun&&(f.calledRun=!0,!Ma)){db||(db=!0,f.noFSInit||Hc||(Hc=!0,Gc(),f.stdin=f.stdin,f.stdout=f.stdout,f.stderr=f.stderr,f.stdin?Ic("stdin",f.stdin):Ac("/dev/tty","/dev/stdin"),f.stdout?Ic("stdout",null,f.stdout):Ac("/dev/tty","/dev/stdout"),f.stderr?Ic("stderr",null,f.stderr):Ac("/dev/tty1","/dev/stderr"),p("/dev/stdin","r"),p("/dev/stdout","w"),p("/dev/stderr","w")),Za(ab));Jb=!1;Za(bb);if(f.onRuntimeInitialized)f.onRuntimeInitialized();if(f.postRun)for("function"== -typeof f.postRun&&(f.postRun=[f.postRun]);f.postRun.length;){var a=f.postRun.shift();cb.unshift(a)}Za(cb)}}if(!(0 { OptionListTile( leading: Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: StreamSvgIcon.close_small( + child: StreamSvgIcon.closeSmall( color: StreamChatTheme.of(context).colorTheme.grey, ), ), diff --git a/packages/stream_chat_flutter/lib/src/channel_header.dart b/packages/stream_chat_flutter/lib/src/channel_header.dart index 27194627..6845a632 100644 --- a/packages/stream_chat_flutter/lib/src/channel_header.dart +++ b/packages/stream_chat_flutter/lib/src/channel_header.dart @@ -89,8 +89,8 @@ class ChannelHeader extends StatelessWidget implements PreferredSizeWidget { return ConnectionStatusBuilder( statusBuilder: (context, status) { - String statusString = ''; - bool showStatus = true; + var statusString = ''; + var showStatus = true; switch (status) { case ConnectionStatus.connected: diff --git a/packages/stream_chat_flutter/lib/src/channel_list_header.dart b/packages/stream_chat_flutter/lib/src/channel_list_header.dart index 045d24d5..cca4170e 100644 --- a/packages/stream_chat_flutter/lib/src/channel_list_header.dart +++ b/packages/stream_chat_flutter/lib/src/channel_list_header.dart @@ -82,8 +82,8 @@ class ChannelListHeader extends StatelessWidget implements PreferredSizeWidget { final user = _client.state.user; return ConnectionStatusBuilder( statusBuilder: (context, status) { - String statusString = ''; - bool showStatus = true; + var statusString = ''; + var showStatus = true; switch (status) { case ConnectionStatus.connected: diff --git a/packages/stream_chat_flutter/lib/src/channel_preview.dart b/packages/stream_chat_flutter/lib/src/channel_preview.dart index eddd0ea6..2d29f12b 100644 --- a/packages/stream_chat_flutter/lib/src/channel_preview.dart +++ b/packages/stream_chat_flutter/lib/src/channel_preview.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:jiffy/jiffy.dart'; -import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:stream_chat_flutter/src/stream_svg_icon.dart'; +import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import '../stream_chat_flutter.dart'; import 'channel_name.dart'; @@ -269,7 +269,7 @@ class ChannelPreview extends StatelessWidget { TextStyle normalTextStyle, TextStyle mentionsTextStyle) { var textList = text.split(' '); - List resList = []; + var resList = []; for (var e in textList) { if (mentions != null && mentions.isNotEmpty && diff --git a/packages/stream_chat_flutter/lib/src/extension.dart b/packages/stream_chat_flutter/lib/src/extension.dart index ad26735a..75a03925 100644 --- a/packages/stream_chat_flutter/lib/src/extension.dart +++ b/packages/stream_chat_flutter/lib/src/extension.dart @@ -1,18 +1,20 @@ -import 'package:emojis/emoji.dart'; import 'package:characters/characters.dart'; +import 'package:emojis/emoji.dart'; final _emojis = Emoji.all(); +/// String extension extension StringExtension on String { + /// Returns the capitalized string String capitalize() { - return "${this[0].toUpperCase()}${this.substring(1)}"; + return '${this[0].toUpperCase()}${substring(1)}'; } // Emojis guidelines // 1 to 3 emojis: big size with no text bubble. // 4+ emojis or emojis+text: standard size with text bubble. bool get isOnlyEmoji { - final characters = this.trim().characters; + final characters = trim().characters; if (characters.isEmpty) return false; if (characters.length > 3) return false; return characters.every((c) => _emojis.map((e) => e.char).contains(c)); diff --git a/packages/stream_chat_flutter/lib/src/file_attachment.dart b/packages/stream_chat_flutter/lib/src/file_attachment.dart index 0fff2445..209cdb99 100644 --- a/packages/stream_chat_flutter/lib/src/file_attachment.dart +++ b/packages/stream_chat_flutter/lib/src/file_attachment.dart @@ -3,10 +3,10 @@ import 'dart:io'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; -import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:stream_chat_flutter/src/stream_chat_theme.dart'; import 'package:stream_chat_flutter/src/stream_svg_icon.dart'; import 'package:stream_chat_flutter/src/utils.dart'; +import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:video_compress/video_compress.dart'; import 'package:video_player/video_player.dart'; @@ -110,7 +110,7 @@ class _FileAttachmentState extends State { type: MaterialType.transparency, child: widget.trailing ?? IconButton( - icon: StreamSvgIcon.cloud_download( + icon: StreamSvgIcon.cloudDownload( color: StreamChatTheme.of(context).colorTheme.black, ), padding: const EdgeInsets.all(8), diff --git a/packages/stream_chat_flutter/lib/src/full_screen_media.dart b/packages/stream_chat_flutter/lib/src/full_screen_media.dart index 98ed3384..16ab0da5 100644 --- a/packages/stream_chat_flutter/lib/src/full_screen_media.dart +++ b/packages/stream_chat_flutter/lib/src/full_screen_media.dart @@ -258,9 +258,9 @@ class VideoPackage { _videoPlayerController.addListener(errorListener); } - get videoPlayer => _videoPlayerController; + VideoPlayerController get videoPlayer => _videoPlayerController; - get chewieController => _chewieController; + ChewieController get chewieController => _chewieController; void dispose() { _videoPlayerController.dispose(); diff --git a/packages/stream_chat_flutter/lib/src/image_actions_modal.dart b/packages/stream_chat_flutter/lib/src/image_actions_modal.dart index 2a251c61..4be1dc1d 100644 --- a/packages/stream_chat_flutter/lib/src/image_actions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/image_actions_modal.dart @@ -56,7 +56,7 @@ class ImageActionsModal extends StatelessWidget { _buildButton( context, 'Reply', - StreamSvgIcon.Icon_curve_line_left_up( + StreamSvgIcon.iconCurveLineLeftUp( size: 24.0, color: StreamChatTheme.of(context).colorTheme.grey, ), @@ -76,7 +76,7 @@ class ImageActionsModal extends StatelessWidget { _buildButton( context, 'Save ${urls[currentIndex].type == 'video' ? 'Video' : 'Image'}', - StreamSvgIcon.Icon_save( + StreamSvgIcon.iconSave( size: 24.0, color: StreamChatTheme.of(context).colorTheme.grey, ), @@ -167,14 +167,14 @@ class ImageActionsModal extends StatelessWidget { final result = await ImageGallerySaver.saveImage( Uint8List.fromList(response.data), quality: 60, - name: "${DateTime.now().millisecondsSinceEpoch}"); + name: '${DateTime.now().millisecondsSinceEpoch}'); return result; } Future _saveVideo(String url) async { var appDocDir = await getTemporaryDirectory(); var savePath = - appDocDir.path + "/${DateTime.now().millisecondsSinceEpoch}.mp4"; + appDocDir.path + '/${DateTime.now().millisecondsSinceEpoch}.mp4'; await Dio().download(url, savePath); final result = await ImageGallerySaver.saveFile(savePath); print(result); diff --git a/packages/stream_chat_flutter/lib/src/image_footer.dart b/packages/stream_chat_flutter/lib/src/image_footer.dart index 4e87423e..7b0ed621 100644 --- a/packages/stream_chat_flutter/lib/src/image_footer.dart +++ b/packages/stream_chat_flutter/lib/src/image_footer.dart @@ -7,9 +7,9 @@ import 'package:dio/dio.dart'; import 'package:esys_flutter_share/esys_flutter_share.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:stream_chat_flutter/src/stream_chat_theme.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; +import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; class ImageFooter extends StatefulWidget implements PreferredSizeWidget { /// Callback to call when pressing the back button. @@ -54,36 +54,17 @@ class ImageFooter extends StatefulWidget implements PreferredSizeWidget { } class _ImageFooterState extends State { - //ignore:unused_field - bool _userSearchMode = false; TextEditingController _searchController; final TextEditingController _messageController = TextEditingController(); final FocusNode _messageFocusNode = FocusNode(); - //ignore:unused_field - String _channelNameQuery; - final List _selectedChannels = []; - Timer _debounce; - Function modalSetStateCallback; - void _userNameListener() { - if (_debounce?.isActive ?? false) _debounce.cancel(); - _debounce = Timer(const Duration(milliseconds: 350), () { - if (mounted && modalSetStateCallback != null) { - modalSetStateCallback(() { - _channelNameQuery = _searchController.text; - }); - } - }); - } - @override void initState() { super.initState(); - _searchController = TextEditingController()..addListener(_userNameListener); _messageFocusNode.addListener(() { setState(() {}); }); @@ -92,7 +73,6 @@ class _ImageFooterState extends State { @override void dispose() { _searchController?.clear(); - _searchController?.removeListener(_userNameListener); _searchController?.dispose(); super.dispose(); } @@ -113,7 +93,7 @@ class _ImageFooterState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ IconButton( - icon: StreamSvgIcon.Icon_SHARE( + icon: StreamSvgIcon.iconShare( size: 24.0, color: StreamChatTheme.of(context).colorTheme.black, ), @@ -151,7 +131,7 @@ class _ImageFooterState extends State { ), ), IconButton( - icon: StreamSvgIcon.Icon_grid( + icon: StreamSvgIcon.iconGrid( color: StreamChatTheme.of(context).colorTheme.black, ), onPressed: () => _showPhotosModal(context), @@ -174,9 +154,9 @@ class _ImageFooterState extends State { backgroundColor: StreamChatTheme.of(context).colorTheme.white, isScrollControlled: true, shape: const RoundedRectangleBorder( - borderRadius: const BorderRadius.only( - topLeft: const Radius.circular(16.0), - topRight: const Radius.circular(16.0), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(16.0), + topRight: Radius.circular(16.0), ), ), builder: (context) { diff --git a/packages/stream_chat_flutter/lib/src/image_header.dart b/packages/stream_chat_flutter/lib/src/image_header.dart index a818ee13..25eab839 100644 --- a/packages/stream_chat_flutter/lib/src/image_header.dart +++ b/packages/stream_chat_flutter/lib/src/image_header.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; -import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:stream_chat_flutter/src/stream_chat_theme.dart'; import 'package:stream_chat_flutter/src/stream_svg_icon.dart'; +import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; + import 'image_actions_modal.dart'; class ImageHeader extends StatelessWidget implements PreferredSizeWidget { @@ -63,7 +64,7 @@ class ImageHeader extends StatelessWidget implements PreferredSizeWidget { StreamChatTheme.of(context).channelTheme.channelHeaderTheme.color, actions: [ IconButton( - icon: StreamSvgIcon.Icon_menu_point_v( + icon: StreamSvgIcon.iconMenuPoint( color: StreamChatTheme.of(context).colorTheme.black, ), onPressed: () { diff --git a/packages/stream_chat_flutter/lib/src/media_utils.dart b/packages/stream_chat_flutter/lib/src/media_utils.dart index e91a47d6..e55e02df 100644 --- a/packages/stream_chat_flutter/lib/src/media_utils.dart +++ b/packages/stream_chat_flutter/lib/src/media_utils.dart @@ -1,14 +1,14 @@ -import 'package:http_parser/http_parser.dart' as httpParser; +import 'package:http_parser/http_parser.dart' as http_parser; import 'package:mime/mime.dart'; class MediaUtils { - static httpParser.MediaType getMimeType(String filename) { - httpParser.MediaType mimeType; + static http_parser.MediaType getMimeType(String filename) { + http_parser.MediaType mimeType; if (filename != null) { if (filename.toLowerCase().endsWith('heic')) { - mimeType = httpParser.MediaType.parse('image/heic'); + mimeType = http_parser.MediaType.parse('image/heic'); } else { - mimeType = httpParser.MediaType.parse(lookupMimeType(filename)); + mimeType = http_parser.MediaType.parse(lookupMimeType(filename)); } } diff --git a/packages/stream_chat_flutter/lib/src/message_actions_modal.dart b/packages/stream_chat_flutter/lib/src/message_actions_modal.dart index 6ca7c688..9551ff71 100644 --- a/packages/stream_chat_flutter/lib/src/message_actions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/message_actions_modal.dart @@ -4,16 +4,16 @@ import 'dart:ui'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:stream_chat_flutter/src/reaction_picker.dart'; import 'package:stream_chat_flutter/src/stream_svg_icon.dart'; import 'package:stream_chat_flutter/src/utils.dart'; +import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; +import 'extension.dart'; import 'message_input.dart'; import 'message_widget.dart'; import 'stream_chat.dart'; import 'stream_chat_theme.dart'; -import 'extension.dart'; class MessageActionsModal extends StatefulWidget { final Widget Function(BuildContext, Message) editMessageInputBuilder; @@ -280,20 +280,22 @@ class _MessageActionsModalState extends State { setState(() { _showActions = false; }); - var answer = await showConfirmationDialog(context, - title: 'Delete message', - icon: StreamSvgIcon.flag( - color: StreamChatTheme.of(context).colorTheme.accentRed, - size: 24.0, - ), - question: 'Are you sure you want to permanently delete this\nmessage?', - okText: 'DELETE', - cancelText: 'CANCEL'); + var answer = await showConfirmationDialog( + context, + title: 'Delete message', + icon: StreamSvgIcon.flag( + color: StreamChatTheme.of(context).colorTheme.accentRed, + size: 24.0, + ), + question: 'Are you sure you want to permanently delete this\nmessage?', + okText: 'DELETE', + cancelText: 'CANCEL', + ); if (answer) { try { Navigator.pop(context); - StreamChat.of(context).client.deleteMessage( + await StreamChat.of(context).client.deleteMessage( widget.message, StreamChannel.of(context).channel.cid, ); @@ -470,7 +472,7 @@ class _MessageActionsModalState extends State { padding: const EdgeInsets.symmetric(vertical: 11.0, horizontal: 16.0), child: Row( children: [ - StreamSvgIcon.icon_flag( + StreamSvgIcon.iconFlag( color: StreamChatTheme.of(context).primaryIconTheme.color, ), const SizedBox(width: 16), @@ -577,7 +579,7 @@ class _MessageActionsModalState extends State { padding: const EdgeInsets.symmetric(vertical: 11.0, horizontal: 16.0), child: Row( children: [ - StreamSvgIcon.circle_up( + StreamSvgIcon.circleUp( color: StreamChatTheme.of(context).colorTheme.accentBlue, ), const SizedBox(width: 16), @@ -632,7 +634,7 @@ class _MessageActionsModalState extends State { ), IconButton( visualDensity: VisualDensity.compact, - icon: StreamSvgIcon.close_small(), + icon: StreamSvgIcon.closeSmall(), onPressed: Navigator.of(context).pop, ), ], diff --git a/packages/stream_chat_flutter/lib/src/message_input.dart b/packages/stream_chat_flutter/lib/src/message_input.dart index b5be1fb1..425bf5ea 100644 --- a/packages/stream_chat_flutter/lib/src/message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input.dart @@ -9,7 +9,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:http_parser/http_parser.dart' as httpParser; +import 'package:http_parser/http_parser.dart' as http_parser; import 'package:image_picker/image_picker.dart'; import 'package:mime/mime.dart'; import 'package:photo_manager/photo_manager.dart'; @@ -202,7 +202,7 @@ class MessageInputState extends State { bool _openFilePickerSection = false; int _filePickerIndex = 0; double _filePickerSize = _kMinMediaPickerSize; - KeyboardVisibilityController _keyboardVisibilityController = + final KeyboardVisibilityController _keyboardVisibilityController = KeyboardVisibilityController(); /// The editing controller passed to the input TextField @@ -247,7 +247,7 @@ class MessageInputState extends State { ), IconButton( visualDensity: VisualDensity.compact, - icon: StreamSvgIcon.close_small(), + icon: StreamSvgIcon.closeSmall(), onPressed: widget.onQuotedMessageCleared, ), ], @@ -493,7 +493,7 @@ class MessageInputState extends State { : null, suffixIcon: _commandEnabled ? IconButton( - icon: StreamSvgIcon.close_small(), + icon: StreamSvgIcon.closeSmall(), splashRadius: 24, padding: const EdgeInsets.all(0), constraints: BoxConstraints.tightFor( @@ -1128,7 +1128,7 @@ class MessageInputState extends State { case 'ban': return CircleAvatar( backgroundColor: StreamChatTheme.of(context).colorTheme.accentBlue, - child: StreamSvgIcon.Icon_user_delete( + child: StreamSvgIcon.iconUserDelete( size: 16.0, color: Colors.white, ), @@ -1964,7 +1964,7 @@ class MessageInputState extends State { final mimeType = _getMimeType(file.path.split('/').last); - Map extraDataMap = {}; + var extraDataMap = {}; if (camera) { if (mimeType.type == 'video' || mimeType.type == 'image') { @@ -2074,13 +2074,13 @@ class MessageInputState extends State { return res.file; } - httpParser.MediaType _getMimeType(String filename) { - httpParser.MediaType mimeType; + http_parser.MediaType _getMimeType(String filename) { + http_parser.MediaType mimeType; if (filename != null) { if (filename.toLowerCase().endsWith('heic')) { - mimeType = httpParser.MediaType.parse('image/heic'); + mimeType = http_parser.MediaType.parse('image/heic'); } else { - mimeType = httpParser.MediaType.parse(lookupMimeType(filename)); + mimeType = http_parser.MediaType.parse(lookupMimeType(filename)); } } diff --git a/packages/stream_chat_flutter/lib/src/message_list_view.dart b/packages/stream_chat_flutter/lib/src/message_list_view.dart index 86c1445c..3bb6b716 100644 --- a/packages/stream_chat_flutter/lib/src/message_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/message_list_view.dart @@ -6,18 +6,18 @@ import 'package:flutter/material.dart'; import 'package:jiffy/jiffy.dart'; import 'package:rxdart/rxdart.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; -import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:stream_chat_flutter/src/info_tile.dart'; import 'package:stream_chat_flutter/src/message_widget.dart'; import 'package:stream_chat_flutter/src/stream_svg_icon.dart'; import 'package:stream_chat_flutter/src/system_message.dart'; +import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:visibility_detector/visibility_detector.dart'; import '../stream_chat_flutter.dart'; import 'connection_status_builder.dart'; import 'date_divider.dart'; -import 'swipeable.dart'; import 'extension.dart'; +import 'swipeable.dart'; typedef MessageBuilder = Widget Function( BuildContext, @@ -237,7 +237,7 @@ class _MessageListViewState extends State { bool _inBetweenList = false; - MessageListController _messageListController = MessageListController(); + final MessageListController _messageListController = MessageListController(); @override Widget build(BuildContext context) { @@ -308,8 +308,8 @@ class _MessageListViewState extends State { children: [ ConnectionStatusBuilder( statusBuilder: (context, status) { - String statusString = ''; - bool showStatus = true; + var statusString = ''; + var showStatus = true; switch (status) { case ConnectionStatus.connected: statusString = 'Connected'; @@ -878,7 +878,7 @@ class _MessageListViewState extends State { if (messages.map((e) => e.id).contains(quotedMessageId)) { scrollToIndex(); } else { - streamChannel.loadChannelAtMessage(quotedMessageId).then((_) { + await streamChannel.loadChannelAtMessage(quotedMessageId).then((_) { WidgetsBinding.instance.addPostFrameCallback((_) { if (messages.map((e) => e.id).contains(quotedMessageId)) { scrollToIndex(); diff --git a/packages/stream_chat_flutter/lib/src/message_search_item.dart b/packages/stream_chat_flutter/lib/src/message_search_item.dart index 4d8d9148..335f7ff4 100644 --- a/packages/stream_chat_flutter/lib/src/message_search_item.dart +++ b/packages/stream_chat_flutter/lib/src/message_search_item.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:jiffy/jiffy.dart'; -import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; +import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; /// It shows the current [Message] preview. /// @@ -152,7 +152,7 @@ class MessageSearchItem extends StatelessWidget { TextStyle normalTextStyle, TextStyle mentionsTextStyle) { var textList = text.split(' '); - List resList = []; + var resList = []; for (var e in textList) { if (mentions != null && mentions.isNotEmpty && diff --git a/packages/stream_chat_flutter/lib/src/message_search_list_view.dart b/packages/stream_chat_flutter/lib/src/message_search_list_view.dart index 8a22bf00..490b3581 100644 --- a/packages/stream_chat_flutter/lib/src/message_search_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/message_search_list_view.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:stream_chat_flutter/src/info_tile.dart'; import 'package:stream_chat_flutter/src/message_search_item.dart'; +import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import '../stream_chat_flutter.dart'; @@ -116,7 +116,7 @@ class MessageSearchListView extends StatefulWidget { } class _MessageSearchListViewState extends State { - MessageSearchListController _messageSearchListController = + final MessageSearchListController _messageSearchListController = MessageSearchListController(); @override @@ -245,7 +245,7 @@ class _MessageSearchListViewState extends State { } Widget _buildQueryProgressIndicator(context) { - MessageSearchBlocState messageSearchBloc = MessageSearchBloc.of(context); + final messageSearchBloc = MessageSearchBloc.of(context); return StreamBuilder( stream: messageSearchBloc.queryMessagesLoading, diff --git a/packages/stream_chat_flutter/lib/src/stream_chat_theme.dart b/packages/stream_chat_flutter/lib/src/stream_chat_theme.dart index c65f36cc..be69e366 100644 --- a/packages/stream_chat_flutter/lib/src/stream_chat_theme.dart +++ b/packages/stream_chat_flutter/lib/src/stream_chat_theme.dart @@ -1,11 +1,11 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; -import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:stream_chat_flutter/src/channel_header.dart'; import 'package:stream_chat_flutter/src/channel_preview.dart'; import 'package:stream_chat_flutter/src/message_input.dart'; import 'package:stream_chat_flutter/src/reaction_icon.dart'; import 'package:stream_chat_flutter/src/utils.dart'; +import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; /// Inherited widget providing the [StreamChatThemeData] to the widget tree class StreamChatTheme extends InheritedWidget { @@ -476,7 +476,7 @@ class ColorTheme { this.bgGradient = const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, - colors: [const Color(0xfff7f7f7), const Color(0xfffcfcfc)], + colors: [Color(0xfff7f7f7), Color(0xfffcfcfc)], stops: [0, 1], ), this.borderTop = const Effect( @@ -519,7 +519,10 @@ class ColorTheme { this.bgGradient = const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, - colors: [const Color(0xff101214), const Color(0xff070a0d)], + colors: [ + Color(0xff101214), + Color(0xff070a0d), + ], stops: [0, 1], ), }); diff --git a/packages/stream_chat_flutter/lib/src/stream_svg_icon.dart b/packages/stream_chat_flutter/lib/src/stream_svg_icon.dart index 0d705d31..b0b3d0bb 100644 --- a/packages/stream_chat_flutter/lib/src/stream_svg_icon.dart +++ b/packages/stream_chat_flutter/lib/src/stream_svg_icon.dart @@ -386,7 +386,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.cloud_download({ + factory StreamSvgIcon.cloudDownload({ double size, Color color, }) { @@ -434,7 +434,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.arrow_right({ + factory StreamSvgIcon.arrowRight({ double size, Color color, }) { @@ -446,7 +446,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.close_small({ + factory StreamSvgIcon.closeSmall({ double size, Color color, }) { @@ -458,7 +458,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.Icon_curve_line_left_up({ + factory StreamSvgIcon.iconCurveLineLeftUp({ double size, Color color, }) { @@ -470,7 +470,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.Icon_moon({ + factory StreamSvgIcon.iconMoon({ double size, Color color, }) { @@ -482,7 +482,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.Icon_SHARE({ + factory StreamSvgIcon.iconShare({ double size, Color color, }) { @@ -494,7 +494,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.Icon_grid({ + factory StreamSvgIcon.iconGrid({ double size, Color color, }) { @@ -506,7 +506,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.Icon_send_message({ + factory StreamSvgIcon.iconSendMessage({ double size, Color color, }) { @@ -518,7 +518,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.Icon_menu_point_v({ + factory StreamSvgIcon.iconMenuPoint({ double size, Color color, }) { @@ -530,7 +530,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.Icon_save({ + factory StreamSvgIcon.iconSave({ double size, Color color, }) { @@ -542,7 +542,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.share_arrow({ + factory StreamSvgIcon.shareArrow({ double size, Color color, }) { @@ -554,7 +554,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_7z({ + factory StreamSvgIcon.filetype7z({ double size, Color color, }) { @@ -566,7 +566,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_csv({ + factory StreamSvgIcon.filetypeCsv({ double size, Color color, }) { @@ -578,7 +578,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_doc({ + factory StreamSvgIcon.filetypeDoc({ double size, Color color, }) { @@ -590,7 +590,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_docx({ + factory StreamSvgIcon.filetypeDocx({ double size, Color color, }) { @@ -602,7 +602,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_Generic({ + factory StreamSvgIcon.filetypeGeneric({ double size, Color color, }) { @@ -614,7 +614,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_html({ + factory StreamSvgIcon.filetypeHtml({ double size, Color color, }) { @@ -626,7 +626,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_md({ + factory StreamSvgIcon.filetypeMd({ double size, Color color, }) { @@ -638,7 +638,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_odt({ + factory StreamSvgIcon.filetypeOdt({ double size, Color color, }) { @@ -650,7 +650,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_pdf({ + factory StreamSvgIcon.filetypePdf({ double size, Color color, }) { @@ -662,7 +662,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_ppt({ + factory StreamSvgIcon.filetypePpt({ double size, Color color, }) { @@ -674,7 +674,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_pptx({ + factory StreamSvgIcon.filetypePptx({ double size, Color color, }) { @@ -686,7 +686,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_rar({ + factory StreamSvgIcon.filetypeRar({ double size, Color color, }) { @@ -698,7 +698,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_rtf({ + factory StreamSvgIcon.filetypeRtf({ double size, Color color, }) { @@ -710,7 +710,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_tar({ + factory StreamSvgIcon.filetypeTar({ double size, Color color, }) { @@ -722,7 +722,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_txt({ + factory StreamSvgIcon.filetypeTxt({ double size, Color color, }) { @@ -734,7 +734,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_xls({ + factory StreamSvgIcon.filetypeXls({ double size, Color color, }) { @@ -746,7 +746,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_xlsx({ + factory StreamSvgIcon.filetypeXlsx({ double size, Color color, }) { @@ -758,7 +758,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.filetype_zip({ + factory StreamSvgIcon.filetypeZip({ double size, Color color, }) { @@ -770,7 +770,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.Icon_group({ + factory StreamSvgIcon.iconGroup({ double size, Color color, }) { @@ -782,7 +782,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.Icon_notification({ + factory StreamSvgIcon.iconNotification({ double size, Color color, }) { @@ -794,7 +794,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.Icon_user_delete({ + factory StreamSvgIcon.iconUserDelete({ double size, Color color, }) { @@ -818,7 +818,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.circle_up({ + factory StreamSvgIcon.circleUp({ double size, Color color, }) { @@ -830,7 +830,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.Icon_user_settings({ + factory StreamSvgIcon.iconUserSettings({ double size, Color color, }) { @@ -890,7 +890,7 @@ class StreamSvgIcon extends StatelessWidget { ); } - factory StreamSvgIcon.icon_flag({ + factory StreamSvgIcon.iconFlag({ double size, Color color, }) { diff --git a/packages/stream_chat_flutter/lib/src/user_list_view.dart b/packages/stream_chat_flutter/lib/src/user_list_view.dart index a53ba97a..a1819592 100644 --- a/packages/stream_chat_flutter/lib/src/user_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/user_list_view.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; +import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; import 'user_item.dart'; @@ -138,7 +138,7 @@ class _UserListViewState extends State with WidgetsBindingObserver { bool get _isListView => widget.crossAxisCount == 1; - UserListController _userListController = UserListController(); + final UserListController _userListController = UserListController(); @override Widget build(BuildContext context) { diff --git a/packages/stream_chat_flutter/lib/src/utils.dart b/packages/stream_chat_flutter/lib/src/utils.dart index 93d87ab2..f7eaf385 100644 --- a/packages/stream_chat_flutter/lib/src/utils.dart +++ b/packages/stream_chat_flutter/lib/src/utils.dart @@ -221,7 +221,7 @@ String getSizeText(int bytes) { } if (bytes <= 1000) { - return '${bytes} bytes'; + return '$bytes bytes'; } else if (bytes <= 100000) { return '${(bytes / 1000).toStringAsFixed(2)} KB'; } else { @@ -233,58 +233,58 @@ String getSizeText(int bytes) { StreamSvgIcon getFileTypeImage(String type) { switch (type) { case '7z': - return StreamSvgIcon.filetype_7z(); + return StreamSvgIcon.filetype7z(); break; case 'csv': - return StreamSvgIcon.filetype_csv(); + return StreamSvgIcon.filetypeCsv(); break; case 'doc': - return StreamSvgIcon.filetype_doc(); + return StreamSvgIcon.filetypeDoc(); break; case 'docx': - return StreamSvgIcon.filetype_docx(); + return StreamSvgIcon.filetypeDocx(); break; case 'html': - return StreamSvgIcon.filetype_html(); + return StreamSvgIcon.filetypeHtml(); break; case 'md': - return StreamSvgIcon.filetype_md(); + return StreamSvgIcon.filetypeMd(); break; case 'odt': - return StreamSvgIcon.filetype_odt(); + return StreamSvgIcon.filetypeOdt(); break; case 'pdf': - return StreamSvgIcon.filetype_pdf(); + return StreamSvgIcon.filetypePdf(); break; case 'ppt': - return StreamSvgIcon.filetype_ppt(); + return StreamSvgIcon.filetypePpt(); break; case 'pptx': - return StreamSvgIcon.filetype_pptx(); + return StreamSvgIcon.filetypePptx(); break; case 'rar': - return StreamSvgIcon.filetype_rar(); + return StreamSvgIcon.filetypeRar(); break; case 'rtf': - return StreamSvgIcon.filetype_rtf(); + return StreamSvgIcon.filetypeRtf(); break; case 'tar': - return StreamSvgIcon.filetype_tar(); + return StreamSvgIcon.filetypeTar(); break; case 'txt': - return StreamSvgIcon.filetype_txt(); + return StreamSvgIcon.filetypeTxt(); break; case 'xls': - return StreamSvgIcon.filetype_xls(); + return StreamSvgIcon.filetypeXls(); break; case 'xlsx': - return StreamSvgIcon.filetype_xlsx(); + return StreamSvgIcon.filetypeXlsx(); break; case 'zip': - return StreamSvgIcon.filetype_zip(); + return StreamSvgIcon.filetypeZip(); break; default: - return StreamSvgIcon.filetype_Generic(); + return StreamSvgIcon.filetypeGeneric(); break; } }