File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Preview Build
2+ on :
3+ workflow_dispatch :
4+ inputs :
5+ jobs :
6+ libcore :
7+ name : Native Build (LibCore)
8+ runs-on : ubuntu-latest
9+ steps :
10+ - name : Checkout
11+ uses : actions/checkout@v4
12+ - name : Golang Status
13+ run : find buildScript libcore/*.sh | xargs cat | sha1sum > golang_status
14+ - name : Libcore Status
15+ run : git ls-files libcore | xargs cat | sha1sum > libcore_status
16+ - name : LibCore Cache
17+ id : cache
18+ uses : actions/cache@v4
19+ with :
20+ path : |
21+ app/libs/libcore.aar
22+ key : ${{ hashFiles('.github/workflows/*', 'golang_status', 'libcore_status') }}
23+ - name : Install Golang
24+ if : steps.cache.outputs.cache-hit != 'true'
25+ uses : actions/setup-go@v5
26+ with :
27+ go-version : ^1.24
28+ - name : Native Build
29+ if : steps.cache.outputs.cache-hit != 'true'
30+ run : ./run lib core
31+ build :
32+ name : Build OSS APK
33+ runs-on : ubuntu-latest
34+ needs :
35+ - libcore
36+ steps :
37+ - name : Checkout
38+ uses : actions/checkout@v4
39+ - name : Golang Status
40+ run : find buildScript libcore/*.sh | xargs cat | sha1sum > golang_status
41+ - name : Libcore Status
42+ run : git ls-files libcore | xargs cat | sha1sum > libcore_status
43+ - name : LibCore Cache
44+ uses : actions/cache@v4
45+ with :
46+ path : |
47+ app/libs/libcore.aar
48+ key : ${{ hashFiles('.github/workflows/*', 'golang_status', 'libcore_status') }}
49+ - name : Gradle cache
50+ uses : actions/cache@v4
51+ with :
52+ path : ~/.gradle
53+ key : gradle-oss-${{ hashFiles('**/*.gradle.kts') }}
54+ - name : Gradle Build
55+ env :
56+ BUILD_PLUGIN : none
57+ run : |
58+ echo "sdk.dir=${ANDROID_HOME}" > local.properties
59+ echo "ndk.dir=${ANDROID_HOME}/ndk/25.0.8775105" >> local.properties
60+ export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
61+ ./run init action gradle
62+ ./gradlew app:assemblePreviewRelease
63+ APK=$(find app/build/outputs/apk -name '*arm64-v8a*.apk')
64+ APK=$(dirname $APK)
65+ echo "APK=$APK" >> $GITHUB_ENV
66+ - uses : actions/upload-artifact@v4
67+ with :
68+ name : APKs
69+ path : ${{ env.APK }}
Original file line number Diff line number Diff line change @@ -271,11 +271,9 @@ fun Context.getColorAttr(@AttrRes resId: Int): Int {
271271}
272272
273273val isExpert: Boolean by lazy { BuildConfig .DEBUG || DataStore .isExpert }
274-
275- val isExpertFlavor = ((BuildConfig .FLAVOR == " expert" ) || BuildConfig .DEBUG )
276274const val isOss = BuildConfig .FLAVOR == " oss"
277- const val isFdroid = BuildConfig .FLAVOR == " fdroid"
278275const val isPlay = BuildConfig .FLAVOR == " play"
276+ const val isPreview = BuildConfig .FLAVOR == " preview"
279277
280278fun <T > Continuation<T>.tryResume (value : T ) {
281279 try {
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ import io.nekohasekai.sagernet.group.GroupInterfaceAdapter
4141import io.nekohasekai.sagernet.group.GroupUpdater
4242import io.nekohasekai.sagernet.ktx.alert
4343import io.nekohasekai.sagernet.ktx.isPlay
44+ import io.nekohasekai.sagernet.ktx.isPreview
4445import io.nekohasekai.sagernet.ktx.launchCustomTab
4546import io.nekohasekai.sagernet.ktx.onMainDispatcher
4647import io.nekohasekai.sagernet.ktx.parseProxies
@@ -114,6 +115,13 @@ class MainActivity : ThemedActivity(),
114115 )
115116 }
116117 }
118+
119+ if (isPreview) {
120+ MaterialAlertDialogBuilder (this ).setTitle(R .string.preview_version)
121+ .setMessage(R .string.preview_version_hint)
122+ .setPositiveButton(android.R .string.ok, null )
123+ .show()
124+ }
117125 }
118126
119127 fun refreshNavMenu (clashApi : Boolean ) {
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ import androidx.preference.PreferenceViewHolder
2020import com.google.android.material.dialog.MaterialAlertDialogBuilder
2121import io.nekohasekai.sagernet.R
2222import io.nekohasekai.sagernet.ktx.getColorAttr
23- import io.nekohasekai.sagernet.ktx.isExpertFlavor
2423import kotlin.math.roundToInt
2524
2625class ColorPickerPreference
Original file line number Diff line number Diff line change 486486 <string name =" global_allow_insecure" >总是跳过 TLS 证书验证</string >
487487 <string name =" network_change_reset_connections" >当网络发生变化时重置出站连接</string >
488488 <string name =" wake_reset_connections" >当设备从睡眠状态唤醒时重置出站连接</string >
489+ <string name =" preview_version" >预览版</string >
490+ <string name =" preview_version_hint" >本应用为预览版,可能存在诸多问题。若您不愿参与测试,请前往GitHub下载正式发布版本!</string >
489491</resources >
Original file line number Diff line number Diff line change 566566 <string name =" padding" >Padding</string >
567567 <string name =" network_change_reset_connections" >Reset outbound connections when network changes</string >
568568 <string name =" wake_reset_connections" >Reset outbound connections when device wake from sleep</string >
569+ <string name =" preview_version" >Preview version</string >
570+ <string name =" preview_version_hint" >This application is a preview version and may contain many problems. If you do not want to test it, please go to GitHub to download the Release version!</string >
569571</resources >
Original file line number Diff line number Diff line change @@ -209,6 +209,7 @@ fun Project.setupApp() {
209209 create(" oss" )
210210 create(" fdroid" )
211211 create(" play" )
212+ create(" preview" )
212213 }
213214
214215 applicationVariants.all {
You can’t perform that action at this time.
0 commit comments