Skip to content

Commit ebef890

Browse files
0xadam-browncodex
andcommitted
ref(android): Extract shared nav sample app infrastructure into .common package
Move shared navigation sample infrastructure into the io.sentry.samples.android.navigation.common package and isolate the existing Nav2 implementation under its own package. Keep Nav2 performance controls focused while wiring route-work support and launcher resources for the sample foundation. Lays the groundwork for the Nav3 sample app. Co-Authored-By: Codex <noreply@openai.com>
1 parent efb603b commit ebef890

33 files changed

Lines changed: 1654 additions & 962 deletions

‎sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@
102102
android:exported="false" />
103103

104104
<activity
105-
android:name=".navigation.Nav2SetupActivity"
105+
android:name=".navigation.nav2.Nav2SetupActivity"
106106
android:exported="false"
107107
android:theme="@style/AppTheme.Main" />
108108

109109
<activity
110-
android:name=".navigation.Nav2Activity"
110+
android:name=".navigation.nav2.Nav2Activity"
111111
android:exported="false"
112112
android:screenOrientation="portrait"
113113
android:theme="@style/AppTheme.Main" />

‎sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/GitHubService.kt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package io.sentry.samples.android
22

3+
import okhttp3.ResponseBody
34
import retrofit2.Call
45
import retrofit2.http.GET
56
import retrofit2.http.Path
67
import retrofit2.http.Query
8+
import retrofit2.http.Url
79

810
interface GitHubService {
911

@@ -14,6 +16,10 @@ interface GitHubService {
1416
@Path("user") user: String,
1517
@Query("per_page") perPage: Int,
1618
): List<Repo>
19+
20+
@GET fun routeWorkRequest(@Url url: String): Call<ResponseBody>
21+
22+
@GET suspend fun routeWorkRequestAsync(@Url url: String): ResponseBody
1723
}
1824

1925
class Repo {

‎sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/GithubAPI.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import okhttp3.OkHttpClient
77
import retrofit2.Retrofit
88
import retrofit2.converter.gson.GsonConverterFactory
99

10-
object GithubAPI {
10+
object GitHubApi {
1111
private val client =
1212
OkHttpClient.Builder()
1313
.eventListener(SentryOkHttpEventListener())

‎sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,10 @@ fun IntegrationsScreen() {
900900
OutlinedButton(
901901
onClick = {
902902
activity.startActivity(
903-
Intent(activity, io.sentry.samples.android.navigation.Nav2SetupActivity::class.java)
903+
Intent(
904+
activity,
905+
io.sentry.samples.android.navigation.nav2.Nav2SetupActivity::class.java,
906+
)
904907
)
905908
},
906909
modifier = Modifier,

‎sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/SecondActivity.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class SecondActivity : AppCompatActivity() {
6767
currentSpan?.startChild("updateRepos", javaClass.simpleName)
6868
?: Sentry.startTransaction("updateRepos", "task")
6969

70-
GithubAPI.service
70+
GitHubApi.service
7171
.listRepos(binding.editRepo.text.toString())
7272
.enqueue(
7373
object : Callback<List<Repo>> {

‎sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ThirdFragment.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ThirdFragment : Fragment(R.layout.third_fragment) {
1515
val span = Sentry.getSpan()
1616
val child = span?.startChild("calc")
1717

18-
GithubAPI.service
18+
GitHubApi.service
1919
.listRepos("getsentry")
2020
.enqueue(
2121
object : Callback<List<Repo>> {

‎sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/compose/ComposeActivity.kt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import io.sentry.android.replay.sentryReplayUnmask
5353
import io.sentry.compose.SentryTraced
5454
import io.sentry.compose.SentryUserFeedbackButton
5555
import io.sentry.compose.withSentryObservableEffect
56-
import io.sentry.samples.android.GithubAPI
56+
import io.sentry.samples.android.GitHubApi
5757
import io.sentry.samples.android.R as IR
5858
import io.sentry.samples.android.SharedState
5959
import kotlinx.coroutines.launch
@@ -160,7 +160,7 @@ fun Github(user: String = "getsentry", perPage: Int = 30) {
160160
LaunchedEffect(perPage) {
161161
result =
162162
try {
163-
GithubAPI.service.listReposAsync(user.text, perPage).random().full_name
163+
GitHubApi.service.listReposAsync(user.text, perPage).random().full_name
164164
} catch (e: Throwable) {
165165
"error"
166166
}
@@ -190,7 +190,7 @@ fun Github(user: String = "getsentry", perPage: Int = 30) {
190190
scope.launch {
191191
result =
192192
try {
193-
GithubAPI.service.listReposAsync(user.text, perPage).random().full_name
193+
GitHubApi.service.listReposAsync(user.text, perPage).random().full_name
194194
} catch (e: Throwable) {
195195
"error"
196196
}

0 commit comments

Comments
 (0)