Skip to content

Commit ce5d918

Browse files
authored
Merge pull request #912 from OneSignal/update-example-app
Updated React Native Example App
2 parents ad67778 + cd21f6b commit ce5d918

File tree

11 files changed

+1304
-1009
lines changed

11 files changed

+1304
-1009
lines changed

examples/RNOneSignal/App.js

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,14 @@ export default class App extends Component {
4949
kOSSettingsKeyAutoPrompt: true,
5050
});
5151

52+
OneSignal.setLogLevel(6, 0);
53+
5254
// Examples for using native IAM public methods
53-
this.oneSignalInAppMessagingExamples();
55+
// this.oneSignalInAppMessagingExamples();
56+
5457
// Examples for using native Outcome Event public methods
55-
this.oneSignalOutcomeEventsExamples();
58+
// this.oneSignalOutcomeEventsExamples();
5659

57-
OneSignal.setLogLevel(6, 0);
5860
}
5961

6062
async componentDidMount() {
@@ -370,6 +372,36 @@ export default class App extends Component {
370372
color={this.state.buttonColor}
371373
/>
372374
</View>
375+
<View style={styles.buttonContainer}>
376+
<Button
377+
style={styles.button}
378+
onPress={() => {
379+
OneSignal.sendOutcome('sendOutcome-ro');
380+
}}
381+
title="Send Outcome"
382+
color={this.state.buttonColor}
383+
/>
384+
</View>
385+
<View style={styles.buttonContainer}>
386+
<Button
387+
style={styles.button}
388+
onPress={() => {
389+
OneSignal.sendOutcome('sendUniqueOutcome-ro');
390+
}}
391+
title="Send Unique Outcome"
392+
color={this.state.buttonColor}
393+
/>
394+
</View>
395+
<View style={styles.buttonContainer}>
396+
<Button
397+
style={styles.button}
398+
onPress={() => {
399+
OneSignal.sendOutcomeWithValue('sendOutcomeWithValue-ro', 18.76);
400+
}}
401+
title="Send Outcome With Value"
402+
color={this.state.buttonColor}
403+
/>
404+
</View>
373405
</View>
374406
</ScrollView>
375407
);

examples/RNOneSignal/android/app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ android {
188188
}
189189

190190
dependencies {
191+
implementation project(':react-native-onesignal')
191192
implementation fileTree(dir: "libs", include: ["*.jar"])
192193
implementation "com.facebook.react:react-native:+" // From node_modules
193194

examples/RNOneSignal/android/app/src/main/java/com/rnonesignal/MainApplication.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.facebook.react.bridge.JavaScriptExecutorFactory;
99
import com.facebook.react.ReactApplication;
1010
import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage;
11+
import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage;
1112
import com.facebook.react.ReactNativeHost;
1213
import com.facebook.react.ReactPackage;
1314
import com.facebook.soloader.SoLoader;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
rootProject.name = 'RNOneSignal'
2+
include ':react-native-onesignal'
3+
project(':react-native-onesignal').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-onesignal/android')
24
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
35
include ':app'
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.network.client</key>
8+
<true/>
9+
</dict>
10+
</plist>

examples/RNOneSignal/ios/Podfile

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ platform :ios, '9.0'
22
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
33

44
target 'RNOneSignal' do
5-
# Pods for RNOneSignal
5+
# Pods for rnPodspecProj
6+
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
7+
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
8+
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
9+
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
610
pod 'React', :path => '../node_modules/react-native/'
7-
pod 'React-Core', :path => '../node_modules/react-native/React'
8-
pod 'React-DevSupport', :path => '../node_modules/react-native/React'
11+
pod 'React-Core', :path => '../node_modules/react-native/'
12+
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
13+
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
914
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
1015
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
1116
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
@@ -15,13 +20,15 @@ target 'RNOneSignal' do
1520
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
1621
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
1722
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
18-
pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
23+
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
1924

2025
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
2126
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
2227
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
2328
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
24-
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
29+
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
30+
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
31+
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
2532

2633
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
2734
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
@@ -30,11 +37,10 @@ target 'RNOneSignal' do
3037
use_native_modules!
3138
# Contains OneSignal wrapper SDK code + Native OneSignal-iOS-SDK
3239
pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal'
33-
3440
end
3541

36-
target 'OneSignalNotificationServiceExtension' do
37-
# OneSignal-iOS-SDK for media, badge inc, other rich notification features
38-
# No react native code / javascript in this iOS target
39-
pod 'OneSignal', '>= 2.9.3', '< 3.0'
40-
end
42+
# target 'OneSignalNotificationServiceExtension' do
43+
# # OneSignal-iOS-SDK for media, badge inc, other rich notification features
44+
# # No react native code / javascript in this iOS target
45+
# pod 'OneSignal', '>= 2.9.3', '< 3.0'
46+
# end

0 commit comments

Comments
 (0)