Skip to content

Commit

Permalink
Example project fixes (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
Psiiirus authored May 1, 2020
1 parent 4a9022d commit f55e7ff
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 58 deletions.
11 changes: 10 additions & 1 deletion example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const App = () => {
const [permissions, setPermissions] = useState({});

useEffect(() => {
PushNotificationIOS.requestPermissions();
PushNotificationIOS.addEventListener('register', onRegistered);
PushNotificationIOS.addEventListener(
'registrationError',
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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
39 changes: 34 additions & 5 deletions example/ios/example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<group>"; };
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 = "<group>"; };
75D14BB724349AA900E7B541 /* exampleDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = exampleDebug.entitlements; path = example/exampleDebug.entitlements; sourceTree = "<group>"; };
75D14BB824349DF600E7B541 /* exampleRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = exampleRelease.entitlements; path = example/exampleRelease.entitlements; sourceTree = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
Expand Down Expand Up @@ -125,6 +127,8 @@
13B07FAE1A68108700A75B9A /* example */ = {
isa = PBXGroup;
children = (
75D14BB824349DF600E7B541 /* exampleRelease.entitlements */,
75D14BB724349AA900E7B541 /* exampleDebug.entitlements */,
008F07F21AC5B25A0029DE68 /* main.jsbundle */,
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
13B07FB01A68108700A75B9A /* AppDelegate.m */,
Expand Down Expand Up @@ -161,7 +165,6 @@
7D3C5FE1AA0D7E8739DFFE25 /* Pods-exampleTests.debug.xcconfig */,
A36F7B58B31FA5BE5CDE910F /* Pods-exampleTests.release.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
Expand Down Expand Up @@ -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;
Expand All @@ -305,7 +312,7 @@
};
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "example" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -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)",
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
Expand Down Expand Up @@ -55,6 +55,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "example-tvOS.app"
BlueprintName = "example-tvOS"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -67,17 +76,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "example-tvOS.app"
BlueprintName = "example-tvOS"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -99,8 +97,6 @@
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
Expand Down Expand Up @@ -55,6 +55,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "example.app"
BlueprintName = "example"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -67,17 +76,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "example.app"
BlueprintName = "example"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -99,8 +97,6 @@
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
4 changes: 2 additions & 2 deletions example/ios/example/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/

#import <UserNotifications/UNUserNotificationCenter.h>
#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>

@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate>
@property (nonatomic, strong) UIWindow *window;

@end
Loading

0 comments on commit f55e7ff

Please sign in to comment.