2022-03-11 15:44:43 +01:00
|
|
|
import 'dart:async';
|
|
|
|
|
2021-04-30 18:58:05 +02:00
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
2022-03-15 10:28:03 +01:00
|
|
|
class Lock {
|
|
|
|
static Future<bool> tryLock(int lockId) async {
|
|
|
|
return (await _channel.invokeMethod<bool>("tryLock", <String, dynamic>{
|
|
|
|
"lockId": lockId,
|
|
|
|
}))!;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Future<void> unlock(int lockId) =>
|
|
|
|
_channel.invokeMethod("unlock", <String, dynamic>{
|
|
|
|
"lockId": lockId,
|
|
|
|
});
|
|
|
|
|
|
|
|
static const _channel = MethodChannel("com.nkming.nc_photos.plugin/lock");
|
|
|
|
}
|
|
|
|
|
2021-04-30 18:58:05 +02:00
|
|
|
class Notification {
|
2021-10-02 11:12:54 +02:00
|
|
|
static Future<int?> notifyDownloadSuccessful(List<String> fileUris,
|
|
|
|
List<String?> mimeTypes, int? notificationId) =>
|
|
|
|
_channel.invokeMethod("notifyDownloadSuccessful", <String, dynamic>{
|
2021-07-10 16:18:04 +02:00
|
|
|
"fileUris": fileUris,
|
|
|
|
"mimeTypes": mimeTypes,
|
2021-10-02 11:12:54 +02:00
|
|
|
"notificationId": notificationId,
|
2021-04-30 18:58:05 +02:00
|
|
|
});
|
|
|
|
|
2021-10-02 11:12:54 +02:00
|
|
|
static Future<int?> notifyDownloadProgress(int progress, int max,
|
|
|
|
String? currentItemTitle, int? notificationId) =>
|
|
|
|
_channel.invokeMethod("notifyDownloadProgress", <String, dynamic>{
|
|
|
|
"progress": progress,
|
|
|
|
"max": max,
|
|
|
|
"currentItemTitle": currentItemTitle,
|
|
|
|
"notificationId": notificationId,
|
|
|
|
});
|
|
|
|
|
|
|
|
static Future<int?> notifyLogSaveSuccessful(String fileUri) =>
|
2021-09-10 13:46:15 +02:00
|
|
|
_channel.invokeMethod("notifyLogSaveSuccessful", <String, dynamic>{
|
|
|
|
"fileUri": fileUri,
|
|
|
|
});
|
|
|
|
|
2021-10-02 11:12:54 +02:00
|
|
|
static Future<void> dismiss(int notificationId) =>
|
|
|
|
_channel.invokeMethod("dismiss", <String, dynamic>{
|
|
|
|
"notificationId": notificationId,
|
|
|
|
});
|
|
|
|
|
2022-03-11 15:44:43 +01:00
|
|
|
static const _channel =
|
|
|
|
MethodChannel("com.nkming.nc_photos.plugin/notification");
|
2021-04-30 18:58:05 +02:00
|
|
|
}
|