chore(repo): Fix linter issues

This commit is contained in:
PapaTutuWawa 2023-08-30 20:46:38 +02:00
parent be58288025
commit 7cc2d0e4be
3 changed files with 77 additions and 16 deletions

View File

@ -41,17 +41,27 @@ class MyAppState extends State<MyApp> {
Future<void> initStateAsync() async {
await Permission.notification.request();
await MoxplatformPlugin.notifications.createNotificationChannel(
"Test notification channel",
"Test1",
channelId,
false,
);
await MoxplatformPlugin.notifications.createNotificationChannel(
"Test notification channel for warnings",
"Test2",
otherChannelId,
false,
await MoxplatformPlugin.notifications.createNotificationChannels(
[
NotificationChannel(
id: channelId,
title: "Test1",
description: "Test notification channel",
importance: NotificationChannelImportance.MIN,
showBadge: true,
vibration: false,
enableLights: false,
),
NotificationChannel(
id: otherChannelId,
title: "Test2",
description: "Test notification channel for warnings",
importance: NotificationChannelImportance.MIN,
showBadge: true,
vibration: false,
enableLights: false,
),
],
);
await MoxplatformPlugin.notifications.setI18n(
NotificationI18nData(
@ -303,9 +313,11 @@ class MyHomePageState extends State<MyHomePage> {
}
final internalPath = join(mediaPath, basename(path));
// ignore: avoid_print
print('Copying file');
await File(path).copy(internalPath);
// ignore: avoid_print
print('Generating thumbnail');
final thumbResult =
await MoxplatformPlugin.platform.generateVideoThumbnail(
@ -313,8 +325,10 @@ class MyHomePageState extends State<MyHomePage> {
'$internalPath.thumbnail.jpg',
720,
);
// ignore: avoid_print
print('Success: $thumbResult');
// ignore: use_build_context_synchronously
await showDialog<void>(
context: context,
builder: (context) => Image.file(

View File

@ -34,8 +34,12 @@ class NotificationMessage {
this.content,
this.jid,
this.timestamp,
this.avatarPath,
);
this.avatarPath, {
this.groupId,
});
/// The grouping key for the notification.
final String? groupId;
/// The sender of the message.
final String? sender;
@ -54,7 +58,7 @@ class NotificationMessage {
}
class MessagingNotification {
const MessagingNotification(this.title, this.id, this.jid, this.messages, this.channelId, this.isGroupchat, this.extra);
const MessagingNotification(this.title, this.id, this.jid, this.messages, this.channelId, this.isGroupchat, this.extra, {this.groupId});
/// The title of the conversation.
final String title;
@ -74,6 +78,9 @@ class MessagingNotification {
/// Flag indicating whether this notification is from a groupchat or not.
final bool isGroupchat;
/// The id for notification grouping.
final String? groupId;
/// Additional data to include.
final Map<String?, String?>? extra;
}
@ -85,7 +92,7 @@ enum NotificationIcon {
}
class RegularNotification {
const RegularNotification(this.title, this.body, this.channelId, this.id, this.icon);
const RegularNotification(this.title, this.body, this.channelId, this.id, this.icon, {this.groupId});
/// The title of the notification.
final String title;
@ -96,6 +103,9 @@ class RegularNotification {
/// The id of the channel to show the notification on.
final String channelId;
/// The id for notification grouping.
final String? groupId;
/// The id of the notification.
final int id;
@ -168,10 +178,46 @@ enum FallbackIconType {
notes;
}
class NotificationGroup {
const NotificationGroup(this.id, this.description);
final String id;
final String description;
}
enum NotificationChannelImportance {
MIN,
HIGH,
DEFAULT
}
class NotificationChannel {
const NotificationChannel(
this.id,
this.title,
this.description, {
this.importance = NotificationChannelImportance.DEFAULT,
this.showBadge = true,
this.groupId,
this.vibration = true,
this.enableLights = true,
});
final String title;
final String description;
final String id;
final NotificationChannelImportance importance;
final bool showBadge;
final String? groupId;
final bool vibration;
final bool enableLights;
}
@HostApi()
abstract class MoxplatformApi {
/// Notification APIs
void createNotificationChannel(String title, String description, String id, bool urgent);
void createNotificationGroups(List<NotificationGroup> groups);
void deleteNotificationGroups(List<String> ids);
void createNotificationChannels(List<NotificationChannel> channels);
void deleteNotificationChannels(List<String> ids);
void showMessagingNotification(MessagingNotification notification);
void showNotification(RegularNotification notification);
void dismissNotification(int id);

View File

@ -5,3 +5,4 @@ environment:
dev_dependencies:
melos: ^3.1.1
pigeon: 10.1.4
very_good_analysis: ^3.0.1