airbridge-react-native-sdk-restricted 2.8.6 → 2.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/.github/actions/add-github-check/action.yml +78 -0
  2. package/.github/actions/add-github-comment/action.yml +48 -0
  3. package/.github/actions/add-slack-message/action.yml +32 -0
  4. package/.github/actions/edit-github-check/action.yml +59 -0
  5. package/.github/actions/edit-github-comment/action.yml +41 -0
  6. package/.github/pull_request_template.md +5 -0
  7. package/.github/readme.md +53 -0
  8. package/.github/workflows/build.yml +367 -0
  9. package/.github/workflows/gitflow.yml +20 -0
  10. package/.github/workflows/release-restricted.yml +35 -0
  11. package/.github/workflows/release.yml +32 -0
  12. package/airbridge-react-native-sdk-restricted.podspec +3 -1
  13. package/android/.settings/org.eclipse.buildship.core.prefs +2 -0
  14. package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeRN.java +19 -4
  15. package/android/src/main/java/co/ab180/airbridge/reactnative/ConfigReader.java +63 -40
  16. package/changelog.md +10 -0
  17. package/ios/AirbridgeRN/ARNConfigReader.h +1 -1
  18. package/ios/AirbridgeRN/ARNConfigReader.m +13 -15
  19. package/ios/AirbridgeRN/AirbridgeRN.m +23 -2
  20. package/ios/copy-config.rb +1 -1
  21. package/package.json +1 -1
  22. package/qa/.bundle/config +2 -0
  23. package/qa/.eslintrc.js +4 -0
  24. package/qa/.prettierrc.js +7 -0
  25. package/qa/.watchmanconfig +1 -0
  26. package/qa/Gemfile +9 -0
  27. package/qa/Gemfile.lock +105 -0
  28. package/qa/__tests__/App.test.tsx +17 -0
  29. package/qa/airbridge.json +7 -0
  30. package/qa/android/app/build.gradle +130 -0
  31. package/qa/android/app/debug.keystore +0 -0
  32. package/qa/android/app/google-services.json +29 -0
  33. package/qa/android/app/proguard-rules.pro +10 -0
  34. package/qa/android/app/src/debug/AndroidManifest.xml +9 -0
  35. package/qa/android/app/src/main/AndroidManifest.xml +65 -0
  36. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/ConfigurationLoader.kt +49 -0
  37. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/MainActivity.kt +35 -0
  38. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/MainApplication.kt +46 -0
  39. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/DeviceInfoInteractor.kt +60 -0
  40. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/DeviceInfoUtils.kt +115 -0
  41. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/IdentifiersInteractor.kt +83 -0
  42. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/InstallReferrerInteractor.kt +91 -0
  43. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/ModuleInjector.kt +22 -0
  44. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/PermissionInteractor.kt +55 -0
  45. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/UserInfoInteractor.kt +74 -0
  46. package/qa/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  47. package/qa/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  48. package/qa/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  49. package/qa/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  50. package/qa/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  51. package/qa/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  52. package/qa/android/app/src/main/res/values/strings.xml +3 -0
  53. package/qa/android/app/src/main/res/values/styles.xml +9 -0
  54. package/qa/android/build.gradle +28 -0
  55. package/qa/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  56. package/qa/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  57. package/qa/android/gradle.properties +41 -0
  58. package/qa/android/gradlew +249 -0
  59. package/qa/android/gradlew.bat +92 -0
  60. package/qa/android/settings.gradle +4 -0
  61. package/qa/app.json +4 -0
  62. package/qa/babel.config.js +3 -0
  63. package/qa/index.js +5 -0
  64. package/qa/ios/.xcode.env +11 -0
  65. package/qa/ios/AirbridgeQA/AirbridgeQA.entitlements +17 -0
  66. package/qa/ios/AirbridgeQA/AppDelegate.h +6 -0
  67. package/qa/ios/AirbridgeQA/AppDelegate.mm +123 -0
  68. package/qa/ios/AirbridgeQA/DeviceInfoInteractor.m +14 -0
  69. package/qa/ios/AirbridgeQA/DeviceInfoInteractor.swift +151 -0
  70. package/qa/ios/AirbridgeQA/IdentifiersInteractor.m +14 -0
  71. package/qa/ios/AirbridgeQA/IdentifiersInteractor.swift +40 -0
  72. package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  73. package/qa/ios/AirbridgeQA/Images.xcassets/Contents.json +6 -0
  74. package/qa/ios/AirbridgeQA/Info.plist +66 -0
  75. package/qa/ios/AirbridgeQA/LaunchScreen.storyboard +47 -0
  76. package/qa/ios/AirbridgeQA/PermissionInteractor.m +14 -0
  77. package/qa/ios/AirbridgeQA/PermissionInteractor.swift +19 -0
  78. package/qa/ios/AirbridgeQA/PrivacyInfo.xcprivacy +39 -0
  79. package/qa/ios/AirbridgeQA/UserInfoInteractor.m +57 -0
  80. package/qa/ios/AirbridgeQA/UserInfoInteractor.swift +49 -0
  81. package/qa/ios/AirbridgeQA/main.m +10 -0
  82. package/qa/ios/AirbridgeQA.xcodeproj/project.pbxproj +771 -0
  83. package/qa/ios/AirbridgeQA.xcodeproj/xcshareddata/xcschemes/AirbridgeQA.xcscheme +88 -0
  84. package/qa/ios/AirbridgeQA.xcworkspace/contents.xcworkspacedata +10 -0
  85. package/qa/ios/AirbridgeQA.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  86. package/qa/ios/AirbridgeQATests/AirbridgeQATests.m +66 -0
  87. package/qa/ios/AirbridgeQATests/Info.plist +24 -0
  88. package/qa/ios/GoogleService-Info.plist +30 -0
  89. package/qa/ios/Library/airbridge-ios-sdk-qa-library.podspec +26 -0
  90. package/qa/ios/Podfile +44 -0
  91. package/qa/ios/Podfile.lock +1634 -0
  92. package/qa/jest.config.js +3 -0
  93. package/qa/metro.config.js +67 -0
  94. package/qa/package-lock.json +14289 -0
  95. package/qa/package.json +47 -0
  96. package/qa/resource/arrow_back.png +0 -0
  97. package/qa/resource/home.png +0 -0
  98. package/qa/resource/info.png +0 -0
  99. package/qa/resource/link.png +0 -0
  100. package/qa/resource/refresh.png +0 -0
  101. package/qa/resource/token.png +0 -0
  102. package/qa/source/App.js +58 -0
  103. package/qa/source/common/Colors.js +20 -0
  104. package/qa/source/common/FCMService.js +94 -0
  105. package/qa/source/common/Native.ts +39 -0
  106. package/qa/source/common/Storage.js +13 -0
  107. package/qa/source/common/Styles.js +39 -0
  108. package/qa/source/component/AttributeEntryInputDialog.js +117 -0
  109. package/qa/source/component/AttributeTypeInputDialog.js +100 -0
  110. package/qa/source/component/ConfirmDialog.js +72 -0
  111. package/qa/source/component/CustomButton.js +50 -0
  112. package/qa/source/component/CustomEventParamsDialog.js +150 -0
  113. package/qa/source/component/CustomTextInput.js +40 -0
  114. package/qa/source/component/EntryInputDialog.js +89 -0
  115. package/qa/source/component/HorizontalPreference.js +46 -0
  116. package/qa/source/component/ImageButton.js +35 -0
  117. package/qa/source/component/InjectInputDialog.js +80 -0
  118. package/qa/source/component/MessageDialog.js +81 -0
  119. package/qa/source/component/UrlInputDialog.js +80 -0
  120. package/qa/source/component/ValueInputDialog.js +80 -0
  121. package/qa/source/component/VerticalPreference.js +42 -0
  122. package/qa/source/navigations/Stack.js +110 -0
  123. package/qa/source/pages/Browse.js +118 -0
  124. package/qa/source/pages/DeviceInfo.js +135 -0
  125. package/qa/source/pages/Event.js +171 -0
  126. package/qa/source/pages/Home.js +136 -0
  127. package/qa/source/pages/Identifiers.js +108 -0
  128. package/qa/source/pages/InstallReferrer.js +64 -0
  129. package/qa/source/pages/Placement.js +38 -0
  130. package/qa/source/pages/RequestPermissions.tsx +41 -0
  131. package/qa/source/pages/UserInfo.js +168 -0
  132. package/qa/source/pages/appInfo.js +22 -0
  133. package/qa/tsconfig.json +3 -0
  134. package/scripts/addiOSFramework.js +48 -0
  135. package/scripts/build-qa.sh +64 -0
  136. package/scripts/change_restricted.sh +21 -0
  137. package/scripts/update_native_version.sh +104 -0
  138. package/src/State.js +10 -2
  139. package/src/WebInterface.js +1 -1
