Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added sample usage scenario for ETR #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<activity android:name=".ComposeSimpleActivity" />
<activity android:name=".network.NetworkAnalysisActivity" />
<activity android:name=".useridentifier.UserIdentifierActivity" />
<activity android:name=".EventTriggeredReplayActivity" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.contentsquare.android.sample

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.contentsquare.android.Contentsquare
import com.contentsquare.android.sample.analytics.Analytics
import com.contentsquare.android.sample.databinding.ActivityEventTriggeredReplayBinding

class EventTriggeredReplayActivity : AppCompatActivity() {

private lateinit var binding: ActivityEventTriggeredReplayBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityEventTriggeredReplayBinding.inflate(layoutInflater)
setContentView(binding.root)
}

override fun onResume() {
super.onResume()
Analytics.trackScreen("Event-Triggered-Replay-Activity")
}

fun triggerReplayForCurrentScreen(view: View) {
Contentsquare.triggerReplayForCurrentScreen("etr-screen-name")
}

fun triggerReplayForCurrentSession(view: View) {
Contentsquare.triggerReplayForCurrentSession("etr-session-name")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class MainActivity : AppCompatActivity() {
startActivity(Intent(this, MaskingScenariosActivity::class.java))
}

fun openEventTriggeredReplay(view: View) {
startActivity(Intent(this, EventTriggeredReplayActivity::class.java))
}

fun openPopUp(view: View) {
val builder = AlertDialog.Builder(this)
builder.setTitle("App Bar color")
Expand Down
45 changes: 45 additions & 0 deletions app/src/main/res/layout/activity_event_triggered_replay.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
tools:context=".EventTriggeredReplayActivity">

<TextView
android:id="@+id/event_triggered_replay_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/event_triggered_replay"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/trigger_replay_for_current_screen_btn"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

<Button
android:id="@+id/trigger_replay_for_current_screen_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginEnd="8dp"
android:onClick="triggerReplayForCurrentScreen"
android:text="@string/trigger_replay_for_current_screen"
app:layout_constraintTop_toBottomOf="@id/event_triggered_replay_tv"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/trigger_replay_for_current_session_btn" />

<Button
android:id="@+id/trigger_replay_for_current_session_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:onClick="triggerReplayForCurrentSession"
android:text="@string/trigger_replay_for_current_session"
app:layout_constraintTop_toTopOf="@id/trigger_replay_for_current_screen_btn"
app:layout_constraintBottom_toBottomOf="@id/trigger_replay_for_current_screen_btn"
app:layout_constraintStart_toEndOf="@id/trigger_replay_for_current_screen_btn"
app:layout_constraintEnd_toEndOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
11 changes: 10 additions & 1 deletion app/src/main/res/layout/content_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,23 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title_session_replay" />

<TextView
android:id="@+id/label_event_triggered_replay"
style="@style/ListText"
android:layout_marginStart="32dp"
android:onClick="openEventTriggeredReplay"
android:text="@string/event_triggered_replay"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/label_masking_scenarios" />

<TextView
android:id="@+id/title_variables"
style="@style/TitleText"
android:layout_marginStart="32dp"
android:layout_marginTop="24dp"
android:text="@string/variables"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/label_masking_scenarios" />
app:layout_constraintTop_toBottomOf="@+id/label_event_triggered_replay" />

<TextView
android:id="@+id/label_custom_variables"
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
<string name="text_multiple_line_text_view">Multiple line TextView. Multiple line TextView. Multiple line TextView. Multiple line TextView. Multiple line TextView. Multiple line TextView. </string>
<string name="text_simple_compose_activity">Simple Compose Activity</string>

<!-- Event Triggered Replay -->
<string name="event_triggered_replay">Event Triggered Replay (ETR)</string>
<string name="trigger_replay_for_current_screen">Trigger replay for current screen</string>
<string name="trigger_replay_for_current_session">Trigger replay for current session</string>

<string name="activity_crash_title">Crashes</string>
<string name="activity_crash_null_pointer_exception">Null pointer exception</string>
<string name="activity_crash_uninitialised">Uninitialised exception</string>
Expand Down