Fixed warnings
This commit is contained in:
parent
947c6faa53
commit
f028e26e82
6 changed files with 21 additions and 15 deletions
|
@ -240,7 +240,7 @@ class ChatRoomViewModel(val chatRoom: ChatRoom) : ViewModel(), ContactViewModelI
|
|||
var body = ""
|
||||
for (content in msg.contents) {
|
||||
if (content.isFile || content.isFileTransfer) body += content.name + " "
|
||||
else if (content.isText) body += content.stringBuffer + " "
|
||||
else if (content.isText) body += content.utf8Text + " "
|
||||
}
|
||||
|
||||
return "$sender: $body"
|
||||
|
|
|
@ -71,7 +71,7 @@ class GroupInfoViewModel(val chatRoom: ChatRoom?) : ErrorReportingViewModel() {
|
|||
}
|
||||
|
||||
override fun onSubjectChanged(chatRoom: ChatRoom, eventLog: EventLog) {
|
||||
subject.value = chatRoom?.subject
|
||||
subject.value = chatRoom.subject
|
||||
}
|
||||
|
||||
override fun onParticipantAdded(chatRoom: ChatRoom, eventLog: EventLog) {
|
||||
|
@ -83,7 +83,7 @@ class GroupInfoViewModel(val chatRoom: ChatRoom?) : ErrorReportingViewModel() {
|
|||
}
|
||||
|
||||
override fun onParticipantAdminStatusChanged(chatRoom: ChatRoom, eventLog: EventLog) {
|
||||
val admin = chatRoom?.me?.isAdmin ?: false
|
||||
val admin = chatRoom.me?.isAdmin ?: false
|
||||
isMeAdmin.value = admin
|
||||
meAdminChangedEvent.value = Event(admin)
|
||||
updateParticipants()
|
||||
|
|
|
@ -51,10 +51,10 @@ open class StatusViewModel : ViewModel() {
|
|||
body: Content
|
||||
) {
|
||||
if (body.type == "application" && body.subtype == "simple-message-summary" && body.size > 0) {
|
||||
val data = body.stringBuffer.toLowerCase(Locale.getDefault())
|
||||
val voiceMail = data.split("voice-message: ")
|
||||
if (voiceMail.size >= 2) {
|
||||
val toParse = voiceMail[1].split("/", limit = 0)
|
||||
val data = body.utf8Text?.toLowerCase(Locale.getDefault())
|
||||
val voiceMail = data?.split("voice-message: ")
|
||||
if (voiceMail?.size ?: 0 >= 2) {
|
||||
val toParse = voiceMail!![1].split("/", limit = 0)
|
||||
try {
|
||||
val unreadCount: Int = toParse[0].toInt()
|
||||
voiceMailCount.value = unreadCount
|
||||
|
|
|
@ -341,8 +341,11 @@ class CoreContext(val context: Context, coreConfig: Config) {
|
|||
fun declineCall(call: Call) {
|
||||
val voiceMailUri = corePreferences.voiceMailUri
|
||||
if (voiceMailUri != null && corePreferences.redirectDeclinedCallToVoiceMail) {
|
||||
Log.i("[Context] Redirecting call $call to voice mail")
|
||||
call.redirect(voiceMailUri)
|
||||
val voiceMailAddress = core.interpretUrl(voiceMailUri)
|
||||
if (voiceMailAddress != null) {
|
||||
Log.i("[Context] Redirecting call $call to voice mail URI: $voiceMailUri")
|
||||
call.redirectTo(voiceMailAddress)
|
||||
}
|
||||
} else {
|
||||
Log.i("[Context] Declining call $call")
|
||||
call.decline(Reason.Declined)
|
||||
|
@ -359,8 +362,11 @@ class CoreContext(val context: Context, coreConfig: Config) {
|
|||
if (currentCall == null) {
|
||||
Log.e("[Context] Couldn't find a call to transfer")
|
||||
} else {
|
||||
val address = core.interpretUrl(addressToCall)
|
||||
if (address != null) {
|
||||
Log.i("[Context] Transferring current call to $addressToCall")
|
||||
currentCall.transfer(addressToCall)
|
||||
currentCall.transferTo(address)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
|||
return
|
||||
}
|
||||
|
||||
val msg = room.createMessage(reply)
|
||||
val msg = room.createMessageFromUtf8(reply)
|
||||
msg.userData = notificationId
|
||||
msg.addListener(coreContext.notificationsManager.chatListener)
|
||||
msg.send()
|
||||
|
@ -90,10 +90,11 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
|||
}
|
||||
|
||||
private fun handleCallIntent(intent: Intent, notificationId: Int) {
|
||||
val remoteAddress: String? = coreContext.notificationsManager.getSipUriForCallNotificationId(notificationId)
|
||||
val remote: String = coreContext.notificationsManager.getSipUriForCallNotificationId(notificationId) ?: ""
|
||||
val core: Core = coreContext.core
|
||||
|
||||
val call = if (remoteAddress != null) core.findCallFromUri(remoteAddress) else null
|
||||
val remoteAddress = core.interpretUrl(remote)
|
||||
val call = if (remoteAddress != null) core.getCallByRemoteAddress2(remoteAddress) else null
|
||||
if (call == null) {
|
||||
Log.e("[Notification Broadcast Receiver] Couldn't find call from remote address $remoteAddress")
|
||||
return
|
||||
|
|
|
@ -116,7 +116,6 @@ class NotificationsManager(private val context: Context) {
|
|||
state: Call.State,
|
||||
message: String
|
||||
) {
|
||||
if (call == null) return
|
||||
Log.i("[Notifications Manager] Call state changed [$state]")
|
||||
|
||||
when (state) {
|
||||
|
|
Loading…
Reference in a new issue