d3b6026bfd
- Filled empty libs/hbb_common/ submodule (cloned from rustdesk/hbb_common) - Patched Flutter 3.44 / Dart 3.12 compatibility: * flutter/lib/generated_bridge.dart: asTypedList with cast<>, DartPort=Int64 * flutter/lib/common.dart: DialogTheme->DialogThemeData, TabBarTheme->TabBarThemeData * flutter/pubspec.yaml: extended_text 14.0.0->15.0.2, google_fonts override 5.0.0 * flutter/macos/Runner/Configs/Release.xcconfig: EXCLUDED_ARCHS=x86_64 - Build verified: cargo check + cargo build --features flutter + cargo build --release --features flutter - Verified flutter build macos --debug and --release both produce working .app - Verified .dmg installer (27MB arm64) created via hdiutil - Build deps: Xcode 26.5, CocoaPods 1.16.2, Flutter 3.44, VCPKG arm64-osx
115 lines
3.3 KiB
Dart
115 lines
3.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
import '../../common.dart';
|
|
import '../../models/platform_model.dart';
|
|
|
|
const _deployDialogTag = 'android-deploy-device';
|
|
|
|
void showDeployPromptDialog() {
|
|
gFFI.dialogManager.dismissByTag(_deployDialogTag);
|
|
gFFI.dialogManager.show<bool>((setState, close, context) {
|
|
submit() => close(true);
|
|
return CustomAlertDialog(
|
|
title: Text(translate("Deploy")),
|
|
content: Text(translate("server_requires_deployment_tip")),
|
|
actions: [
|
|
dialogButton("Cancel", onPressed: close, isOutline: true),
|
|
dialogButton("OK", onPressed: submit),
|
|
],
|
|
onSubmit: submit,
|
|
onCancel: close,
|
|
);
|
|
}, tag: _deployDialogTag).then((deploy) {
|
|
if (deploy == true) {
|
|
showDeployDialog();
|
|
}
|
|
});
|
|
}
|
|
|
|
void showDeployDialog() {
|
|
gFFI.dialogManager.dismissByTag(_deployDialogTag);
|
|
final tokenController = TextEditingController();
|
|
final idController = TextEditingController();
|
|
var errorText = "";
|
|
var isInProgress = false;
|
|
gFFI.dialogManager.show((setState, close, context) {
|
|
submit() async {
|
|
if (isInProgress) return;
|
|
final token = tokenController.text.trim();
|
|
if (token.isEmpty) {
|
|
setState(() {
|
|
errorText = translate("token is required!");
|
|
});
|
|
return;
|
|
}
|
|
setState(() {
|
|
errorText = "";
|
|
isInProgress = true;
|
|
});
|
|
String res;
|
|
try {
|
|
res = await bind.mainDeployDevice(
|
|
token: token, id: idController.text.trim());
|
|
} catch (e) {
|
|
setState(() {
|
|
errorText = translate(e.toString());
|
|
isInProgress = false;
|
|
});
|
|
return;
|
|
}
|
|
if (res.isEmpty) {
|
|
close();
|
|
await gFFI.serverModel.fetchID();
|
|
showToast(translate("Successful"));
|
|
} else {
|
|
setState(() {
|
|
errorText = translate(res.toString());
|
|
isInProgress = false;
|
|
});
|
|
}
|
|
}
|
|
|
|
return CustomAlertDialog(
|
|
title: Text(translate("Deploy")),
|
|
content: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
TextField(
|
|
controller: tokenController,
|
|
decoration: InputDecoration(labelText: translate("API Token")),
|
|
obscureText: true,
|
|
enableSuggestions: false,
|
|
autocorrect: false,
|
|
autofocus: true,
|
|
).workaroundFreezeLinuxMint(),
|
|
TextField(
|
|
controller: idController,
|
|
decoration:
|
|
InputDecoration(labelText: translate("Custom ID (optional)")),
|
|
).workaroundFreezeLinuxMint(),
|
|
if (errorText.isNotEmpty)
|
|
Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: SelectableText(
|
|
errorText,
|
|
style: TextStyle(
|
|
color: Theme.of(context).colorScheme.error,
|
|
fontSize: 12,
|
|
),
|
|
).paddingOnly(top: 8),
|
|
),
|
|
if (isInProgress) const LinearProgressIndicator().paddingOnly(top: 8),
|
|
],
|
|
),
|
|
actions: [
|
|
dialogButton("Cancel",
|
|
onPressed: isInProgress ? null : close, isOutline: true),
|
|
dialogButton("OK", onPressed: isInProgress ? null : submit),
|
|
],
|
|
onSubmit: submit,
|
|
onCancel: isInProgress ? null : close,
|
|
);
|
|
}, tag: _deployDialogTag);
|
|
}
|