diff --git a/app/src/main/java/io/nekohasekai/sagernet/ui/MainActivity.kt b/app/src/main/java/io/nekohasekai/sagernet/ui/MainActivity.kt index 55b2acab..387c8c80 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/ui/MainActivity.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/ui/MainActivity.kt @@ -36,9 +36,7 @@ import io.nekohasekai.sagernet.group.GroupInterfaceAdapter import io.nekohasekai.sagernet.group.GroupUpdater import io.nekohasekai.sagernet.ktx.* import io.nekohasekai.sagernet.widget.ListHolderListener -import libcore.Libcore import moe.matsuri.nb4a.utils.Util -import java.text.SimpleDateFormat import java.util.* class MainActivity : ThemedActivity(), @@ -465,42 +463,4 @@ class MainActivity : ThemedActivity(), return fragment != null && fragment.onKeyDown(keyCode, event) } - @SuppressLint("SimpleDateFormat") - override fun onResume() { - super.onResume() - - val sdf = SimpleDateFormat("yyyy-MM-dd") - val now = System.currentTimeMillis() - val expire = Libcore.getExpireTime() * 1000 - val dateExpire = Date(expire) - val build = Libcore.getBuildTime() * 1000 - val dateBuild = Date(build) - - var text: String? = null - if (now > expire) { - text = getString( - R.string.please_update_force, sdf.format(dateBuild), sdf.format(dateExpire) - ) - } else if (now > (expire - 2592000000)) { - // 30 days remind :D - text = getString( - R.string.please_update, sdf.format(dateBuild), sdf.format(dateExpire) - ) - } - - - if (text != null) { - MaterialAlertDialogBuilder(this@MainActivity).setTitle(R.string.insecure) - .setMessage(text) - .setPositiveButton(R.string.action_download) { _, _ -> - launchCustomTab( - "https://github.com/MatsuriDayo/NekoBoxForAndroid/releases" - ) - } - .setNegativeButton(android.R.string.cancel, null) - .setCancelable(false) - .show() - } - } - } diff --git a/libcore/box.go b/libcore/box.go index f373af11..b250ae0c 100644 --- a/libcore/box.go +++ b/libcore/box.go @@ -118,10 +118,6 @@ func NewSingBoxInstance(config string) (b *BoxInstance, err error) { func (b *BoxInstance) Start() (err error) { defer device.DeferPanicToError("box.Start", func(err_ error) { err = err_ }) - if outdated != "" { - return errors.New(outdated) - } - if b.state == 0 { b.state = 1 return b.Box.Start() diff --git a/libcore/date.go b/libcore/date.go deleted file mode 100644 index 5bab1a65..00000000 --- a/libcore/date.go +++ /dev/null @@ -1,20 +0,0 @@ -package libcore - -import ( - "strconv" - "time" -) - -var outdated string - -func GetBuildTime() int64 { - buildDate := 20231005 - buildTime, _ := time.Parse("20060102", strconv.Itoa(buildDate)) - return buildTime.Unix() -} - -func GetExpireTime() int64 { - buildTime := time.Unix(GetBuildTime(), 0) - expireTime := buildTime.AddDate(0, 6, 0) // current force update: 6 months - return expireTime.Unix() -} diff --git a/libcore/nb4a.go b/libcore/nb4a.go index d22fbe24..97ae290d 100644 --- a/libcore/nb4a.go +++ b/libcore/nb4a.go @@ -6,7 +6,6 @@ import ( "path/filepath" "runtime" "strings" - "time" _ "unsafe" "log" @@ -72,10 +71,6 @@ func InitCore(process, cachePath, internalAssets, externalAssets string, externalAssetsPath = externalAssets internalAssetsPath = internalAssets - if time.Now().Unix() >= GetExpireTime() { - outdated = "Your version is too old! Please update!! 版本太旧,请升级!" - } - // certs pem, err := os.ReadFile(externalAssetsPath + "ca.pem") if err == nil {