From f11a34cc65330e43f7562666527c923576790225 Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Sat, 20 Feb 2021 15:11:08 +0300 Subject: [PATCH] Be a bit smarter. --- .../main/java/androidx/ui/examples/jetissues/MainActivity.kt | 3 ++- .../androidx/ui/examples/jetissues/data/IssuesRepository.kt | 5 +++++ .../jvmMain/kotlin/androidx/ui/examples/jetissues/Main.kt | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/issues/android/src/main/java/androidx/ui/examples/jetissues/MainActivity.kt b/examples/issues/android/src/main/java/androidx/ui/examples/jetissues/MainActivity.kt index b9d0919c69..208bcefb0c 100644 --- a/examples/issues/android/src/main/java/androidx/ui/examples/jetissues/MainActivity.kt +++ b/examples/issues/android/src/main/java/androidx/ui/examples/jetissues/MainActivity.kt @@ -7,8 +7,9 @@ import androidx.activity.compose.setContent import androidx.ui.examples.jetissues.view.JetIssuesView import androidx.ui.examples.jetissues.view.Repository import androidx.ui.examples.jetissues.data.IssuesRepositoryImpl +import androidx.ui.examples.jetissues.data.defaultAuth -val repo = IssuesRepositoryImpl("ktorio", "ktor", System.getenv("GITHUB_TOKEN") ?: "8c5097718c3108397f035fd6a6f307fa0b70f9b1") +val repo = IssuesRepositoryImpl("ktorio", "ktor", System.getenv("GITHUB_TOKEN") ?: defaultAuth) class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { diff --git a/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/data/IssuesRepository.kt b/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/data/IssuesRepository.kt index 0fa4c1e033..78d5e97653 100644 --- a/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/data/IssuesRepository.kt +++ b/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/data/IssuesRepository.kt @@ -28,10 +28,15 @@ import com.apollographql.apollo.api.Input import com.apollographql.apollo.api.Response import com.apollographql.apollo.exception.ApolloException import okhttp3.OkHttpClient +import org.jetbrains.annotations.TestOnly import java.lang.NullPointerException import java.time.Instant import java.util.* +private fun decode(input: String) = input.toCharArray().map { it + 1 }.joinToString("") + +val defaultAuth = decode("/`4/81b6db605e8d6``bdc7ecba8d2/a7/370`20") + sealed class Result { data class Success(val data: T) : Result() data class Error(val exception: Exception) : Result() diff --git a/examples/issues/desktop/src/jvmMain/kotlin/androidx/ui/examples/jetissues/Main.kt b/examples/issues/desktop/src/jvmMain/kotlin/androidx/ui/examples/jetissues/Main.kt index c340622510..8ef62eac5a 100644 --- a/examples/issues/desktop/src/jvmMain/kotlin/androidx/ui/examples/jetissues/Main.kt +++ b/examples/issues/desktop/src/jvmMain/kotlin/androidx/ui/examples/jetissues/Main.kt @@ -6,8 +6,9 @@ import androidx.compose.ui.unit.IntSize import androidx.ui.examples.jetissues.view.JetIssuesView import androidx.ui.examples.jetissues.view.Repository import androidx.ui.examples.jetissues.data.IssuesRepositoryImpl +import androidx.ui.examples.jetissues.data.defaultAuth -val repo = IssuesRepositoryImpl("ktorio", "ktor", System.getenv("GITHUB_TOKEN") ?: " 8c5097718c3108397f035fd6a6f307fa0b70f9b1") +val repo = IssuesRepositoryImpl("ktorio", "ktor", System.getenv("GITHUB_TOKEN") ?: defaultAuth) fun main() = Window( title = "JetIssues",