7474
7575</td ></table >
7676
77- ** Step 3-** Open app/build.gradle file and change min SDk version to 21 and add lint ignore option <br />
77+ ** Step 3-** Open app/build.gradle file and change min SDk version to 33 <br />
7878
7979<table ><td >
8080
8181``` groovy
8282 defaultConfig {
8383 // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
8484 applicationId <YOUR_PACKAGE_NAME>
85- minSdkVersion 21
85+ minSdkVersion 33
8686 targetSdkVersion <TARGET_SDK_Version>
8787 versionCode flutterVersionCode.toInteger()
8888 versionName flutterVersionName
8989 }
9090
91-
92-
93- lintOptions {
94- disable 'InvalidPackage'
95- disable "Instantiatable"
96- checkReleaseBuilds false
97- abortOnError false
98- }
91+ lintOptions {
92+ disable 'InvalidPackage'
93+ disable "Instantiatable"
94+ checkReleaseBuilds false
95+ abortOnError false
96+ }
9997```
10098
10199
@@ -111,12 +109,10 @@ import 'package:flutter_chat_ui_kit/flutter_chat_ui_kit.dart';
111109
112110```
113111
114- <!-- You can refer to the below link for next instructions:<br/> -->
115- <!-- [📝 Add Java Pluto UI Kit Dependency](https://www.cometchat.com/docs/java-uikit-beta/integration) -->
116112
117113<hr />
118114
119- ## Configure CometChat SDK
115+ ## Configure CometChat UI kit
120116
121117### i. Initialize CometChat 🌟
122118The init() method initializes the settings required for CometChat. We suggest calling the init() method on app startup, preferably in the init() method of the Home class.
@@ -130,23 +126,30 @@ import 'package:flutter_chat_ui_kit/flutter_chat_ui_kit.dart';
130126
131127String appID = "APP_ID"; // Replace with your App ID
132128String region = "REGION"; // Replace with your App Region ("eu" or "us")
133-
134- AppSettings appSettings = (AppSettingsBuilder()
135- ..subscriptionType = CometChatSubscriptionType.allUsers
136- ..region= region
137- ..autoEstablishSocketConnection = true
138- ).build();
139-
140- CometChat.init(appID, appSettings, onSuccess: (String successMessage) {
141- debugPrint("Initialization completed successfully $successMessage");
142- }, onError: (CometChatException e) {
143- debugPrint("Initialization failed with exception: ${e.message}");
144- });
129+ static const String authKey = "Auth key"; //Replace with your auth key
130+
131+ UIKitSettings authSettings = (UIKitSettingsBuilder()
132+ ..subscriptionType = CometChatSubscriptionType.allUsers
133+ ..region = region
134+ ..autoEstablishSocketConnection = true
135+ ..appId = appID
136+ ..apiKey = authKey)
137+ .build();
138+
139+ CometChatUIKit.init(
140+ authSettings: authSettings,
141+ onSuccess: (String successMessage){
142+ debugPrint("Initialization completed successfully $successMessage");
143+ },
144+ onError: (CometChatException e) {
145+ debugPrint("Initialization failed with exception: ${e.message}");
146+ }
147+ );
145148```
146149
147150</td ></table >
148151
149- | :information_source :   ; <b > Note: Make sure to replace ` region ` and ` appID ` with your credentials.</b > |
152+ | :information_source :   ; <b > Note: Make sure to replace ` region ` , ` appID ` and ` authKey ` with your credentials.</b > |
150153| ------------------------------------------------------------------------------------------------------------|
151154
152155### ii. Create User 👤
@@ -157,14 +160,12 @@ Once initialisation is successful, you will need to create a user. You need to u
157160import 'package:flutter_chat_ui_kit/flutter_chat_ui_kit.dart';
158161
159162
160- String authKey = "AUTH_KEY"; // Replace with your App Auth Key
161- User user = User(uid: "usr1" , name: "Kevin" );
163+ User user = User(uid: "usr1", name: "Kevin");
162164
163- CometChat .createUser(user, authKey, onSuccess: (User user){
165+ CometChatUIKit .createUser(user, onSuccess: (User user) {
164166 debugPrint("Create User succesfull ${user}");
165-
166- }, onError: (CometChatException e){
167- debugPrint("Create User Failed with exception ${e.message}");
167+ }, onError: (CometChatException e) {
168+ debugPrint("Create User Failed with exception ${e.message}");
168169});
169170
170171```
@@ -181,24 +182,23 @@ Once you have created the user successfully, you will need to log the user into
181182
182183``` dart
183184String UID = "user_id"; // Replace with the UID of the user to login
184- String authKey = "AUTH_KEY"; // Replace with your App Auth Key
185185
186- final user = await CometChat.getLoggedInUser();
186+ final user = await CometChat.getLoggedInUser();//checking if already logged in
187187if (user == null) {
188- await CometChat.login(UID, authKey,
189- onSuccess: (User user ) {
190- debugPrint("Login Successful : $user" );
191- }, onError: (CometChatException e) {
192- debugPrint("Login failed with exception: ${e.message}");
193- });
188+
189+ await CometChatUIKit.login(UID, onSuccess: (User loggedInUser ) {
190+ debugPrint("Login Successful : $user" );
191+ }, onError: (CometChatException e) {
192+ debugPrint("Login failed with exception: ${e.message}");
193+ });
194194}else{
195195//Already logged in
196196}
197197```
198198
199199</td ></table >
200200
201- | :information_source :   ; <b >Note - The login() method needs to be called only once. Also replace AUTH_KEY with your App Auth Key. </b > |
201+ | :information_source :   ; <b >Note - The login() method needs to be called only once. Use this method while development </b > |
202202| ------------------------------------------------------------------------------------------------------------|
203203
204204<hr />
@@ -221,7 +221,8 @@ if (user == null) {
221221
222222Thanks to the following people who have contributed to this project:
223223
224- [ 👨💻 @shantanukhare 💻] ( https://github.com/Shantanu-CometChat ) <br >
224+ [ ⚔️ @shantanukhare 🛡] ( https://github.com/Shantanu-CometChat ) <br >
225+ [ ⚔️ @nabhodiptagarai 🛡] ( https://github.com/nabhodiptagarai ) <br >
225226
226227---
227228
0 commit comments