flutter: Catcher: Only enable on Android or iOS
This commit is contained in:
parent
ffa1bf986c
commit
a96268d720
|
@ -34,6 +34,11 @@ import 'widgets/main_menu.dart';
|
||||||
//import 'package:sentry_flutter/sentry_flutter.dart';
|
//import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
|
if (!(Platform.isAndroid || Platform.isIOS)) {
|
||||||
|
runApp(SanmillApp());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var catcher = Catcher(rootWidget: SanmillApp(), ensureInitialized: true);
|
var catcher = Catcher(rootWidget: SanmillApp(), ensureInitialized: true);
|
||||||
|
|
||||||
//DateTime now = DateTime.now();
|
//DateTime now = DateTime.now();
|
||||||
|
|
|
@ -53,15 +53,19 @@ bool FlutterWindow::OnCreate() {
|
||||||
}
|
}
|
||||||
RegisterPlugins(flutter_controller_->engine());
|
RegisterPlugins(flutter_controller_->engine());
|
||||||
|
|
||||||
engine = new MillEngine();
|
if (engine == nullptr) {
|
||||||
auto channel = std::make_unique<flutter::MethodChannel<>>(
|
engine = new MillEngine();
|
||||||
flutter_controller_->engine()->messenger(), "com.calcitem.sanmill/engine",
|
|
||||||
&flutter::StandardMethodCodec::GetInstance());
|
auto channel = std::make_unique<flutter::MethodChannel<>>(
|
||||||
channel->SetMethodCallHandler(
|
flutter_controller_->engine()->messenger(), "com.calcitem.sanmill/engine",
|
||||||
[this](const auto &call, auto result) {
|
&flutter::StandardMethodCodec::GetInstance());
|
||||||
HandleMethodCall(call, std::move(result));
|
|
||||||
}
|
channel->SetMethodCallHandler(
|
||||||
);
|
[this](const auto &call, auto result) {
|
||||||
|
HandleMethodCall(call, std::move(result));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
run_loop_->RegisterFlutterInstance(flutter_controller_->engine());
|
run_loop_->RegisterFlutterInstance(flutter_controller_->engine());
|
||||||
SetChildContent(flutter_controller_->view()->GetNativeWindow());
|
SetChildContent(flutter_controller_->view()->GetNativeWindow());
|
||||||
|
|
|
@ -38,7 +38,7 @@ extern "C" {
|
||||||
EngineState state = EngineState::STATE_READY;
|
EngineState state = EngineState::STATE_READY;
|
||||||
pthread_t thread_id = nullptr;
|
pthread_t thread_id = nullptr;
|
||||||
|
|
||||||
void *engineThread(void *)
|
DWORD WINAPI engineThread(LPVOID lpParam)
|
||||||
{
|
{
|
||||||
printf("Engine Think Thread enter.\n");
|
printf("Engine Think Thread enter.\n");
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ void *engineThread(void *)
|
||||||
|
|
||||||
printf("Engine Think Thread exit.\n");
|
printf("Engine Think Thread exit.\n");
|
||||||
|
|
||||||
return nullptr;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MillEngine::startup()
|
int MillEngine::startup()
|
||||||
|
|
Loading…
Reference in New Issue