feat: Move the notification code back into moxxy_native
This commit is contained in:
@@ -1 +1,2 @@
|
||||
export 'pigeon/picker.dart';
|
||||
export 'pigeon/notifications.g.dart';
|
||||
export 'pigeon/picker.g.dart';
|
||||
|
||||
695
lib/pigeon/notifications.g.dart
Normal file
695
lib/pigeon/notifications.g.dart
Normal file
@@ -0,0 +1,695 @@
|
||||
// Autogenerated from Pigeon (v11.0.1), do not edit directly.
|
||||
// See also: https://pub.dev/packages/pigeon
|
||||
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
|
||||
|
||||
import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
enum NotificationIcon {
|
||||
warning,
|
||||
error,
|
||||
none,
|
||||
}
|
||||
|
||||
enum NotificationEventType {
|
||||
markAsRead,
|
||||
reply,
|
||||
open,
|
||||
}
|
||||
|
||||
enum NotificationChannelImportance {
|
||||
MIN,
|
||||
HIGH,
|
||||
DEFAULT,
|
||||
}
|
||||
|
||||
class NotificationMessageContent {
|
||||
NotificationMessageContent({
|
||||
this.body,
|
||||
this.mime,
|
||||
this.path,
|
||||
});
|
||||
|
||||
/// The textual body of the message.
|
||||
String? body;
|
||||
|
||||
/// The path and mime type of the media to show.
|
||||
String? mime;
|
||||
|
||||
String? path;
|
||||
|
||||
Object encode() {
|
||||
return <Object?>[
|
||||
body,
|
||||
mime,
|
||||
path,
|
||||
];
|
||||
}
|
||||
|
||||
static NotificationMessageContent decode(Object result) {
|
||||
result as List<Object?>;
|
||||
return NotificationMessageContent(
|
||||
body: result[0] as String?,
|
||||
mime: result[1] as String?,
|
||||
path: result[2] as String?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class NotificationMessage {
|
||||
NotificationMessage({
|
||||
this.groupId,
|
||||
this.sender,
|
||||
this.jid,
|
||||
required this.content,
|
||||
required this.timestamp,
|
||||
this.avatarPath,
|
||||
});
|
||||
|
||||
/// The grouping key for the notification.
|
||||
String? groupId;
|
||||
|
||||
/// The sender of the message.
|
||||
String? sender;
|
||||
|
||||
/// The jid of the sender.
|
||||
String? jid;
|
||||
|
||||
/// The body of the message.
|
||||
NotificationMessageContent content;
|
||||
|
||||
/// Milliseconds since epoch.
|
||||
int timestamp;
|
||||
|
||||
/// The path to the avatar to use
|
||||
String? avatarPath;
|
||||
|
||||
Object encode() {
|
||||
return <Object?>[
|
||||
groupId,
|
||||
sender,
|
||||
jid,
|
||||
content.encode(),
|
||||
timestamp,
|
||||
avatarPath,
|
||||
];
|
||||
}
|
||||
|
||||
static NotificationMessage decode(Object result) {
|
||||
result as List<Object?>;
|
||||
return NotificationMessage(
|
||||
groupId: result[0] as String?,
|
||||
sender: result[1] as String?,
|
||||
jid: result[2] as String?,
|
||||
content: NotificationMessageContent.decode(result[3]! as List<Object?>),
|
||||
timestamp: result[4]! as int,
|
||||
avatarPath: result[5] as String?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MessagingNotification {
|
||||
MessagingNotification({
|
||||
required this.title,
|
||||
required this.id,
|
||||
required this.channelId,
|
||||
required this.jid,
|
||||
required this.messages,
|
||||
required this.isGroupchat,
|
||||
this.groupId,
|
||||
this.extra,
|
||||
});
|
||||
|
||||
/// The title of the conversation.
|
||||
String title;
|
||||
|
||||
/// The id of the notification.
|
||||
int id;
|
||||
|
||||
/// The id of the notification channel the notification should appear on.
|
||||
String channelId;
|
||||
|
||||
/// The JID of the chat in which the notifications happen.
|
||||
String jid;
|
||||
|
||||
/// Messages to show.
|
||||
List<NotificationMessage?> messages;
|
||||
|
||||
/// Flag indicating whether this notification is from a groupchat or not.
|
||||
bool isGroupchat;
|
||||
|
||||
/// The id for notification grouping.
|
||||
String? groupId;
|
||||
|
||||
/// Additional data to include.
|
||||
Map<String?, String?>? extra;
|
||||
|
||||
Object encode() {
|
||||
return <Object?>[
|
||||
title,
|
||||
id,
|
||||
channelId,
|
||||
jid,
|
||||
messages,
|
||||
isGroupchat,
|
||||
groupId,
|
||||
extra,
|
||||
];
|
||||
}
|
||||
|
||||
static MessagingNotification decode(Object result) {
|
||||
result as List<Object?>;
|
||||
return MessagingNotification(
|
||||
title: result[0]! as String,
|
||||
id: result[1]! as int,
|
||||
channelId: result[2]! as String,
|
||||
jid: result[3]! as String,
|
||||
messages: (result[4] as List<Object?>?)!.cast<NotificationMessage?>(),
|
||||
isGroupchat: result[5]! as bool,
|
||||
groupId: result[6] as String?,
|
||||
extra: (result[7] as Map<Object?, Object?>?)?.cast<String?, String?>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class RegularNotification {
|
||||
RegularNotification({
|
||||
required this.title,
|
||||
required this.body,
|
||||
required this.channelId,
|
||||
this.groupId,
|
||||
required this.id,
|
||||
required this.icon,
|
||||
});
|
||||
|
||||
/// The title of the notification.
|
||||
String title;
|
||||
|
||||
/// The body of the notification.
|
||||
String body;
|
||||
|
||||
/// The id of the channel to show the notification on.
|
||||
String channelId;
|
||||
|
||||
/// The id for notification grouping.
|
||||
String? groupId;
|
||||
|
||||
/// The id of the notification.
|
||||
int id;
|
||||
|
||||
/// The icon to use.
|
||||
NotificationIcon icon;
|
||||
|
||||
Object encode() {
|
||||
return <Object?>[
|
||||
title,
|
||||
body,
|
||||
channelId,
|
||||
groupId,
|
||||
id,
|
||||
icon.index,
|
||||
];
|
||||
}
|
||||
|
||||
static RegularNotification decode(Object result) {
|
||||
result as List<Object?>;
|
||||
return RegularNotification(
|
||||
title: result[0]! as String,
|
||||
body: result[1]! as String,
|
||||
channelId: result[2]! as String,
|
||||
groupId: result[3] as String?,
|
||||
id: result[4]! as int,
|
||||
icon: NotificationIcon.values[result[5]! as int],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class NotificationEvent {
|
||||
NotificationEvent({
|
||||
required this.id,
|
||||
required this.jid,
|
||||
required this.type,
|
||||
this.payload,
|
||||
this.extra,
|
||||
});
|
||||
|
||||
/// The notification id.
|
||||
int id;
|
||||
|
||||
/// The JID the notification was for.
|
||||
String jid;
|
||||
|
||||
/// The type of event.
|
||||
NotificationEventType type;
|
||||
|
||||
/// An optional payload.
|
||||
/// - type == NotificationType.reply: The reply message text.
|
||||
/// Otherwise: undefined.
|
||||
String? payload;
|
||||
|
||||
/// Extra data. Only set when type == NotificationType.reply.
|
||||
Map<String?, String?>? extra;
|
||||
|
||||
Object encode() {
|
||||
return <Object?>[
|
||||
id,
|
||||
jid,
|
||||
type.index,
|
||||
payload,
|
||||
extra,
|
||||
];
|
||||
}
|
||||
|
||||
static NotificationEvent decode(Object result) {
|
||||
result as List<Object?>;
|
||||
return NotificationEvent(
|
||||
id: result[0]! as int,
|
||||
jid: result[1]! as String,
|
||||
type: NotificationEventType.values[result[2]! as int],
|
||||
payload: result[3] as String?,
|
||||
extra: (result[4] as Map<Object?, Object?>?)?.cast<String?, String?>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class NotificationI18nData {
|
||||
NotificationI18nData({
|
||||
required this.reply,
|
||||
required this.markAsRead,
|
||||
required this.you,
|
||||
});
|
||||
|
||||
/// The content of the reply button.
|
||||
String reply;
|
||||
|
||||
/// The content of the "mark as read" button.
|
||||
String markAsRead;
|
||||
|
||||
/// The text to show when *you* reply.
|
||||
String you;
|
||||
|
||||
Object encode() {
|
||||
return <Object?>[
|
||||
reply,
|
||||
markAsRead,
|
||||
you,
|
||||
];
|
||||
}
|
||||
|
||||
static NotificationI18nData decode(Object result) {
|
||||
result as List<Object?>;
|
||||
return NotificationI18nData(
|
||||
reply: result[0]! as String,
|
||||
markAsRead: result[1]! as String,
|
||||
you: result[2]! as String,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class NotificationGroup {
|
||||
NotificationGroup({
|
||||
required this.id,
|
||||
required this.description,
|
||||
});
|
||||
|
||||
String id;
|
||||
|
||||
String description;
|
||||
|
||||
Object encode() {
|
||||
return <Object?>[
|
||||
id,
|
||||
description,
|
||||
];
|
||||
}
|
||||
|
||||
static NotificationGroup decode(Object result) {
|
||||
result as List<Object?>;
|
||||
return NotificationGroup(
|
||||
id: result[0]! as String,
|
||||
description: result[1]! as String,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class NotificationChannel {
|
||||
NotificationChannel({
|
||||
required this.title,
|
||||
required this.description,
|
||||
required this.id,
|
||||
required this.importance,
|
||||
required this.showBadge,
|
||||
this.groupId,
|
||||
required this.vibration,
|
||||
required this.enableLights,
|
||||
});
|
||||
|
||||
String title;
|
||||
|
||||
String description;
|
||||
|
||||
String id;
|
||||
|
||||
NotificationChannelImportance importance;
|
||||
|
||||
bool showBadge;
|
||||
|
||||
String? groupId;
|
||||
|
||||
bool vibration;
|
||||
|
||||
bool enableLights;
|
||||
|
||||
Object encode() {
|
||||
return <Object?>[
|
||||
title,
|
||||
description,
|
||||
id,
|
||||
importance.index,
|
||||
showBadge,
|
||||
groupId,
|
||||
vibration,
|
||||
enableLights,
|
||||
];
|
||||
}
|
||||
|
||||
static NotificationChannel decode(Object result) {
|
||||
result as List<Object?>;
|
||||
return NotificationChannel(
|
||||
title: result[0]! as String,
|
||||
description: result[1]! as String,
|
||||
id: result[2]! as String,
|
||||
importance: NotificationChannelImportance.values[result[3]! as int],
|
||||
showBadge: result[4]! as bool,
|
||||
groupId: result[5] as String?,
|
||||
vibration: result[6]! as bool,
|
||||
enableLights: result[7]! as bool,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _MoxxyNotificationsApiCodec extends StandardMessageCodec {
|
||||
const _MoxxyNotificationsApiCodec();
|
||||
@override
|
||||
void writeValue(WriteBuffer buffer, Object? value) {
|
||||
if (value is MessagingNotification) {
|
||||
buffer.putUint8(128);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is NotificationChannel) {
|
||||
buffer.putUint8(129);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is NotificationEvent) {
|
||||
buffer.putUint8(130);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is NotificationGroup) {
|
||||
buffer.putUint8(131);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is NotificationI18nData) {
|
||||
buffer.putUint8(132);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is NotificationMessage) {
|
||||
buffer.putUint8(133);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is NotificationMessageContent) {
|
||||
buffer.putUint8(134);
|
||||
writeValue(buffer, value.encode());
|
||||
} else if (value is RegularNotification) {
|
||||
buffer.putUint8(135);
|
||||
writeValue(buffer, value.encode());
|
||||
} else {
|
||||
super.writeValue(buffer, value);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Object? readValueOfType(int type, ReadBuffer buffer) {
|
||||
switch (type) {
|
||||
case 128:
|
||||
return MessagingNotification.decode(readValue(buffer)!);
|
||||
case 129:
|
||||
return NotificationChannel.decode(readValue(buffer)!);
|
||||
case 130:
|
||||
return NotificationEvent.decode(readValue(buffer)!);
|
||||
case 131:
|
||||
return NotificationGroup.decode(readValue(buffer)!);
|
||||
case 132:
|
||||
return NotificationI18nData.decode(readValue(buffer)!);
|
||||
case 133:
|
||||
return NotificationMessage.decode(readValue(buffer)!);
|
||||
case 134:
|
||||
return NotificationMessageContent.decode(readValue(buffer)!);
|
||||
case 135:
|
||||
return RegularNotification.decode(readValue(buffer)!);
|
||||
default:
|
||||
return super.readValueOfType(type, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MoxxyNotificationsApi {
|
||||
/// Constructor for [MoxxyNotificationsApi]. The [binaryMessenger] named argument is
|
||||
/// available for dependency injection. If it is left null, the default
|
||||
/// BinaryMessenger will be used which routes to the host platform.
|
||||
MoxxyNotificationsApi({BinaryMessenger? binaryMessenger})
|
||||
: _binaryMessenger = binaryMessenger;
|
||||
final BinaryMessenger? _binaryMessenger;
|
||||
|
||||
static const MessageCodec<Object?> codec = _MoxxyNotificationsApiCodec();
|
||||
|
||||
/// Notification APIs
|
||||
Future<void> createNotificationGroups(
|
||||
List<NotificationGroup?> arg_groups) async {
|
||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.moxxy_native.MoxxyNotificationsApi.createNotificationGroups',
|
||||
codec,
|
||||
binaryMessenger: _binaryMessenger);
|
||||
final List<Object?>? replyList =
|
||||
await channel.send(<Object?>[arg_groups]) as List<Object?>?;
|
||||
if (replyList == null) {
|
||||
throw PlatformException(
|
||||
code: 'channel-error',
|
||||
message: 'Unable to establish connection on channel.',
|
||||
);
|
||||
} else if (replyList.length > 1) {
|
||||
throw PlatformException(
|
||||
code: replyList[0]! as String,
|
||||
message: replyList[1] as String?,
|
||||
details: replyList[2],
|
||||
);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> deleteNotificationGroups(List<String?> arg_ids) async {
|
||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.moxxy_native.MoxxyNotificationsApi.deleteNotificationGroups',
|
||||
codec,
|
||||
binaryMessenger: _binaryMessenger);
|
||||
final List<Object?>? replyList =
|
||||
await channel.send(<Object?>[arg_ids]) as List<Object?>?;
|
||||
if (replyList == null) {
|
||||
throw PlatformException(
|
||||
code: 'channel-error',
|
||||
message: 'Unable to establish connection on channel.',
|
||||
);
|
||||
} else if (replyList.length > 1) {
|
||||
throw PlatformException(
|
||||
code: replyList[0]! as String,
|
||||
message: replyList[1] as String?,
|
||||
details: replyList[2],
|
||||
);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> createNotificationChannels(
|
||||
List<NotificationChannel?> arg_channels) async {
|
||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.moxxy_native.MoxxyNotificationsApi.createNotificationChannels',
|
||||
codec,
|
||||
binaryMessenger: _binaryMessenger);
|
||||
final List<Object?>? replyList =
|
||||
await channel.send(<Object?>[arg_channels]) as List<Object?>?;
|
||||
if (replyList == null) {
|
||||
throw PlatformException(
|
||||
code: 'channel-error',
|
||||
message: 'Unable to establish connection on channel.',
|
||||
);
|
||||
} else if (replyList.length > 1) {
|
||||
throw PlatformException(
|
||||
code: replyList[0]! as String,
|
||||
message: replyList[1] as String?,
|
||||
details: replyList[2],
|
||||
);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> deleteNotificationChannels(List<String?> arg_ids) async {
|
||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.moxxy_native.MoxxyNotificationsApi.deleteNotificationChannels',
|
||||
codec,
|
||||
binaryMessenger: _binaryMessenger);
|
||||
final List<Object?>? replyList =
|
||||
await channel.send(<Object?>[arg_ids]) as List<Object?>?;
|
||||
if (replyList == null) {
|
||||
throw PlatformException(
|
||||
code: 'channel-error',
|
||||
message: 'Unable to establish connection on channel.',
|
||||
);
|
||||
} else if (replyList.length > 1) {
|
||||
throw PlatformException(
|
||||
code: replyList[0]! as String,
|
||||
message: replyList[1] as String?,
|
||||
details: replyList[2],
|
||||
);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> showMessagingNotification(
|
||||
MessagingNotification arg_notification) async {
|
||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.moxxy_native.MoxxyNotificationsApi.showMessagingNotification',
|
||||
codec,
|
||||
binaryMessenger: _binaryMessenger);
|
||||
final List<Object?>? replyList =
|
||||
await channel.send(<Object?>[arg_notification]) as List<Object?>?;
|
||||
if (replyList == null) {
|
||||
throw PlatformException(
|
||||
code: 'channel-error',
|
||||
message: 'Unable to establish connection on channel.',
|
||||
);
|
||||
} else if (replyList.length > 1) {
|
||||
throw PlatformException(
|
||||
code: replyList[0]! as String,
|
||||
message: replyList[1] as String?,
|
||||
details: replyList[2],
|
||||
);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> showNotification(RegularNotification arg_notification) async {
|
||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.moxxy_native.MoxxyNotificationsApi.showNotification',
|
||||
codec,
|
||||
binaryMessenger: _binaryMessenger);
|
||||
final List<Object?>? replyList =
|
||||
await channel.send(<Object?>[arg_notification]) as List<Object?>?;
|
||||
if (replyList == null) {
|
||||
throw PlatformException(
|
||||
code: 'channel-error',
|
||||
message: 'Unable to establish connection on channel.',
|
||||
);
|
||||
} else if (replyList.length > 1) {
|
||||
throw PlatformException(
|
||||
code: replyList[0]! as String,
|
||||
message: replyList[1] as String?,
|
||||
details: replyList[2],
|
||||
);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> dismissNotification(int arg_id) async {
|
||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.moxxy_native.MoxxyNotificationsApi.dismissNotification',
|
||||
codec,
|
||||
binaryMessenger: _binaryMessenger);
|
||||
final List<Object?>? replyList =
|
||||
await channel.send(<Object?>[arg_id]) as List<Object?>?;
|
||||
if (replyList == null) {
|
||||
throw PlatformException(
|
||||
code: 'channel-error',
|
||||
message: 'Unable to establish connection on channel.',
|
||||
);
|
||||
} else if (replyList.length > 1) {
|
||||
throw PlatformException(
|
||||
code: replyList[0]! as String,
|
||||
message: replyList[1] as String?,
|
||||
details: replyList[2],
|
||||
);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> setNotificationSelfAvatar(String arg_path) async {
|
||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.moxxy_native.MoxxyNotificationsApi.setNotificationSelfAvatar',
|
||||
codec,
|
||||
binaryMessenger: _binaryMessenger);
|
||||
final List<Object?>? replyList =
|
||||
await channel.send(<Object?>[arg_path]) as List<Object?>?;
|
||||
if (replyList == null) {
|
||||
throw PlatformException(
|
||||
code: 'channel-error',
|
||||
message: 'Unable to establish connection on channel.',
|
||||
);
|
||||
} else if (replyList.length > 1) {
|
||||
throw PlatformException(
|
||||
code: replyList[0]! as String,
|
||||
message: replyList[1] as String?,
|
||||
details: replyList[2],
|
||||
);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> setNotificationI18n(NotificationI18nData arg_data) async {
|
||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.moxxy_native.MoxxyNotificationsApi.setNotificationI18n',
|
||||
codec,
|
||||
binaryMessenger: _binaryMessenger);
|
||||
final List<Object?>? replyList =
|
||||
await channel.send(<Object?>[arg_data]) as List<Object?>?;
|
||||
if (replyList == null) {
|
||||
throw PlatformException(
|
||||
code: 'channel-error',
|
||||
message: 'Unable to establish connection on channel.',
|
||||
);
|
||||
} else if (replyList.length > 1) {
|
||||
throw PlatformException(
|
||||
code: replyList[0]! as String,
|
||||
message: replyList[1] as String?,
|
||||
details: replyList[2],
|
||||
);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> notificationStub(NotificationEvent arg_event) async {
|
||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.moxxy_native.MoxxyNotificationsApi.notificationStub',
|
||||
codec,
|
||||
binaryMessenger: _binaryMessenger);
|
||||
final List<Object?>? replyList =
|
||||
await channel.send(<Object?>[arg_event]) as List<Object?>?;
|
||||
if (replyList == null) {
|
||||
throw PlatformException(
|
||||
code: 'channel-error',
|
||||
message: 'Unable to establish connection on channel.',
|
||||
);
|
||||
} else if (replyList.length > 1) {
|
||||
throw PlatformException(
|
||||
code: replyList[0]! as String,
|
||||
message: replyList[1] as String?,
|
||||
details: replyList[2],
|
||||
);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,13 @@ import 'package:flutter/services.dart';
|
||||
enum FilePickerType {
|
||||
/// Pick only image(s)
|
||||
image,
|
||||
|
||||
/// Pick only video(s)
|
||||
video,
|
||||
|
||||
/// Pick image(s) and video(s)
|
||||
imageAndVideo,
|
||||
|
||||
/// Pick any kind of file(s)
|
||||
generic,
|
||||
}
|
||||
@@ -37,12 +40,13 @@ class MoxxyPickerApi {
|
||||
///
|
||||
/// [multiple] controls whether multiple files can be picked (true) or just a single file
|
||||
/// is enough (false).
|
||||
Future<List<String?>> pickFiles(FilePickerType arg_type, bool arg_multiple) async {
|
||||
Future<List<String?>> pickFiles(
|
||||
FilePickerType arg_type, bool arg_multiple) async {
|
||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.moxxy_native.MoxxyPickerApi.pickFiles', codec,
|
||||
binaryMessenger: _binaryMessenger);
|
||||
final List<Object?>? replyList =
|
||||
await channel.send(<Object?>[arg_type.index, arg_multiple]) as List<Object?>?;
|
||||
final List<Object?>? replyList = await channel
|
||||
.send(<Object?>[arg_type.index, arg_multiple]) as List<Object?>?;
|
||||
if (replyList == null) {
|
||||
throw PlatformException(
|
||||
code: 'channel-error',
|
||||
@@ -67,7 +71,8 @@ class MoxxyPickerApi {
|
||||
/// Like [pickFiles] but sets multiple to false and returns the raw binary data from the file.
|
||||
Future<Uint8List?> pickFileWithData(FilePickerType arg_type) async {
|
||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||
'dev.flutter.pigeon.moxxy_native.MoxxyPickerApi.pickFileWithData', codec,
|
||||
'dev.flutter.pigeon.moxxy_native.MoxxyPickerApi.pickFileWithData',
|
||||
codec,
|
||||
binaryMessenger: _binaryMessenger);
|
||||
final List<Object?>? replyList =
|
||||
await channel.send(<Object?>[arg_type.index]) as List<Object?>?;
|
||||
Reference in New Issue
Block a user