Skip to content

Commit 81bbf2d

Browse files
committed
fix: android icons and splashscreen
refactor: changeserverbutton widget fear: new header flclashx-serverinfo refactor: update readme and templates fix: cache logo in service-logo header fix: theme opacity layer
1 parent 973c44e commit 81bbf2d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+478
-117
lines changed

.github/pre_release_template.md

Lines changed: 61 additions & 0 deletions

.github/workflows/build.yaml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,27 @@ jobs:
272272

273273
- name: Generate release.md
274274
run: |
275-
# Add pre-release warning at the top if needed
276-
if [ "${{ env.IS_STABLE }}" != "true" ]; then
277-
echo "⚠️ **This is a pre-release version for testing purposes.**" > release.md
278-
echo "" >> release.md
279-
echo "---" >> release.md
280-
echo "" >> release.md
275+
tags=($(git tag --merged $(git rev-parse HEAD) --sort=-creatordate))
276+
277+
# Determine previous tag based on release type
278+
if [ "${{ env.IS_STABLE }}" == "true" ]; then
279+
# For stable: get latest stable release from API
280+
preTag=$(curl --silent "https://api.github.com/repos/pluralplay/FlClashX/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' || echo "")
281+
else
282+
# For pre-release: get the latest pre-release tag (last tag with '-' in name before current)
283+
preTag=""
284+
for tag in "${tags[@]}"; do
285+
if [ "$tag" != "${tags[0]}" ] && [[ "$tag" == *-* ]]; then
286+
preTag="$tag"
287+
break
288+
fi
289+
done
290+
# If no previous pre-release found, use latest stable
291+
if [ -z "$preTag" ]; then
292+
preTag=$(curl --silent "https://api.github.com/repos/pluralplay/FlClashX/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' || echo "")
293+
fi
281294
fi
282295
283-
tags=($(git tag --merged $(git rev-parse HEAD) --sort=-creatordate))
284-
preTag=$(curl --silent "https://api.github.com/repos/pluralplay/FlClashX/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' || echo "")
285296
currentTag=""
286297
for ((i = 0; i <= ${#tags[@]}; i++)); do
287298
if (( i < ${#tags[@]} )); then
@@ -308,7 +319,11 @@ jobs:
308319
- name: Patch release.md
309320
run: |
310321
version=$(echo "${{ github.ref_name }}" | sed 's/^v//')
311-
sed "s|VERSION|$version|g" ./.github/release_template.md >> release.md
322+
if [ "${{ env.IS_STABLE }}" == "true" ]; then
323+
sed "s|VERSION|$version|g" ./.github/release_template.md >> release.md
324+
else
325+
sed "s|VERSION|$version|g" ./.github/pre_release_template.md >> release.md
326+
fi
312327
313328
- name: Generate sha256
314329
if: env.IS_STABLE == 'true'

README.md

Lines changed: 14 additions & 0 deletions

README_EN.md

Lines changed: 14 additions & 0 deletions

android/app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ flutter {
9494
dependencies {
9595
implementation(project(":core"))
9696
implementation("androidx.core:core-splashscreen:1.0.1")
97+
implementation("androidx.appcompat:appcompat:1.6.1")
9798
implementation("com.google.code.gson:gson:2.10.1")
9899
implementation("com.android.tools.smali:smali-dexlib2:3.0.9") {
99100
exclude(group = "com.google.guava", module = "guava")

android/app/src/main/kotlin/com/follow/clashx/MainActivity.kt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
package com.follow.clashx
22

3+
import android.content.Context
34
import android.os.Build
45
import android.os.Bundle
56
import android.provider.Settings
7+
import androidx.appcompat.app.AppCompatDelegate
68
import com.follow.clashx.plugins.AppPlugin
79
import com.follow.clashx.plugins.ServicePlugin
810
import com.follow.clashx.plugins.TilePlugin
911
import io.flutter.embedding.android.FlutterActivity
1012
import io.flutter.embedding.engine.FlutterEngine
1113
import io.flutter.plugin.common.MethodChannel
14+
import org.json.JSONObject
1215

1316
class MainActivity : FlutterActivity() {
1417
override fun onCreate(savedInstanceState: Bundle?) {
18+
// Apply app theme before creating the activity to fix splash screen theme
19+
applyAppTheme()
20+
1521
super.onCreate(savedInstanceState)
1622

1723
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
@@ -68,4 +74,35 @@ class MainActivity : FlutterActivity() {
6874
GlobalState.runState.value = RunState.STOP
6975
super.onDestroy()
7076
}
77+
78+
private fun applyAppTheme() {
79+
try {
80+
val prefs = getSharedPreferences("FlutterSharedPreferences", Context.MODE_PRIVATE)
81+
val configJson = prefs.getString("flutter.config", null)
82+
83+
if (configJson != null) {
84+
val config = JSONObject(configJson)
85+
val themeProps = config.optJSONObject("themeProps")
86+
val themeMode = themeProps?.optString("themeMode", "ThemeMode.system") ?: "ThemeMode.system"
87+
88+
when {
89+
themeMode.contains("light", ignoreCase = true) -> {
90+
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
91+
}
92+
themeMode.contains("dark", ignoreCase = true) -> {
93+
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
94+
}
95+
else -> {
96+
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
97+
}
98+
}
99+
} else {
100+
// Default to system theme if config not found
101+
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
102+
}
103+
} catch (e: Exception) {
104+
// Fallback to system theme on error
105+
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
106+
}
107+
}
71108
}
9.5 KB
6.81 KB
5.69 KB
4.45 KB

0 commit comments

Comments
 (0)