@@ -0,0 +1,42 @@
1
+ import React, { Component } from 'react'
2
+ import {
3
+ TouchableOpacity,
4
+ Pressable,
5
+ View,
6
+ Text
7
+ } from 'react-native'
8
+
9
+ import { Styles } from '../common/Styles'
10
+ import { Colors } from '../common/Colors'
11
+
12
+ export default class VerticalPreference extends Component{
13
+
14
+ constructor(props){
15
+ super(props)
16
+
17
+ this.accessibilityLabel = Platform.OS !== 'ios' ? this.props.accessibilityLabel : null
18
+ this.testID = this.props.accessibilityLabel
19
+ }
20
+
21
+ render() {
22
+ return (
23
+ <Pressable
24
+ onPress={this.props.onPress}>
25
+ <Text
26
+ style={{
27
+ color: Colors.black,
28
+ fontSize: 16,
29
+ fontWeight: 600
30
+ }}>{this.props.title}</Text>
31
+ <Text
32
+ testID={this.testID}
33
+ accessibilityLabel={this.accessibilityLabel}
34
+ style={{
35
+ color: Colors.black,
36
+ fontSize: 12
37
+ }}>{this.props.text}</Text>
38
+ <View style={Styles.line} />
39
+ </Pressable>
40
+ )
41
+ }
42
+ }
@@ -0,0 +1,110 @@
1
+ import React from 'react'
2
+ import { createStackNavigator } from '@react-navigation/stack'
3
+
4
+ import ImageButton from '../component/ImageButton'
5
+
6
+ import HomePage from '../pages/Home'
7
+
8
+ import UserInfoPage from '../pages/UserInfo'
9
+ import EventPage from '../pages/Event'
10
+ import DeviceInfoPage from '../pages/DeviceInfo'
11
+ import IdentifiersPage from '../pages/Identifiers'
12
+ import InstallReferrerPage from '../pages/InstallReferrer'
13
+ import PlacementPage from '../pages/Placement'
14
+ import { RequestPermissionsPage } from '../pages/RequestPermissions'
15
+ import BrowsePage from '../pages/Browse'
16
+ import AppInfoPage from '../pages/appInfo'
17
+
18
+ const Stack = createStackNavigator()
19
+
20
+ const createNavigateButton = (navigation, accessibilityLabel, source) => {
21
+ return (
22
+ <ImageButton
23
+ source={source}
24
+ width={20}
25
+ height={20}
26
+ accessibilityLabel={accessibilityLabel}
27
+ onPress={() => {
28
+ if (navigation.canGoBack()) {
29
+ navigation.goBack()
30
+ }
31
+ }} />
32
+ )
33
+ }
34
+
35
+ const createNavigateBackButton = (navigation) => {
36
+ return createNavigateButton(navigation, 'navigateBack', require('./../../resource/arrow_back.png'))
37
+ }
38
+
39
+ const createNavigateHomeButton = (navigation) => {
40
+ return createNavigateButton(navigation, 'navigateHome', require('./../../resource/home.png'))
41
+ }
42
+
43
+ const StackNavigation = () => {
44
+ return (
45
+ <Stack.Navigator>
46
+ <Stack.Screen name='home'
47
+ component={HomePage}
48
+ options={({ navigation }) => ({
49
+ title: 'AirbridgeQA(react-native)',
50
+ headerRight: () => createNavigateHomeButton(navigation)
51
+ })}/>
52
+ <Stack.Screen name='userInfo'
53
+ component={UserInfoPage}
54
+ options={({ navigation }) => ({
55
+ headerLeft: () => createNavigateBackButton(navigation),
56
+ headerRight: () => createNavigateHomeButton(navigation)
57
+ })}/>
58
+ <Stack.Screen name='occurringEvent'
59
+ component={EventPage}
60
+ options={({ navigation }) => ({
61
+ headerLeft: () => createNavigateBackButton(navigation),
62
+ headerRight: () => createNavigateHomeButton(navigation)
63
+ })}/>
64
+ <Stack.Screen name='identifiers'
65
+ component={IdentifiersPage}
66
+ options={({ navigation }) => ({
67
+ headerLeft: () => createNavigateBackButton(navigation),
68
+ headerRight: () => createNavigateHomeButton(navigation)
69
+ })}/>
70
+ <Stack.Screen name='installReferrer'
71
+ component={InstallReferrerPage}
72
+ options={({ navigation }) => ({
73
+ headerLeft: () => createNavigateBackButton(navigation),
74
+ headerRight: () => createNavigateHomeButton(navigation)
75
+ })} />
76
+ <Stack.Screen name='deviceInfo'
77
+ component={DeviceInfoPage}
78
+ options={({ navigation }) => ({
79
+ headerLeft: () => createNavigateBackButton(navigation),
80
+ headerRight: () => createNavigateHomeButton(navigation)
81
+ })} />
82
+ <Stack.Screen name='requestPermissions'
83
+ component={RequestPermissionsPage}
84
+ options={({ navigation }) => ({
85
+ headerLeft: () => createNavigateBackButton(navigation),
86
+ headerRight: () => createNavigateHomeButton(navigation)
87
+ })} />
88
+ <Stack.Screen name='trackingLinksWithinApps'
89
+ component={PlacementPage}
90
+ options={({ navigation }) => ({
91
+ headerLeft: () => createNavigateBackButton(navigation),
92
+ headerRight: () => createNavigateHomeButton(navigation)
93
+ })} />
94
+ <Stack.Screen name='browse'
95
+ component={BrowsePage}
96
+ options={({ navigation }) => ({
97
+ headerLeft: () => createNavigateBackButton(navigation),
98
+ headerRight: () => createNavigateHomeButton(navigation)
99
+ })} />
100
+ <Stack.Screen name='appInfo'
101
+ component={AppInfoPage}
102
+ options={({ navigation }) => ({
103
+ headerLeft: () => createNavigateBackButton(navigation),
104
+ headerRight: () => createNavigateHomeButton(navigation)
105
+ })} />
106
+ </Stack.Navigator>
107
+ )
108
+ }
109
+
110
+ export default StackNavigation
@@ -0,0 +1,118 @@
1
+ import React, { Component } from 'react'
2
+
3
+ import { View } from 'react-native'
4
+ import ImageButton from '../component/ImageButton'
5
+
6
+ import UrlInputDialog from '../component/UrlInputDialog'
7
+ import InjectInputDialog from '../component/InjectInputDialog'
8
+ import MessageDialog from '../component/MessageDialog'
9
+
10
+ import { WebView } from 'react-native-webview'
11
+ import Airbridge from 'airbridge-react-native-sdk'
12
+
13
+ export default class BrowsePage extends Component {
14
+
15
+ constructor(props) {
16
+ super(props);
17
+
18
+ this.defaultQASource = 'https://sdk-download.airbridge.io/airbridge-web-sdk-qa-library/latest/AirbridgeQALibrary/index.html'
19
+ let token = '46bbd826f96e49ca92f04daf0d816f95'
20
+ this.webInterface = this.createWebInterface(token)
21
+
22
+ this.state = {
23
+ source: this.defaultQASource,
24
+ token: token,
25
+ script: this.webInterface.script,
26
+ info: ''
27
+ };
28
+
29
+ this.webviewRef = React.createRef()
30
+ this.urlRef = React.createRef()
31
+ this.injectRef = React.createRef()
32
+ this.infoRef = React.createRef()
33
+ }
34
+
35
+ handleWebViewMessage = (event) => {
36
+ console.log('Message received from web page:', event.nativeEvent);
37
+
38
+ const message = event.nativeEvent.data;
39
+ this.webInterface.handle(message);
40
+ }
41
+
42
+ createWebInterface = (token) => {
43
+ return Airbridge.createWebInterface(
44
+ token,
45
+ (command) => {
46
+ return `window.ReactNativeWebView.postMessage(${command})`;
47
+ }
48
+ )
49
+ }
50
+
51
+ render() {
52
+ return (
53
+ <View style={{flex: 1}}>
54
+ <WebView
55
+ ref={this.webviewRef}
56
+ source={{ uri: this.state.source }}
57
+ onMessage={ this.handleWebViewMessage }
58
+ webviewDebuggingEnabled={true}
59
+ injectedJavaScript={ this.state.script } />
60
+
61
+ <View style={{ flexDirection: 'row'}}>
62
+ <ImageButton
63
+ source={require('./../../resource/refresh.png')}
64
+ accessibilityLabel={'browseReload'}
65
+ onPress={() => {this.webviewRef.current.reload()}} />
66
+ <View style={{ margin: 4 }} />
67
+ <ImageButton
68
+ source={require('./../../resource/home.png')}
69
+ accessibilityLabel={'hybridTestPage'}
70
+ onPress={() => this.setState({source: this.defaultQASource})} />
71
+ <View style={{ margin: 4 }} />
72
+ <ImageButton
73
+ source={require('./../../resource/link.png')}
74
+ accessibilityLabel={'browseUrl'}
75
+ onPress={() => {this.urlRef.current.show()}} />
76
+ <View style={{ margin: 4 }} />
77
+ <ImageButton
78
+ source={require('./../../resource/token.png')}
79
+ accessibilityLabel={'injectWebToken'}
80
+ onPress={() => { this.injectRef.current.show() }} />
81
+ <View style={{ margin: 4 }} />
82
+ <ImageButton
83
+ source={require('./../../resource/info.png')}
84
+ accessibilityLabel={'info'}
85
+ onPress={() => {
86
+ var log = ''
87
+ log += 'url : ' + this.state.source.toString() + '\n\n'
88
+ log += 'webToken : ' + this.state.token.toString() + '\n'
89
+ this.setState({
90
+ info : log
91
+ })
92
+ this.infoRef.current.show()
93
+ }} />
94
+ </View>
95
+
96
+ <UrlInputDialog
97
+ ref={this.urlRef}
98
+ onConfirm={(value) => this.setState({source: value})} />
99
+ <InjectInputDialog
100
+ ref={this.injectRef}
101
+ onConfirm={(value) => {
102
+ this.webInterface = this.createWebInterface(value)
103
+ this.setState({
104
+ script: this.webInterface.script,
105
+ token: value
106
+ })
107
+ this.webviewRef.current.reload()
108
+ }} />
109
+ <MessageDialog
110
+ ref={this.infoRef}
111
+ title={'info'}
112
+ accessibilityLabel={'info'}
113
+ autoClose={false}
114
+ message={this.state.info} />
115
+ </View>
116
+ )
117
+ }
118
+ }
@@ -0,0 +1,135 @@
1
+ import React, { Component } from 'react'
2
+
3
+ import { View, NativeModules } from 'react-native'
4
+ import CustomButton from '../component/CustomButton'
5
+ import { Styles } from '../common/Styles'
6
+ import { Colors } from '../common/Colors'
7
+
8
+ import HorizontalPreference from '../component/HorizontalPreference';
9
+
10
+ import EntryInputDialog from '../component/EntryInputDialog'
11
+ import ValueInputDialog from '../component/ValueInputDialog'
12
+
13
+ import Airbridge from 'airbridge-react-native-sdk'
14
+
15
+ export default class DeviceInfoPage extends Component {
16
+
17
+ constructor(props) {
18
+ super(props);
19
+
20
+ this.state = { };
21
+
22
+ this.addRef = React.createRef()
23
+ this.removeRef = React.createRef()
24
+
25
+ this.fetchDeviceInfo()
26
+ }
27
+
28
+ fetchDeviceInfo = async () => {
29
+ const response = await NativeModules.DeviceInfoInteractor.deviceInfo()
30
+ console.log('response : ' + response)
31
+ const jsonData = JSON.parse(response)
32
+ const data = jsonData['data']
33
+ const NA = 'N/A'
34
+ this.setState({
35
+ deviceModel: `${data['deviceModel'] ?? NA}`,
36
+ deviceManufacturer: `${data['deviceManufacturer'] ?? NA}`,
37
+ osVersion: `${data['osVersion'] ?? NA}`,
38
+ locale: `${data['locale'] ?? NA}`,
39
+ timezone: `${data['timezone'] ?? NA}`,
40
+ orientation: `${data['orientation'] ?? NA}`,
41
+ screenSize: `${data['screenSize'] ?? NA}`,
42
+ location: `${data['location'] ?? NA}`,
43
+ speed: `${data['speed'] ?? NA}`,
44
+ bluetoothStatus: `${data['wifiStatus'] ?? NA}`,
45
+ networkCarrier: `${data['networkCarrier'] ?? NA}`,
46
+ cellularStatus: `${data['cellularStatus'] ?? NA}`,
47
+ wifiStatus: `${data['wifiStatus'] ?? NA}`,
48
+ })
49
+ }
50
+
51
+ render() {
52
+ return (
53
+ <View style={Styles.container}>
54
+ <CustomButton
55
+ buttonColor={Colors.red}
56
+ title={'ADD ALIAS'}
57
+ accessibilityLabel={'addAlias'}
58
+ onPress={() => this.addRef.current.show()} />
59
+ <CustomButton
60
+ buttonColor={Colors.pink}
61
+ title={'REMOVE ALIAS'}
62
+ accessibilityLabel={'removeAlias'}
63
+ onPress={() => this.removeRef.current.show()} />
64
+ <CustomButton
65
+ buttonColor={Colors.purple}
66
+ title={'CLEAR ALIAS'}
67
+ accessibilityLabel={'clearAlias'}
68
+ onPress={() => Airbridge.clearDeviceAlias()} />
69
+
70
+ <View style={{margin : 8}} />
71
+
72
+ <HorizontalPreference
73
+ title={'Device Model'}
74
+ text={this.state.deviceModel}
75
+ accessibilityLabel={'deviceModel'} />
76
+ <HorizontalPreference
77
+ title={'Device Manufacturer'}
78
+ text={this.state.deviceManufacturer}
79
+ accessibilityLabel={'deviceManufacturer'} />
80
+ <HorizontalPreference
81
+ title={'OS Version'}
82
+ text={this.state.osVersion}
83
+ accessibilityLabel={'osVersion'} />
84
+ <HorizontalPreference
85
+ title={'Locale'}
86
+ text={this.state.locale}
87
+ accessibilityLabel={'locale'} />
88
+ <HorizontalPreference
89
+ title={'Timezone'}
90
+ text={this.state.timezone}
91
+ accessibilityLabel={'timezone'} />
92
+ <HorizontalPreference
93
+ title={'Orientation'}
94
+ text={this.state.orientation}
95
+ accessibilityLabel={'orientation'} />
96
+ <HorizontalPreference
97
+ title={'Screen Size'}
98
+ text={this.state.screenSize}
99
+ accessibilityLabel={'screenSize'} />
100
+ <HorizontalPreference
101
+ title={'Location'}
102
+ text={this.state.location}
103
+ accessibilityLabel={'location'} />
104
+ <HorizontalPreference
105
+ title={'Speed'}
106
+ text={this.state.speed}
107
+ accessibilityLabel={'speed'} />
108
+ <HorizontalPreference
109
+ title={'Network Carrier'}
110
+ text={this.state.networkCarrier}
111
+ accessibilityLabel={'networkCarrier'} />
112
+ <HorizontalPreference
113
+ title={'Bluetooth Status'}
114
+ text={this.state.bluetoothStatus}
115
+ accessibilityLabel={'bluetoothStatus'} />
116
+ <HorizontalPreference
117
+ title={'Cellular Status'}
118
+ text={this.state.cellularStatus}
119
+ accessibilityLabel={'cellularStatus'} />
120
+ <HorizontalPreference
121
+ title={'Wifi Status'}
122
+ text={this.state.wifiStatus}
123
+ accessibilityLabel={'wifiStatus'} />
124
+
125
+ <EntryInputDialog
126
+ ref={this.addRef}
127
+ onConfirm={(key, value) => Airbridge.setDeviceAlias(key, value)} />
128
+ <ValueInputDialog
129
+ ref={this.removeRef}
130
+ onConfirm={(value) => Airbridge.removeDeviceAlias(value)} />
131
+
132
+ </View>
133
+ )
134
+ }
135
+ }
@@ -0,0 +1,171 @@
1
+ import React, { Component } from 'react'
2
+ import {
3
+ Text,
4
+ View,
5
+ } from 'react-native'
6
+
7
+ import CustomButton from '../component/CustomButton'
8
+ import { Styles } from '../common/Styles'
9
+ import { Colors } from '../common/Colors'
10
+
11
+ import CustomEventParamsDialog from '../component/CustomEventParamsDialog'
12
+
13
+ import Airbridge, {
14
+ AirbridgeCategory,
15
+ AirbridgeProduct,
16
+ AirbridgeAttributes
17
+ } from 'airbridge-react-native-sdk';
18
+
19
+ export default class EventPage extends Component {
20
+
21
+ constructor(props) {
22
+ super(props);
23
+ this.state = {
24
+ eventModalVisible: false
25
+ };
26
+ this.customEventRef = React.createRef()
27
+ }
28
+
29
+ setEventModalVisible = (enable) => {
30
+ this.setState({ eventModalVisible: enable })
31
+ }
32
+
33
+ createTestProducts = () => {
34
+ return [{
35
+ [AirbridgeProduct.PRODUCT_ID]: 'coca_1',
36
+ [AirbridgeProduct.NAME]: 'Coca cola',
37
+ [AirbridgeProduct.PRICE]: 1.99,
38
+ [AirbridgeProduct.CURRENCY]: 'usd',
39
+ [AirbridgeProduct.QUANTITY]: 10,
40
+ [AirbridgeProduct.POSITION]: 1,
41
+ }, {
42
+ [AirbridgeProduct.PRODUCT_ID]: 'fanta_1',
43
+ [AirbridgeProduct.NAME]: 'Fanta Orange',
44
+ [AirbridgeProduct.PRICE]: 2.50,
45
+ [AirbridgeProduct.CURRENCY]: 'usd',
46
+ [AirbridgeProduct.QUANTITY]: 5,
47
+ [AirbridgeProduct.POSITION]: 2,
48
+ }, {
49
+ [AirbridgeProduct.PRODUCT_ID]: 'terra_pack_1',
50
+ [AirbridgeProduct.NAME]: 'Terra 12 Pack',
51
+ [AirbridgeProduct.PRICE]: 10.99,
52
+ [AirbridgeProduct.CURRENCY]: 'usd',
53
+ [AirbridgeProduct.QUANTITY]: 10,
54
+ [AirbridgeProduct.POSITION]: 3,
55
+ }];
56
+ }
57
+
58
+ render() {
59
+ return (
60
+ <View style={Styles.container}>
61
+ <Text style={{marginHorizontal:2, marginBottom: 2}}>Custom Event</Text>
62
+ <CustomButton
63
+ buttonColor={Colors.red}
64
+ title={'CUSTOM EVENT'}
65
+ accessibilityLabel={'customEvent'}
66
+ arrow={true}
67
+ onPress={() => this.customEventRef.current.show()} />
68
+
69
+ <Text style={{marginHorizontal:2, marginBottom: 2}}>In app Events</Text>
70
+ <CustomButton
71
+ buttonColor={Colors.red}
72
+ title={'SIGN UP EVENT'}
73
+ accessibilityLabel={'signUpEvent'}
74
+ onPress={() => Airbridge.trackEvent(AirbridgeCategory.SIGN_UP)} />
75
+ <CustomButton
76
+ buttonColor={Colors.pink}
77
+ title={'SIGN IN EVENT'}
78
+ accessibilityLabel={'signInEvent'}
79
+ onPress={() => Airbridge.trackEvent(AirbridgeCategory.SIGN_IN)} />
80
+ <CustomButton
81
+ buttonColor={Colors.purple}
82
+ title={'SIGN OUT EVENT'}
83
+ accessibilityLabel={'signOutEvent'}
84
+ onPress={() => Airbridge.trackEvent(AirbridgeCategory.SIGN_OUT)} />
85
+
86
+ <Text style={{marginHorizontal:2, marginBottom: 2}}>E-COMMERCE Events</Text>
87
+ <CustomButton
88
+ buttonColor={Colors.red}
89
+ title={'HOME VIEW EVENT'}
90
+ accessibilityLabel={'homeViewEvent'}
91
+ onPress={() => Airbridge.trackEvent(AirbridgeCategory.HOME_VIEW)} />
92
+ <CustomButton
93
+ buttonColor={Colors.pink}
94
+ title={'SEARCH RESULT VIEW EVENT'}
95
+ accessibilityLabel={'searchResultViewEvent'}
96
+ onPress={() => {
97
+ Airbridge.event.trackEvent(AirbridgeCategory.SEARCH_RESULT_VIEW, {
98
+ semanticAttributes: {
99
+ [AirbridgeAttributes.QUERY]: 'query_1',
100
+ [AirbridgeAttributes.PRODUCTS]: this.createTestProducts()
101
+ }})
102
+ }} />
103
+ <CustomButton
104
+ buttonColor={Colors.purple}
105
+ title={'PRODUCT LIST VIEW EVENT'}
106
+ accessibilityLabel={'productListViewEvent'}
107
+ onPress={() => {
108
+ Airbridge.event.trackEvent(AirbridgeCategory.PRODUCT_LIST_VIEW, {
109
+ semanticAttributes: {
110
+ [AirbridgeAttributes.PRODUCT_LIST_ID]: 'list_1',
111
+ [AirbridgeAttributes.PRODUCTS]: this.createTestProducts()
112
+ }})
113
+ }} />
114
+ <CustomButton
115
+ buttonColor={Colors.deepPurple}
116
+ title={'PRODUCT DETAILS VIEW EVENT'}
117
+ accessibilityLabel={'productDetailsViewEvent'}
118
+ onPress={() => {
119
+ Airbridge.event.trackEvent(AirbridgeCategory.PRODUCT_DETAILS_VIEW, {
120
+ semanticAttributes: {
121
+ [AirbridgeAttributes.QUERY]: 'query_1',
122
+ [AirbridgeAttributes.PRODUCTS]: this.createTestProducts()
123
+ }})
124
+ }} />
125
+ <CustomButton
126
+ buttonColor={Colors.indigo}
127
+ title={'ADD TO CART EVENT'}
128
+ accessibilityLabel={'addToCartEvent'}
129
+ onPress={() => {
130
+ Airbridge.event.trackEvent(AirbridgeCategory.ADD_TO_CART, {
131
+ value: 43.39,
132
+ semanticAttributes: {
133
+ [AirbridgeAttributes.CART_ID]: 'cart_1',
134
+ [AirbridgeAttributes.CURRENCY]: 'usd',
135
+ [AirbridgeAttributes.TOTAL_QUANTITY]: 16,
136
+ [AirbridgeAttributes.PRODUCTS]: this.createTestProducts()
137
+ }})
138
+ }} />
139
+ <CustomButton
140
+ buttonColor={Colors.blue}
141
+ title={'ORDER COMPLETE EVENT'}
142
+ accessibilityLabel={'orderCompleteEvent'}
143
+ onPress={() => {
144
+ Airbridge.event.trackEvent(AirbridgeCategory.ORDER_COMPLETED, {
145
+ value: 43.39,
146
+ semanticAttributes: {
147
+ [AirbridgeAttributes.CART_ID]: 'cart_1',
148
+ [AirbridgeAttributes.CURRENCY]: 'usd',
149
+ [AirbridgeAttributes.TOTAL_QUANTITY]: 16,
150
+ [AirbridgeAttributes.PRODUCTS]: this.createTestProducts()
151
+ }})
152
+ }} />
153
+
154
+ <CustomEventParamsDialog
155
+ ref={this.customEventRef}
156
+ initCategory={'custom_category'}
157
+ initAction={'custom_action'}
158
+ initLabel={'custom_label'}
159
+ initValue={1234}
160
+ onConfirm={(category, action, label, value, semanticAttr, customAttr) => {
161
+ Airbridge.event.trackEvent(category, {
162
+ action: action,
163
+ label: label,
164
+ value: value,
165
+ semanticAttributes: semanticAttr,
166
+ customAttributes: customAttr})
167
+ }} />
168
+ </View>
169
+ );
170
+ }
171
+ }