Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NoQA] Unsubscribe from Broadcast receiver task #56169

Merged
2 changes: 1 addition & 1 deletion ios/NewExpensify/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#import "RCTStartupTimer.h"
#import <HardwareShortcuts.h>
#import <BackgroundTasks/BackgroundTasks.h>
#import <expensify-react-native-background-task/RNBackgroundTaskManager.h>
#import <expensify_react_native_background_task/RNBackgroundTaskManager.h>

@interface AppDelegate () <UNUserNotificationCenterDelegate>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ class ReactNativeBackgroundTaskModule internal constructor(context: ReactApplica
return NAME
}

override fun invalidate() {
super.invalidate()
try {
reactApplicationContext.unregisterReceiver(taskReceiver)
Log.d("ReactNativeBackgroundTaskModule", "BroadcastReceiver unregistered")
} catch (e: IllegalArgumentException) {
Log.w("ReactNativeBackgroundTaskModule", "Receiver not registered or already unregistered")
}
}

@ReactMethod
override fun defineTask(taskName: String, taskExecutor: Callback, promise: Promise) {
try {
Expand Down
Loading