From 62224640a0f1fd4b852e32987050b8b017806924 Mon Sep 17 00:00:00 2001 From: munikiran-cometchat <132883878+munikiran-cometchat@users.noreply.github.com> Date: Mon, 3 Jun 2024 13:23:57 +0530 Subject: [PATCH 1/6] Updated to version v1.0.12 --- README.md | 5 +++++ ios/Podfile.lock | 12 ++++++------ lib/utils/demo_meta_info_constants.dart | 2 +- pubspec.yaml | 6 +++--- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 17edb1b..6921362 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,11 @@ This reference application showcases the integration of [**CometChat's Flutter U cd ios pod install ``` + If you are facing any issue with pod install, you can try running the following command: + ```sh + pod update + ``` + 6. Open a Simulator or connect a physical device. 7. Run the app on a device or emulator from the repo root. diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 1589af1..91135a9 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -2,14 +2,14 @@ PODS: - cometchat_calls_sdk (4.0.9): - CometChatCallsSDK (= 4.0.6) - Flutter - - cometchat_calls_uikit (4.3.0): + - cometchat_calls_uikit (4.3.1): - Flutter - - cometchat_chat_uikit (4.5.0): + - cometchat_chat_uikit (4.5.1): - Flutter - cometchat_sdk (4.0.11): - CometChatSDK (= 4.0.46) - Flutter - - cometchat_uikit_shared (4.3.0): + - cometchat_uikit_shared (4.4.1): - Flutter - CometChatCallsSDK (4.0.6): - CometChatWebRTC (= 1.106.1) @@ -83,10 +83,10 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: cometchat_calls_sdk: f1710462c3adc9a9e866adf8774312905a3d098c - cometchat_calls_uikit: 42579739b2c878ee012e11bf8b3719ea7dd86c88 - cometchat_chat_uikit: 7ee1be90a8ae91a3d2b4d87b381fd5abb10e5084 + cometchat_calls_uikit: 5a45a72863bff731bcd670368424429281a5d7ed + cometchat_chat_uikit: f158178adf9450fc14225f1042af4bbd495c515a cometchat_sdk: e7ff1e2ea4dea67f68e6b91b99d559cec7ff75d3 - cometchat_uikit_shared: 6d85a7fd9fad059b9e4effa5f89b9f203a51cf3b + cometchat_uikit_shared: 52a411f53b32dab6bbfd5bc8df1d38353fcb4190 CometChatCallsSDK: 121b36c761d5f244cc9608c44a15a2a8c02ee877 CometChatSDK: 4d564fc763fabffde62749c85847a2304a76f38e CometChatWebRTC: c08f446967168f6de442b48b824623411651dbb5 diff --git a/lib/utils/demo_meta_info_constants.dart b/lib/utils/demo_meta_info_constants.dart index 8cf1d24..328c0d1 100644 --- a/lib/utils/demo_meta_info_constants.dart +++ b/lib/utils/demo_meta_info_constants.dart @@ -3,7 +3,7 @@ import 'dart:io'; class DemoMetaInfoConstants { static String name = "cometchat_flutter_sample_app"; static String type = "sample-app"; - static String version = "1.0.11"; + static String version = "1.0.12"; static String bundle = Platform.isAndroid ? "com.cometchat.cometchat_flutter_sample_app" : "com.cometchat.cometchatFlutterSampleApp"; static String platform = "Flutter"; } \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index f13b273..26e8054 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 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.11 +version: 1.0.12 environment: sdk: ">=2.16.2 <3.0.0" @@ -34,8 +34,8 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 - cometchat_chat_uikit: ^4.5.0 - cometchat_calls_uikit: ^4.3.0 + cometchat_chat_uikit: ^4.5.1 + cometchat_calls_uikit: ^4.3.1 flutter_localizations: sdk: flutter toast: ^0.3.0 From 68a5a3257ad7cfe3ac06a1c9b7de8f94f8ae4227 Mon Sep 17 00:00:00 2001 From: munikiran-cometchat <132883878+munikiran-cometchat@users.noreply.github.com> Date: Fri, 21 Jun 2024 20:28:45 +0530 Subject: [PATCH 2/6] Updated to version 1.0.13 --- assets/sample_app/sample_data.json | 29 +++ assets/wolverine_avatar.png | Bin 0 -> 9984 bytes ios/Podfile.lock | 22 +- ios/Runner.xcodeproj/project.pbxproj | 64 ++--- lib/login.dart | 281 ++++++++++----------- lib/models/material_button_user_model.dart | 11 + lib/services/api_services.dart | 58 +++++ lib/utils/demo_meta_info_constants.dart | 2 +- pubspec.yaml | 8 +- 9 files changed, 274 insertions(+), 201 deletions(-) create mode 100644 assets/sample_app/sample_data.json create mode 100644 assets/wolverine_avatar.png create mode 100644 lib/models/material_button_user_model.dart create mode 100644 lib/services/api_services.dart diff --git a/assets/sample_app/sample_data.json b/assets/sample_app/sample_data.json new file mode 100644 index 0000000..df0c8ea --- /dev/null +++ b/assets/sample_app/sample_data.json @@ -0,0 +1,29 @@ +{ + "users":[ + { + "uid": "superhero1", + "name": "Iron Man", + "avatar": "assets/ironman_avatar.png" + }, + { + "uid": "superhero2", + "name": "Captain America", + "avatar": "assets/captainamerica_avatar.png" + }, + { + "uid": "superhero3", + "name": "Spiderman", + "avatar": "assets/spiderman_avatar.png" + }, + { + "uid": "superhero4", + "name": "Wolverine", + "avatar": "assets/wolverine_avatar.png" + }, + { + "uid": "superhero5", + "name": "Cyclops", + "avatar": "assets/cyclops_avatar.png" + } + ] +} \ No newline at end of file diff --git a/assets/wolverine_avatar.png b/assets/wolverine_avatar.png new file mode 100644 index 0000000000000000000000000000000000000000..43913642c12f0cdd0d06b826ffdcdf08f6b0207c GIT binary patch literal 9984 zcmaKS2RNH=+%9U*SXHC8+Ei8Ty&`FCV$-T>i_{2e*H%T1ptVOr?a?ZtHl-nP`&)YLp56fKTZ zIG-Rvp-{z1JlfjY=buDf9c}^4Xgwng2AfCg8yac?U1=%Dp{Wd9*YF3S7n z`H*NR{KE0yq`-_sB7ym=Ot!T|;&Z+#5EfWwhTS|X7C}Y{ZGWO5w&|U|qySvp9Ms%_ z;c5{CHwI+YnLK@ceG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J7} zA+0QGrddzmu3^+;j^-D}%W6OKOyj}WGEDsbKpsmU`3$8=yVzg|Uw@!%IlM2%CQs6n zcJ4zyKvQh|A*@+_K(?spgk0#%o;q1ba9_4eUWz@GPTxwD4L`E!#symMQ}v(TpW%z0 zxCX-4Y1yc`?DVw-Ec%kC$1v%f_@4@iIqe24<+p879CkA5TZ@q6oz*}Bdog1w$@}*| zoa?jMWssmcY4&#GpRBLSS>~?X5qmGVfpdmhj>x}?gFERq*)oPoC)UO_658l5tJ!zo zK6F(c52a%Z%#>4d-TLc3&u4sSJGQ(_1 za9TW6-LsrMR4z!oE>?8ytXpbA&5iwT;Pw>^{8Y+)CfPKhROGBeOqt1&Dd7F%f?})h z{;2sd(ZrE{iFBvG;-M32Ke6-rTKCP;&K;4jStGW74H>@i3^GqWZ&57jn#tST^VE#H zn`b=)>v&dAEhu{yD^^2Zg;nn_mh3!1`iV&Vx$=iRzXgH0-6kH-<2%^;QJCYWt8eJ# zVrE^NlXylgZ6RgGV~HN2m}8HAu=Il%|AxU>c1jS z&A?_p-l6yXqb!a;1v6mnKXZd517c7SnTW94FlEzqJu^X_De)FK2mh?VrV0LCI$+qoME?{$e{~I( zr}QlF4^I_gs)U}|!zlsO*d?y6fmJ`g88t{+3Vg|o78Fl{N`6B*AFQucp-F|lyD`!L$+*Vzpun0^s40gDzPi_*Jq92^+A`tCH7N;BhtB3hFJ9#EcF#gGN zTP1VGr*vdcs#b!9YjggUlY^V%I1xqZ1Ii88!2~q)m*JKGF?p9oTXJ@l!k(G#;V6el zChyxV&(sG?;^+bNR+1^>>^dr<`&hbynFCvt8zGQ!j#g50U)5?PRm~(&{lp3;nT}wX zjUvS1l08H5Ah^jx)BrLGbn_7x3*M(H=ZbJ$Xh|y8JIfD6o48*}gBoCGEdf { - List userModelList = [ - MaterialButtonUserModel( - "superhero1", "SUPERHERO1", "assets/ironman_avatar.png"), - MaterialButtonUserModel( - "superhero2", "SUPERHERO2", "assets/captainamerica_avatar.png"), - MaterialButtonUserModel( - "superhero3", "SUPERHERO3", "assets/spiderman_avatar.png"), - MaterialButtonUserModel( - "superhero4", "SUPERHERO4", "assets/cyclops_avatar.png"), - ]; - - @override - void initState() { - super.initState(); - - //CometChat SDk should be initialized at the start of application. No need to initialize it again - // AppSettings appSettings = (AppSettingsBuilder() - // ..subscriptionType = CometChatSubscriptionType.allUsers - // ..region = CometChatConstants.region - // ..autoEstablishSocketConnection = true) - // .build(); - // - // CometChat.init(CometChatConstants.appId, appSettings, - // onSuccess: (String successMessage) { - // debugPrint("Initialization completed successfully $successMessage"); - // }, onError: (CometChatException excep) { - // debugPrint("Initialization failed with exception: ${excep.message}"); - // }); - - //initialization end + Widget userSelectionButton( + MaterialButtonUserModel model, + BuildContext context, + ) { + return MaterialButton( + color: Colors.black, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)), + onPressed: () { + loginUser(model.userId, context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CircleAvatar( + backgroundColor: Colors.white, + child: model.imageURL.startsWith('http') + ? Image.network( + model.imageURL, + height: 30, + width: 30, + ) + : Image.asset( + model.imageURL, + height: 30, + width: 30, + ), + ), + const SizedBox(width: 10.0), + Expanded( + child: Text( + model.username, + style: const TextStyle(color: Colors.white, fontSize: 14.0), + ), + ) + ], + ), + ), + ); } //Login User function must pass userid and authkey should be used only while developing - loginUser(String userId, BuildContext context) async { + loginUser(String userId, context) async { Alert.showLoadingIndicatorDialog(context); - User? _user = await CometChat.getLoggedInUser(); + User? user = await CometChat.getLoggedInUser(); try { - if (_user != null) { - if (_user.uid == userId) { + if (user != null) { + if (user.uid == userId) { Navigator.of(context).pop(); Navigator.push(context, @@ -72,127 +82,96 @@ class _LoginState extends State { await CometChatUIKit.login(userId, onSuccess: (User loggedInUser) { debugPrint("Login Successful from UI : $loggedInUser"); Navigator.of(context).pop(); - _user = loggedInUser; + user = loggedInUser; Navigator.push( context, MaterialPageRoute(builder: (context) => const Dashboard())); }, onError: (CometChatException e) { Navigator.of(context).pop(); debugPrint("Login failed with exception: ${e.message}"); }); - - // await CometChat.login(userId, CometChatConstants.authKey, - // onSuccess: (User loggedInUser) { - // debugPrint("Login Successful : $loggedInUser"); - // Navigator.of(context).pop(); - // _user = loggedInUser; - // Navigator.push( - // context, MaterialPageRoute(builder: (context) => const Dashboard())); - // }, onError: (CometChatException e) { - // Navigator.of(context).pop(); - // debugPrint("Login failed with exception: ${e.message}"); - // }); - } - - Widget userSelectionButton( - MaterialButtonUserModel model, BuildContext context) { - return MaterialButton( - color: Colors.black, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)), - onPressed: () { - loginUser(model.userId, context); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - CircleAvatar( - backgroundColor: Colors.white, - child: Image.asset( - model.imageURL, - height: 30, - width: 30, - ), - ), - Text( - model.userId, - style: const TextStyle(color: Colors.white, fontSize: 14.0), - ) - ], - ), - ); } @override Widget build(BuildContext context) { return Scaffold( body: SafeArea( - child: SingleChildScrollView( - child: Padding( + child: SingleChildScrollView( padding: const EdgeInsets.all(10.0), - child: (Column( + child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset("assets/cometchat_logo.png", height: 100, width: 100), + Image.asset( + "assets/cometchat_logo.png", + height: 100, + width: 100, + ), const Text( "CometChat", style: TextStyle( - color: Colors.black54, - fontSize: 30, - fontWeight: FontWeight.bold), - ), - const SizedBox( - height: 20.0, - ), - const Wrap( - children: [ - Text( - "Login with one of our sample user", - style: TextStyle(color: Colors.black38), - ) - ], + color: Colors.black54, + fontSize: 30, + fontWeight: FontWeight.bold, + ), ), - const SizedBox( - height: 20.0, + const SizedBox(height: 20.0), + const Text( + "Login with one of our sample users", + style: TextStyle(color: Colors.black38), ), - - //All available user Ids in grid - GridView.count( - shrinkWrap: true, - crossAxisCount: 2, - crossAxisSpacing: 10.0, - mainAxisSpacing: 10.0, - childAspectRatio: 3.0, - children: List.generate( - userModelList.length, - (index) => - userSelectionButton(userModelList[index], context)), + const SizedBox(height: 20.0), + // Use FutureBuilder to handle async operation and show loader + FutureBuilder>( + future: ApiServices.fetchUsers(), + builder: (BuildContext context, + AsyncSnapshot> snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + // Show loader while fetching data + return Center( + child: Image.asset( + AssetConstants.spinner, + package: UIConstants.packageName, + ), + ); + } else if (snapshot.hasError) { + // Handle error + return Center(child: Text('Error: ${snapshot.error}')); + } else { + // Show user selection buttons + return GridView.count( + shrinkWrap: true, + crossAxisCount: 2, + crossAxisSpacing: 10.0, + mainAxisSpacing: 10.0, + childAspectRatio: 3.0, + children: (snapshot.data ?? []).take(4).map((user) { + return userSelectionButton(user, context); + }).toList(), + ); + } + }, ), const SizedBox(height: 20), - - const Wrap( - children: [ - Text( - "or else continue login with", - style: TextStyle(color: Colors.black38), - ) - ], - ), - - const SizedBox( - height: 5, + const Text( + "or continue login with", + style: TextStyle(color: Colors.black38), ), + const SizedBox(height: 5), Center( child: MaterialButton( color: Colors.blue, height: 45, minWidth: 200, shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0)), + borderRadius: BorderRadius.circular(10.0), + ), onPressed: () { Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const LoginWithUID())); + context, + MaterialPageRoute( + builder: (context) => const LoginWithUID(), + ), + ); }, child: const Text( "Login using UID", @@ -200,41 +179,35 @@ class _LoginState extends State { ), ), ), - const SizedBox(height: 100), - Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text("New to cometchat? "), + const Text("New to CometChat? "), GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const SignUp())); - }, - child: const Text("CREATE NEW", - style: TextStyle( - //decoration: TextDecoration.underline, - fontWeight: FontWeight.bold, - fontSize: 15, - color: Colors.blue))) + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const SignUp(), + ), + ); + }, + child: const Text( + "CREATE NEW", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 15, + color: Colors.blue, + ), + ), + ), ], ), - ], - )), + ), ), - )), + ), ); } } - -class MaterialButtonUserModel { - String username; - String userId; - String imageURL; - - MaterialButtonUserModel(this.username, this.userId, this.imageURL); -} diff --git a/lib/models/material_button_user_model.dart b/lib/models/material_button_user_model.dart new file mode 100644 index 0000000..bc6122d --- /dev/null +++ b/lib/models/material_button_user_model.dart @@ -0,0 +1,11 @@ +class MaterialButtonUserModel { + final String username; + final String userId; + final String imageURL; + + MaterialButtonUserModel( + this.username, + this.userId, + this.imageURL, + ); +} diff --git a/lib/services/api_services.dart b/lib/services/api_services.dart new file mode 100644 index 0000000..509c068 --- /dev/null +++ b/lib/services/api_services.dart @@ -0,0 +1,58 @@ +import 'package:cometchat_flutter_sample_app/models/material_button_user_model.dart'; +import 'package:http/http.dart' as http; +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +class ApiServices { + + // Fetch users from the API + + static Future> fetchUsers() async { + try { + final response = await http.get( + Uri.parse('https://assets.cometchat.io/sampleapp/sampledata.json'), + ); + + if (response.statusCode == 200) { + final List data = json.decode(response.body)['users'] ?? []; + final List userList = data + .map((user) => MaterialButtonUserModel( + user['name'] ?? "", + user['uid'] ?? "", + user['avatar'] ?? "", + )) + .toList(); + return userList; + } else { + throw Exception('Failed to load users'); + } + } catch (e) { + debugPrint('Exception while fetching users: $e'); + // Handle exception here, load users from local asset + return getDefaultUsers(); + } + } + + // Load default users from local asset + static Future> getDefaultUsers() async { + Map jsonData = + await loadJsonFromAssets('assets/sample_app/sample_data.json'); + final List data = jsonData['users'] ?? []; + final List userList = data + .map((user) => MaterialButtonUserModel( + user['name'] ?? "", + user['uid'] ?? "", + user['avatar'] ?? "", + )) + .toList(); + return userList; + } + + // Load JSON from local asset + static Future> loadJsonFromAssets( + String filePath) async { + String jsonString = await rootBundle.loadString(filePath); + return jsonDecode(jsonString); + } +} diff --git a/lib/utils/demo_meta_info_constants.dart b/lib/utils/demo_meta_info_constants.dart index 328c0d1..ea5f159 100644 --- a/lib/utils/demo_meta_info_constants.dart +++ b/lib/utils/demo_meta_info_constants.dart @@ -3,7 +3,7 @@ import 'dart:io'; class DemoMetaInfoConstants { static String name = "cometchat_flutter_sample_app"; static String type = "sample-app"; - static String version = "1.0.12"; + static String version = "1.0.13"; static String bundle = Platform.isAndroid ? "com.cometchat.cometchat_flutter_sample_app" : "com.cometchat.cometchatFlutterSampleApp"; static String platform = "Flutter"; } \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 26e8054..d53e3b6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 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.12 +version: 1.0.13 environment: sdk: ">=2.16.2 <3.0.0" @@ -34,8 +34,9 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 - cometchat_chat_uikit: ^4.5.1 - cometchat_calls_uikit: ^4.3.1 + cometchat_chat_uikit: ^4.5.2 + cometchat_calls_uikit: ^4.3.2 + http: ^1.1.0 flutter_localizations: sdk: flutter toast: ^0.3.0 @@ -75,6 +76,7 @@ flutter: assets: - assets/ - assets/icons/ + - assets/sample_app/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. From 56574782e0624eb36ca3feac22512ffefc91e7fd Mon Sep 17 00:00:00 2001 From: "Ketan (CometChat)" Date: Fri, 9 Aug 2024 20:15:59 +0530 Subject: [PATCH 3/6] updated readme for old sample users --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6921362..0a25634 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,11 @@ This reference application showcases the integration of [**CometChat's Flutter U ``` 4. Enter your CometChat _`App ID`_, _`Region`_, and _`Auth Key`_ in the [lib/app_constants.dart](lib/app_constants.dart) file: - https://github.com/cometchat/cometchat-sample-app-flutter/blob/b67064409ec5c875aca74fd2eff5e80968c485c7/lib/app_constants.dart#L1-L5 + https://github.com/cometchat/cometchat-sample-app-flutter/blob/68a5a3257ad7cfe3ac06a1c9b7de8f94f8ae4227/lib/app_constants.dart#L1-L5 -5. For iOS, install dependencies after navigating to ios : +5. If your app is created before August 12th, 2024 then change the sample data URL to `https://assets.cometchat.io/sampleapp/v1/sampledata.json` in the [lib/services/api_services.dart](https://github.com/cometchat/cometchat-sample-app-flutter/blob/v4/lib/services/api_services.dart) file: https://github.com/cometchat/cometchat-sample-app-flutter/blob/68a5a3257ad7cfe3ac06a1c9b7de8f94f8ae4227/lib/services/api_services.dart#L13-L15 + +6. For iOS, install dependencies after navigating to ios : ```sh cd ios pod install @@ -44,9 +46,9 @@ This reference application showcases the integration of [**CometChat's Flutter U pod update ``` -6. Open a Simulator or connect a physical device. +7. Open a Simulator or connect a physical device. -7. Run the app on a device or emulator from the repo root. +8. Run the app on a device or emulator from the repo root. ```sh flutter run ``` From 69a2732ef5469e3c3c9619cd009cf962d32006a0 Mon Sep 17 00:00:00 2001 From: "Ketan (CometChat)" Date: Fri, 7 Feb 2025 16:00:28 +0530 Subject: [PATCH 4/6] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0a25634..2486a05 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,12 @@ This reference application showcases the integration of [**CometChat's Flutter U ## Installation 1. Clone the repository: ``` - git clone https://github.com/cometchat/cometchat-sample-app-flutter.git + git clone https://github.com/cometchat/cometchat-uikit-flutter.git ``` 2. Navigate to the project directory: ```sh - cd cometchat-sample-app-flutter + cd cometchat-uikit-flutter ``` 3. Install flutter dependencies @@ -32,9 +32,9 @@ This reference application showcases the integration of [**CometChat's Flutter U ``` 4. Enter your CometChat _`App ID`_, _`Region`_, and _`Auth Key`_ in the [lib/app_constants.dart](lib/app_constants.dart) file: - https://github.com/cometchat/cometchat-sample-app-flutter/blob/68a5a3257ad7cfe3ac06a1c9b7de8f94f8ae4227/lib/app_constants.dart#L1-L5 + https://github.com/cometchat/cometchat-uikit-flutter/blob/68a5a3257ad7cfe3ac06a1c9b7de8f94f8ae4227/lib/app_constants.dart#L1-L5 -5. If your app is created before August 12th, 2024 then change the sample data URL to `https://assets.cometchat.io/sampleapp/v1/sampledata.json` in the [lib/services/api_services.dart](https://github.com/cometchat/cometchat-sample-app-flutter/blob/v4/lib/services/api_services.dart) file: https://github.com/cometchat/cometchat-sample-app-flutter/blob/68a5a3257ad7cfe3ac06a1c9b7de8f94f8ae4227/lib/services/api_services.dart#L13-L15 +5. If your app is created before August 12th, 2024 then change the sample data URL to `https://assets.cometchat.io/sampleapp/v1/sampledata.json` in the [lib/services/api_services.dart](https://github.com/cometchat/cometchat-uikit-flutter/blob/v4/lib/services/api_services.dart) file: https://github.com/cometchat/cometchat-uikit-flutter/blob/68a5a3257ad7cfe3ac06a1c9b7de8f94f8ae4227/lib/services/api_services.dart#L13-L15 6. For iOS, install dependencies after navigating to ios : ```sh From f9f9d9d26e961a84c92d973c840989753398e01f Mon Sep 17 00:00:00 2001 From: "Ketan (CometChat)" Date: Fri, 7 Feb 2025 16:05:30 +0530 Subject: [PATCH 5/6] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 2486a05..798f722 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,9 @@ This reference application showcases the integration of [**CometChat's Flutter UI Kit**](https://www.cometchat.com/docs/v4/flutter-uikit/overview) within an Flutter framework. It provides developers with examples of implementing real-time messaging and voice and video calling features in their Flutter-based applications. +## 🚀 Try the New v5 UI Kit! +Discover the all-new [v5 UI Kit](https://github.com/cometchat/cometchat-uikit-flutter/tree/v5), featuring a completely revamped design for enhanced usability and visual appeal. With restructured components, advanced styling options, and a streamlined integration process, v5 offers a seamless, customizable experience tailored to your needs. Try it now and elevate your development workflow! + ## Prerequisites - XCode for iOS and Android Studio for Android From 78c5e39a97dd622e82f5c727ffad6c5c03fb0650 Mon Sep 17 00:00:00 2001 From: munikiran-cometchat Date: Tue, 4 Mar 2025 14:02:12 +0530 Subject: [PATCH 6/6] Updated to version 1.0.14 --- android/app/build.gradle | 25 ++++++++-------- android/build.gradle | 17 ++--------- .../gradle/wrapper/gradle-wrapper.properties | 2 +- android/settings.gradle | 30 ++++++++++++++----- pubspec.yaml | 2 +- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 608fff8..a9bf7e5 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,10 +12,7 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} + def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { @@ -21,20 +24,18 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { + namespace "com.cometchat.cometchat_flutter_sample_app" compileSdkVersion 34 compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '11' } sourceSets { @@ -70,6 +71,4 @@ flutter { source '../..' } -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} +dependencies {} diff --git a/android/build.gradle b/android/build.gradle index f7eb7f6..c709783 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,20 +1,7 @@ -buildscript { - ext.kotlin_version = '1.7.10' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.3.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { google() - mavenCentral() + jcenter() } } @@ -28,4 +15,4 @@ subprojects { tasks.register("clean", Delete) { delete rootProject.buildDir -} +} \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 6b66533..7aeeb11 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip diff --git a/android/settings.gradle b/android/settings.gradle index 44e62bc..e2c71cf 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,11 +1,25 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} -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" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.5.0" apply false + id "org.jetbrains.kotlin.android" version "1.9.0" apply false +} + +include ":app" \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index d53e3b6..58744b2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 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.13 +version: 1.0.14 environment: sdk: ">=2.16.2 <3.0.0"