fix iOS
This commit is contained in:
parent
cbc25547ba
commit
384d51450c
@ -53,7 +53,7 @@ class PlatformFFI {
|
|||||||
var a = name.toNativeUtf8();
|
var a = name.toNativeUtf8();
|
||||||
var b = arg.toNativeUtf8();
|
var b = arg.toNativeUtf8();
|
||||||
var p = _getByName!(a, b);
|
var p = _getByName!(a, b);
|
||||||
assert(p != nullptr && p != null);
|
assert(p != nullptr);
|
||||||
var res = p.toDartString();
|
var res = p.toDartString();
|
||||||
calloc.free(p);
|
calloc.free(p);
|
||||||
calloc.free(a);
|
calloc.free(a);
|
||||||
@ -86,7 +86,11 @@ class PlatformFFI {
|
|||||||
.lookupFunction<Void Function(Pointer<RgbaFrame>), F4>('free_rgba');
|
.lookupFunction<Void Function(Pointer<RgbaFrame>), F4>('free_rgba');
|
||||||
_getRgba = dylib.lookupFunction<F5, F5>('get_rgba');
|
_getRgba = dylib.lookupFunction<F5, F5>('get_rgba');
|
||||||
_dir = (await getApplicationDocumentsDirectory()).path;
|
_dir = (await getApplicationDocumentsDirectory()).path;
|
||||||
_homeDir = (await ExternalPath.getExternalStorageDirectories())[0];
|
try {
|
||||||
|
_homeDir = (await ExternalPath.getExternalStorageDirectories())[0];
|
||||||
|
} catch (e) {
|
||||||
|
print(e);
|
||||||
|
}
|
||||||
String id = 'NA';
|
String id = 'NA';
|
||||||
String name = 'Flutter';
|
String name = 'Flutter';
|
||||||
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||||
@ -123,9 +127,9 @@ class PlatformFFI {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static invokeMethod(String method,[ dynamic arguments ]) async {
|
static invokeMethod(String method, [dynamic arguments]) async {
|
||||||
if (!isAndroid) return Future<bool>(() => false);
|
if (!isAndroid) return Future<bool>(() => false);
|
||||||
return await toAndroidChannel.invokeMethod(method,arguments);
|
return await toAndroidChannel.invokeMethod(method, arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import 'package:image_picker/image_picker.dart';
|
|||||||
import 'package:image/image.dart' as img;
|
import 'package:image/image.dart' as img;
|
||||||
import 'package:zxing2/qrcode.dart';
|
import 'package:zxing2/qrcode.dart';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import '../common.dart';
|
import '../common.dart';
|
||||||
import '../models/model.dart';
|
import '../models/model.dart';
|
||||||
@ -130,7 +131,7 @@ class _ScanPageState extends State<ScanPage> {
|
|||||||
|
|
||||||
void showServerSettingFromQr(String data) async {
|
void showServerSettingFromQr(String data) async {
|
||||||
backToHome();
|
backToHome();
|
||||||
await controller!.stopCamera();
|
await controller?.pauseCamera();
|
||||||
if (!data.startsWith('config=')) {
|
if (!data.startsWith('config=')) {
|
||||||
showToast('Invalid QR code');
|
showToast('Invalid QR code');
|
||||||
return;
|
return;
|
||||||
@ -140,7 +141,9 @@ class _ScanPageState extends State<ScanPage> {
|
|||||||
var host = values['host'] != null ? values['host'] as String : '';
|
var host = values['host'] != null ? values['host'] as String : '';
|
||||||
var key = values['key'] != null ? values['key'] as String : '';
|
var key = values['key'] != null ? values['key'] as String : '';
|
||||||
var api = values['api'] != null ? values['api'] as String : '';
|
var api = values['api'] != null ? values['api'] as String : '';
|
||||||
showServerSettingsWithValue(host, '', key, api);
|
Timer(Duration(milliseconds: 60), () {
|
||||||
|
showServerSettingsWithValue(host, '', key, api);
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showToast('Invalid QR code');
|
showToast('Invalid QR code');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user