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

Development #335

Closed
wants to merge 4 commits into from
Closed
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
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ android {

defaultConfig {
applicationId = "com.joeloewi.croissant"
versionCode = 54
versionName = "1.2.5"
versionCode = 55
versionName = "1.2.6"
targetSdk = 34

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/joeloewi/croissant/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class MainActivity : AppCompatActivity() {

enableEdgeToEdge()

lifecycleScope.launch {
lifecycleScope.launch(CoroutineExceptionHandler { _, _ -> }) {
lifecycle.repeatOnLifecycle(Lifecycle.State.STARTED) {
_mainActivityViewModel.darkThemeEnabled.onEach { darkThemeEnabled ->
if (darkThemeEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ import androidx.core.view.WindowCompat
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.withResumed
import androidx.webkit.WebSettingsCompat
import androidx.webkit.WebViewFeature
import com.google.accompanist.web.*
Expand Down Expand Up @@ -156,7 +158,15 @@ fun LoginHoYoLABContent(
Column {
TopAppBar(
navigationIcon = {
IconButton(onClick = onNavigateUp) {
IconButton(onClick = {
with(lifecycleOwner) {
lifecycleScope.launch(CoroutineExceptionHandler { _, _ -> }) {
lifecycle.withResumed {
onNavigateUp()
}
}
}
}) {
Icon(
imageVector = Icons.Default.Close,
contentDescription = Icons.Default.Close.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,16 @@ fun Spanned.toAnnotatedString(): AnnotatedString = buildAnnotatedString {
), start, end
)

is URLSpan -> addUrlAnnotation(UrlAnnotation(span.url), start, end)
is URLSpan -> {
addUrlAnnotation(UrlAnnotation(span.url), start, end)
addStyle(
SpanStyle(
color = Color(0xFF548AF7),
textDecoration = TextDecoration.Underline
), start, end
)
}

is UnderlineSpan -> addStyle(
SpanStyle(textDecoration = TextDecoration.Underline),
start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class RedemptionCodesViewModel @Inject constructor(
repeat(9) {
select("p:last-child").remove()
}
}.select("p:nth-child(n+46)").html().replace("https://oo.pe/", "")
}.select("p:nth-child(n+47)").html().replace("https://oo.pe/", "")
}
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
-->

<network-security-config>
<domain-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">hoyolab.com</domain>
<trust-anchors>
<certificates src="@raw/hoyolab_ca"/>
<certificates src="@raw/hoyolab_ca" />
</trust-anchors>
</domain-config>
</network-security-config>
1 change: 1 addition & 0 deletions data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies {
implementation(libs.retrofit.converter.scalars)
implementation(platform(libs.okhttp3.bom))
implementation(libs.okhttp3.logging.interceptor)
implementation(libs.okhttp3.dnsoverhttps)

//moshi
implementation(libs.moshi)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ import com.joeloewi.croissant.data.common.generateDS
import com.skydoves.sandwich.ApiResponse
import retrofit2.Call
import retrofit2.http.*
import java.time.Instant

interface HoYoLABService {

@GET("community/painter/wapi/user/full")
fun getUserFullInfo(
@Header("Cookie") cookie: String,
@Query("t") currentMillis: Long = Instant.now().toEpochMilli()
@Header("Cookie") cookie: String
): Call<ApiResponse<UserFullInfoResponse>>

@GET("game_record/card/wapi/getGameRecordCard")
Expand Down
21 changes: 21 additions & 0 deletions data/src/main/kotlin/com/joeloewi/croissant/data/di/ApiModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import okhttp3.ConnectionSpec
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
Expand Down Expand Up @@ -70,7 +71,27 @@ object ApiModule {
.followRedirects(true)
.followSslRedirects(true)
.retryOnConnectionFailure(true)
.connectionSpecs(listOf(ConnectionSpec.COMPATIBLE_TLS, ConnectionSpec.CLEARTEXT))
.build()
/*.run {
newBuilder()
.dns(
DnsOverHttps.Builder()
.client(this)
.url("https://1.1.1.1/dns-query".toHttpUrl())
.bootstrapDnsHosts(
*runCatching {
arrayOf(
InetAddress.getByName("1.1.1.1"),
InetAddress.getByName("1.0.0.1")
)
}.getOrDefault(emptyArray())
)
.includeIPv6(false)
.build()
)
.build()
}*/

@Singleton
@Provides
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ protobuf-kotlin-lite = { group = "com.google.protobuf", name = "protobuf-kotlin-
retrofit = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" }
retrofit-converter-moshi = { group = "com.squareup.retrofit2", name = "converter-moshi", version.ref = "retrofit" }
retrofit-converter-scalars = { group = "com.squareup.retrofit2", name = "converter-scalars", version.ref = "retrofit" }
okhttp3-dnsoverhttps = { group = "com.squareup.okhttp3", name = "okhttp-dnsoverhttps", version.ref = "okhttp3Bom" }
okhttp3-bom = { group = "com.squareup.okhttp3", name = "okhttp-bom", version.ref = "okhttp3Bom" }
okhttp3-logging-interceptor = { group = "com.squareup.okhttp3", name = "logging-interceptor" }
room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room" }
Expand Down