Skip to content

Commit 826ee4f

Browse files
Merge pull request #54 from cometchat-pro/dev
v1.0.0
2 parents d51adb2 + e884f27 commit 826ee4f

5 files changed

Lines changed: 30 additions & 30 deletions

File tree

LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

LICENSE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Copyright (c) 2023 CometChat Inc.
2+
3+
License agreement: https://www.cometchat.com/legal-terms-of-service

Readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ You are requested to follow the contribution guidelines specified in [CONTRIBUTI
126126

127127
Please connect with our real-time support via the [CometChat Dashboard](https://app.cometchat.com/).
128128

129-
<!-- LICENSE -->
129+
<!-- LICENSE.md -->
130130

131131
## License
132132

133-
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
133+
This project is licensed under the MIT License - see the [LICENSE](./LICENSE.md) file for details.
134134

135135
## About Authors
136136

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ android {
1010
minSdk 21
1111
targetSdk 33
1212
versionCode 1
13-
versionName "4.0.0"
13+
versionName "1.0.0"
1414

1515
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1616
manifestPlaceholders = [file_provider: "com.cometchat.javasampleapp"]
@@ -37,5 +37,5 @@ dependencies {
3737
testImplementation 'junit:junit:4.13.2'
3838
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
3939
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
40-
implementation 'com.cometchat:calls-sdk-android:4.0.0'
40+
implementation 'com.cometchat:calls-sdk-android:4.0.1'
4141
}

app/src/main/java/com/cometchat/javasampleapp/activity/MainActivity.java

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@
1919
import com.cometchat.javasampleapp.AppConstants;
2020
import com.cometchat.javasampleapp.AppUtils;
2121
import com.cometchat.javasampleapp.Application;
22+
import com.cometchat.javasampleapp.BuildConfig;
2223
import com.cometchat.javasampleapp.R;
2324
import com.cometchat.chat.models.User;
2425
import com.google.android.material.card.MaterialCardView;
2526

27+
import org.json.JSONObject;
28+
2629
public class MainActivity extends AppCompatActivity {
2730

2831
private MaterialCardView superhero1;
@@ -41,12 +44,13 @@ public class MainActivity extends AppCompatActivity {
4144
protected void onCreate(Bundle savedInstanceState) {
4245
super.onCreate(savedInstanceState);
4346
setContentView(R.layout.activity_main);
44-
parentView=findViewById(R.id.parent_view);
47+
parentView = findViewById(R.id.parent_view);
4548
Utils.setStatusBarColor(this, getResources().getColor(android.R.color.white));
4649
UIKitSettings uiKitSettings = new UIKitSettings.UIKitSettingsBuilder().setRegion(AppConstants.REGION).setAppId(AppConstants.APP_ID).setAuthKey(AppConstants.AUTH_KEY).subscribePresenceForAllUsers().build();
4750
CometChatUIKit.init(this, uiKitSettings, new CometChat.CallbackListener<String>() {
4851
@Override
4952
public void onSuccess(String s) {
53+
CometChat.setDemoMetaInfo(getAppMetadata());
5054
if (CometChatUIKit.getLoggedInUser() != null) {
5155
Application.addCallListener(MainActivity.this);
5256
AppUtils.fetchDefaultObjects();
@@ -110,15 +114,29 @@ public void onError(CometChatException e) {
110114
}
111115

112116
private void setUpUI() {
113-
if(AppUtils.isNightMode(this)){
114-
Utils.setStatusBarColor(this, ContextCompat.getColor(this,R.color.app_background_dark));
115-
parentView.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(this,R.color.app_background_dark)));
116-
}else {
117+
if (AppUtils.isNightMode(this)) {
118+
Utils.setStatusBarColor(this, ContextCompat.getColor(this, R.color.app_background_dark));
119+
parentView.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.app_background_dark)));
120+
} else {
117121
Utils.setStatusBarColor(this, getResources().getColor(R.color.app_background));
118122
parentView.setBackgroundTintList(ColorStateList.valueOf(getResources().getColor(R.color.app_background)));
119123
}
120124
}
121125

126+
private JSONObject getAppMetadata() {
127+
JSONObject jsonObject = new JSONObject();
128+
try {
129+
jsonObject.put("name", getResources().getString(R.string.app_name));
130+
jsonObject.put("type", "sample");
131+
jsonObject.put("version", BuildConfig.VERSION_NAME);
132+
jsonObject.put("bundle", BuildConfig.APPLICATION_ID);
133+
jsonObject.put("platform", "android");
134+
} catch (Exception e) {
135+
e.printStackTrace();
136+
}
137+
return jsonObject;
138+
}
139+
122140
public void createUser(View view) {
123141
startActivity(new Intent(this, CreateUserActivity.class));
124142
}

0 commit comments

Comments
 (0)