|
|
|
import 'dart:async';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
|
|
|
class Min {
|
|
|
|
static const MethodChannel _channel = const MethodChannel('min');
|
|
|
|
|
|
|
|
static Future<bool> isInitialize() async {
|
|
|
|
return await _channel.invokeMethod('isInitialize');
|
|
|
|
}
|
|
|
|
|
|
|
|
static Future<bool> isExistsApp(appid) async {
|
|
|
|
return await _channel
|
|
|
|
.invokeMethod('isExistsApp', <String, dynamic>{"appid": appid});
|
|
|
|
}
|
|
|
|
|
|
|
|
static Future<String> getAppVersionInfo(appid) async {
|
|
|
|
final String version = await _channel.invokeMethod('getAppVersionInfo', <String, dynamic>{"appid": appid});
|
|
|
|
return version;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Future<bool> initialize() async {
|
|
|
|
final bool isInit = await _channel.invokeMethod('initialize');
|
|
|
|
return isInit;
|
|
|
|
}
|
|
|
|
|
|
|
|
static startMin(appid, json) async {
|
|
|
|
print("startMin: $json");
|
|
|
|
_channel.invokeMethod(
|
|
|
|
'startMin', <String, dynamic>{"appid": appid, "json": json});
|
|
|
|
}
|
|
|
|
|
|
|
|
static Future<bool> reloadWgt(appid, wgtPath) async {
|
|
|
|
final bool isReload = await _channel.invokeMethod(
|
|
|
|
'reloadWgt', <String, dynamic>{"appid": appid, "wgtPath": wgtPath});
|
|
|
|
return isReload;
|
|
|
|
}
|
|
|
|
|
|
|
|
static clickListener() {
|
|
|
|
_channel.invokeMethod('clickListener');
|
|
|
|
}
|
|
|
|
}
|