From 0ec08a36d5c95c5174865d5a7b21c58c3c9c7a36 Mon Sep 17 00:00:00 2001 From: mikemilla Date: Fri, 8 Sep 2023 13:07:40 -0700 Subject: [PATCH] Release --- README.md | 2 +- .../src/main/java/com/courier/android/Courier.kt | 11 +---------- .../com/courier/android/modules/CoreInbox.kt | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 498f053..7c03e2a 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ dependencyResolutionManagement { ```gradle dependencies { - implementation 'com.github.trycourier:courier-android:2.0.2' + implementation 'com.github.trycourier:courier-android:2.0.3' } ``` diff --git a/android/src/main/java/com/courier/android/Courier.kt b/android/src/main/java/com/courier/android/Courier.kt index d223070..7d010b5 100644 --- a/android/src/main/java/com/courier/android/Courier.kt +++ b/android/src/main/java/com/courier/android/Courier.kt @@ -1,22 +1,13 @@ package com.courier.android import android.annotation.SuppressLint -import android.app.Activity import android.content.Context import androidx.appcompat.app.AppCompatActivity -import androidx.lifecycle.Lifecycle import com.courier.android.models.CourierAgent import com.courier.android.models.CourierException import com.courier.android.modules.* -import com.courier.android.modules.CoreAuth -import com.courier.android.modules.CoreInbox -import com.courier.android.modules.CoreLogging -import com.courier.android.modules.CorePush import com.courier.android.utils.NotificationEventBus -import com.google.firebase.FirebaseApp -import com.google.firebase.messaging.RemoteMessage import kotlinx.coroutines.* -import kotlinx.coroutines.flow.collectLatest /** @@ -54,7 +45,7 @@ class Courier private constructor(internal val context: Context) { companion object { var USER_AGENT = CourierAgent.NATIVE_ANDROID - internal const val VERSION = "2.0.2" + internal const val VERSION = "2.0.3" internal const val TAG = "Courier SDK" internal const val COURIER_PENDING_NOTIFICATION_KEY = "courier_pending_notification_key" internal val eventBus by lazy { NotificationEventBus() } diff --git a/android/src/main/java/com/courier/android/modules/CoreInbox.kt b/android/src/main/java/com/courier/android/modules/CoreInbox.kt index 90d9039..d90f993 100644 --- a/android/src/main/java/com/courier/android/modules/CoreInbox.kt +++ b/android/src/main/java/com/courier/android/modules/CoreInbox.kt @@ -26,7 +26,7 @@ internal class CoreInbox : DefaultLifecycleObserver { private val brandsRepo by lazy { BrandsRepository() } private var listeners: MutableList = mutableListOf() - private var inbox: Inbox? = null + internal var inbox: Inbox? = null internal var brandId: String? = null internal val brand: CourierBrand? get() = inbox?.brand @@ -571,11 +571,19 @@ fun Courier.readAllInboxMessages(onSuccess: () -> Unit, onFailure: (Exception) - } } +fun Courier.readMessage(messageId: String) { + inbox.inbox?.readMessage(messageId) +} + +fun Courier.unreadMessage(messageId: String) { + inbox.inbox?.unreadMessage(messageId) +} + /** * Internal Classes */ -private data class Inbox( +internal data class Inbox( var messages: MutableList?, var totalCount: Int, var unreadCount: Int, @@ -692,12 +700,12 @@ private data class Inbox( } -private data class ReadAllOperation( +internal data class ReadAllOperation( val messages: MutableList?, val unreadCount: Int, ) -private data class UpdateOperation( +internal data class UpdateOperation( val index: Int, val unreadCount: Int, val message: InboxMessage,