Skip to content

Commit

Permalink
Using annotation instead of block
Browse files Browse the repository at this point in the history
  • Loading branch information
BernardGatt committed Dec 6, 2023
1 parent c0b77f5 commit a7dbf10
Showing 1 changed file with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,24 @@ internal class GistModalManager : GistListener {
GistSdk.addListener(this)
}

internal fun showModalMessage(message: Message, position: MessagePosition? = null): Boolean {
synchronized(this) {
currentMessage?.let { currentMessage ->
Log.i(
GIST_TAG,
"Message ${message.messageId} not shown, ${currentMessage.messageId} is already showing."
)
return false
}
@Synchronized internal fun showModalMessage(message: Message, position: MessagePosition? = null): Boolean {

Check warning on line 16 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalManager.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistModalManager.kt#L16

Added line #L16 was not covered by tests
currentMessage?.let { currentMessage ->
Log.i(
GIST_TAG,
"Message ${message.messageId} not shown, ${currentMessage.messageId} is already showing."
)
return false
}

Log.i(GIST_TAG, "Showing message: ${message.messageId}")
currentMessage = message
Log.i(GIST_TAG, "Showing message: ${message.messageId}")
currentMessage = message

val intent = GistModalActivity.newIntent(GistSdk.application)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
intent.putExtra(GIST_MESSAGE_INTENT, Gson().toJson(message))
intent.putExtra(GIST_MODAL_POSITION_INTENT, position?.toString())
GistSdk.application.startActivity(intent)
return true
}
val intent = GistModalActivity.newIntent(GistSdk.application)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
intent.putExtra(GIST_MESSAGE_INTENT, Gson().toJson(message))
intent.putExtra(GIST_MODAL_POSITION_INTENT, position?.toString())
GistSdk.application.startActivity(intent)
return true
}

internal fun dismissActiveMessage() {
Expand Down

0 comments on commit a7dbf10

Please sign in to comment.