Skip to content

Commit

Permalink
Merge pull request #19 from cometchat/dev
Browse files Browse the repository at this point in the history
3.0.14-2
  • Loading branch information
vivekCometChat authored Apr 2, 2024
2 parents ea3ebe5 + 095456d commit 7883c2e
Show file tree
Hide file tree
Showing 32 changed files with 5,297 additions and 3,325 deletions.
2 changes: 1 addition & 1 deletion uikit-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ dependencies {
//cometchat
compileOnly 'com.cometchat:pro-android-chat-sdk:3.0.14'
compileOnly 'com.cometchat:pro-android-calls-sdk:2.3.0'

implementation 'com.google.android.flexbox:flexbox:3.0.0'
def activityKtxVersion = "1.3.1"
implementation "androidx.activity:activity-ktx:$activityKtxVersion"
def fragmentKtxVersion = "1.4.0-alpha06"
Expand Down
22 changes: 16 additions & 6 deletions uikit-kotlin/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,24 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.cometchat.pro.uikit">

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32"
tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />

<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />

<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<application
android:hardwareAccelerated="true"
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -774,10 +774,29 @@ class CometChatThreadMessageList : Fragment(), View.OnClickListener, OnMessageLo
}

override fun onAudioActionClicked() {
if (Utils.hasPermissions(context, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
startActivityForResult(MediaUtils.openAudio(activity!!), UIKitConstants.RequestCode.AUDIO)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
if (Utils.hasPermissions(context, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
MediaUtils.openAudio(
activity!!
)
} else {
requestPermissions(
arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
UIKitConstants.RequestCode.AUDIO
)
}
} else {
requestPermissions(arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), UIKitConstants.RequestCode.AUDIO)
if (Utils.hasPermissions(context, Manifest.permission.READ_MEDIA_AUDIO)) {
MediaUtils.openAudio(
activity!!
)

} else {
requestPermissions(
arrayOf(Manifest.permission.READ_MEDIA_AUDIO),
UIKitConstants.RequestCode.AUDIO
)
}
}
}

Expand All @@ -791,17 +810,26 @@ class CometChatThreadMessageList : Fragment(), View.OnClickListener, OnMessageLo

override fun onGalleryActionClicked() {
if (Utils.hasPermissions(context, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
startActivityForResult(MediaUtils.openGallery(activity!!), UIKitConstants.RequestCode.GALLERY)
MediaUtils.openGallery(activity!!)
} else {
requestPermissions(arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), UIKitConstants.RequestCode.GALLERY)
}
}

override fun onFileActionClicked() {
if (Utils.hasPermissions(context, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
startActivityForResult(MediaUtils.getFileIntent(UIKitConstants.IntentStrings.EXTRA_MIME_DOC), UIKitConstants.RequestCode.FILE)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU || Utils.hasPermissions(
context, Manifest.permission.WRITE_EXTERNAL_STORAGE
)
) {
startActivityForResult(
MediaUtils.getFileIntent(UIKitConstants.IntentStrings.EXTRA_MIME_DOC),
UIKitConstants.RequestCode.FILE
)
} else {
requestPermissions(arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), UIKitConstants.RequestCode.FILE)
requestPermissions(
arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
UIKitConstants.RequestCode.FILE
)
}
}

Expand Down Expand Up @@ -948,8 +976,8 @@ class CometChatThreadMessageList : Fragment(), View.OnClickListener, OnMessageLo
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String?>, grantResults: IntArray) {
Log.d(Companion.TAG, "onRequestPermissionsResult: ")
when (requestCode) {
UIKitConstants.RequestCode.CAMERA -> if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED) startActivityForResult(MediaUtils.openCamera(activity!!), UIKitConstants.RequestCode.CAMERA) else showSnackBar(view!!.findViewById<View>(R.id.message_box), resources.getString(R.string.grant_camera_permission))
UIKitConstants.RequestCode.GALLERY -> if (grantResults[0] == PackageManager.PERMISSION_GRANTED) startActivityForResult(MediaUtils.openGallery(activity!!), UIKitConstants.RequestCode.GALLERY) else showSnackBar(view!!.findViewById<View>(R.id.message_box), resources.getString(R.string.grant_storage_permission))
UIKitConstants.RequestCode.CAMERA -> if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED) MediaUtils.openCamera(activity!!)else showSnackBar(view!!.findViewById<View>(R.id.message_box), resources.getString(R.string.grant_camera_permission))
UIKitConstants.RequestCode.GALLERY -> if (grantResults[0] == PackageManager.PERMISSION_GRANTED) MediaUtils.openGallery(activity!!) else showSnackBar(view!!.findViewById<View>(R.id.message_box), resources.getString(R.string.grant_storage_permission))
UIKitConstants.RequestCode.FILE -> if (grantResults[0] == PackageManager.PERMISSION_GRANTED) startActivityForResult(MediaUtils.getFileIntent(UIKitConstants.IntentStrings.EXTRA_MIME_DOC), UIKitConstants.RequestCode.FILE) else showSnackBar(view!!.findViewById<View>(R.id.message_box), resources.getString(R.string.grant_storage_permission))
UIKitConstants.RequestCode.LOCATION -> if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
} else showSnackBar(view!!.findViewById<View>(R.id.message_box), resources.getString(R.string.grant_location_permission))
Expand Down
Loading

0 comments on commit 7883c2e

Please sign in to comment.