Compare commits

...

1 Commits

Author SHA1 Message Date
chen08209
9315bb4b41 Fix android tile service 2025-09-28 00:45:57 +08:00
6 changed files with 16 additions and 5 deletions

View File

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

View File

@@ -33,6 +33,8 @@ var (
) )
func handleInitClash(paramsString string) bool { func handleInitClash(paramsString string) bool {
runLock.Lock()
defer runLock.Unlock()
var params = InitParams{} var params = InitParams{}
err := json.Unmarshal([]byte(paramsString), &params) err := json.Unmarshal([]byte(paramsString), &params)
if err != nil { if err != nil {
@@ -41,6 +43,11 @@ func handleInitClash(paramsString string) bool {
version = params.Version version = params.Version
if !isInit { if !isInit {
constant.SetHomeDir(params.HomeDir) 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 isInit = true
} }
return isInit return isInit

View File

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

View File

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

View File

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

View File

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