Skip to content

Commit

Permalink
clear current message when destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahroz16 committed Oct 19, 2023
1 parent 0a84875 commit f68685e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions messaginginapp/api/messaginginapp.api
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ public final class io/customer/messaginginapp/gist/presentation/GistSdk : androi
public static field dataCenter Ljava/lang/String;
public static field siteId Ljava/lang/String;
public final fun addListener (Lio/customer/messaginginapp/gist/presentation/GistListener;)V
public final fun clearCurrentMessage ()V
public final fun clearListeners ()V
public final fun clearUserToken ()V
public final fun dismissMessage ()V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ class GistModalActivity : AppCompatActivity(), GistListener, GistViewListener {
// If the message is not persistent, dismiss it and inform the callback
if (!isPersistentMessage()) {
GistSdk.dismissMessage()
} else {
GistSdk.clearCurrentMessage()
}
super.onDestroy()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,8 @@ internal class GistModalManager : GistListener {
override fun onMessageShown(message: Message) {}

override fun onAction(message: Message, currentRoute: String, action: String, name: String) {}

internal fun clearCurrentMessage() {
currentMessage = null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ object GistSdk : Application.ActivityLifecycleCallbacks {
gistModalManager.dismissActiveMessage()
}

fun clearCurrentMessage() {
gistModalManager.clearCurrentMessage()
}

// Listeners

fun addListener(listener: GistListener) {
Expand Down

0 comments on commit f68685e

Please sign in to comment.