mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
Merge branch 'chore/app-store-screenshots'
This commit is contained in:
@@ -14,6 +14,9 @@ class NotificationService {
|
||||
factory NotificationService() => _instance;
|
||||
NotificationService._internal();
|
||||
|
||||
static const bool _skipPermissionRequests = bool.fromEnvironment(
|
||||
'MESHCORE_SCREENSHOTS',
|
||||
);
|
||||
final FlutterLocalNotificationsPlugin _notificationsPlugin =
|
||||
FlutterLocalNotificationsPlugin();
|
||||
static const String _prefMessagesEnabled = 'notifications_messages_enabled';
|
||||
@@ -101,9 +104,9 @@ class NotificationService {
|
||||
|
||||
// iOS initialization settings
|
||||
final darwinSettings = DarwinInitializationSettings(
|
||||
requestAlertPermission: true,
|
||||
requestBadgePermission: true,
|
||||
requestSoundPermission: true,
|
||||
requestAlertPermission: !_skipPermissionRequests,
|
||||
requestBadgePermission: !_skipPermissionRequests,
|
||||
requestSoundPermission: !_skipPermissionRequests,
|
||||
);
|
||||
|
||||
// Combined initialization settings
|
||||
@@ -125,7 +128,11 @@ class NotificationService {
|
||||
}
|
||||
|
||||
// Request permissions
|
||||
await _requestPermissions();
|
||||
if (_skipPermissionRequests) {
|
||||
_permissionGranted = true;
|
||||
} else {
|
||||
await _requestPermissions();
|
||||
}
|
||||
await _loadPreferences();
|
||||
|
||||
// Create notification channels (Android)
|
||||
@@ -338,6 +345,8 @@ class NotificationService {
|
||||
String? notes,
|
||||
AppLocalizations? localizations,
|
||||
}) async {
|
||||
if (_skipPermissionRequests) return;
|
||||
|
||||
if (!_isInitialized) {
|
||||
debugPrint(
|
||||
'⚠️ [NotificationService] Not initialized, skipping notification',
|
||||
@@ -520,6 +529,8 @@ class NotificationService {
|
||||
String? channelName,
|
||||
AppLocalizations? localizations,
|
||||
}) async {
|
||||
if (_skipPermissionRequests) return;
|
||||
|
||||
if (!_isInitialized) {
|
||||
debugPrint(
|
||||
'⚠️ [NotificationService] Not initialized, skipping notification',
|
||||
@@ -722,6 +733,8 @@ class NotificationService {
|
||||
required String downloadUrl,
|
||||
AppLocalizations? localizations,
|
||||
}) async {
|
||||
if (_skipPermissionRequests) return;
|
||||
|
||||
if (!_isInitialized) {
|
||||
debugPrint(
|
||||
'⚠️ [NotificationService] Not initialized, skipping notification',
|
||||
@@ -822,6 +835,8 @@ class NotificationService {
|
||||
required double batteryPercent,
|
||||
required bool isCurrentDevice,
|
||||
}) async {
|
||||
if (_skipPermissionRequests) return false;
|
||||
|
||||
if (!_isInitialized) {
|
||||
debugPrint(
|
||||
'⚠️ [NotificationService] Not initialized, skipping notification',
|
||||
@@ -913,6 +928,8 @@ class NotificationService {
|
||||
required String contactKey,
|
||||
String? contactName,
|
||||
}) async {
|
||||
if (_skipPermissionRequests) return false;
|
||||
|
||||
if (!_isInitialized) return false;
|
||||
if (!_permissionGranted) return false;
|
||||
if (!_discoveryNotificationsEnabled) return false;
|
||||
|
||||
Reference in New Issue
Block a user