fix: Format and lint
This commit is contained in:
parent
b12e36da83
commit
43e88af803
@ -1,4 +1,8 @@
|
|||||||
include: package:very_good_analysis/analysis_options.yaml
|
include: package:very_good_analysis/analysis_options.yaml
|
||||||
|
analyzer:
|
||||||
|
exclude:
|
||||||
|
- lib/src/api.g.dart
|
||||||
|
|
||||||
linter:
|
linter:
|
||||||
rules:
|
rules:
|
||||||
public_member_api_docs: false
|
public_member_api_docs: false
|
||||||
|
@ -4,9 +4,7 @@ import 'dart:typed_data';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:moxplatform/moxplatform.dart';
|
import 'package:moxplatform/moxplatform.dart';
|
||||||
import 'package:moxplatform_platform_interface/moxplatform_platform_interface.dart';
|
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:file_picker/file_picker.dart';
|
|
||||||
|
|
||||||
/// The id of the notification channel.
|
/// The id of the notification channel.
|
||||||
const channelId = "me.polynom.moxplatform.testing3";
|
const channelId = "me.polynom.moxplatform.testing3";
|
||||||
@ -63,7 +61,10 @@ class MyAppState extends State<MyApp> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
MoxplatformPlugin.notifications.getEventStream().listen((event) {
|
MoxplatformPlugin.notifications.getEventStream().listen((event) {
|
||||||
print('NotificationEvent(type: ${event.type}, jid: ${event.jid}, payload: ${event.payload}, extras: ${event.extra})');
|
// ignore: avoid_print
|
||||||
|
print(
|
||||||
|
'NotificationEvent(type: ${event.type}, jid: ${event.jid}, payload: ${event.payload}, extras: ${event.extra})',
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,14 +75,19 @@ class MyAppState extends State<MyApp> {
|
|||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
primarySwatch: Colors.blue,
|
primarySwatch: Colors.blue,
|
||||||
),
|
),
|
||||||
home: MyHomePage(),
|
home: const MyHomePage(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyHomePage extends StatelessWidget {
|
class MyHomePage extends StatefulWidget {
|
||||||
MyHomePage({super.key});
|
const MyHomePage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
MyHomePageState createState() => MyHomePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyHomePageState extends State<MyHomePage> {
|
||||||
/// List of "Message senders".
|
/// List of "Message senders".
|
||||||
final List<Sender> senders = const [
|
final List<Sender> senders = const [
|
||||||
Sender('Mash Kyrielight', 'mash@example.org'),
|
Sender('Mash Kyrielight', 'mash@example.org'),
|
||||||
@ -90,7 +96,8 @@ class MyHomePage extends StatelessWidget {
|
|||||||
];
|
];
|
||||||
|
|
||||||
/// List of sent messages.
|
/// List of sent messages.
|
||||||
List<NotificationMessage> messages = List<NotificationMessage>.empty(growable: true);
|
List<NotificationMessage> messages =
|
||||||
|
List<NotificationMessage>.empty(growable: true);
|
||||||
|
|
||||||
Future<void> _cryptoTest() async {
|
Future<void> _cryptoTest() async {
|
||||||
final result = await FilePicker.platform.pickFiles();
|
final result = await FilePicker.platform.pickFiles();
|
||||||
@ -111,10 +118,13 @@ class MyHomePage extends StatelessWidget {
|
|||||||
final end = DateTime.now();
|
final end = DateTime.now();
|
||||||
|
|
||||||
final diff = end.millisecondsSinceEpoch - start.millisecondsSinceEpoch;
|
final diff = end.millisecondsSinceEpoch - start.millisecondsSinceEpoch;
|
||||||
|
// ignore: avoid_print
|
||||||
print('TIME: ${diff / 1000}s');
|
print('TIME: ${diff / 1000}s');
|
||||||
|
// ignore: avoid_print
|
||||||
print('DONE (${enc != null})');
|
print('DONE (${enc != null})');
|
||||||
final lengthEnc = await File('$path.enc').length();
|
final lengthEnc = await File('$path.enc').length();
|
||||||
final lengthOrig = await File(path).length();
|
final lengthOrig = await File(path).length();
|
||||||
|
// ignore: avoid_print
|
||||||
print('Encrypted file is $lengthEnc Bytes large (Orig $lengthOrig)');
|
print('Encrypted file is $lengthEnc Bytes large (Orig $lengthOrig)');
|
||||||
|
|
||||||
await MoxplatformPlugin.crypto.decryptFile(
|
await MoxplatformPlugin.crypto.decryptFile(
|
||||||
@ -125,9 +135,11 @@ class MyHomePage extends StatelessWidget {
|
|||||||
CipherAlgorithm.aes256CbcPkcs7,
|
CipherAlgorithm.aes256CbcPkcs7,
|
||||||
'SHA-256',
|
'SHA-256',
|
||||||
);
|
);
|
||||||
|
// ignore: avoid_print
|
||||||
print('DONE');
|
print('DONE');
|
||||||
|
|
||||||
final lengthDec = await File('$path.dec').length();
|
final lengthDec = await File('$path.dec').length();
|
||||||
|
// ignore: avoid_print
|
||||||
print('Decrypted file is $lengthDec Bytes large (Orig $lengthOrig)');
|
print('Decrypted file is $lengthDec Bytes large (Orig $lengthOrig)');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,13 +164,15 @@ class MyHomePage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
MoxplatformPlugin.contacts.recordSentMessage('Person', 'Person', fallbackIcon: FallbackIconType.person);
|
MoxplatformPlugin.contacts.recordSentMessage('Person', 'Person',
|
||||||
|
fallbackIcon: FallbackIconType.person);
|
||||||
},
|
},
|
||||||
child: const Text('Test recordSentMessage (person fallback)'),
|
child: const Text('Test recordSentMessage (person fallback)'),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
MoxplatformPlugin.contacts.recordSentMessage('Notes', 'Notes', fallbackIcon: FallbackIconType.notes);
|
MoxplatformPlugin.contacts.recordSentMessage('Notes', 'Notes',
|
||||||
|
fallbackIcon: FallbackIconType.notes);
|
||||||
},
|
},
|
||||||
child: const Text('Test recordSentMessage (notes fallback)'),
|
child: const Text('Test recordSentMessage (notes fallback)'),
|
||||||
),
|
),
|
||||||
@ -167,23 +181,22 @@ class MyHomePage extends StatelessWidget {
|
|||||||
final result = await FilePicker.platform.pickFiles(
|
final result = await FilePicker.platform.pickFiles(
|
||||||
type: FileType.image,
|
type: FileType.image,
|
||||||
);
|
);
|
||||||
|
// ignore: avoid_print
|
||||||
print('Picked file: ${result?.files.single.path}');
|
print('Picked file: ${result?.files.single.path}');
|
||||||
|
|
||||||
// Create a new message.
|
// Create a new message.
|
||||||
final senderIndex = Random().nextInt(senders.length);
|
final senderIndex = Random().nextInt(senders.length);
|
||||||
final time = DateTime.now().millisecondsSinceEpoch;
|
final time = DateTime.now().millisecondsSinceEpoch;
|
||||||
messages.add(
|
messages.add(NotificationMessage(
|
||||||
NotificationMessage(
|
jid: senders[senderIndex].jid,
|
||||||
jid: senders[senderIndex].jid,
|
sender: senders[senderIndex].name,
|
||||||
sender: senders[senderIndex].name,
|
content: NotificationMessageContent(
|
||||||
content: NotificationMessageContent(
|
body: result != null ? null : 'Message #${messages.length}',
|
||||||
body: result != null ? null : 'Message #${messages.length}',
|
mime: 'image/jpeg',
|
||||||
mime: 'image/jpeg',
|
path: result?.files.single.path,
|
||||||
path: result?.files.single.path,
|
),
|
||||||
),
|
timestamp: time,
|
||||||
timestamp: time,
|
));
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
await Future<void>.delayed(const Duration(seconds: 4));
|
await Future<void>.delayed(const Duration(seconds: 4));
|
||||||
await MoxplatformPlugin.notifications.showMessagingNotification(
|
await MoxplatformPlugin.notifications.showMessagingNotification(
|
||||||
@ -239,18 +252,21 @@ class MyHomePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
if (result == null) return;
|
if (result == null) return;
|
||||||
|
|
||||||
MoxplatformPlugin.notifications.setNotificationSelfAvatar(result.files.single.path!);
|
MoxplatformPlugin.notifications
|
||||||
|
.setNotificationSelfAvatar(result.files.single.path!);
|
||||||
},
|
},
|
||||||
child: const Text('Set notification self-avatar'),
|
child: const Text('Set notification self-avatar'),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
// ignore: avoid_print
|
||||||
print(await MoxplatformPlugin.platform.getPersistentDataPath());
|
print(await MoxplatformPlugin.platform.getPersistentDataPath());
|
||||||
},
|
},
|
||||||
child: const Text('Get data directory'),
|
child: const Text('Get data directory'),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
// ignore: avoid_print
|
||||||
print(await MoxplatformPlugin.platform.getCacheDataPath());
|
print(await MoxplatformPlugin.platform.getCacheDataPath());
|
||||||
},
|
},
|
||||||
child: const Text('Get cache directory'),
|
child: const Text('Get cache directory'),
|
||||||
|
@ -8,5 +8,7 @@ command:
|
|||||||
usePubspecOverrides: true
|
usePubspecOverrides: true
|
||||||
|
|
||||||
scripts:
|
scripts:
|
||||||
|
format:
|
||||||
|
exec: dart format .
|
||||||
analyze:
|
analyze:
|
||||||
exec: dart analyze .
|
exec: flutter analyze
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
library moxplatform;
|
library moxplatform;
|
||||||
|
|
||||||
|
export 'package:moxplatform_platform_interface/moxplatform_platform_interface.dart';
|
||||||
|
|
||||||
export 'src/plugin.dart';
|
export 'src/plugin.dart';
|
||||||
export 'src/types.dart';
|
export 'src/types.dart';
|
||||||
|
@ -4,6 +4,7 @@ class MoxplatformPlugin {
|
|||||||
static IsolateHandler get handler => MoxplatformInterface.handler;
|
static IsolateHandler get handler => MoxplatformInterface.handler;
|
||||||
static CryptographyImplementation get crypto => MoxplatformInterface.crypto;
|
static CryptographyImplementation get crypto => MoxplatformInterface.crypto;
|
||||||
static ContactsImplementation get contacts => MoxplatformInterface.contacts;
|
static ContactsImplementation get contacts => MoxplatformInterface.contacts;
|
||||||
static NotificationsImplementation get notifications => MoxplatformInterface.notifications;
|
static NotificationsImplementation get notifications =>
|
||||||
|
MoxplatformInterface.notifications;
|
||||||
static PlatformImplementation get platform => MoxplatformInterface.platform;
|
static PlatformImplementation get platform => MoxplatformInterface.platform;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
|
@ -1,5 +1,4 @@
|
|||||||
import 'package:moxplatform_platform_interface/moxplatform_platform_interface.dart';
|
import 'package:moxplatform_platform_interface/moxplatform_platform_interface.dart';
|
||||||
import 'package:moxplatform_platform_interface/src/api.g.dart';
|
|
||||||
|
|
||||||
class AndroidContactsImplementation extends ContactsImplementation {
|
class AndroidContactsImplementation extends ContactsImplementation {
|
||||||
final MoxplatformApi _api = MoxplatformApi();
|
final MoxplatformApi _api = MoxplatformApi();
|
||||||
|
@ -7,7 +7,6 @@ import 'package:logging/logging.dart';
|
|||||||
import 'package:moxlib/moxlib.dart';
|
import 'package:moxlib/moxlib.dart';
|
||||||
import 'package:moxplatform/moxplatform.dart';
|
import 'package:moxplatform/moxplatform.dart';
|
||||||
import 'package:moxplatform_android/src/service_android.dart';
|
import 'package:moxplatform_android/src/service_android.dart';
|
||||||
import 'package:moxplatform_platform_interface/moxplatform_platform_interface.dart';
|
|
||||||
|
|
||||||
/// An [AwaitableDataSender] that uses flutter_background_service.
|
/// An [AwaitableDataSender] that uses flutter_background_service.
|
||||||
class BackgroundServiceDataSender
|
class BackgroundServiceDataSender
|
||||||
|
@ -6,7 +6,6 @@ import 'package:logging/logging.dart';
|
|||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'package:moxlib/moxlib.dart';
|
import 'package:moxlib/moxlib.dart';
|
||||||
import 'package:moxplatform/moxplatform.dart';
|
import 'package:moxplatform/moxplatform.dart';
|
||||||
import 'package:moxplatform_platform_interface/moxplatform_platform_interface.dart';
|
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
class AndroidBackgroundService extends BackgroundService {
|
class AndroidBackgroundService extends BackgroundService {
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
|
@ -387,12 +387,15 @@ class MoxplatformApi {
|
|||||||
static const MessageCodec<Object?> codec = _MoxplatformApiCodec();
|
static const MessageCodec<Object?> codec = _MoxplatformApiCodec();
|
||||||
|
|
||||||
/// Notification APIs
|
/// Notification APIs
|
||||||
Future<void> createNotificationChannel(String arg_title, String arg_description, String arg_id, bool arg_urgent) async {
|
Future<void> createNotificationChannel(String arg_title,
|
||||||
|
String arg_description, String arg_id, bool arg_urgent) async {
|
||||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.createNotificationChannel', codec,
|
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.createNotificationChannel',
|
||||||
|
codec,
|
||||||
binaryMessenger: _binaryMessenger);
|
binaryMessenger: _binaryMessenger);
|
||||||
final List<Object?>? replyList =
|
final List<Object?>? replyList = await channel
|
||||||
await channel.send(<Object?>[arg_title, arg_description, arg_id, arg_urgent]) as List<Object?>?;
|
.send(<Object?>[arg_title, arg_description, arg_id, arg_urgent])
|
||||||
|
as List<Object?>?;
|
||||||
if (replyList == null) {
|
if (replyList == null) {
|
||||||
throw PlatformException(
|
throw PlatformException(
|
||||||
code: 'channel-error',
|
code: 'channel-error',
|
||||||
@ -409,9 +412,11 @@ class MoxplatformApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> showMessagingNotification(MessagingNotification arg_notification) async {
|
Future<void> showMessagingNotification(
|
||||||
|
MessagingNotification arg_notification) async {
|
||||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.showMessagingNotification', codec,
|
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.showMessagingNotification',
|
||||||
|
codec,
|
||||||
binaryMessenger: _binaryMessenger);
|
binaryMessenger: _binaryMessenger);
|
||||||
final List<Object?>? replyList =
|
final List<Object?>? replyList =
|
||||||
await channel.send(<Object?>[arg_notification]) as List<Object?>?;
|
await channel.send(<Object?>[arg_notification]) as List<Object?>?;
|
||||||
@ -433,7 +438,8 @@ class MoxplatformApi {
|
|||||||
|
|
||||||
Future<void> showNotification(RegularNotification arg_notification) async {
|
Future<void> showNotification(RegularNotification arg_notification) async {
|
||||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.showNotification', codec,
|
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.showNotification',
|
||||||
|
codec,
|
||||||
binaryMessenger: _binaryMessenger);
|
binaryMessenger: _binaryMessenger);
|
||||||
final List<Object?>? replyList =
|
final List<Object?>? replyList =
|
||||||
await channel.send(<Object?>[arg_notification]) as List<Object?>?;
|
await channel.send(<Object?>[arg_notification]) as List<Object?>?;
|
||||||
@ -455,7 +461,8 @@ class MoxplatformApi {
|
|||||||
|
|
||||||
Future<void> dismissNotification(int arg_id) async {
|
Future<void> dismissNotification(int arg_id) async {
|
||||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.dismissNotification', codec,
|
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.dismissNotification',
|
||||||
|
codec,
|
||||||
binaryMessenger: _binaryMessenger);
|
binaryMessenger: _binaryMessenger);
|
||||||
final List<Object?>? replyList =
|
final List<Object?>? replyList =
|
||||||
await channel.send(<Object?>[arg_id]) as List<Object?>?;
|
await channel.send(<Object?>[arg_id]) as List<Object?>?;
|
||||||
@ -477,7 +484,8 @@ class MoxplatformApi {
|
|||||||
|
|
||||||
Future<void> setNotificationSelfAvatar(String arg_path) async {
|
Future<void> setNotificationSelfAvatar(String arg_path) async {
|
||||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.setNotificationSelfAvatar', codec,
|
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.setNotificationSelfAvatar',
|
||||||
|
codec,
|
||||||
binaryMessenger: _binaryMessenger);
|
binaryMessenger: _binaryMessenger);
|
||||||
final List<Object?>? replyList =
|
final List<Object?>? replyList =
|
||||||
await channel.send(<Object?>[arg_path]) as List<Object?>?;
|
await channel.send(<Object?>[arg_path]) as List<Object?>?;
|
||||||
@ -499,7 +507,8 @@ class MoxplatformApi {
|
|||||||
|
|
||||||
Future<void> setNotificationI18n(NotificationI18nData arg_data) async {
|
Future<void> setNotificationI18n(NotificationI18nData arg_data) async {
|
||||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.setNotificationI18n', codec,
|
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.setNotificationI18n',
|
||||||
|
codec,
|
||||||
binaryMessenger: _binaryMessenger);
|
binaryMessenger: _binaryMessenger);
|
||||||
final List<Object?>? replyList =
|
final List<Object?>? replyList =
|
||||||
await channel.send(<Object?>[arg_data]) as List<Object?>?;
|
await channel.send(<Object?>[arg_data]) as List<Object?>?;
|
||||||
@ -522,10 +531,10 @@ class MoxplatformApi {
|
|||||||
/// Platform APIs
|
/// Platform APIs
|
||||||
Future<String> getPersistentDataPath() async {
|
Future<String> getPersistentDataPath() async {
|
||||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.getPersistentDataPath', codec,
|
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.getPersistentDataPath',
|
||||||
|
codec,
|
||||||
binaryMessenger: _binaryMessenger);
|
binaryMessenger: _binaryMessenger);
|
||||||
final List<Object?>? replyList =
|
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
|
||||||
await channel.send(null) as List<Object?>?;
|
|
||||||
if (replyList == null) {
|
if (replyList == null) {
|
||||||
throw PlatformException(
|
throw PlatformException(
|
||||||
code: 'channel-error',
|
code: 'channel-error',
|
||||||
@ -549,10 +558,10 @@ class MoxplatformApi {
|
|||||||
|
|
||||||
Future<String> getCacheDataPath() async {
|
Future<String> getCacheDataPath() async {
|
||||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.getCacheDataPath', codec,
|
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.getCacheDataPath',
|
||||||
|
codec,
|
||||||
binaryMessenger: _binaryMessenger);
|
binaryMessenger: _binaryMessenger);
|
||||||
final List<Object?>? replyList =
|
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
|
||||||
await channel.send(null) as List<Object?>?;
|
|
||||||
if (replyList == null) {
|
if (replyList == null) {
|
||||||
throw PlatformException(
|
throw PlatformException(
|
||||||
code: 'channel-error',
|
code: 'channel-error',
|
||||||
@ -575,12 +584,18 @@ class MoxplatformApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Contacts APIs
|
/// Contacts APIs
|
||||||
Future<void> recordSentMessage(String arg_name, String arg_jid, String? arg_avatarPath, FallbackIconType arg_fallbackIcon) async {
|
Future<void> recordSentMessage(String arg_name, String arg_jid,
|
||||||
|
String? arg_avatarPath, FallbackIconType arg_fallbackIcon) async {
|
||||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.recordSentMessage', codec,
|
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.recordSentMessage',
|
||||||
|
codec,
|
||||||
binaryMessenger: _binaryMessenger);
|
binaryMessenger: _binaryMessenger);
|
||||||
final List<Object?>? replyList =
|
final List<Object?>? replyList = await channel.send(<Object?>[
|
||||||
await channel.send(<Object?>[arg_name, arg_jid, arg_avatarPath, arg_fallbackIcon.index]) as List<Object?>?;
|
arg_name,
|
||||||
|
arg_jid,
|
||||||
|
arg_avatarPath,
|
||||||
|
arg_fallbackIcon.index
|
||||||
|
]) as List<Object?>?;
|
||||||
if (replyList == null) {
|
if (replyList == null) {
|
||||||
throw PlatformException(
|
throw PlatformException(
|
||||||
code: 'channel-error',
|
code: 'channel-error',
|
||||||
@ -598,12 +613,25 @@ class MoxplatformApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Cryptography APIs
|
/// Cryptography APIs
|
||||||
Future<CryptographyResult?> encryptFile(String arg_sourcePath, String arg_destPath, Uint8List arg_key, Uint8List arg_iv, CipherAlgorithm arg_algorithm, String arg_hashSpec) async {
|
Future<CryptographyResult?> encryptFile(
|
||||||
|
String arg_sourcePath,
|
||||||
|
String arg_destPath,
|
||||||
|
Uint8List arg_key,
|
||||||
|
Uint8List arg_iv,
|
||||||
|
CipherAlgorithm arg_algorithm,
|
||||||
|
String arg_hashSpec) async {
|
||||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.encryptFile', codec,
|
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.encryptFile',
|
||||||
|
codec,
|
||||||
binaryMessenger: _binaryMessenger);
|
binaryMessenger: _binaryMessenger);
|
||||||
final List<Object?>? replyList =
|
final List<Object?>? replyList = await channel.send(<Object?>[
|
||||||
await channel.send(<Object?>[arg_sourcePath, arg_destPath, arg_key, arg_iv, arg_algorithm.index, arg_hashSpec]) as List<Object?>?;
|
arg_sourcePath,
|
||||||
|
arg_destPath,
|
||||||
|
arg_key,
|
||||||
|
arg_iv,
|
||||||
|
arg_algorithm.index,
|
||||||
|
arg_hashSpec
|
||||||
|
]) as List<Object?>?;
|
||||||
if (replyList == null) {
|
if (replyList == null) {
|
||||||
throw PlatformException(
|
throw PlatformException(
|
||||||
code: 'channel-error',
|
code: 'channel-error',
|
||||||
@ -620,12 +648,25 @@ class MoxplatformApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<CryptographyResult?> decryptFile(String arg_sourcePath, String arg_destPath, Uint8List arg_key, Uint8List arg_iv, CipherAlgorithm arg_algorithm, String arg_hashSpec) async {
|
Future<CryptographyResult?> decryptFile(
|
||||||
|
String arg_sourcePath,
|
||||||
|
String arg_destPath,
|
||||||
|
Uint8List arg_key,
|
||||||
|
Uint8List arg_iv,
|
||||||
|
CipherAlgorithm arg_algorithm,
|
||||||
|
String arg_hashSpec) async {
|
||||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.decryptFile', codec,
|
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.decryptFile',
|
||||||
|
codec,
|
||||||
binaryMessenger: _binaryMessenger);
|
binaryMessenger: _binaryMessenger);
|
||||||
final List<Object?>? replyList =
|
final List<Object?>? replyList = await channel.send(<Object?>[
|
||||||
await channel.send(<Object?>[arg_sourcePath, arg_destPath, arg_key, arg_iv, arg_algorithm.index, arg_hashSpec]) as List<Object?>?;
|
arg_sourcePath,
|
||||||
|
arg_destPath,
|
||||||
|
arg_key,
|
||||||
|
arg_iv,
|
||||||
|
arg_algorithm.index,
|
||||||
|
arg_hashSpec
|
||||||
|
]) as List<Object?>?;
|
||||||
if (replyList == null) {
|
if (replyList == null) {
|
||||||
throw PlatformException(
|
throw PlatformException(
|
||||||
code: 'channel-error',
|
code: 'channel-error',
|
||||||
@ -642,12 +683,14 @@ class MoxplatformApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Uint8List?> hashFile(String arg_sourcePath, String arg_hashSpec) async {
|
Future<Uint8List?> hashFile(
|
||||||
|
String arg_sourcePath, String arg_hashSpec) async {
|
||||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.hashFile', codec,
|
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.hashFile',
|
||||||
|
codec,
|
||||||
binaryMessenger: _binaryMessenger);
|
binaryMessenger: _binaryMessenger);
|
||||||
final List<Object?>? replyList =
|
final List<Object?>? replyList = await channel
|
||||||
await channel.send(<Object?>[arg_sourcePath, arg_hashSpec]) as List<Object?>?;
|
.send(<Object?>[arg_sourcePath, arg_hashSpec]) as List<Object?>?;
|
||||||
if (replyList == null) {
|
if (replyList == null) {
|
||||||
throw PlatformException(
|
throw PlatformException(
|
||||||
code: 'channel-error',
|
code: 'channel-error',
|
||||||
@ -667,7 +710,8 @@ class MoxplatformApi {
|
|||||||
/// Stubs
|
/// Stubs
|
||||||
Future<void> eventStub(NotificationEvent arg_event) async {
|
Future<void> eventStub(NotificationEvent arg_event) async {
|
||||||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
|
||||||
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.eventStub', codec,
|
'dev.flutter.pigeon.moxplatform_platform_interface.MoxplatformApi.eventStub',
|
||||||
|
codec,
|
||||||
binaryMessenger: _binaryMessenger);
|
binaryMessenger: _binaryMessenger);
|
||||||
final List<Object?>? replyList =
|
final List<Object?>? replyList =
|
||||||
await channel.send(<Object?>[arg_event]) as List<Object?>?;
|
await channel.send(<Object?>[arg_event]) as List<Object?>?;
|
||||||
|
@ -21,7 +21,8 @@ abstract class MoxplatformInterface extends PlatformInterface {
|
|||||||
static IsolateHandler handler = StubIsolateHandler();
|
static IsolateHandler handler = StubIsolateHandler();
|
||||||
static CryptographyImplementation crypto = StubCryptographyImplementation();
|
static CryptographyImplementation crypto = StubCryptographyImplementation();
|
||||||
static ContactsImplementation contacts = StubContactsImplementation();
|
static ContactsImplementation contacts = StubContactsImplementation();
|
||||||
static NotificationsImplementation notifications = StubNotificationsImplementation();
|
static NotificationsImplementation notifications =
|
||||||
|
StubNotificationsImplementation();
|
||||||
static PlatformImplementation platform = StubPlatformImplementation();
|
static PlatformImplementation platform = StubPlatformImplementation();
|
||||||
|
|
||||||
/// Return the current platform name.
|
/// Return the current platform name.
|
||||||
|
@ -4,7 +4,12 @@ import 'package:moxplatform_platform_interface/src/api.g.dart';
|
|||||||
abstract class NotificationsImplementation {
|
abstract class NotificationsImplementation {
|
||||||
/// Creates a notification channel with the name [title] and id [id]. If [urgent] is true, then
|
/// Creates a notification channel with the name [title] and id [id]. If [urgent] is true, then
|
||||||
/// it configures the channel as carrying urgent information.
|
/// it configures the channel as carrying urgent information.
|
||||||
Future<void> createNotificationChannel(String title, String description, String id, bool urgent);
|
Future<void> createNotificationChannel(
|
||||||
|
String title,
|
||||||
|
String description,
|
||||||
|
String id,
|
||||||
|
bool urgent,
|
||||||
|
);
|
||||||
|
|
||||||
/// Shows a notification [notification] in the messaging style with everyting it needs.
|
/// Shows a notification [notification] in the messaging style with everyting it needs.
|
||||||
Future<void> showMessagingNotification(MessagingNotification notification);
|
Future<void> showMessagingNotification(MessagingNotification notification);
|
||||||
|
@ -4,10 +4,17 @@ import 'package:moxplatform_platform_interface/src/notifications.dart';
|
|||||||
|
|
||||||
class StubNotificationsImplementation extends NotificationsImplementation {
|
class StubNotificationsImplementation extends NotificationsImplementation {
|
||||||
@override
|
@override
|
||||||
Future<void> createNotificationChannel(String title, String description, String id, bool urgent) async {}
|
Future<void> createNotificationChannel(
|
||||||
|
String title,
|
||||||
|
String description,
|
||||||
|
String id,
|
||||||
|
bool urgent,
|
||||||
|
) async {}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> showMessagingNotification(MessagingNotification notification) async {}
|
Future<void> showMessagingNotification(
|
||||||
|
MessagingNotification notification,
|
||||||
|
) async {}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> showNotification(RegularNotification notification) async {}
|
Future<void> showNotification(RegularNotification notification) async {}
|
||||||
|
@ -2,8 +2,10 @@ import 'package:moxplatform_platform_interface/src/platform.dart';
|
|||||||
|
|
||||||
class StubPlatformImplementation extends PlatformImplementation {
|
class StubPlatformImplementation extends PlatformImplementation {
|
||||||
/// Returns the path where persistent data should be stored.
|
/// Returns the path where persistent data should be stored.
|
||||||
Future<String> getPersistentDataPath() async => "";
|
@override
|
||||||
|
Future<String> getPersistentDataPath() async => '';
|
||||||
|
|
||||||
/// Returns the path where cache data should be stored.
|
/// Returns the path where cache data should be stored.
|
||||||
Future<String> getCacheDataPath() async => "";
|
@override
|
||||||
|
Future<String> getCacheDataPath() async => '';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user