globocom / react-native-ua

React Native module for Urban Airship
MIT License
37 stars 33 forks source link

Settings screen appear every time the app is opened? #25

Closed olle-moren closed 8 years ago

olle-moren commented 8 years ago

This happens due to

RCT_EXPORT_METHOD(enableNotification) {
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

    [UAirship push].userPushNotificationsEnabled = YES;

    if ([defaults objectForKey:@"first_time_notification_enable"]) {

        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

    } else {

        [defaults setBool:YES forKey:@"first_time_notification_enable"];
        [defaults synchronize];

    }
}

in react-native-ua/ios/ReactNativeUAIOS/ReactNativeUAIOS.m

Can I turn this behaving off somehow?

evandroeisinger commented 8 years ago

hey @olle-moren-schibsted

So, at this moment you should call enableNotification only once and control it calls according to your application behavior. Because every time you call it, it will ask the user to enable notifications.

We are open to pull requests 🎅 Any ideia is welcome!

olle-moren commented 8 years ago

Thanx for the info! It works fine now ⛵️