Skip to content

Commit

Permalink
Initialises Clarity SDK for the Jetpack app
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonis Lilis committed Dec 11, 2023
1 parent 78ab297 commit 039019c
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.microsoft.clarity.Clarity
import com.microsoft.clarity.ClarityConfig
import org.wordpress.android.BuildConfig
import org.wordpress.android.R
import org.wordpress.android.WordPress
import org.wordpress.android.ui.main.WPMainActivity
Expand All @@ -20,6 +23,7 @@ class WPLaunchActivity : LocaleAwareActivity() {
*/
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setupClarity()
if (isMissingSplits(this)) {
// There are missing splits. Display a warning message.
showMissingSplitsDialog()
Expand All @@ -29,6 +33,13 @@ class WPLaunchActivity : LocaleAwareActivity() {
launchWPMainActivity()
}

private fun setupClarity() {
if (BuildConfig.IS_JETPACK_APP) {
val config = ClarityConfig(projectId = BuildConfig.CLARITY_ID)
Clarity.initialize(applicationContext, config)
}
}

private fun showMissingSplitsDialog() {
MaterialAlertDialogBuilder(this)
.setTitle(R.string.missing_splits_dialog_title)
Expand Down

0 comments on commit 039019c

Please sign in to comment.