Skip to content

Commit

Permalink
fix(ios): change global variable name to avoid conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ghashi committed Mar 31, 2022
1 parent 87c4f79 commit 6bc9e47
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions ios/RnAlarmNotification.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

@implementation RnAlarmNotification

bool hasListeners;
bool hasRnAlarmNotificationListeners;
AVAudioPlayer *player;
MPVolumeView *volumeView;
UISlider *volumeSlider;
Expand Down Expand Up @@ -254,7 +254,7 @@ - (void)didReceiveNotificationResponse:(UNNotificationResponse *)response
// Will be called when this module's first listener is added.
- (void)startObserving {
NSLog(@"RnAlarmNotification ~ startObserving");
hasListeners = YES;
hasRnAlarmNotificationListeners = YES;

// receive notification
[[NSNotificationCenter defaultCenter] addObserver:self
Expand All @@ -275,7 +275,7 @@ - (void)startObserving {
// Will be called when this module's last listener is removed, or on dealloc.
- (void)stopObserving {
NSLog(@"RnAlarmNotification ~ stopObserving");
hasListeners = NO;
hasRnAlarmNotificationListeners = NO;
[[NSNotificationCenter defaultCenter] removeObserver:self];
}

Expand All @@ -284,25 +284,25 @@ - (void)stopObserving {
}

- (void)handleLocalNotificationReceived:(NSNotification *)notification {
NSLog(@"RnAlarmNotification ~ handleLocalNotificationReceived - %@", hasListeners ? @"true" : @"false");
NSLog(@"RnAlarmNotification ~ handleLocalNotificationReceived - %@", hasRnAlarmNotificationListeners ? @"true" : @"false");
// send to js
if (hasListeners) {
if (hasRnAlarmNotificationListeners) {
[self sendEventWithName:@"OnNotificationOpened" body: stringify(notification.userInfo)];
}
}

- (void)handleLocalNotificationDismissed:(NSNotification *)notification {
NSLog(@"RnAlarmNotification ~ handleLocalNotificationDismissed - %@", hasListeners ? @"true" : @"false");
NSLog(@"RnAlarmNotification ~ handleLocalNotificationDismissed - %@", hasRnAlarmNotificationListeners ? @"true" : @"false");
// send to js
if (hasListeners) {
if (hasRnAlarmNotificationListeners) {
[self sendEventWithName:@"OnNotificationDismissed" body: stringify(notification.userInfo)];
}
}

- (void)handleLocalNotificationStarted:(NSNotification *)notification {
NSLog(@"RnAlarmNotification ~ handleLocalNotificationStarted - %@", hasListeners ? @"true" : @"false");
NSLog(@"RnAlarmNotification ~ handleLocalNotificationStarted - %@", hasRnAlarmNotificationListeners ? @"true" : @"false");
// send to js
if (hasListeners) {
if (hasRnAlarmNotificationListeners) {
[self sendEventWithName:@"OnNotificationStarted" body: stringify(notification.userInfo)];
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-native-alarm-notification",
"title": "React Native Alarm Notification",
"version": "1.8.7",
"version": "1.8.8",
"description": "schedule alarm with notification in react-native",
"main": "index.js",
"files": [
Expand Down

0 comments on commit 6bc9e47

Please sign in to comment.