|
@@ -86,18 +86,26 @@ TaskManager.defineTask(
|
|
);
|
|
);
|
|
|
|
|
|
export const registerBackgroundNotificationTask = async () => {
|
|
export const registerBackgroundNotificationTask = async () => {
|
|
- const isRegistered = await TaskManager.isTaskRegisteredAsync(BACKGROUND_NOTIFICATION_TASK);
|
|
|
|
|
|
+ try {
|
|
|
|
+ const isRegistered = await TaskManager.isTaskRegisteredAsync(BACKGROUND_NOTIFICATION_TASK);
|
|
|
|
|
|
- if (!isRegistered && Platform.OS === 'ios') {
|
|
|
|
- await Notifications.registerTaskAsync(BACKGROUND_NOTIFICATION_TASK);
|
|
|
|
|
|
+ if (!isRegistered && Platform.OS === 'ios') {
|
|
|
|
+ await Notifications.registerTaskAsync(BACKGROUND_NOTIFICATION_TASK);
|
|
|
|
+ }
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.warn('Background notification task registration failed:', error);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
export const unregisterBackgroundNotificationTask = async () => {
|
|
export const unregisterBackgroundNotificationTask = async () => {
|
|
- const isRegistered = await TaskManager.isTaskRegisteredAsync(BACKGROUND_NOTIFICATION_TASK);
|
|
|
|
|
|
+ try {
|
|
|
|
+ const isRegistered = await TaskManager.isTaskRegisteredAsync(BACKGROUND_NOTIFICATION_TASK);
|
|
|
|
|
|
- if (isRegistered) {
|
|
|
|
- await TaskManager.unregisterTaskAsync(BACKGROUND_NOTIFICATION_TASK);
|
|
|
|
|
|
+ if (isRegistered) {
|
|
|
|
+ await TaskManager.unregisterTaskAsync(BACKGROUND_NOTIFICATION_TASK);
|
|
|
|
+ }
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.warn('Background notification task unregistration failed:', error);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|