Skip to content

Commit

Permalink
v4.3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
vivekCometChat committed Jul 9, 2024
1 parent e1d6dff commit 0430695
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId = "com.cometchat.kotlinsampleapp"
minSdk = 21
targetSdk = 34
versionCode = 3
versionName = "4.3.11"
versionCode = 4
versionName = "4.3.13"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,9 @@ import org.json.JSONObject

class MainActivity : AppCompatActivity() {
private lateinit var user1: MaterialCardView

private lateinit var user2: MaterialCardView

private lateinit var user3: MaterialCardView

private lateinit var user4: MaterialCardView

private lateinit var ivLogo: AppCompatImageView
private lateinit var progressBar: ProgressBar
private lateinit var tvCometChat: AppCompatTextView
Expand All @@ -56,6 +52,34 @@ class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val uiKitSettings =
UIKitSettingsBuilder().setRegion(AppConstants.REGION).setAppId(AppConstants.APP_ID)
.setAuthKey(AppConstants.AUTH_KEY).subscribePresenceForAllUsers().build()
CometChatUIKit.init(this, uiKitSettings, object : CometChat.CallbackListener<String?>() {
override fun onSuccess(s: String?) {
CometChat.setDemoMetaInfo(appMetadata)
if (CometChatUIKit.getLoggedInUser() != null) {
fetchDefaultObjects()
startActivity(
Intent(
this@MainActivity,
HomeActivity::class.java
)
)
finish()
} else {
viewInit()
}
}

override fun onError(e: CometChatException) {
Toast.makeText(this@MainActivity, e.message, Toast.LENGTH_SHORT).show()
}
})

}

private fun viewInit() {
setContentView(R.layout.activity_main)
parentView = findViewById(R.id.parent_view)
progressBar = findViewById(R.id.progress_bar)
Expand Down Expand Up @@ -86,30 +110,6 @@ class MainActivity : AppCompatActivity() {
stateMessage.text = getString(R.string.please_wait)
progressBar.visibility = View.VISIBLE
Utils.setStatusBarColor(this, resources.getColor(android.R.color.white))
val uiKitSettings =
UIKitSettingsBuilder().setRegion(AppConstants.REGION).setAppId(AppConstants.APP_ID)
.setAuthKey(AppConstants.AUTH_KEY).subscribePresenceForAllUsers().build()
CometChatUIKit.init(this, uiKitSettings, object : CometChat.CallbackListener<String?>() {
override fun onSuccess(s: String?) {
CometChat.setDemoMetaInfo(appMetadata)
if (CometChatUIKit.getLoggedInUser() != null) {
fetchDefaultObjects()
startActivity(
Intent(
this@MainActivity,
HomeActivity::class.java
)
)
finish()
}
}

override fun onError(e: CometChatException) {
Toast.makeText(this@MainActivity, e.message, Toast.LENGTH_SHORT).show()
}
})


AppUtils.fetchSampleUsers(object : CometChat.CallbackListener<List<User>>() {
override fun onSuccess(users: List<User>) {
if (users.isNotEmpty()) {
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ dependencyResolutionManagement {
}
}

rootProject.name = "CometChatSampleAppKotlin"
rootProject.name = "KotlinSampleApp"
include(":app")

0 comments on commit 0430695

Please sign in to comment.