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

View File

@ -34,8 +34,12 @@ class NotificationMessage {
this.content, this.content,
this.jid, this.jid,
this.timestamp, this.timestamp,
this.avatarPath, this.avatarPath, {
); this.groupId,
});
/// The grouping key for the notification.
final String? groupId;
/// The sender of the message. /// The sender of the message.
final String? sender; final String? sender;
@ -54,7 +58,7 @@ class NotificationMessage {
} }
class MessagingNotification { 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. /// The title of the conversation.
final String title; final String title;
@ -74,6 +78,9 @@ class MessagingNotification {
/// Flag indicating whether this notification is from a groupchat or not. /// Flag indicating whether this notification is from a groupchat or not.
final bool isGroupchat; final bool isGroupchat;
/// The id for notification grouping.
final String? groupId;
/// Additional data to include. /// Additional data to include.
final Map<String?, String?>? extra; final Map<String?, String?>? extra;
} }
@ -85,7 +92,7 @@ enum NotificationIcon {
} }
class RegularNotification { 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. /// The title of the notification.
final String title; final String title;
@ -96,6 +103,9 @@ class RegularNotification {
/// The id of the channel to show the notification on. /// The id of the channel to show the notification on.
final String channelId; final String channelId;
/// The id for notification grouping.
final String? groupId;
/// The id of the notification. /// The id of the notification.
final int id; final int id;
@ -168,10 +178,46 @@ enum FallbackIconType {
notes; 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() @HostApi()
abstract class MoxplatformApi { abstract class MoxplatformApi {
/// Notification APIs /// 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 showMessagingNotification(MessagingNotification notification);
void showNotification(RegularNotification notification); void showNotification(RegularNotification notification);
void dismissNotification(int id); void dismissNotification(int id);

View File

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