Fix: fix time zone
This commit is contained in:
@@ -84,6 +84,16 @@ Java_com_github_kr328_clash_core_bridge_Bridge_nativeNotifyDnsChanged(JNIEnv *en
|
||||
notifyDnsChanged(_dns_list);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_github_kr328_clash_core_bridge_Bridge_nativeNotifyTimeZoneChanged(JNIEnv *env, jobject thiz,
|
||||
jstring name, jint offset) {
|
||||
TRACE_METHOD();
|
||||
|
||||
scoped_string _name = get_string(name);
|
||||
|
||||
notifyTimeZoneChanged(_name, offset);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_github_kr328_clash_core_bridge_Bridge_nativeNotifyInstalledAppChanged(JNIEnv *env,
|
||||
jobject thiz,
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"cfa/native/app"
|
||||
|
||||
"github.com/Dreamacro/clash/log"
|
||||
)
|
||||
|
||||
@@ -42,6 +43,12 @@ func notifyInstalledAppsChanged(uids C.c_string) {
|
||||
app.NotifyInstallAppsChanged(u)
|
||||
}
|
||||
|
||||
//export notifyTimeZoneChanged
|
||||
func notifyTimeZoneChanged(name C.c_string, offset C.int) {
|
||||
app.NotifyTimeZoneChanged(C.GoString(name), int(offset))
|
||||
}
|
||||
|
||||
|
||||
//export queryConfiguration
|
||||
func queryConfiguration() *C.char {
|
||||
response := &struct{}{}
|
||||
|
||||
@@ -3,6 +3,7 @@ package app
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var appVersionName string
|
||||
@@ -46,3 +47,7 @@ func NotifyInstallAppsChanged(uidList string) {
|
||||
func QueryAppByUid(uid int) string {
|
||||
return installedAppsUid[uid]
|
||||
}
|
||||
|
||||
func NotifyTimeZoneChanged(name string, offset int) {
|
||||
time.Local = time.FixedZone(name, offset)
|
||||
}
|
||||
@@ -52,6 +52,10 @@ object Clash {
|
||||
Bridge.nativeNotifyDnsChanged(dns.joinToString(separator = ","))
|
||||
}
|
||||
|
||||
fun notifyTimeZoneChanged(name: String, offset: Int) {
|
||||
Bridge.nativeNotifyTimeZoneChanged(name, offset)
|
||||
}
|
||||
|
||||
fun notifyInstalledAppsChanged(uids: List<Pair<Int, String>>) {
|
||||
val uidList = uids.joinToString(separator = ",") { "${it.first}:${it.second}" }
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ object Bridge {
|
||||
external fun nativeQueryTrafficNow(): Long
|
||||
external fun nativeQueryTrafficTotal(): Long
|
||||
external fun nativeNotifyDnsChanged(dnsList: String)
|
||||
external fun nativeNotifyTimeZoneChanged(name: String, offset: Int)
|
||||
external fun nativeNotifyInstalledAppChanged(uidList: String)
|
||||
external fun nativeStartTun(fd: Int, mtu: Int, dns: String, blocking: String, cb: TunInterface)
|
||||
external fun nativeStopTun()
|
||||
|
||||
Reference in New Issue
Block a user