Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 27 additions & 18 deletions lib/src/notification/service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,29 @@ class NotificationService {
}
const android = AndroidInitializationSettings('ic_stat_notification');
final ios = DarwinInitializationSettings(
onDidReceiveLocalNotification: _onDidReceiveLocalNotification,
// onDidReceiveLocalNotification: _onDidReceiveLocalNotification,
);
const macos = DarwinInitializationSettings();
final initSettings =
InitializationSettings(android: android, iOS: ios, macOS: macos);
final initSettings = InitializationSettings(
android: android,
iOS: ios,
macOS: macos,
);
await _flutterLocalNotificationsPlugin.initialize(
initSettings,
onDidReceiveNotificationResponse: _selectNotification,
);
if (Platform.isAndroid) {
await _flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>()
AndroidFlutterLocalNotificationsPlugin
>()
?.requestNotificationsPermission();
}
if (checkForLaunchDetails) {
final launchDetails = await _flutterLocalNotificationsPlugin
.getNotificationAppLaunchDetails();
final launchDetails =
await _flutterLocalNotificationsPlugin
.getNotificationAppLaunchDetails();
if (launchDetails != null && launchDetails.didNotificationLaunchApp) {
final response = launchDetails.notificationResponse;
if (response != null) {
Expand Down Expand Up @@ -132,10 +137,7 @@ class NotificationService {

if (payloadText != null && payloadText.startsWith(_messagePayloadStart)) {
final payload = _deserialize(payloadText);
usedContext.pushNamed(
Routes.mailDetailsForNotification,
extra: payload,
);
usedContext.pushNamed(Routes.mailDetailsForNotification, extra: payload);
}
}

Expand All @@ -152,15 +154,17 @@ class NotificationService {
) {
String retrieveFromName() {
final mimeFrom = mimeMessage.from;
final personalName = mimeFrom != null && mimeFrom.isNotEmpty
? mimeFrom.first.personalName
: mimeMessage.sender?.personalName;
final personalName =
mimeFrom != null && mimeFrom.isNotEmpty
? mimeFrom.first.personalName
: mimeMessage.sender?.personalName;
if (personalName != null && personalName.isNotEmpty) {
return personalName;
}
final email = mimeFrom != null && mimeFrom.isNotEmpty
? mimeFrom.first.email
: mimeMessage.sender?.email;
final email =
mimeFrom != null && mimeFrom.isNotEmpty
? mimeFrom.first.email
: mimeMessage.sender?.email;
if (email != null && email.isNotEmpty) {
return email;
}
Expand Down Expand Up @@ -225,8 +229,13 @@ class NotificationService {
android: androidPlatformChannelSpecifics,
iOS: iosPlatformChannelSpecifics,
);
await _flutterLocalNotificationsPlugin
.show(id, title, text, platformChannelSpecifics, payload: payloadText);
await _flutterLocalNotificationsPlugin.show(
id,
title,
text,
platformChannelSpecifics,
payload: payloadText,
);
}

void cancelNotificationForMessage(maily.Message message) =>
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ version: 1.0.0+96

environment:
flutter: ">=3.22.0"
sdk: '>=3.4.0 <4.0.0'
sdk: ">=3.4.0 <4.0.0"

dependencies:
background_fetch: ^1.2.1
Expand Down Expand Up @@ -73,7 +73,7 @@ dependencies:
logger: ^2.0.2+1
map: ^2.0.2
modal_bottom_sheet: ^3.0.0-pre
package_info_plus: ^1.3.0
package_info_plus: ^8.3.0
path_provider: ^2.0.8
riverpod_annotation: ^2.1.5
share_plus: ^9.0.0
Expand All @@ -89,7 +89,7 @@ dependency_overrides:
device_info_plus: ^9.1.0
package_info_plus: ^4.2.0
ffi: ^2.1.0
pdfx: ^2.6.0
pdfx: ^2.6.0
js: ^0.7.1 # for pdfx & fluttercontactpicker
# out-comment the following to enable git-based development:
enough_mail:
Expand Down
Loading