diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8dc565ed..97a4778f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
### v2.6.1
+- Remove App upgrade check [#317](https://github.com/hushenghao/AndroidEasterEggs/issues/317)
- Known issue fixes
### v2.6.0 (2024-07-16)
diff --git a/CHANGELOG_zh.md b/CHANGELOG_zh.md
index b94c7b24..ccae03d7 100644
--- a/CHANGELOG_zh.md
+++ b/CHANGELOG_zh.md
@@ -1,5 +1,6 @@
### v2.6.1
+- 删除 App 更新检查 [#317](https://github.com/hushenghao/AndroidEasterEggs/issues/317)
- 修复已知问题
### v2.6.0 (2024-07-16)
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index ba4e910a..70db1648 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -113,12 +113,6 @@ dependencies {
implementation(libs.viewbinding.delegate)
implementation(libs.blurhash.android)
// implementation(libs.blurhash.painter)
- implementation(platform(libs.squareup.okhttp.bom))
- implementation(libs.squareup.okhttp)
- implementation(libs.squareup.okhttp.logging)
- implementation(libs.squareup.retrofit)
- implementation(libs.squareup.retrofit.converter.moshi)
- ksp(libs.squareup.moshi.codegen)
debugImplementation(libs.squareup.leakcanary)
implementation(project(":eggs:UpsideDownCake"))
diff --git a/app/src/debug/AndroidManifest.xml b/app/src/debug/AndroidManifest.xml
index 8c0c566b..9c41ec68 100644
--- a/app/src/debug/AndroidManifest.xml
+++ b/app/src/debug/AndroidManifest.xml
@@ -5,4 +5,5 @@
+
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 249640de..46189b26 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -8,8 +8,6 @@
android:name="com.android.launcher.permission.INSTALL_SHORTCUT"
android:maxSdkVersion="26" />
-
-
create(): T = retrofit.create(T::class.java)
-
- private fun getLoggingInterceptor(): Interceptor {
- val interceptor = HttpLoggingInterceptor()
- if (BuildConfig.DEBUG) {
- interceptor.setLevel(HttpLoggingInterceptor.Level.BODY)
- }
- return interceptor
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/dede/android_eggs/api/request/GithubRequests.kt b/app/src/main/java/com/dede/android_eggs/api/request/GithubRequests.kt
deleted file mode 100644
index 6961b907..00000000
--- a/app/src/main/java/com/dede/android_eggs/api/request/GithubRequests.kt
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.dede.android_eggs.api.request
-
-import com.dede.android_eggs.api.ApiManager
-import com.squareup.moshi.Json
-import com.squareup.moshi.JsonClass
-import dagger.Module
-import dagger.Provides
-import dagger.hilt.InstallIn
-import dagger.hilt.components.SingletonComponent
-import retrofit2.http.GET
-import retrofit2.http.Headers
-import retrofit2.http.Path
-import javax.inject.Singleton
-
-interface GithubRequests {
-
- companion object {
- private const val GITHUB_OWNER = "hushenghao"
- private const val GITHUB_REPO = "AndroidEasterEggs"
-
- private const val GITHUB_RELEASE_URL =
- "https://github.com/${GITHUB_OWNER}/${GITHUB_REPO}/releases"
- }
-
- @Module
- @InstallIn(SingletonComponent::class)
- object Provider {
- @Provides
- @Singleton
- fun providerGithubRequests(): GithubRequests {
- return ApiManager.create()
- }
- }
-
- @Headers("Accept: application/vnd.github+json")
- @GET("repos/{owner}/{repo}")
- suspend fun getRepositoryInfo(
- @Path(value = "owner") owner: String = GITHUB_OWNER,
- @Path(value = "repo") repo: String = GITHUB_REPO,
- ): RepositoryInfo?
-
- @JsonClass(generateAdapter = true)
- data class RepositoryInfo(
- val id: Long,
- val name: String,
- @Json(name = "full_name")
- val fullName: String,
- val private: Boolean,
- @Json(name = "stargazers_count")
- val stargazersCount: Int,
- val forks: Int,
- )
-
- @Headers("Accept: application/vnd.github+json")
- @GET("repos/{owner}/{repo}/releases/latest")
- suspend fun getLatestRelease(
- @Path(value = "owner") owner: String = GITHUB_OWNER,
- @Path(value = "repo") repo: String = GITHUB_REPO,
- ): LatestRelease?
-
- @JsonClass(generateAdapter = true)
- data class LatestRelease(
- val id: Long,
- @Json(name = "tag_name")
- val tagName: String,
- val assets: List
- ) {
- @JsonClass(generateAdapter = true)
- data class Assets(
- val id: Long,
- val name: String,
- @Json(name = "content_type")
- val contentType: String,
- val size: Long,
- @Json(name = "browser_download_url")
- val browserDownloadUrl: String = GITHUB_RELEASE_URL
- )
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/dede/android_eggs/api/upgrade/UpgradeChecker.kt b/app/src/main/java/com/dede/android_eggs/api/upgrade/UpgradeChecker.kt
deleted file mode 100644
index 9d8f2c1d..00000000
--- a/app/src/main/java/com/dede/android_eggs/api/upgrade/UpgradeChecker.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.dede.android_eggs.api.upgrade
-
-import com.dede.android_eggs.BuildConfig
-import com.dede.android_eggs.api.upgrade.impl.GithubUpgradeCheckerImpl
-import com.dede.android_eggs.util.compareStringVersion
-import dagger.Binds
-import dagger.Module
-import dagger.hilt.InstallIn
-import dagger.hilt.components.SingletonComponent
-import javax.inject.Qualifier
-import javax.inject.Singleton
-
-interface UpgradeChecker {
-
- data class Version(val versionName: String? = null, val versionCode: Int = -1) {
- constructor(versionName: String?, versionCodeStr: String?)
- : this(versionName, versionCodeStr?.toIntOrNull() ?: -1)
-
- var upgradeUrl: String? = null
- }
-
- suspend fun getLatestVersion(): Version?
-
- fun getAppVersion(): Version {
- return Version(
- versionName = BuildConfig.VERSION_NAME,
- versionCode = BuildConfig.VERSION_CODE
- )
- }
-
- fun haveUpgrade(latestVersion: Version?): Boolean {
- if (latestVersion == null) {
- return false
- }
- val appVersion = getAppVersion()
- if (latestVersion.versionCode > appVersion.versionCode) {
- return true
- }
- val latestVersionName = latestVersion.versionName
- val appVersionName = appVersion.versionName
- if (latestVersionName.isNullOrBlank() || appVersionName.isNullOrBlank()) {
- return false
- }
- return compareStringVersion(latestVersionName, appVersionName) > 0
- }
-
-}
-
-@Qualifier
-@Retention(AnnotationRetention.BINARY)
-annotation class Github
-
-@Module
-@InstallIn(SingletonComponent::class)
-abstract class UpgradeCheckerImplProviders {
-
- @Github
- @Binds
- @Singleton
- abstract fun providerGithubImpl(impl: GithubUpgradeCheckerImpl): UpgradeChecker
-
-}
diff --git a/app/src/main/java/com/dede/android_eggs/api/upgrade/impl/GithubUpgradeCheckerImpl.kt b/app/src/main/java/com/dede/android_eggs/api/upgrade/impl/GithubUpgradeCheckerImpl.kt
deleted file mode 100644
index 879cb061..00000000
--- a/app/src/main/java/com/dede/android_eggs/api/upgrade/impl/GithubUpgradeCheckerImpl.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.dede.android_eggs.api.upgrade.impl
-
-import com.dede.android_eggs.api.request.GithubRequests
-import com.dede.android_eggs.api.upgrade.UpgradeChecker
-import javax.inject.Inject
-
-class GithubUpgradeCheckerImpl @Inject constructor(val githubRequests: GithubRequests) :
- UpgradeChecker {
-
- override suspend fun getLatestVersion(): UpgradeChecker.Version? {
- return githubRequests.getLatestRelease()?.convertToVersion()
- }
-
- private fun GithubRequests.LatestRelease?.convertToVersion(): UpgradeChecker.Version? {
- val regex = Regex("^\\S*_([\\d.]+)_(\\d+)\\S*.apk$")
- // example: easter_eggs_2.5.2_42-release.apk
- val apkAssets = this?.assets?.find { regex.matches(it.name) } ?: return null
- val matchGroups = regex.matchEntire(apkAssets.name)?.groups ?: return null
- val versionName = matchGroups[1]?.value ?: return null
- val versionCode = matchGroups[2]?.value ?: return null
- return UpgradeChecker.Version(
- versionName = versionName,
- versionCodeStr = versionCode
- ).apply {
- upgradeUrl = apkAssets.browserDownloadUrl
- }
- }
-}
diff --git a/app/src/main/java/com/dede/android_eggs/views/settings/compose/options/GithubOption.kt b/app/src/main/java/com/dede/android_eggs/views/settings/compose/options/GithubOption.kt
index fda67acc..fb420c49 100644
--- a/app/src/main/java/com/dede/android_eggs/views/settings/compose/options/GithubOption.kt
+++ b/app/src/main/java/com/dede/android_eggs/views/settings/compose/options/GithubOption.kt
@@ -3,27 +3,16 @@ package com.dede.android_eggs.views.settings.compose.options
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Star
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
-import androidx.lifecycle.ViewModel
-import androidx.lifecycle.viewModelScope
import com.dede.android_eggs.R
-import com.dede.android_eggs.api.request.GithubRequests
import com.dede.android_eggs.ui.composes.icons.Github
import com.dede.android_eggs.util.CustomTabsBrowser
-import com.dede.android_eggs.util.launchCatchable
import com.dede.android_eggs.views.settings.compose.basic.Option
import com.dede.android_eggs.views.settings.compose.basic.imageVectorIconBlock
-import dagger.hilt.android.lifecycle.HiltViewModel
-import javax.inject.Inject
@Composable
-fun GithubOption(
-// viewModel: GithubViewModel = viewModel()
-) {
+fun GithubOption() {
val context = LocalContext.current
Option(
leadingIcon = imageVectorIconBlock(
@@ -33,58 +22,8 @@ fun GithubOption(
title = stringResource(R.string.label_github),
desc = stringResource(R.string.url_github),
trailingContent = imageVectorIconBlock(imageVector = Icons.Rounded.Star),
-// trailingContent = {
-// Column(
-// modifier = Modifier.animateContentSize(alignment = Alignment.TopCenter),
-// horizontalAlignment = Alignment.CenterHorizontally
-// ) {
-// Icon(
-// imageVector = Icons.Rounded.Star,
-// contentDescription = null,
-// tint = Color(0xFFDFAA39)
-// )
-// if (viewModel.starCount != null) {
-// Text(
-// text = viewModel.starCount!!,
-// style = MaterialTheme.typography.labelSmall,
-// fontWeight = FontWeight.Bold,
-// modifier = Modifier
-// .background(
-// MaterialTheme.colorScheme.secondaryContainer,
-// RoundedCornerShape(10.dp)
-// )
-// .padding(horizontal = 4.dp)
-// )
-// }
-// }
-// },
onClick = {
CustomTabsBrowser.launchUrl(context, R.string.url_github)
}
)
}
-
-@HiltViewModel
-class GithubViewModel @Inject constructor(val githubRequests: GithubRequests) : ViewModel() {
-
- var starCount by mutableStateOf(null)
- private set
-
- init {
- getRepositoryInfo()
- }
-
- private fun getRepositoryInfo() {
- viewModelScope.launchCatchable {
- val repositoryInfo = githubRequests.getRepositoryInfo()
- if (repositoryInfo != null) {
- val stargazersCount = repositoryInfo.stargazersCount
- starCount = if (stargazersCount >= 1000) {
- "%.1f".format(stargazersCount / 1000f)
- } else {
- stargazersCount.toString()
- }
- }
- }
- }
-}
diff --git a/app/src/main/java/com/dede/android_eggs/views/settings/compose/options/VersionOption.kt b/app/src/main/java/com/dede/android_eggs/views/settings/compose/options/VersionOption.kt
index dd8c2e74..6da433a6 100644
--- a/app/src/main/java/com/dede/android_eggs/views/settings/compose/options/VersionOption.kt
+++ b/app/src/main/java/com/dede/android_eggs/views/settings/compose/options/VersionOption.kt
@@ -1,78 +1,24 @@
package com.dede.android_eggs.views.settings.compose.options
-import androidx.compose.animation.Crossfade
-import androidx.compose.animation.core.FastOutSlowInEasing
-import androidx.compose.animation.core.RepeatMode
-import androidx.compose.animation.core.animateFloat
-import androidx.compose.animation.core.infiniteRepeatable
-import androidx.compose.animation.core.rememberInfiniteTransition
-import androidx.compose.animation.core.tween
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
-import androidx.compose.material.icons.automirrored.rounded.NavigateNext
import androidx.compose.material.icons.outlined.NewReleases
-import androidx.compose.material.icons.rounded.Upgrade
-import androidx.compose.material3.Icon
-import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.surfaceColorAtElevation
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.livedata.observeAsState
-import androidx.compose.runtime.remember
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.draw.scale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
-import androidx.compose.ui.unit.dp
import androidx.core.net.toUri
-import androidx.lifecycle.LiveData
-import androidx.lifecycle.MutableLiveData
-import androidx.lifecycle.ViewModel
-import androidx.lifecycle.viewModelScope
-import androidx.lifecycle.viewmodel.compose.viewModel
import com.dede.android_eggs.BuildConfig
import com.dede.android_eggs.R
-import com.dede.android_eggs.api.upgrade.Github
-import com.dede.android_eggs.api.upgrade.UpgradeChecker
-import com.dede.android_eggs.util.CustomTabsBrowser
import com.dede.android_eggs.util.AGPUtils
-import com.dede.android_eggs.util.launchCatchable
+import com.dede.android_eggs.util.CustomTabsBrowser
import com.dede.android_eggs.views.settings.compose.basic.Option
import com.dede.android_eggs.views.settings.compose.basic.OptionShapes
import com.dede.android_eggs.views.settings.compose.basic.imageVectorIconBlock
-import dagger.hilt.android.lifecycle.HiltViewModel
-import javax.inject.Inject
@Composable
-fun VersionOption(
- viewModel: VersionViewModel = viewModel()
-) {
+fun VersionOption() {
val context = LocalContext.current
- val latestVersion by viewModel.latestVersion.observeAsState()
- val haveUpgrade = remember(viewModel.upgradeChecker, latestVersion) {
- viewModel.upgradeChecker.haveUpgrade(latestVersion)
- }
- val scale = if (!haveUpgrade) {
- 1f
- } else {
- val infiniteTransition =
- rememberInfiniteTransition(label = "UpgradeScaleInfiniteTransition")
- val value by infiniteTransition.animateFloat(
- initialValue = 1f,
- targetValue = 1.06f,
- animationSpec = infiniteRepeatable(
- animation = tween(800, easing = FastOutSlowInEasing),
- repeatMode = RepeatMode.Reverse,
- ),
- label = "UpgradeScaleInfiniteAnimation"
- )
- value
- }
Option(
- modifier = Modifier.scale(scale),
shape = OptionShapes.firstShape(),
leadingIcon = imageVectorIconBlock(imageVector = Icons.Outlined.NewReleases),
title = stringResource(
@@ -81,64 +27,14 @@ fun VersionOption(
BuildConfig.VERSION_CODE
),
desc = AGPUtils.getVcsRevision(7),
- trailingContent = {
- Crossfade(
- targetState = haveUpgrade,
- label = "VersionNavigateCrossfade"
- ) {
- if (it) {
- Icon(
- imageVector = Icons.Rounded.Upgrade,
- contentDescription = null,
- modifier = Modifier
- .background(
- MaterialTheme.colorScheme.surfaceColorAtElevation(4.dp),
- RoundedCornerShape(50)
- )
- .padding(4.dp)
- )
- } else {
- Icon(
- imageVector = Icons.AutoMirrored.Rounded.NavigateNext,
- contentDescription = null,
- )
- }
- }
- },
onClick = {
- val version = latestVersion
- if (haveUpgrade && version != null) {
- CustomTabsBrowser.launchUrl(context, version.upgradeUrl!!.toUri())
+ val revision = AGPUtils.getVcsRevision()
+ val uri = if (revision == null) {
+ context.getString(R.string.url_github)
} else {
- val revision = AGPUtils.getVcsRevision()
- val uri = if (revision == null) {
- context.getString(R.string.url_github)
- } else {
- context.getString(R.string.url_github_commit, revision)
- }
- CustomTabsBrowser.launchUrl(context, uri.toUri())
+ context.getString(R.string.url_github_commit, revision)
}
+ CustomTabsBrowser.launchUrl(context, uri.toUri())
}
)
}
-
-@HiltViewModel
-class VersionViewModel @Inject constructor(
- @Github
- val upgradeChecker: UpgradeChecker
-) : ViewModel() {
-
- private val _latestVersion: MutableLiveData = MutableLiveData(null)
-
- val latestVersion: LiveData = _latestVersion
-
- init {
- getLatestVersion()
- }
-
- private fun getLatestVersion() {
- viewModelScope.launchCatchable {
- _latestVersion.value = upgradeChecker.getLatestVersion()
- }
- }
-}
diff --git a/fastlane/metadata/android/en-US/changelogs/43.txt b/fastlane/metadata/android/en-US/changelogs/43.txt
index cbb56c06..fca4384a 100644
--- a/fastlane/metadata/android/en-US/changelogs/43.txt
+++ b/fastlane/metadata/android/en-US/changelogs/43.txt
@@ -1 +1,2 @@
+- Remove App upgrade check
- Known issue fixes
\ No newline at end of file
diff --git a/fastlane/metadata/android/zh-CN/changelogs/43.txt b/fastlane/metadata/android/zh-CN/changelogs/43.txt
index edfbdf61..da0cf02e 100644
--- a/fastlane/metadata/android/zh-CN/changelogs/43.txt
+++ b/fastlane/metadata/android/zh-CN/changelogs/43.txt
@@ -1 +1,2 @@
+- 删除 App 更新检查
- 修复已知问题
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index afce9daf..62b1652b 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -23,3 +23,5 @@ android.nonTransitiveRClass=true
kotlin.code.style=official
android.nonFinalResIds=true
org.gradle.unsafe.configuration-cache=true
+
+android.suppressUnsupportedCompileSdk=35
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 3eace4b4..5ecc9d94 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -9,7 +9,6 @@ accompanist = "0.34.0"
lifecycle = "2.8.3"
activity = "1.9.0"
coil = "2.6.0"
-retrofit = "2.11.0"
# test
espresso = "3.6.1"
@@ -63,13 +62,7 @@ io-coil = { module = "io.coil-kt:coil", version.ref = "coil" }
# io-coil-svg = { module = "io.coil-kt:coil-svg", version.ref = "coil" }
# io-coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" }
free-reflection = "com.github.tiann:FreeReflection:3.2.0"
-squareup-okhttp-bom = "com.squareup.okhttp3:okhttp-bom:4.12.0"
-squareup-okhttp = { module = "com.squareup.okhttp3:okhttp" }
-squareup-okio = { module = "com.squareup.okio:okio" }
-squareup-okhttp-logging = { module = "com.squareup.okhttp3:logging-interceptor" }
-squareup-retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
-squareup-retrofit-converter-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit" }
-squareup-moshi-codegen = "com.squareup.moshi:moshi-kotlin-codegen:1.15.1"
+squareup-okio = { module = "com.squareup.okio:okio", version = "3.8.0" }
squareup-leakcanary = "com.squareup.leakcanary:leakcanary-android-startup:2.14"
nanohttpd = "org.nanohttpd:nanohttpd:2.3.1"