mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-18 22:20:06 +08:00
Remove unused
This commit is contained in:
parent
51889ed28e
commit
5dc09caf22
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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()
|
||||
}
|
||||
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user