Fix android tile service

This commit is contained in:
chen08209
2025-09-27 23:39:20 +08:00
parent 201062dc5d
commit 9315bb4b41
6 changed files with 16 additions and 5 deletions

View File

@@ -92,6 +92,7 @@ object State {
suspend fun destroyServiceEngine() {
runLock.withLock {
GlobalState.log("Destroy service engine")
withContext(Dispatchers.Main) {
runCatching {
serviceFlutterEngine?.destroy()
@@ -103,10 +104,12 @@ object State {
suspend fun startServiceWithEngine() {
runLock.withLock {
if (serviceFlutterEngine != null || runStateFlow.value == RunState.PENDING || runStateFlow.value == RunState.START) {
if (runStateFlow.value == RunState.PENDING || runStateFlow.value == RunState.START) {
return
}
GlobalState.log("Create service engine")
withContext(Dispatchers.Main) {
serviceFlutterEngine?.destroy()
serviceFlutterEngine = FlutterEngine(GlobalState.application)
serviceFlutterEngine?.plugins?.add(ServicePlugin())
serviceFlutterEngine?.plugins?.add(AppPlugin())

View File

@@ -33,6 +33,8 @@ var (
)
func handleInitClash(paramsString string) bool {
runLock.Lock()
defer runLock.Unlock()
var params = InitParams{}
err := json.Unmarshal([]byte(paramsString), &params)
if err != nil {
@@ -41,6 +43,11 @@ func handleInitClash(paramsString string) bool {
version = params.Version
if !isInit {
constant.SetHomeDir(params.HomeDir)
//currentConfig, _ = config.ParseRawConfig(config.DefaultRawConfig())
//startTime := time.Now()
//hub.ApplyConfig(currentConfig)
//elapsedTime := time.Since(startTime) / time.Millisecond
//log.Infoln("Initial clash env, total time: %dms", elapsedTime)
isInit = true
}
return isInit

View File

@@ -962,7 +962,7 @@ class AppController {
final res = await futureFunction();
return res;
} catch (e) {
commonPrint.log('$futureFunction ===> $e', logLevel: LogLevel.warning);
commonPrint.log('$title===> $e', logLevel: LogLevel.warning);
if (realSilence) {
globalState.showNotifier(e.toString());
} else {

View File

@@ -40,8 +40,8 @@ Future<void> _service(List<String> flags) async {
final clashConfig = globalState.config.patchClashConfig.copyWith.tun(
enable: false,
);
await globalState.handleStart();
await coreController.setupConfig(clashConfig);
await globalState.handleStart();
});
}

View File

@@ -147,7 +147,8 @@ class ProviderItem extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 4),
Text(_buildProviderDesc()),
if (provider.updateAt.microsecondsSinceEpoch > 0)
Text(_buildProviderDesc()),
const SizedBox(height: 4),
if (provider.subscriptionInfo != null)
SubscriptionInfoView(subscriptionInfo: provider.subscriptionInfo),

View File

@@ -1,7 +1,7 @@
name: fl_clash
description: A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free.
publish_to: 'none'
version: 0.8.89+2025092701
version: 0.8.90+2025092801
environment:
sdk: '>=3.8.0 <4.0.0'