Skip to content

Commit

Permalink
Merge branch 'mihonapp:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
L-oung authored Feb 3, 2025
2 parents 8dbb49f + d592ab2 commit ef468b8
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co

### Fixed
- Fix MAL `main_picture` nullability breaking search if a result doesn't have a cover set ([@MajorTanya](https://github.com/MajorTanya)) ([#1618](https://github.com/mihonapp/mihon/pull/1618))
- Fix Bangumi and MAL tracking 401 errors due to Mihon sending expired credentials ([@MajorTanya](https://github.com/MajorTanya)) ([#1681](https://github.com/mihonapp/mihon/pull/1681), [#1682](https://github.com/mihonapp/mihon/pull/1682))
- Fix certain Infinix devices being unable to use any "Open link in browser" actions, including tracker setup ([@MajorTanya](https://github.com/MajorTanya)) ([#1684](https://github.com/mihonapp/mihon/pull/1684))

### Other
- Add zoned "Current time" to debug info and include year & timezone in logcat output ([@MajorTanya](https://github.com/MajorTanya)) ([#1672](https://github.com/mihonapp/mihon/pull/1672))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ class BangumiInterceptor(private val bangumi: Bangumi) : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val originalRequest = chain.request()

val currAuth = oauth ?: throw Exception("Not authenticated with Bangumi")
var currAuth: BGMOAuth = oauth ?: throw Exception("Not authenticated with Bangumi")

if (currAuth.isExpired()) {
val response = chain.proceed(BangumiApi.refreshTokenRequest(currAuth.refreshToken!!))
if (response.isSuccessful) {
newAuth(json.decodeFromString<BGMOAuth>(response.body.string()))
currAuth = json.decodeFromString<BGMOAuth>(response.body.string())
newAuth(currAuth)
} else {
response.close()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.data.track.bangumi.dto

import kotlinx.serialization.EncodeDefault
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand All @@ -10,6 +11,7 @@ data class BGMOAuth(
@SerialName("token_type")
val tokenType: String,
@SerialName("created_at")
@EncodeDefault
val createdAt: Long = System.currentTimeMillis() / 1000,
@SerialName("expires_in")
val expiresIn: Long,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.data.track.myanimelist.dto

import kotlinx.serialization.EncodeDefault
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand All @@ -14,10 +15,11 @@ data class MALOAuth(
@SerialName("expires_in")
val expiresIn: Long,
@SerialName("created_at")
val createdAt: Long = System.currentTimeMillis(),
@EncodeDefault
val createdAt: Long = System.currentTimeMillis() / 1000,
) {
// Assumes expired a minute earlier
private val adjustedExpiresIn: Long = (expiresIn - 60) * 1000
private val adjustedExpiresIn: Long = (expiresIn - 60)

fun isExpired() = createdAt + adjustedExpiresIn < System.currentTimeMillis()
fun isExpired() = createdAt + adjustedExpiresIn < System.currentTimeMillis() / 1000
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,25 @@ object DeviceUtil {
}
}

/**
* A list of package names that may be incorrectly resolved as usable browsers by
* the system.
*
* If these are resolved for [android.content.Intent.ACTION_VIEW], it prevents the
* system from opening a proper browser or any usable app .
*
* Some of them may only be present on certain manufacturer's devices.
*/
val invalidDefaultBrowsers = listOf(
"android",
// Honor
"com.hihonor.android.internal.app",
// Huawei
"com.huawei.android.internal.app",
// Lenovo
"com.zui.resolver",
// Infinix
"com.transsion.resolver",
)

/**
Expand Down
2 changes: 1 addition & 1 deletion gradle/kotlinx.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin_version = "2.1.0"
kotlin_version = "2.1.10"
serialization_version = "1.8.0"
xml_serialization_version = "0.90.3"

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
aboutlib_version = "11.4.0"
aboutlib_version = "11.5.0"
leakcanary = "2.14"
moko = "0.24.4"
okhttp_version = "5.0.0-alpha.14"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down

0 comments on commit ef468b8

Please sign in to comment.