Skip to content

Commit b34eb03

Browse files
Merge pull request #27 from MirrorFly/release/V7.12.4
Release/v7.12.4
2 parents 083da6c + 3b3fc32 commit b34eb03

File tree

56 files changed

+1036
-481
lines changed

Some content is hidden

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

56 files changed

+1036
-481
lines changed

app/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ android {
5757
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
5858
}
5959

60+
6061
release {
6162
initWith debug
6263
buildConfigField 'Boolean', 'IS_QA_BUILD', 'true'
@@ -202,7 +203,7 @@ dependencies {
202203
implementation project(':sdk:googletranslation')
203204
implementation project(path: ':call')
204205

205-
implementation 'com.mirrorfly.sdk:mirrorflysdk:7.12.0'
206+
implementation 'com.mirrorfly.sdk:mirrorflysdk:7.12.4'
206207

207208
//Socket - versions.gradle
208209
implementation 'com.github.nkzawa:socket.io-client:0.6.0'

app/contus_internal_keystore.jks

2.26 KB
Binary file not shown.

app/keystore.jks

2.2 KB
Binary file not shown.

app/src/main/java/com/contusfly/activities/ChatActivity.kt

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class ChatActivity : ChatParent(), ActionMode.Callback, View.OnTouchListener, Em
118118

119119
private var smartReply:String ?= null
120120

121-
private var forwardClickedPostition:Int = -1
121+
private var forwardClickedItem:ChatMessage?=null
122122

123123
private var selectedReportMessage = Constants.EMPTY_STRING
124124

@@ -286,7 +286,7 @@ class ChatActivity : ChatParent(), ActionMode.Callback, View.OnTouchListener, Em
286286
) {
287287
removeUnReadMsgSeparatorOnMessageReceiver()
288288
loadNextData()
289-
playForgroundNotificationSound(this)
289+
playForegroundNotificationSound(this)
290290
}
291291
}
292292
}
@@ -544,14 +544,17 @@ class ChatActivity : ChatParent(), ActionMode.Callback, View.OnTouchListener, Em
544544
}
545545

