From ab5953d8bda7ff209546442a5a78c8ce0bbc2b1d Mon Sep 17 00:00:00 2001 From: TatankaConCube Date: Wed, 28 Jun 2023 12:16:57 +0300 Subject: [PATCH 1/3] - improve badge refreshing logic; --- chat_sample/lib/src/utils/api_utils.dart | 26 +++++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/chat_sample/lib/src/utils/api_utils.dart b/chat_sample/lib/src/utils/api_utils.dart index 8679862..9c4b39a 100644 --- a/chat_sample/lib/src/utils/api_utils.dart +++ b/chat_sample/lib/src/utils/api_utils.dart @@ -6,6 +6,7 @@ import 'package:connectycube_sdk/connectycube_sdk.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_app_badger/flutter_app_badger.dart'; import 'package:universal_io/io.dart'; import '../managers/push_notifications_manager.dart'; @@ -55,8 +56,8 @@ Future> getUsersByIds(Set ids) async { Completer> completer = Completer(); Map users = HashMap(); try { - var result = await (getAllUsersByIds(ids) - as FutureOr>); + var result = + await (getAllUsersByIds(ids) as FutureOr>); users.addAll(Map.fromIterable(result.items, key: (item) => item.id, value: (item) => item)); } catch (ex) { @@ -66,22 +67,27 @@ Future> getUsersByIds(Set ids) async { return completer.future; } - Future getUploadingImageFuture(FilePickerResult result) async { // there possible to upload the file as an array of bytes, but here showed two ways just as an example - if(kIsWeb){ - return uploadRawFile(result.files.single.bytes!, result.files.single.name, isPublic: true, onProgress: (progress) { + if (kIsWeb) { + return uploadRawFile(result.files.single.bytes!, result.files.single.name, + isPublic: true, onProgress: (progress) { log("uploadImageFile progress= $progress"); }); } else { - return uploadFile(File(result.files.single.path!), isPublic: true, onProgress: (progress) { + return uploadFile(File(result.files.single.path!), isPublic: true, + onProgress: (progress) { log("uploadImageFile progress= $progress"); }); } } -refreshBadgeCount(){ - getUnreadMessagesCount().then((result) { - updateBadgeCount(result['total']); +refreshBadgeCount() { + FlutterAppBadger.isAppBadgeSupported().then((isBadgesSupported) { + if (isBadgesSupported) { + getUnreadMessagesCount().then((result) { + updateBadgeCount(result['total']); + }); + } }); -} \ No newline at end of file +} From eccd114f42bcf7366a2b630efc44f008885b5fbe Mon Sep 17 00:00:00 2001 From: TatankaConCube Date: Thu, 3 Aug 2023 18:55:26 +0300 Subject: [PATCH 2/3] - add Facebook auth feature; --- .../android/app/src/main/AndroidManifest.xml | 31 +- .../app/src/main/res/values/strings.xml | 6 + chat_sample/build/web/assets/NOTICES | 111 + .../build/web/flutter_service_worker.js | 8 +- chat_sample/build/web/index.html | 2 +- chat_sample/build/web/main.dart.js | 108867 ++++++++------- chat_sample/ios/Podfile | 4 +- chat_sample/ios/Podfile.lock | 31 +- .../ios/Runner.xcodeproj/project.pbxproj | 141 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- chat_sample/ios/Runner/AppDelegate.swift | 42 +- .../ios/Runner/ChatSample.entitlements | 2 + chat_sample/ios/Runner/Info.plist | 13 + chat_sample/lib/main.dart | 44 +- chat_sample/lib/src/login_screen.dart | 103 +- chat_sample/lib/src/phone_auth_flow.dart | 51 +- chat_sample/lib/src/settings_screen.dart | 2 + chat_sample/lib/src/utils/api_utils.dart | 3 +- chat_sample/lib/src/utils/auth_utils.dart | 17 + chat_sample/lib/src/utils/configs.dart | 20 +- chat_sample/lib/src/utils/pref_util.dart | 1 + .../flutter/generated_plugin_registrant.cc | 4 + .../linux/flutter/generated_plugins.cmake | 1 + .../Flutter/GeneratedPluginRegistrant.swift | 4 + chat_sample/macos/Podfile.lock | 12 + .../macos/Runner/DebugProfile.entitlements | 2 + chat_sample/macos/Runner/Info.plist | 2 + chat_sample/macos/Runner/Release.entitlements | 2 + chat_sample/pubspec.yaml | 10 +- .../flutter/generated_plugin_registrant.cc | 3 + .../windows/flutter/generated_plugins.cmake | 1 + 31 files changed, 55143 insertions(+), 54399 deletions(-) create mode 100644 chat_sample/android/app/src/main/res/values/strings.xml diff --git a/chat_sample/android/app/src/main/AndroidManifest.xml b/chat_sample/android/app/src/main/AndroidManifest.xml index 88ea619..b026071 100644 --- a/chat_sample/android/app/src/main/AndroidManifest.xml +++ b/chat_sample/android/app/src/main/AndroidManifest.xml @@ -11,21 +11,23 @@ + android:icon="@mipmap/ic_launcher" + android:label="Chat Sample"> + android:launchMode="singleTop" + android:theme="@style/LaunchTheme" + android:windowSoftInputMode="adjustResize"> - - + + + + + + + + + + + + diff --git a/chat_sample/android/app/src/main/res/values/strings.xml b/chat_sample/android/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..9dd5fef --- /dev/null +++ b/chat_sample/android/app/src/main/res/values/strings.xml @@ -0,0 +1,6 @@ + + + 786550356345266 + fb786550356345266 + 85257b1c8796e12ca3539373237c404c + diff --git a/chat_sample/build/web/assets/NOTICES b/chat_sample/build/web/assets/NOTICES index 0e7ac81..45447f5 100644 --- a/chat_sample/build/web/assets/NOTICES +++ b/chat_sample/build/web/assets/NOTICES @@ -2,6 +2,7 @@ _flutterfire_internals firebase_ui_auth firebase_ui_localizations firebase_ui_oauth +firebase_ui_oauth_facebook firebase_ui_shared Copyright 2017, the Chromium project authors. All rights reserved. @@ -7162,6 +7163,30 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- +facebook_auth_desktop + +MIT License + +Copyright (c) 2022 DARWIN MOROCHO ROCHA + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +-------------------------------------------------------------------------------- ffx_spd Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved. @@ -7710,6 +7735,55 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-------------------------------------------------------------------------------- +flutter_facebook_auth + +MIT License + +Copyright (c) 2019 DARWIN MOROCHO ROCHA + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +-------------------------------------------------------------------------------- +flutter_facebook_auth_platform_interface +flutter_facebook_auth_web + +MIT License + +Copyright (c) 2020 DARWIN MOROCHO ROCHA + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. -------------------------------------------------------------------------------- flutter_local_notifications flutter_local_notifications_linux @@ -7818,6 +7892,43 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +flutter_secure_storage +flutter_secure_storage_linux +flutter_secure_storage_macos +flutter_secure_storage_platform_interface +flutter_secure_storage_web +flutter_secure_storage_windows + +BSD 3-Clause License + +Copyright 2017 German Saprykin +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- flutter_svg diff --git a/chat_sample/build/web/flutter_service_worker.js b/chat_sample/build/web/flutter_service_worker.js index d017f8a..2b347af 100644 --- a/chat_sample/build/web/flutter_service_worker.js +++ b/chat_sample/build/web/flutter_service_worker.js @@ -4,10 +4,10 @@ const TEMP = 'flutter-temp-cache'; const CACHE_NAME = 'flutter-app-cache'; const RESOURCES = {"version.json": "a29275557e1ad57cd6e1add76041252f", -"index.html": "a41c5f7255fbb26594c1c58e460f8993", -"/": "a41c5f7255fbb26594c1c58e460f8993", +"index.html": "9355cd22483f0f31771cbf554cc2115a", +"/": "9355cd22483f0f31771cbf554cc2115a", "firebase-messaging-sw.js": "a43f2eac8588b877b1194cb36242cbae", -"main.dart.js": "f31c890d93f705e24858cb82c85b049f", +"main.dart.js": "c8374065bc116bd85aa8700ae3b32c95", "flutter.js": "6fef97aeca90b426343ba6c5c9dc5d4a", "icons/favicon-16x16.png": "1fcc687e538a1fa2310543ea74432dd7", "icons/favicon.ico": "33df157f932cc0af7754871debe8e8c2", @@ -16,7 +16,7 @@ const RESOURCES = {"version.json": "a29275557e1ad57cd6e1add76041252f", "icons/favicon-32x32.png": "b664008f33a310f05ef871d037f27da0", "manifest.json": "354bec2e18572e000457749fdce63207", "assets/AssetManifest.json": "844a0d7c900ee1257e7f27f4380fd75d", -"assets/NOTICES": "735716f3d3197a8507e2e68efe143c90", +"assets/NOTICES": "5910587d3f4f198637dd9ec4f7519300", "assets/FontManifest.json": "95766328e0d804735e9b8436b62cb8ad", "assets/packages/fluttertoast/assets/toastify.js": "56e2c9cedd97f10e7e5f1cebd85d53e3", "assets/packages/fluttertoast/assets/toastify.css": "a85675050054f179444bc5ad70ffc635", diff --git a/chat_sample/build/web/index.html b/chat_sample/build/web/index.html index 5610439..169980a 100644 --- a/chat_sample/build/web/index.html +++ b/chat_sample/build/web/index.html @@ -38,7 +38,7 @@ application. For more information, see: https://developers.google.com/web/fundamentals/primers/service-workers -->