You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.0 KiB

4 years ago
import 'dart:async';
4 years ago
import 'dart:io';
4 years ago
import 'package:flutter/services.dart';
class Min {
4 years ago
static const MethodChannel _channel = const MethodChannel('min');
4 years ago
4 years ago
static Future<bool> isInitialize() async {
4 years ago
return await _channel.invokeMethod('isInitialize');
4 years ago
}
static Future<bool> isExistsApp(appid) async {
4 years ago
return await _channel
4 years ago
.invokeMethod('isExistsApp', <String, dynamic>{"appid": appid});
}
4 years ago
static Future<String> getAppVersionInfo(appid) async {
4 years ago
final String version = await _channel.invokeMethod('getAppVersionInfo', <String, dynamic>{"appid": appid});
return version;
4 years ago
}
4 years ago
static Future<String> getAppBasePath(appid) async {
if(Platform.isIOS) {
final String getAppBasePath = await _channel.invokeMethod(
'getAppBasePath', <String, dynamic>{"appid": appid}
);
return getAppBasePath;
} else {
final String getAppBasePath = await _channel.invokeMethod(
'getAppBasePath',
);
return getAppBasePath;
}
4 years ago
}
static Future<String> runingAppid() async {
final String runingAppid = await _channel.invokeMethod(
'runingAppid',
);
return runingAppid;
}
static Future<String> currentPageUrl() async {
final String currentPageUrl = await _channel.invokeMethod(
'currentPageUrl',
);
return currentPageUrl;
}
static Future<bool> closeCurrentApp() async {
final bool isExists = await _channel.invokeMethod('closeCurrentApp');
return isExists;
}
4 years ago
static Future<bool> initialize() async {
final bool isInit = await _channel.invokeMethod('initialize');
return isInit;
}
4 years ago
static startMin(appid, json) async {
3 years ago
print("startMin: $json");
4 years ago
_channel.invokeMethod(
'startMin', <String, dynamic>{"appid": appid, "json": json});
4 years ago
}
static Future<bool> reloadWgt(appid, wgtPath) async {
final bool isReload = await _channel.invokeMethod(
'reloadWgt', <String, dynamic>{"appid": appid, "wgtPath": wgtPath});
return isReload;
4 years ago
}
4 years ago
static clickListener() {
_channel.invokeMethod('clickListener');
}
4 years ago
}