546546
private fun initChatAdapter() {
547-
chatAdapter = ChatAdapter(mainList, clickedMessages, chat.chatType, this, userJid)
547+
chatAdapter = ChatAdapter(mainList, clickedMessages, chat.chatType, this, userJid, listChats = listChats)
548548
chatAdapter.hasStableIds()
549549
listChats.setHasFixedSize(true)
550550
listChats.adapter = chatAdapter
551551
chatAdapter.setOnDownloadClickListener(this)
552552
val messageSwipeController = MessageSwipeController(this, object : MessageSwipeController.SwipeControllerActions {
553553
override fun showSwipeInReplyUI(position: Int) {
554-
if (profileDetails.isBlocked || profileDetails.isAdminBlocked)
554+
if (profileDetails.isBlocked || profileDetails.isAdminBlocked || (chatType == ChatType.TYPE_GROUP_CHAT && !parentViewModel.isGroupUserExist(
555+
chat.toUser,
556+
SharedPreferenceManager.getCurrentUserJid()
557+
)))
555558
return
556559
Handler(Looper.getMainLooper()).postDelayed({
557560
isReplyTagged = true
@@ -654,11 +657,21 @@ class ChatActivity : ChatParent(), ActionMode.Callback, View.OnTouchListener, Em
654657
}
655658

656659
private fun highlightGivenMessage() {
657-
if (mainList.isNotEmpty()) {
658-
if (messageId.isNotEmpty() && messageId != unreadMessageTypeMessageId)
659-
highlightGivenMessageId(messageId)
660-
else
661-
listChats.scrollToPosition(mainList.size - 1)
660+
try {
661+
if (mainList.isNotEmpty()) {
662+
if (messageId.isNotEmpty() && messageId != unreadMessageTypeMessageId)
663+
highlightGivenMessageId(messageId)
664+
else {
665+
val tempMessage = mainList.lastOrNull()
666+
if (tempMessage != null) {
667+
scrollPosition(tempMessage)
668+
} else {
669+
listChats.scrollToPosition(mainList.size - 1)
670+
}
671+
}
672+
}
673+
}catch (e:Exception){
674+
LogMessage.e(TAG,e.toString())
662675
}
663676
}
664677

@@ -1452,7 +1465,7 @@ class ChatActivity : ChatParent(), ActionMode.Callback, View.OnTouchListener, Em
14521465
clickDone = true
14531466
}
14541467
R.id.action_reply -> {
1455-
if (!profileDetails.isAdminBlocked) {
1468+
if (isAdminAndUserProfileNotBlocked()) {
14561469
isReplyTagged = true
14571470
replyMessageActionMenuClicked()
14581471
chatMessageEditText.showSoftKeyboard()
@@ -1472,6 +1485,10 @@ class ChatActivity : ChatParent(), ActionMode.Callback, View.OnTouchListener, Em
14721485
return clickDone
14731486
}
14741487

1488+
private fun isAdminAndUserProfileNotBlocked(): Boolean {
1489+
return !profileDetails.isAdminBlocked && !profileDetails.isBlocked
1490+
}
1491+
14751492
private fun launchEditMessageActivity(){
14761493
val intent = Intent(this, EditMessageActivity::class.java).apply {
14771494
putExtra(LibConstants.JID, chat.toUser)
@@ -1801,7 +1818,7 @@ class ChatActivity : ChatParent(), ActionMode.Callback, View.OnTouchListener, Em
18011818
if (clickedMessages.isNotEmpty())
18021819
forwardMessageActionMenuClicked(clickedMessages)
18031820
else
1804-
senderMediaForward(forwardClickedPostition)
1821+
senderMediaForward(forwardClickedItem)
18051822
} else {
18061823
CustomToast.show(context, data.getMessage())
18071824
}
@@ -1850,9 +1867,13 @@ class ChatActivity : ChatParent(), ActionMode.Callback, View.OnTouchListener, Em
18501867
handleCommonDeleteOperation(isRecalled)
18511868
smartReplyForPreviousMessage()
18521869
} else if (position == 2) {
1853-
isRecalled = true
1854-
recallSelectedMessages()
1855-
handleCommonDeleteOperation(isRecalled)
1870+
if(isGroupUserAvailableInGroupChatOrSingleChat()) {
1871+
isRecalled = true
1872+
recallSelectedMessages()
1873+
handleCommonDeleteOperation(isRecalled)
1874+
}else{
1875+
actionMode?.finish()
1876+
}
18561877
}
18571878
}
18581879

@@ -2008,24 +2029,24 @@ class ChatActivity : ChatParent(), ActionMode.Callback, View.OnTouchListener, Em
20082029
onItemClick(position)
20092030
return
20102031
}else{
2011-
forwardClickedPostition = position
2032+
forwardClickedItem = item
20122033
}
20132034

20142035
if (SystemClock.elapsedRealtime() - lastClickTime > 1000) {
20152036
try {
20162037
hideKeyboard()
2017-
senderMediaForward(position)
2038+
senderMediaForward(item)
20182039
} catch (e: Exception) {
20192040
LogMessage.e(Constants.TAG, e)
20202041
}
20212042
}
20222043
lastClickTime = SystemClock.elapsedRealtime()
20232044
}
20242045

2025-
private fun senderMediaForward(position: Int) {
2046+
private fun senderMediaForward(item: ChatMessage?=null) {
20262047
val forwardMediaMessageSelected: ChatMessage
2027-
if (position.isValidIndex()) {
2028-
forwardMediaMessageSelected = mainList[position]
2048+
if (item!=null) {
2049+
forwardMediaMessageSelected = item
20292050
if (clickedMessages.contains(forwardMediaMessageSelected.messageId))
20302051
return
20312052
if (!forwardMediaMessageSelected.isNotificationMessage() && (!FlyCore.isBusyStatusEnabled() || chat.getChatType().name == ChatType.TYPE_GROUP_CHAT)) {
@@ -2437,8 +2458,10 @@ class ChatActivity : ChatParent(), ActionMode.Callback, View.OnTouchListener, Em
24372458

24382459
if (!videoMessage.first)
24392460
showAudioVideoDurationValidationDialog(videoDuration.toString(), Constants.MSG_TYPE_VIDEO)
2461+
else if(!videoMessage.second)
2462+
showUploadAlert(Constants.MAX_VIDEO_UPLOAD_SIZE)
24402463
else
2441-
validateAndSendMessage(videoMessage.second!!)
2464+
validateAndSendMessage(videoMessage.third!!)
24422465
}
24432466

24442467
private fun sendImageFromGallery(intent: Intent) {
@@ -2665,6 +2688,9 @@ class ChatActivity : ChatParent(), ActionMode.Callback, View.OnTouchListener, Em
26652688
leftUserJid=removedMemberJid
26662689
viewModel.getProfileDetails()
26672690
handleOnResume()
2691+
if (removedMemberJid == SharedPreferenceManager.getCurrentUserJid()) {
2692+
invalidateActionMode() // to update the action items.
2693+
}
26682694
}
26692695
}
26702696

@@ -3048,7 +3074,7 @@ class ChatActivity : ChatParent(), ActionMode.Callback, View.OnTouchListener, Em
30483074

30493075

30503076
private fun setMentionPopupBackground(){
3051-
if( groupTagAdapter.itemCount > 0 && isSoftKeyboardShown && isMentionTriggered) {
3077+
if( groupTagAdapter.itemCount > 0 && isSoftKeyboardShown && chatMessageEditText.text.toString().isNotEmpty()) {
30523078
viewChat.background = ContextCompat.getDrawable(
30533079
this@ChatActivity,
30543080
R.drawable.bg_chat_footer_shape_mention

app/src/main/java/com/contusfly/activities/DashboardActivity.kt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import androidx.viewpager2.widget.ViewPager2
1818
import com.contusfly.*
1919
import com.contusfly.activities.parent.DashboardParent
2020
import com.contusfly.adapters.ViewPagerAdapter
21+
import com.contusfly.call.MissedCallNotificationUtils.clearMissedCallNotificationDetails
2122
import com.contusfly.call.calllog.CallHistoryFragment
2223
import com.contusfly.call.groupcall.utils.CallUtils
2324
import com.contusfly.databinding.ActivityDashboardBinding
@@ -202,6 +203,7 @@ class DashboardActivity : DashboardParent(), View.OnClickListener, ActionMode.Ca
202203
1 -> {
203204
swipeRefreshLayout.isEnabled = false
204205
dashboardBinding.newChatFab.visibility = View.GONE
206+
clearMissedCallNotificationDetails()
205207
//mark missed calls as read
206208
CallLogManager.markAllUnreadMissedCallsAsRead()
207209
validateMissedCallsCount()
@@ -398,9 +400,9 @@ class DashboardActivity : DashboardParent(), View.OnClickListener, ActionMode.Ca
398400
viewModel.getPrivateChatStatus()
399401
viewModel.getArchivedChatStatus()
400402
viewModel.updateUnReadChatCount()
401-
callLogviewModel.resetPagination()
403+
callLogviewModel.resetPagination(context = context!!)
402404
if (callLogviewModel.isCallLogScreenInitiated()) {
403-
callLogviewModel.addLoaderToTheList()
405+
callLogviewModel.addLoaderToTheList(context = context)
404406
callLogviewModel.getCallLogsList(isLoadCallLogsOnMainThread)
405407
CallUtils.setCallsTabToBeShown(false)
406408
}
@@ -573,14 +575,16 @@ class DashboardActivity : DashboardParent(), View.OnClickListener, ActionMode.Ca
573575
checkListForMuteUnMuteIcon.add(recentList[i].isMuted)
574576

575577
when {
576-
checkListForMuteUnMuteIcon.contains(false) -> {
577-
actionModeMenu.findItem(R.id.action_mute).isVisible = true
578-
actionModeMenu.findItem(R.id.action_unmute).isVisible = false
579-
}
580578
checkListForMuteUnMuteIcon.contains(true) -> {
581579
actionModeMenu.findItem(R.id.action_mute).isVisible = false
582580
actionModeMenu.findItem(R.id.action_unmute).isVisible = true
583581
}
582+
583+
checkListForMuteUnMuteIcon.contains(false) -> {
584+
actionModeMenu.findItem(R.id.action_mute).isVisible = true
585+
actionModeMenu.findItem(R.id.action_unmute).isVisible = false
586+
}
587+
584588
else -> {
585589
actionModeMenu.findItem(R.id.action_mute).isVisible = false
586590
actionModeMenu.findItem(R.id.action_unmute).isVisible = false
@@ -832,5 +836,6 @@ class DashboardActivity : DashboardParent(), View.OnClickListener, ActionMode.Ca
832836
super.onConnected()
833837
LogMessage.d("DashboardActivity", "#dashboard #recent onConnected chatHistoryMigration")
834838
viewModel.chatHistoryMigration()
839+
callLogviewModel.uploadUnSyncedCallLogs()
835840
}
836841
}

app/src/main/java/com/contusfly/activities/EditMessageActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class EditMessageActivity : EditChatParent(), View.OnTouchListener,
8686
val message = getMessage()
8787
if (message != null) {
8888
mainList.add(message)
89-
chatAdapter = ChatAdapter(mainList, arrayListOf(), chat.chatType, this, toUser,true)
89+
chatAdapter = ChatAdapter(mainList, arrayListOf(), chat.chatType, this, toUser,true, listChats)
9090
chatAdapter.hasStableIds()
9191
listChats.adapter = chatAdapter
9292
setMessageInEditText(message)

app/src/main/java/com/contusfly/activities/ForwardMessageActivity.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,8 @@ class ForwardMessageActivity : BaseActivity(), CoroutineScope {
479479
val intent = Intent(context, ChatActivity::class.java)
480480
startActivity(intent.putExtra(LibConstants.JID, selectedUsersWithNames.keys.first())
481481
.putExtra(Constants.CHAT_TYPE, ProfileDetailsUtils.getProfileDetails(selectedUsersWithNames.keys.first())?.getChatType())
482-
.putExtra("externalCall", true))
482+
.putExtra("externalCall", true)
483+
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
483484
finish()
484485
}
485486
}

app/src/main/java/com/contusfly/activities/GroupInfoActivity.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ class GroupInfoActivity : BaseActivity(),CommonAlertDialog.CommonDialogClosedLis
312312
SharedPreferenceManager.setString(com.contusfly.utils.Constants.ON_GOING_CHAT_USER,groupProfileDetails.jid)
313313
commonAlertDialog = CommonAlertDialog(this)
314314
commonAlertDialog!!.setOnDialogCloseListener(this)
315+
enableCollapsingToolbar(false)
316+
showLoader(true)
315317
checkPrivateChatAvailable()
316318
onClickFunction()
317319
groupMembersAdapter.setHasStableIds(true)
@@ -1177,6 +1179,22 @@ class GroupInfoActivity : BaseActivity(),CommonAlertDialog.CommonDialogClosedLis
11771179
showOrHideAddParticipant(false)
11781180
}
11791181
}
1182+
private fun enableCollapsingToolbar(enable: Boolean) {
1183+
binding.collapsingToolbar.setScrimsShown(enable)
1184+
val params = binding.collapsingToolbar.layoutParams as AppBarLayout.LayoutParams
1185+
if (enable) {
1186+
params.scrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL or
1187+
AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED
1188+
1189+
}
1190+
else {
1191+
params.scrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_NO_SCROLL
1192+
}
1193+
}
1194+
1195+
private fun showLoader(show:Boolean){
1196+
binding.progressSpinner.visibility = if(show) View.VISIBLE else View.GONE
1197+
}
11801198

11811199
/**
11821200
* Loads the Group adapter data into the list
@@ -1205,6 +1223,8 @@ class GroupInfoActivity : BaseActivity(),CommonAlertDialog.CommonDialogClosedLis
12051223
groupMembersList.addAll(usersList)
12061224
groupMembersAdapter.notifyDataSetChanged()
12071225
invalidateOptionsMenu()
1226+
enableCollapsingToolbar(true)
1227+
showLoader(false)
12081228
}
12091229
}
12101230
}

app/src/main/java/com/contusfly/activities/MediaPreviewActivity.kt

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -802,32 +802,39 @@ class MediaPreviewActivity : BaseActivity(), MediaPreviewAdapter.OnItemClickList
802802
}
803803

804804
private fun maintainAddedMentionUser(position:Int) {
805-
if (selectedImageList[position].mentionedUsersIds != null && selectedImageList[position].mentionedUsersIds.size > 0 && selectedImageList[position].caption.isNotEmpty()) {
806-
val texts = context!!.getString(R.string.chat_text)
807-
val textMessage = selectedImageList[position].caption + texts + texts
808-
val unSentMentionedUserIdList=ArrayList<ProfileDetails?>()
809-
val mentionIdList=selectedImageList[position].mentionedUsersIds
810-
for(mentionUser in mentionIdList){
811-
val jidFormation= FlyUtils.getJid(mentionUser)
812-
val profile= FlyCore.getUserProfile(jidFormation)
813-
if (profile != null) {
814-
unSentMentionedUserIdList.add(profile)
805+
try {
806+
if (selectedImageList.size == 0) return
807+
if (selectedImageList[position].mentionedUsersIds != null && selectedImageList[position].mentionedUsersIds.size > 0 && selectedImageList[position].caption.isNotEmpty()) {
808+
val texts = context!!.getString(R.string.chat_text)
809+
val textMessage = selectedImageList[position].caption + texts + texts
810+
val unSentMentionedUserIdList = ArrayList<ProfileDetails?>()
811+
val mentionIdList = selectedImageList[position].mentionedUsersIds
812+
for (mentionUser in mentionIdList) {
813+
val jidFormation = FlyUtils.getJid(mentionUser)
814+
val profile = FlyCore.getUserProfile(jidFormation)
815+
if (profile != null) {
816+
unSentMentionedUserIdList.add(profile)
817+
}
815818
}
816-
}
817-
var text = MentionUtils.formatUnSentMentionText(
818-
unSentMentionedUserIdList,
819-
textMessage,
820-
this,
821-
emojiEditText!!
822-
)
823-
emojiEditText!!.setText(TextUtils.concat(text.trim(), " "))
824-
} else {
825-
emojiEditText!!.setText(
826-
if (Utils.returnEmptyStringIfNull(selectedImageList[position].caption)
827-
.isNotEmpty()
819+
var text = MentionUtils.formatUnSentMentionText(
820+
unSentMentionedUserIdList,
821+
textMessage,
822+
this,
823+
emojiEditText!!
828824
)
829-
selectedImageList[position].caption else ""
830-
)
825+
emojiEditText!!.setText(TextUtils.concat(text.trim(), " "))
826+
} else {
827+
emojiEditText!!.setText(
828+
if (Utils.returnEmptyStringIfNull(selectedImageList[position].caption)
829+
.isNotEmpty()
830+
)
831+
selectedImageList[position].caption else ""
832+
)
833+
}
834+
} catch (e: ArrayIndexOutOfBoundsException) {
835+
LogMessage.e(TAG, e.toString())
836+
} catch (e: Exception) {
837+
LogMessage.e(TAG, e.toString())
831838
}
832839
}
833840

@@ -1066,7 +1073,7 @@ class MediaPreviewActivity : BaseActivity(), MediaPreviewAdapter.OnItemClickList
10661073

10671074
CoroutineScope(Dispatchers.IO).launch {
10681075
val messageObject = messagingClient.composeVideoMessage(toUser, intent.getStringExtra(Constants.FILE_PATH)!!,
1069-
sendTextMessageWithMentionFormat.toString(), replyMessageId, mentionedUsersIds).second
1076+
sendTextMessageWithMentionFormat.toString(), replyMessageId, mentionedUsersIds).third
10701077

10711078
messageObject?.let {
10721079
messagingClient.sendMessage(it, object : MessageListener {
@@ -1130,7 +1137,7 @@ class MediaPreviewActivity : BaseActivity(), MediaPreviewAdapter.OnItemClickList
11301137
mediaPreviewBinding.sendMedia.isEnabled = true
11311138
break
11321139
}
1133-
messageObject = messagingClient.composeVideoMessage(toUser, item.path, item.caption, replyMessageId,item.mentionedUsersIds).second
1140+
messageObject = messagingClient.composeVideoMessage(toUser, item.path, item.caption, replyMessageId,item.mentionedUsersIds).third
11341141
}
11351142
sendGalleryAttachmentFiles(messageObject,sentMessages,toUser,errorMessageList)
11361143

0 commit comments

Comments
 (0)