Prevents Core from shutting down when closing chat message notification bubble
This commit is contained in:
parent
a93f337e89
commit
8c8de826b2
6 changed files with 16 additions and 21 deletions
|
@ -126,8 +126,7 @@ class ChatBubbleActivity : GenericActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.setCloseBubbleClickListener {
|
binding.setCloseBubbleClickListener {
|
||||||
val notificationId = coreContext.notificationsManager.getChatNotificationIdForSipUri(viewModel.chatRoom.peerAddress.asStringUriOnly())
|
coreContext.notificationsManager.cancelChatNotificationIdForSipUri(viewModel.chatRoom.peerAddress.asStringUriOnly())
|
||||||
coreContext.notificationsManager.cancel(notificationId)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.setSendMessageClickListener {
|
binding.setSendMessageClickListener {
|
||||||
|
|
|
@ -60,8 +60,12 @@ class CoreService : CoreService() {
|
||||||
|
|
||||||
override fun onTaskRemoved(rootIntent: Intent?) {
|
override fun onTaskRemoved(rootIntent: Intent?) {
|
||||||
if (!corePreferences.keepServiceAlive) {
|
if (!corePreferences.keepServiceAlive) {
|
||||||
|
if (coreContext.core.isInBackground()) {
|
||||||
Log.i("[Service] Task removed, stopping Core")
|
Log.i("[Service] Task removed, stopping Core")
|
||||||
coreContext.stop()
|
coreContext.stop()
|
||||||
|
} else {
|
||||||
|
Log.w("[Service] Task removed but Core in not in background, skipping")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onTaskRemoved(rootIntent)
|
super.onTaskRemoved(rootIntent)
|
||||||
|
|
|
@ -93,11 +93,7 @@ class NotificationsManager(private val context: Context) {
|
||||||
field = value
|
field = value
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
// When a chat room becomes visible, cancel unread chat notification if any
|
// When a chat room becomes visible, cancel unread chat notification if any
|
||||||
val notifiable: Notifiable? = chatNotificationsMap[value]
|
cancelChatNotificationIdForSipUri(value)
|
||||||
if (notifiable != null) {
|
|
||||||
cancel(notifiable.notificationId)
|
|
||||||
notifiable.messages.clear()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,12 +242,12 @@ class NotificationsManager(private val context: Context) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getChatNotificationIdForSipUri(sipUri: String): Int {
|
fun cancelChatNotificationIdForSipUri(sipUri: String) {
|
||||||
val notifiable: Notifiable? = chatNotificationsMap[sipUri]
|
val notifiable: Notifiable? = chatNotificationsMap[sipUri]
|
||||||
if (notifiable != null) {
|
if (notifiable != null) {
|
||||||
return notifiable.notificationId
|
notifiable.messages.clear()
|
||||||
|
cancel(notifiable.notificationId)
|
||||||
}
|
}
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Service related */
|
/* Service related */
|
||||||
|
|
BIN
app/src/main/res/drawable-xhdpi/collapse_default.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/collapse_default.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
BIN
app/src/main/res/drawable-xhdpi/fullscreen_default.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/fullscreen_default.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
|
@ -32,17 +32,15 @@
|
||||||
android:background="?attr/lightToolbarBackgroundColor"
|
android:background="?attr/lightToolbarBackgroundColor"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<!-- Disabled for now -->
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:contentDescription="@string/content_description_close_bubble"
|
android:contentDescription="@string/content_description_close_bubble"
|
||||||
android:visibility="gone"
|
|
||||||
android:onClick="@{closeBubbleClickListener}"
|
android:onClick="@{closeBubbleClickListener}"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="0.2"
|
android:layout_weight="0.2"
|
||||||
android:layout_margin="5dp"
|
android:padding="15dp"
|
||||||
android:background="?attr/button_background_drawable"
|
android:background="?attr/button_background_drawable"
|
||||||
android:src="@drawable/menu_delete_default"
|
android:src="@drawable/collapse_default"
|
||||||
app:tint="?attr/drawableTintColor" />
|
app:tint="?attr/drawableTintColor" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -71,18 +69,16 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- Disabled for now -->
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:onClick="@{openAppClickListener}"
|
android:onClick="@{openAppClickListener}"
|
||||||
android:visibility="gone"
|
|
||||||
android:contentDescription="@string/content_description_open_app"
|
android:contentDescription="@string/content_description_open_app"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="0.2"
|
android:layout_weight="0.2"
|
||||||
android:layout_margin="5dp"
|
android:padding="15dp"
|
||||||
android:background="?attr/button_background_drawable"
|
android:background="?attr/button_background_drawable"
|
||||||
app:tint="?attr/colorPrimary"
|
app:tint="?attr/drawableTintColor"
|
||||||
android:src="@drawable/linphone_logo"/>
|
android:src="@drawable/fullscreen_default"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue