|
|
@@ -34,10 +34,10 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
|
|
|
|
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
|
{
|
|
|
-// [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenNotificationSettingsURLString]];
|
|
|
-// NSString *url = UIApplicationOpenNotificationSettingsURLString;
|
|
|
+ // [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenNotificationSettingsURLString]];
|
|
|
+ // NSString *url = UIApplicationOpenNotificationSettingsURLString;
|
|
|
// APNS
|
|
|
-// BOOL isLocation = [CLLocationManager locationServicesEnabled];
|
|
|
+ // BOOL isLocation = [CLLocationManager locationServicesEnabled];
|
|
|
self.rnLoaded = NO;
|
|
|
NSDate *date = [NSDate date];
|
|
|
//zone为当前时区信息 在我的程序中打印的是@"Asia/Shanghai"
|
|
|
@@ -46,20 +46,20 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
|
|
NSInteger interval = [zone secondsFromGMTForDate: date];
|
|
|
//加上时差,得到本地时间
|
|
|
NSDate *localeDate = [date dateByAddingTimeInterval: interval];
|
|
|
-
|
|
|
-// JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc] init];
|
|
|
-// if (@available(iOS 12.0, *)) {
|
|
|
-// entity.types = JPAuthorizationOptionNone; //JPAuthorizationOptionAlert|JPAuthorizationOptionBadge|JPAuthorizationOptionSou//nd|JPAuthorizationOptionProvidesAppNotificationSettings;
|
|
|
-// }
|
|
|
-// [JPUSHService registerForRemoteNotificationConfig:entity delegate:self];
|
|
|
+
|
|
|
+ // JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc] init];
|
|
|
+ // if (@available(iOS 12.0, *)) {
|
|
|
+ // entity.types = JPAuthorizationOptionNone; //JPAuthorizationOptionAlert|JPAuthorizationOptionBadge|JPAuthorizationOptionSou//nd|JPAuthorizationOptionProvidesAppNotificationSettings;
|
|
|
+ // }
|
|
|
+ // [JPUSHService registerForRemoteNotificationConfig:entity delegate:self];
|
|
|
|
|
|
RCTAppSetupPrepareApp(application);
|
|
|
-
|
|
|
+
|
|
|
RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
|
|
|
|
|
|
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
|
|
|
center.delegate = self;
|
|
|
-
|
|
|
+
|
|
|
#if RCT_NEW_ARCH_ENABLED
|
|
|
_contextContainer = std::make_shared<facebook::react::ContextContainer const>();
|
|
|
_reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
|
|
|
@@ -67,16 +67,16 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
|
|
_bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
|
|
|
bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
|
|
|
#endif
|
|
|
-
|
|
|
+
|
|
|
NSDictionary *initProps = [self prepareInitialProps];
|
|
|
UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"taroDemo" initialProperties:initProps];
|
|
|
-
|
|
|
+
|
|
|
if (@available(iOS 13.0, *)) {
|
|
|
rootView.backgroundColor = [UIColor systemBackgroundColor];
|
|
|
} else {
|
|
|
rootView.backgroundColor = [UIColor blackColor];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
|
self.window.backgroundColor = [UIColor blackColor];
|
|
|
UIViewController *rootViewController = [self.reactDelegate createRootViewController];
|
|
|
@@ -91,7 +91,9 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
|
|
return YES;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+- (void)applicationDidBecomeActive:(UIApplication *)application {
|
|
|
+ [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
|
|
|
+}
|
|
|
- (void)registerForPushNotifications {
|
|
|
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
|
|
|
[center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error) {
|