fix #136
This commit is contained in:
parent
72a212b4a5
commit
468db9d8a6
2 changed files with 13 additions and 32 deletions
|
|
@ -1,13 +0,0 @@
|
|||
import 'dart:io';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:mangayomi/main.dart';
|
||||
import 'package:mangayomi/messages/generated.dart';
|
||||
import 'package:mangayomi/providers/storage_provider.dart';
|
||||
|
||||
Future<void> initInIsolate(RootIsolateToken token) async {
|
||||
await initializeRust();
|
||||
HttpOverrides.global = MyHttpoverrides();
|
||||
isar = await StorageProvider().initDB(null, inspector: kDebugMode);
|
||||
iniDateFormatting();
|
||||
}
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:mangayomi/eval/bridge/m_source.dart';
|
||||
import 'package:mangayomi/eval/model/filter.dart';
|
||||
import 'package:mangayomi/eval/model/m_pages.dart';
|
||||
|
|
@ -7,7 +5,6 @@ import 'package:mangayomi/eval/compiler/compiler.dart';
|
|||
import 'package:mangayomi/eval/model/m_provider.dart';
|
||||
import 'package:mangayomi/models/source.dart';
|
||||
import 'package:mangayomi/eval/runtime/runtime.dart';
|
||||
import 'package:mangayomi/services/isolate.dart';
|
||||
import 'package:mangayomi/sources/source_test.dart';
|
||||
|
||||
Future<MPages?> search(
|
||||
|
|
@ -15,20 +12,17 @@ Future<MPages?> search(
|
|||
required String query,
|
||||
required int page,
|
||||
required List<dynamic> filterList}) async {
|
||||
return await compute<RootIsolateToken, MPages?>((token) async {
|
||||
await initInIsolate(token);
|
||||
MPages? manga;
|
||||
final bytecode =
|
||||
compilerEval(useTestSourceCode ? testSourceCode : source.sourceCode!);
|
||||
final runtime = runtimeEval(bytecode);
|
||||
var res = runtime.executeLib('package:mangayomi/main.dart', 'main',
|
||||
[$MSource.wrap(source.toMSource())]);
|
||||
try {
|
||||
manga =
|
||||
await (res as MProvider).search(query, page, FilterList(filterList));
|
||||
} catch (e) {
|
||||
throw Exception(e);
|
||||
}
|
||||
return manga;
|
||||
}, RootIsolateToken.instance!);
|
||||
MPages? manga;
|
||||
final bytecode =
|
||||
compilerEval(useTestSourceCode ? testSourceCode : source.sourceCode!);
|
||||
final runtime = runtimeEval(bytecode);
|
||||
var res = runtime.executeLib('package:mangayomi/main.dart', 'main',
|
||||
[$MSource.wrap(source.toMSource())]);
|
||||
try {
|
||||
manga =
|
||||
await (res as MProvider).search(query, page, FilterList(filterList));
|
||||
} catch (e) {
|
||||
throw Exception(e);
|
||||
}
|
||||
return manga;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue