Skip to content

Commit 8e99ced

Browse files
created
1 parent 17d527d commit 8e99ced

File tree

326 files changed

+26865
-14107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

326 files changed

+26865
-14107
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 3.0.6-pluto.beta.2
2+
* Major structural changes
3+
14
## 3.0.5-pluto.beta.1.1
25
* Issue Fixes
36
* cometchat 3.0.5 compatibility

README.md

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -74,28 +74,26 @@ end
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 🌟
122118
The 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
131127
String appID = "APP_ID"; // Replace with your App ID
132128
String 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: &nbsp; <b> Note: Make sure to replace `region` and `appID` with your credentials.</b> |
152+
| :information_source: &nbsp; <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
157160
import '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
183184
String 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
187187
if (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: &nbsp; <b>Note - The login() method needs to be called only once. Also replace AUTH_KEY with your App Auth Key.</b> |
201+
| :information_source: &nbsp; <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

222222
Thanks 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

android/src/main/AndroidManifest.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<uses-permission android:name="android.permission.INTERNET"/>
66
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
77
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
8+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
9+
<uses-permission android:name="android.permission.VIBRATE" />
810

911
<queries>
1012
<!-- If your app makes calls -->
@@ -17,10 +19,14 @@
1719
<action android:name="android.intent.action.SEND" />
1820
<data android:mimeType="*/*" />
1921
</intent>
22+
<intent>
23+
<action android:name="android.intent.action.GET_CONTENT" />
24+
<data android:mimeType="*/*"/>
25+
</intent>
2026
</queries>
2127

2228

23-
<uses-permission android:name="android.permission.VIBRATE" />
29+
2430
<application>
2531
<provider
2632
android:name="com.cometchat.flutter_chat_ui_kit.FileProvider"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.cometchat.flutter_chat_ui_kit
2+
3+
import android.net.Uri
4+
import java.util.HashMap
5+
6+
class CometChatFileInfo(val path: String?, val name: String?, val uri: Uri?, val size: Long, val bytes: ByteArray?) {
7+
class Builder {
8+
private var path: String? = null
9+
private var name: String? = null
10+
private var uri: Uri? = null
11+
private var size: Long = 0
12+
private var bytes: ByteArray? = null
13+
fun withPath(path: String?): Builder {
14+
this.path = path
15+
return this
16+
}
17+
18+
fun withName(name: String?): Builder {
19+
this.name = name
20+
return this
21+
}
22+
23+
fun withSize(size: Long): Builder {
24+
this.size = size
25+
return this
26+
}
27+
28+
fun withData(bytes: ByteArray?): Builder {
29+
this.bytes = bytes
30+
return this
31+
}
32+
33+
fun withUri(uri: Uri?): Builder {
34+
this.uri = uri
35+
return this
36+
}
37+
38+
fun build(): CometChatFileInfo {
39+
return CometChatFileInfo(path, name, uri, size, bytes)
40+
}
41+
}
42+
43+
fun toMap(): HashMap<String, Any?> {
44+
val data = HashMap<String, Any?>()
45+
data["path"] = path
46+
data["name"] = name
47+
data["size"] = size
48+
data["bytes"] = bytes
49+
data["identifier"] = uri.toString()
50+
return data
51+
}
52+
}

0 commit comments

Comments
 (0)