add desktop

This commit is contained in:
csf
2022-05-23 16:02:37 +08:00
parent 222245a60c
commit a23fa7fc66
7 changed files with 28 additions and 13 deletions

View File

@@ -282,7 +282,7 @@ class ImageModel with ChangeNotifier {
void update(ui.Image? image) {
if (_image == null && image != null) {
if (isDesktop) {
if (isWebDesktop) {
FFI.canvasModel.updateViewStyle();
} else {
final size = MediaQueryData.fromWindow(ui.window).size;
@@ -394,7 +394,7 @@ class CanvasModel with ChangeNotifier {
}
void resetOffset() {
if (isDesktop) {
if (isWebDesktop) {
updateViewStyle();
} else {
_x = 0;
@@ -783,7 +783,7 @@ class FFI {
static void close() {
chatModel.close();
if (FFI.imageModel.image != null && !isDesktop) {
if (FFI.imageModel.image != null && !isWebDesktop) {
savePreference(id, cursorModel.x, cursorModel.y, canvasModel.x,
canvasModel.y, canvasModel.scale, ffiModel.pi.currentDisplay);
}
@@ -919,7 +919,7 @@ void savePreference(String id, double xCursor, double yCursor, double xCanvas,
}
Future<Map<String, dynamic>?> getPreference(String id) async {
if (!isDesktop) return null;
if (!isWebDesktop) return null;
SharedPreferences prefs = await SharedPreferences.getInstance();
var p = prefs.getString('peer' + id);
if (p == null) return null;

View File

@@ -59,6 +59,11 @@ class PlatformFFI {
static Future<Null> init() async {
isIOS = Platform.isIOS;
isAndroid = Platform.isAndroid;
isDesktop = Platform.isWindows || Platform.isMacOS || Platform.isLinux;
if (isDesktop) {
// TODO
return;
}
final dylib = Platform.isAndroid
? DynamicLibrary.open('librustdesk.so')
: DynamicLibrary.process();

View File

@@ -20,7 +20,7 @@ class PlatformFFI {
static Future<Null> init() async {
isWeb = true;
isDesktop = !context.callMethod('isMobile');
isWebDesktop = !context.callMethod('isMobile');
context.callMethod('init');
version = getByName('version');
}