diff --git a/example/App.js b/example/App.js index b83b1035b..1f9e05d56 100644 --- a/example/App.js +++ b/example/App.js @@ -33,7 +33,6 @@ export const App = () => { const [permissions, setPermissions] = useState({}); useEffect(() => { - PushNotificationIOS.requestPermissions(); PushNotificationIOS.addEventListener('register', onRegistered); PushNotificationIOS.addEventListener( 'registrationError', @@ -44,6 +43,16 @@ export const App = () => { 'localNotification', onLocalNotification, ); + + PushNotificationIOS.requestPermissions().then( + data => { + console.log('PushNotificationIOS.requestPermissions', data); + }, + data => { + console.log('PushNotificationIOS.requestPermissions failed', data); + }, + ); + return () => { PushNotificationIOS.removeEventListener('register', onRegistered); PushNotificationIOS.removeEventListener( diff --git a/example/ios/Podfile b/example/ios/Podfile index d5e2a7547..00d9c093f 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -34,7 +34,7 @@ target 'example' do pod 'DoubleConversion', :podspec => "#{$node_modules_path}/react-native/third-party-podspecs/DoubleConversion.podspec" pod 'glog', :podspec => "#{$node_modules_path}/react-native/third-party-podspecs/glog.podspec" pod 'Folly', :podspec => "#{$node_modules_path}/react-native/third-party-podspecs/Folly.podspec" - pod 'RNCPushNotificationIOS', :podspec => "../../RNCPushNotificationIOS.podspec" + pod 'RNCPushNotificationIOS', :path => "../../" target 'exampleTests' do inherit! :search_paths diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index f205dbe7d..07876b71c 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -217,7 +217,7 @@ PODS: - React-cxxreact (= 0.61.5) - React-jsi (= 0.61.5) - ReactCommon/jscallinvoker (= 0.61.5) - - RNCPushNotificationIOS (1.0.7): + - RNCPushNotificationIOS (1.1.1): - React - Yoga (1.14.0) @@ -249,7 +249,7 @@ DEPENDENCIES: - React-RCTVibration (from `../../node_modules/react-native/Libraries/Vibration`) - ReactCommon/jscallinvoker (from `../../node_modules/react-native/ReactCommon`) - ReactCommon/turbomodule/core (from `../../node_modules/react-native/ReactCommon`) - - RNCPushNotificationIOS (from `../../RNCPushNotificationIOS.podspec`) + - RNCPushNotificationIOS (from `../../`) - Yoga (from `../../node_modules/react-native/ReactCommon/yoga`) SPEC REPOS: @@ -306,7 +306,7 @@ EXTERNAL SOURCES: ReactCommon: :path: "../../node_modules/react-native/ReactCommon" RNCPushNotificationIOS: - :podspec: "../../RNCPushNotificationIOS.podspec" + :path: "../../" Yoga: :path: "../../node_modules/react-native/ReactCommon/yoga" @@ -336,9 +336,9 @@ SPEC CHECKSUMS: React-RCTText: 9ccc88273e9a3aacff5094d2175a605efa854dbe React-RCTVibration: a49a1f42bf8f5acf1c3e297097517c6b3af377ad ReactCommon: 198c7c8d3591f975e5431bec1b0b3b581aa1c5dd - RNCPushNotificationIOS: eea954fa69537d4a8db898fe1b1a06e2b7e15841 + RNCPushNotificationIOS: a0b6894f4ad9b93d9dac467fdf4d055660ac8a0d Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b -PODFILE CHECKSUM: 0eec3d6f93caee9d49875394b0b3b4beac7f7548 +PODFILE CHECKSUM: 86da3041baf50e3a45b63907fdf8bb3e1a6ad95a -COCOAPODS: 1.8.4 +COCOAPODS: 1.8.3 diff --git a/example/ios/example.xcodeproj/project.pbxproj b/example/ios/example.xcodeproj/project.pbxproj index 98a444bc9..d649f49af 100644 --- a/example/ios/example.xcodeproj/project.pbxproj +++ b/example/ios/example.xcodeproj/project.pbxproj @@ -59,6 +59,8 @@ 2D02E4901E0B4A5D006451C7 /* example-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "example-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 3F85BB085CA785A85936BC93 /* Pods-example-tvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example-tvOS.release.xcconfig"; path = "Target Support Files/Pods-example-tvOS/Pods-example-tvOS.release.xcconfig"; sourceTree = ""; }; 5BA977284AE2212EF9829344 /* Pods-example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.release.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.release.xcconfig"; sourceTree = ""; }; + 75D14BB724349AA900E7B541 /* exampleDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = exampleDebug.entitlements; path = example/exampleDebug.entitlements; sourceTree = ""; }; + 75D14BB824349DF600E7B541 /* exampleRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = exampleRelease.entitlements; path = example/exampleRelease.entitlements; sourceTree = ""; }; 7D3C5FE1AA0D7E8739DFFE25 /* Pods-exampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-exampleTests.debug.xcconfig"; path = "Target Support Files/Pods-exampleTests/Pods-exampleTests.debug.xcconfig"; sourceTree = ""; }; A34583DBF473F8BF312C0413 /* Pods-example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.debug.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.debug.xcconfig"; sourceTree = ""; }; A36F7B58B31FA5BE5CDE910F /* Pods-exampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-exampleTests.release.xcconfig"; path = "Target Support Files/Pods-exampleTests/Pods-exampleTests.release.xcconfig"; sourceTree = ""; }; @@ -125,6 +127,8 @@ 13B07FAE1A68108700A75B9A /* example */ = { isa = PBXGroup; children = ( + 75D14BB824349DF600E7B541 /* exampleRelease.entitlements */, + 75D14BB724349AA900E7B541 /* exampleDebug.entitlements */, 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 13B07FB01A68108700A75B9A /* AppDelegate.m */, @@ -161,7 +165,6 @@ 7D3C5FE1AA0D7E8739DFFE25 /* Pods-exampleTests.debug.xcconfig */, A36F7B58B31FA5BE5CDE910F /* Pods-exampleTests.release.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -285,13 +288,17 @@ 83CBB9F71A601CBA00E9B192 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0940; + LastUpgradeCheck = 1130; ORGANIZATIONNAME = Facebook; TargetAttributes = { 00E356ED1AD99517003FC87E = { CreatedOnToolsVersion = 6.2; + ProvisioningStyle = Automatic; TestTargetID = 13B07F861A680F5B00A75B9A; }; + 13B07F861A680F5B00A75B9A = { + ProvisioningStyle = Automatic; + }; 2D02E47A1E0B4A5D006451C7 = { CreatedOnToolsVersion = 8.2.1; ProvisioningStyle = Automatic; @@ -305,7 +312,7 @@ }; buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "example" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -583,6 +590,9 @@ baseConfigurationReference = 7D3C5FE1AA0D7E8739DFFE25 /* Pods-exampleTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; + CODE_SIGN_STYLE = Automatic; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", @@ -597,6 +607,8 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/example"; }; name = Debug; @@ -606,6 +618,9 @@ baseConfigurationReference = A36F7B58B31FA5BE5CDE910F /* Pods-exampleTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; + CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; INFOPLIST_FILE = exampleTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; @@ -617,6 +632,8 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/example"; }; name = Release; @@ -626,17 +643,22 @@ baseConfigurationReference = A34583DBF473F8BF312C0413 /* Pods-example.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = example/exampleDebug.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = NO; INFOPLIST_FILE = example/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", "-lc++", ); - PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.example.push-ios-example"; PRODUCT_NAME = example; + PROVISIONING_PROFILE_SPECIFIER = ""; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -646,16 +668,21 @@ baseConfigurationReference = 5BA977284AE2212EF9829344 /* Pods-example.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = example/exampleRelease.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; INFOPLIST_FILE = example/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", "-lc++", ); - PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.example.push-ios-example"; PRODUCT_NAME = example; + PROVISIONING_PROFILE_SPECIFIER = ""; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; @@ -774,6 +801,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -827,6 +855,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; diff --git a/example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme b/example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme index c513ae061..02a1570ee 100644 --- a/example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme +++ b/example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -67,17 +76,6 @@ - - - - - - - - + + + + @@ -67,17 +76,6 @@ - - - - - - - - #import #import -@interface AppDelegate : UIResponder - +@interface AppDelegate : UIResponder @property (nonatomic, strong) UIWindow *window; @end diff --git a/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json b/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json index 118c98f74..81213230d 100644 --- a/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json @@ -2,37 +2,52 @@ "images" : [ { "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" + "scale" : "2x", + "size" : "20x20" }, { "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" + "scale" : "3x", + "size" : "20x20" }, { "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" + "scale" : "2x", + "size" : "29x29" }, { "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" + "scale" : "3x", + "size" : "29x29" }, { "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" + "scale" : "2x", + "size" : "40x40" }, { "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/example/ios/example/Info.plist b/example/ios/example/Info.plist index 20fb35c96..22032f6fc 100644 --- a/example/ios/example/Info.plist +++ b/example/ios/example/Info.plist @@ -39,6 +39,10 @@ NSLocationWhenInUseUsageDescription + UIBackgroundModes + + remote-notification + UILaunchStoryboardName LaunchScreen UIRequiredDeviceCapabilities diff --git a/example/ios/example/exampleDebug.entitlements b/example/ios/example/exampleDebug.entitlements new file mode 100644 index 000000000..903def2af --- /dev/null +++ b/example/ios/example/exampleDebug.entitlements @@ -0,0 +1,8 @@ + + + + + aps-environment + development + + diff --git a/example/ios/example/exampleRelease.entitlements b/example/ios/example/exampleRelease.entitlements new file mode 100644 index 000000000..903def2af --- /dev/null +++ b/example/ios/example/exampleRelease.entitlements @@ -0,0 +1,8 @@ + + + + + aps-environment + development + +