Skip to content

Commit

Permalink
_message_suppressed送信前に、まれにクラッシュしていたためtry-catchを追加 (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
tikidunpon authored Sep 18, 2024
1 parent 6278316 commit ee88fb5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
** 🔨CHANGED**
- イベント送信のログにイベント内容を付与しました。

### InAppMessaging 2.20.1
** 🔨FIXED **
- _message_suppressed送信前に、まれにクラッシュする不具合を修正しました。

# Releases - 2024.08.21

### InAppMessaging 2.20.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import io.karte.android.tracking.client.TrackRequest
import io.karte.android.tracking.client.TrackResponse
import io.karte.android.tracking.queue.TrackEventRejectionFilterRule
import io.karte.android.utilities.ActivityLifecycleCallback
import org.json.JSONException
import org.json.JSONObject

private const val LOG_TAG = "Karte.InAppMessaging"
Expand Down Expand Up @@ -273,15 +274,14 @@ class InAppMessaging : Library, ActionModule, UserModule, TrackModule, ActivityL
}

private fun trackMessageSuppressed(message: JSONObject, reason: String) {
val action = message.getJSONObject("action")
val campaignId = action.getString("campaign_id")
val shortenId = action.getString("shorten_id")
val campaign = message.getJSONObject("campaign")
val serviceActionType = campaign.getString("service_action_type")
if (serviceActionType == "remote_config") {
return
try {
val action = message.getJSONObject("action")
val campaignId = action.getString("campaign_id")
val shortenId = action.getString("shorten_id")
val values = mapOf("reason" to reason)
Tracker.track(MessageEvent(MessageEventType.Suppressed, campaignId, shortenId, values))
} catch (e: JSONException) {
Logger.d(LOG_TAG, "Failed to parse json.", e)
}
val values = mapOf("reason" to reason)
Tracker.track(MessageEvent(MessageEventType.Suppressed, campaignId, shortenId, values))
}
}
2 changes: 1 addition & 1 deletion inappmessaging/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.20.0
2.20.1

0 comments on commit ee88fb5

Please sign in to comment.