airbridge-react-native-sdk-restricted 2.8.7 → 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 (138) 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/android/.settings/org.eclipse.buildship.core.prefs +2 -0
  13. package/android/src/main/java/co/ab180/airbridge/reactnative/AirbridgeRN.java +19 -4
  14. package/android/src/main/java/co/ab180/airbridge/reactnative/ConfigReader.java +63 -40
  15. package/changelog.md +5 -0
  16. package/ios/AirbridgeRN/ARNConfigReader.h +1 -1
  17. package/ios/AirbridgeRN/ARNConfigReader.m +13 -15
  18. package/ios/AirbridgeRN/AirbridgeRN.m +23 -2
  19. package/ios/copy-config.rb +1 -1
  20. package/package.json +1 -1
  21. package/qa/.bundle/config +2 -0
  22. package/qa/.eslintrc.js +4 -0
  23. package/qa/.prettierrc.js +7 -0
  24. package/qa/.watchmanconfig +1 -0
  25. package/qa/Gemfile +9 -0
  26. package/qa/Gemfile.lock +105 -0
  27. package/qa/__tests__/App.test.tsx +17 -0
  28. package/qa/airbridge.json +7 -0
  29. package/qa/android/app/build.gradle +130 -0
  30. package/qa/android/app/debug.keystore +0 -0
  31. package/qa/android/app/google-services.json +29 -0
  32. package/qa/android/app/proguard-rules.pro +10 -0
  33. package/qa/android/app/src/debug/AndroidManifest.xml +9 -0
  34. package/qa/android/app/src/main/AndroidManifest.xml +65 -0
  35. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/ConfigurationLoader.kt +49 -0
  36. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/MainActivity.kt +35 -0
  37. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/MainApplication.kt +46 -0
  38. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/DeviceInfoInteractor.kt +60 -0
  39. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/DeviceInfoUtils.kt +115 -0
  40. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/IdentifiersInteractor.kt +83 -0
  41. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/InstallReferrerInteractor.kt +91 -0
  42. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/ModuleInjector.kt +22 -0
  43. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/PermissionInteractor.kt +55 -0
  44. package/qa/android/app/src/main/java/co/ab180/airbridge/qa/application/module/UserInfoInteractor.kt +74 -0
  45. package/qa/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  46. package/qa/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  47. package/qa/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  48. package/qa/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  49. package/qa/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  50. package/qa/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  51. package/qa/android/app/src/main/res/values/strings.xml +3 -0
  52. package/qa/android/app/src/main/res/values/styles.xml +9 -0
  53. package/qa/android/build.gradle +28 -0
  54. package/qa/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  55. package/qa/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  56. package/qa/android/gradle.properties +41 -0
  57. package/qa/android/gradlew +249 -0
  58. package/qa/android/gradlew.bat +92 -0
  59. package/qa/android/settings.gradle +4 -0
  60. package/qa/app.json +4 -0
  61. package/qa/babel.config.js +3 -0
  62. package/qa/index.js +5 -0
  63. package/qa/ios/.xcode.env +11 -0
  64. package/qa/ios/AirbridgeQA/AirbridgeQA.entitlements +17 -0
  65. package/qa/ios/AirbridgeQA/AppDelegate.h +6 -0
  66. package/qa/ios/AirbridgeQA/AppDelegate.mm +123 -0
  67. package/qa/ios/AirbridgeQA/DeviceInfoInteractor.m +14 -0
  68. package/qa/ios/AirbridgeQA/DeviceInfoInteractor.swift +151 -0
  69. package/qa/ios/AirbridgeQA/IdentifiersInteractor.m +14 -0
  70. package/qa/ios/AirbridgeQA/IdentifiersInteractor.swift +40 -0
  71. package/qa/ios/AirbridgeQA/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  72. package/qa/ios/AirbridgeQA/Images.xcassets/Contents.json +6 -0
  73. package/qa/ios/AirbridgeQA/Info.plist +66 -0
  74. package/qa/ios/AirbridgeQA/LaunchScreen.storyboard +47 -0
  75. package/qa/ios/AirbridgeQA/PermissionInteractor.m +14 -0
  76. package/qa/ios/AirbridgeQA/PermissionInteractor.swift +19 -0
  77. package/qa/ios/AirbridgeQA/PrivacyInfo.xcprivacy +39 -0
  78. package/qa/ios/AirbridgeQA/UserInfoInteractor.m +57 -0
  79. package/qa/ios/AirbridgeQA/UserInfoInteractor.swift +49 -0
  80. package/qa/ios/AirbridgeQA/main.m +10 -0
  81. package/qa/ios/AirbridgeQA.xcodeproj/project.pbxproj +771 -0
  82. package/qa/ios/AirbridgeQA.xcodeproj/xcshareddata/xcschemes/AirbridgeQA.xcscheme +88 -0
  83. package/qa/ios/AirbridgeQA.xcworkspace/contents.xcworkspacedata +10 -0
  84. package/qa/ios/AirbridgeQA.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  85. package/qa/ios/AirbridgeQATests/AirbridgeQATests.m +66 -0
  86. package/qa/ios/AirbridgeQATests/Info.plist +24 -0
  87. package/qa/ios/GoogleService-Info.plist +30 -0
  88. package/qa/ios/Library/airbridge-ios-sdk-qa-library.podspec +26 -0
  89. package/qa/ios/Podfile +44 -0
  90. package/qa/ios/Podfile.lock +1634 -0
  91. package/qa/jest.config.js +3 -0
  92. package/qa/metro.config.js +67 -0
  93. package/qa/package-lock.json +14289 -0
  94. package/qa/package.json +47 -0
  95. package/qa/resource/arrow_back.png +0 -0
  96. package/qa/resource/home.png +0 -0
  97. package/qa/resource/info.png +0 -0
  98. package/qa/resource/link.png +0 -0
  99. package/qa/resource/refresh.png +0 -0
  100. package/qa/resource/token.png +0 -0
  101. package/qa/source/App.js +58 -0
  102. package/qa/source/common/Colors.js +20 -0
  103. package/qa/source/common/FCMService.js +94 -0
  104. package/qa/source/common/Native.ts +39 -0
  105. package/qa/source/common/Storage.js +13 -0
  106. package/qa/source/common/Styles.js +39 -0
  107. package/qa/source/component/AttributeEntryInputDialog.js +117 -0
  108. package/qa/source/component/AttributeTypeInputDialog.js +100 -0
  109. package/qa/source/component/ConfirmDialog.js +72 -0
  110. package/qa/source/component/CustomButton.js +50 -0
  111. package/qa/source/component/CustomEventParamsDialog.js +150 -0
  112. package/qa/source/component/CustomTextInput.js +40 -0
  113. package/qa/source/component/EntryInputDialog.js +89 -0
  114. package/qa/source/component/HorizontalPreference.js +46 -0
  115. package/qa/source/component/ImageButton.js +35 -0
  116. package/qa/source/component/InjectInputDialog.js +80 -0
  117. package/qa/source/component/MessageDialog.js +81 -0
  118. package/qa/source/component/UrlInputDialog.js +80 -0
  119. package/qa/source/component/ValueInputDialog.js +80 -0
  120. package/qa/source/component/VerticalPreference.js +42 -0
  121. package/qa/source/navigations/Stack.js +110 -0
  122. package/qa/source/pages/Browse.js +118 -0
  123. package/qa/source/pages/DeviceInfo.js +135 -0
  124. package/qa/source/pages/Event.js +171 -0
  125. package/qa/source/pages/Home.js +136 -0
  126. package/qa/source/pages/Identifiers.js +108 -0
  127. package/qa/source/pages/InstallReferrer.js +64 -0
  128. package/qa/source/pages/Placement.js +38 -0
  129. package/qa/source/pages/RequestPermissions.tsx +41 -0
  130. package/qa/source/pages/UserInfo.js +168 -0
  131. package/qa/source/pages/appInfo.js +22 -0
  132. package/qa/tsconfig.json +3 -0
  133. package/scripts/addiOSFramework.js +48 -0
  134. package/scripts/build-qa.sh +64 -0
  135. package/scripts/change_restricted.sh +21 -0
  136. package/scripts/update_native_version.sh +104 -0
  137. package/src/State.js +10 -2
  138. package/src/WebInterface.js +1 -1
@@ -0,0 +1,150 @@
1
+ import React, { Component } from 'react'
2
+ import propTypes from 'prop-types'
3
+
4
+ import { View, Modal, Text } from 'react-native'
5
+ import { Styles } from '../common/Styles'
6
+ import CustomButton from './CustomButton'
7
+ import { Colors } from '../common/Colors'
8
+
9
+ import CustomTextInput from './CustomTextInput'
10
+
11
+ export default class CustomEventParamsDialog extends Component {
12
+
13
+ constructor(props) {
14
+ super(props)
15
+ this.state = {
16
+ visible: false,
17
+ category: this.props.initCategory == null ? '' : this.props.initCategory,
18
+ action: this.props.initAction == null ? '' : this.props.initAction,
19
+ label: this.props.initLabel == null ? '' : this.props.initLabel,
20
+ value: this.props.initValue == null ? '' : '' + this.props.initValue,
21
+ semanticAttr: '',
22
+ customAttr: ''
23
+ }
24
+ }
25
+
26
+ show = () => {
27
+ this.setState({ visible: true })
28
+ }
29
+
30
+ close = () => {
31
+ this.setState({
32
+ visible: false,
33
+ category: this.props.initCategory == null ? '' : this.props.initCategory,
34
+ action: this.props.initAction == null ? '' : this.props.initAction,
35
+ label: this.props.initLabel == null ? '' : this.props.initLabel,
36
+ value: this.props.initValue == null ? '' : '' + this.props.initValue,
37
+ semanticAttr: '',
38
+ customAttr: ''
39
+ })
40
+ }
41
+
42
+ confirm = () => {
43
+ if (this.props.onConfirm != null) {
44
+ var outputCategory = this.state.category.trim()
45
+ var outputAction = this.state.action.trim()
46
+ outputAction = outputAction.length == 0 ? null : outputAction
47
+ var outputLabel = this.state.label.trim()
48
+ outputLabel = outputLabel.length == 0 ? null : outputLabel
49
+ var outputValue = this.state.value.length == 0 ? null : Number(this.state.value)
50
+ var outputSemanticAttr
51
+ try{
52
+ outputSemanticAttr = JSON.parse(this.state.semanticAttr)
53
+ outputSemanticAttr = outputSemanticAttr.length == 0 ? null : outputSemanticAttr
54
+ } catch (e) {
55
+ outputSemanticAttr = null
56
+ }
57
+ var outputCustomAttr
58
+ try{
59
+ outputCustomAttr = JSON.parse(this.state.customAttr)
60
+ outputCustomAttr = outputCustomAttr.length == 0 ? null : outputCustomAttr
61
+ } catch (e) {
62
+ outputCustomAttr = null
63
+ }
64
+ this.props.onConfirm(outputCategory, outputAction, outputLabel, outputValue, outputSemanticAttr, outputCustomAttr)
65
+ }
66
+ this.close()
67
+ }
68
+
69
+ render() {
70
+ return (
71
+ <Modal
72
+ visible={this.state.visible}
73
+ transparent={true}>
74
+ <View style={Styles.centeredView}>
75
+ <View style={Styles.modalView}>
76
+ <Text style={ Styles.h2 }>Custom event params</Text>
77
+ <View style={{ margin: 4 }} />
78
+ <CustomTextInput
79
+ title={'CATEGORY'}
80
+ placeholder={'Enter category'}
81
+ accessibilityLabel={'customEventCategory'}
82
+ onChangeText={newText => this.setState({ category: newText })}
83
+ value={this.state.category} />
84
+ <View style={{ margin: 4 }} />
85
+ <CustomTextInput
86
+ title={'ACTION'}
87
+ placeholder={'Enter action'}
88
+ accessibilityLabel={'customEventAction'}
89
+ onChangeText={newText => this.setState({ action: newText })}
90
+ value={this.state.action} />
91
+ <View style={{ margin: 4 }} />
92
+ <CustomTextInput
93
+ title={'LABEL'}
94
+ placeholder={'Enter label'}
95
+ accessibilityLabel={'customEventLabel'}
96
+ onChangeText={newText => this.setState({ label: newText })}
97
+ value={this.state.label} />
98
+ <View style={{ margin: 4 }} />
99
+ <CustomTextInput
100
+ title={'VALUE'}
101
+ placeholder={'Enter value'}
102
+ accessibilityLabel={'customEventValue'}
103
+ onChangeText={newText => this.setState({ value: newText })}
104
+ value={this.state.value} />
105
+ <View style={{ margin: 4 }} />
106
+ <CustomTextInput
107
+ title={'SEMANTIC ATTRIBUTES'}
108
+ placeholder={'Enter SemanticAttributes'}
109
+ accessibilityLabel={'customEventSemanticAttributes'}
110
+ onChangeText={newText => this.setState({ semanticAttr: newText })}
111
+ value={this.state.semanticAttr} />
112
+ <View style={{ margin: 4 }} />
113
+ <CustomTextInput
114
+ title={'CUSTOM ATTRIBUTES'}
115
+ placeholder={'Enter CustomAttributes'}
116
+ accessibilityLabel={'customEventCustomAttributes'}
117
+ onChangeText={newText => this.setState({ customAttr: newText })}
118
+ value={this.state.customAttr} />
119
+ <View style={{ margin: 4 }} />
120
+
121
+ <View style={{ flexDirection: 'row'}}>
122
+ <CustomButton
123
+ buttonColor={Colors.deepBlue}
124
+ title={'cancel'}
125
+ titleColor='white'
126
+ accessibilityLabel={'cancel'}
127
+ onPress={() => this.close()} />
128
+ <View style={{ margin: 4 }} />
129
+ <CustomButton
130
+ buttonColor={Colors.deepBlue}
131
+ title={'save'}
132
+ titleColor='white'
133
+ accessibilityLabel={'save'}
134
+ onPress={() => this.confirm()} />
135
+ </View>
136
+ </View>
137
+ </View>
138
+ </Modal>
139
+ )
140
+ }
141
+ }
142
+
143
+ CustomEventParamsDialog.propTypes = {
144
+ onConfirm: propTypes.func.isRequired,
145
+
146
+ initCategory: propTypes.string,
147
+ initAction: propTypes.string,
148
+ initLabel: propTypes.string,
149
+ initValue: propTypes.number,
150
+ }
@@ -0,0 +1,40 @@
1
+ import React, { Component } from 'react'
2
+ import {
3
+ Platform,
4
+ View,
5
+ Text,
6
+ TextInput
7
+ } from 'react-native'
8
+
9
+ export default class CustomTextInput extends Component{
10
+
11
+ constructor(props){
12
+ super(props)
13
+
14
+ this.accessibilityLabel = Platform.OS !== 'ios' ? this.props.accessibilityLabel : null
15
+ this.testID = this.props.accessibilityLabel
16
+ }
17
+
18
+ render() {
19
+ return (
20
+ <View style={{width: '100%'}}>
21
+ <Text style={{width: '100%', fontWeight: 'bold', fontSize: 12}}>{this.props.title}</Text>
22
+ <TextInput
23
+ placeholder={this.props.placeholder}
24
+ testID={this.testID}
25
+ accessibilityLabel={this.accessibilityLabel}
26
+ onChangeText={this.props.onChangeText}
27
+ value={this.props.value}
28
+ style={{
29
+ width: '100%',
30
+ backgroundColor: 'white',
31
+ borderColor: 'grey',
32
+ borderWidth: 1,
33
+ minHeight: 36,
34
+ paddingHorizontal: 16,
35
+ borderRadius: 16,
36
+ }} />
37
+ </View>
38
+ )
39
+ }
40
+ }
@@ -0,0 +1,89 @@
1
+ import React, { Component } from 'react'
2
+ import propTypes from 'prop-types'
3
+
4
+ import { View, Modal, Text } from 'react-native'
5
+ import { Styles } from '../common/Styles'
6
+ import CustomButton from './CustomButton'
7
+ import { Colors } from '../common/Colors'
8
+
9
+ import CustomTextInput from './CustomTextInput'
10
+
11
+ export default class EntryInputDialog extends Component {
12
+
13
+ constructor(props) {
14
+ super(props)
15
+ this.state = {
16
+ visible: false,
17
+ key: '',
18
+ value: ''
19
+ }
20
+ }
21
+
22
+ show = () => {
23
+ this.setState({ visible: true })
24
+ }
25
+
26
+ close = () => {
27
+ this.setState({
28
+ visible: false,
29
+ key: '',
30
+ value: ''
31
+ })
32
+ }
33
+
34
+ confirm = () => {
35
+ if (this.props.onConfirm != null) {
36
+ this.props.onConfirm(this.state.key, this.state.value)
37
+ }
38
+ this.close()
39
+ }
40
+
41
+ render() {
42
+ return (
43
+ <Modal
44
+ visible={this.state.visible}
45
+ transparent={true}>
46
+ <View style={Styles.centeredView}>
47
+ <View style={Styles.modalView}>
48
+ <Text style={ Styles.h2 }>Input Entry</Text>
49
+ <View style={{ margin: 4 }} />
50
+ <CustomTextInput
51
+ title={'KEY'}
52
+ placeholder={'Enter key'}
53
+ accessibilityLabel={'key'}
54
+ onChangeText={newText => this.setState({ key: newText })}
55
+ value={this.state.key} />
56
+ <View style={{ margin: 4 }} />
57
+ <CustomTextInput
58
+ title={'VALUE'}
59
+ placeholder={'Enter value'}
60
+ accessibilityLabel={'value'}
61
+ onChangeText={newText => this.setState({ value: newText })}
62
+ value={this.state.value} />
63
+ <View style={{ margin: 4 }} />
64
+
65
+ <View style={{ flexDirection: 'row'}}>
66
+ <CustomButton
67
+ buttonColor={Colors.deepBlue}
68
+ title={'cancel'}
69
+ titleColor='white'
70
+ accessibilityLabel={'cancel'}
71
+ onPress={() => this.close()} />
72
+ <View style={{ margin: 4 }} />
73
+ <CustomButton
74
+ buttonColor={Colors.deepBlue}
75
+ title={'save'}
76
+ titleColor='white'
77
+ accessibilityLabel={'save'}
78
+ onPress={() => this.confirm()} />
79
+ </View>
80
+ </View>
81
+ </View>
82
+ </Modal>
83
+ )
84
+ }
85
+ }
86
+
87
+ EntryInputDialog.propTypes = {
88
+ onConfirm: propTypes.func.isRequired
89
+ }
@@ -0,0 +1,46 @@
1
+ import React, { Component } from 'react'
2
+ import {
3
+ View,
4
+ Text
5
+ } from 'react-native'
6
+
7
+ import { Styles } from '../common/Styles'
8
+ import { Colors } from '../common/Colors'
9
+
10
+ export default class HorizontalPreference extends Component{
11
+
12
+ constructor(props){
13
+ super(props)
14
+
15
+ this.accessibilityLabel = Platform.OS !== 'ios' ? this.props.accessibilityLabel : null
16
+ this.testID = this.props.accessibilityLabel
17
+ }
18
+
19
+ render() {
20
+ return (
21
+ <View>
22
+ <View
23
+ style={{
24
+ flexDirection: 'row',
25
+ marginBottom: 4,
26
+ alignItems: 'center'
27
+ }}>
28
+ <Text style={{
29
+ color: Colors.black,
30
+ fontSize: 16,
31
+ fontWeight: 900,
32
+ marginEnd: 12
33
+ }}>{this.props.title}</Text>
34
+ <Text
35
+ testID={this.testID}
36
+ accessibilityLabel={this.accessibilityLabel}
37
+ style={{
38
+ color: Colors.black,
39
+ fontSize: 16
40
+ }}>{this.props.text}</Text>
41
+ </View>
42
+ <View style={Styles.line} />
43
+ </View>
44
+ )
45
+ }
46
+ }
@@ -0,0 +1,35 @@
1
+ import React, { Component } from 'react'
2
+
3
+ import {
4
+ Platform,
5
+ Pressable,
6
+ Image,
7
+ } from 'react-native'
8
+
9
+ export default class ImageButton extends Component{
10
+
11
+ constructor(props){
12
+ super(props)
13
+
14
+ this.accessibilityLabel = Platform.OS !== 'ios' ? this.props.accessibilityLabel : null
15
+ this.testID = this.props.accessibilityLabel
16
+ }
17
+
18
+ render() {
19
+ return (
20
+ <Pressable
21
+ testID={this.testID}
22
+ accessibilityLabel={this.accessibilityLabel}
23
+ onPress={this.props.onPress}>
24
+ <Image
25
+ style={{
26
+ padding: 12,
27
+ margin: 12,
28
+ width: this.props.width,
29
+ height: this.props.height
30
+ }}
31
+ source={ this.props.source }/>
32
+ </Pressable>
33
+ )
34
+ }
35
+ }
@@ -0,0 +1,80 @@
1
+ import React, { Component } from 'react'
2
+ import propTypes from 'prop-types'
3
+
4
+ import { View, Modal, Text } from 'react-native'
5
+ import { Styles } from '../common/Styles'
6
+ import CustomButton from './CustomButton'
7
+ import { Colors } from '../common/Colors'
8
+
9
+ import CustomTextInput from './CustomTextInput'
10
+
11
+ export default class InjectInputDialog extends Component {
12
+
13
+ constructor(props) {
14
+ super(props)
15
+ this.state = {
16
+ visible: false,
17
+ value: ''
18
+ }
19
+ }
20
+
21
+ show = () => {
22
+ this.setState({ visible: true })
23
+ }
24
+
25
+ close = () => {
26
+ this.setState({
27
+ visible: false,
28
+ value: ''
29
+ })
30
+ }
31
+
32
+ confirm = () => {
33
+ if (this.props.onConfirm != null) {
34
+ this.props.onConfirm(this.state.value)
35
+ }
36
+ this.close()
37
+ }
38
+
39
+ render() {
40
+ return (
41
+ <Modal
42
+ visible={this.state.visible}
43
+ transparent={true}>
44
+ <View style={Styles.centeredView}>
45
+ <View style={Styles.modalView}>
46
+ <Text style={ Styles.h2 }>Input token</Text>
47
+ <View style={{ margin: 4 }} />
48
+ <CustomTextInput
49
+ title={'Token'}
50
+ placeholder={'Enter token'}
51
+ accessibilityLabel='token'
52
+ onChangeText={newText => this.setState({ value: newText })}
53
+ value={this.state.value} />
54
+ <View style={{ margin: 4 }} />
55
+
56
+ <View style={{ flexDirection: 'row'}}>
57
+ <CustomButton
58
+ buttonColor={Colors.deepBlue}
59
+ title={'cancel'}
60
+ titleColor='white'
61
+ accessibilityLabel={'cancel'}
62
+ onPress={() => this.close()} />
63
+ <View style={{ margin: 4 }} />
64
+ <CustomButton
65
+ buttonColor={Colors.deepBlue}
66
+ title={'inject'}
67
+ titleColor='white'
68
+ accessibilityLabel={'inject'}
69
+ onPress={() => this.confirm()} />
70
+ </View>
71
+ </View>
72
+ </View>
73
+ </Modal>
74
+ )
75
+ }
76
+ }
77
+
78
+ InjectInputDialog.propTypes = {
79
+ onConfirm: propTypes.func.isRequired
80
+ }
@@ -0,0 +1,81 @@
1
+ import React, { Component } from 'react'
2
+ import propTypes from 'prop-types'
3
+
4
+ import { View, Modal, Text } from 'react-native'
5
+ import { Styles } from '../common/Styles'
6
+ import { Colors } from '../common/Colors'
7
+
8
+ import CustomButton from './CustomButton'
9
+
10
+ export default class MessageDialog extends Component {
11
+
12
+ constructor(props) {
13
+ super(props)
14
+
15
+ this.accessibilityLabel = Platform.OS !== 'ios' ? this.props.accessibilityLabel : null
16
+ this.testID = this.props.accessibilityLabel
17
+ this.autoClose = this.props.autoClose ?? true
18
+
19
+ this.state = {
20
+ visible: false,
21
+ value: ''
22
+ }
23
+ }
24
+
25
+ show = () => {
26
+ this.setState({ visible: true })
27
+
28
+ if (this.autoClose == true) {
29
+ this.setTimer(2000)
30
+ }
31
+ }
32
+
33
+ close = () => {
34
+ this.setState({
35
+ visible: false,
36
+ value: ''
37
+ })
38
+ }
39
+
40
+ setTimer = async (value) => {
41
+ new Promise(resolve => {
42
+ setTimeout(() => {
43
+ resolve(value)
44
+ this.close()
45
+ }, value)
46
+ })
47
+ }
48
+
49
+ render() {
50
+ return (
51
+ <Modal
52
+ visible={this.state.visible}
53
+ transparent={true}>
54
+ <View style={Styles.centeredView}>
55
+ <View style={Styles.modalView}>
56
+ <Text style={ Styles.h2 }>{this.props.title}</Text>
57
+ <View style={{ margin: 4 }} />
58
+ <Text
59
+ testID={this.testID}
60
+ accessibilityLabel={this.accessibilityLabel}
61
+ >{this.props.message}</Text>
62
+ {this.autoClose == false &&
63
+ <CustomButton
64
+ buttonColor={Colors.deepBlue}
65
+ title={'ok'}
66
+ titleColor='white'
67
+ accessibilityLabel={'ok'}
68
+ onPress={() => this.close()} />
69
+ }
70
+ </View>
71
+ </View>
72
+ </Modal>
73
+ )
74
+ }
75
+ }
76
+
77
+ MessageDialog.propTypes = {
78
+ title: propTypes.string.isRequired,
79
+ message: propTypes.string.isRequired,
80
+ accessibilityLabel: propTypes.string.isRequired
81
+ }
@@ -0,0 +1,80 @@
1
+ import React, { Component } from 'react'
2
+ import propTypes from 'prop-types'
3
+
4
+ import { View, Modal, Text } from 'react-native'
5
+ import { Styles } from '../common/Styles'
6
+ import CustomButton from './CustomButton'
7
+ import { Colors } from '../common/Colors'
8
+
9
+ import CustomTextInput from './CustomTextInput'
10
+
11
+ export default class UrlInputDialog extends Component {
12
+
13
+ constructor(props) {
14
+ super(props)
15
+ this.state = {
16
+ visible: false,
17
+ value: ''
18
+ }
19
+ }
20
+
21
+ show = () => {
22
+ this.setState({ visible: true })
23
+ }
24
+
25
+ close = () => {
26
+ this.setState({
27
+ visible: false,
28
+ value: ''
29
+ })
30
+ }
31
+
32
+ confirm = () => {
33
+ if (this.props.onConfirm != null) {
34
+ this.props.onConfirm(this.state.value)
35
+ }
36
+ this.close()
37
+ }
38
+
39
+ render() {
40
+ return (
41
+ <Modal
42
+ visible={this.state.visible}
43
+ transparent={true}>
44
+ <View style={Styles.centeredView}>
45
+ <View style={Styles.modalView}>
46
+ <Text style={ Styles.h2 }>Input URL</Text>
47
+ <View style={{ margin: 4 }} />
48
+ <CustomTextInput
49
+ title={'URL'}
50
+ placeholder={'Enter URL'}
51
+ accessibilityLabel='url'
52
+ onChangeText={newText => this.setState({ value: newText })}
53
+ value={this.state.value} />
54
+ <View style={{ margin: 4 }} />
55
+
56
+ <View style={{ flexDirection: 'row'}}>
57
+ <CustomButton
58
+ buttonColor={Colors.deepBlue}
59
+ title={'cancel'}
60
+ titleColor='white'
61
+ accessibilityLabel={'cancel'}
62
+ onPress={() => this.close()} />
63
+ <View style={{ margin: 4 }} />
64
+ <CustomButton
65
+ buttonColor={Colors.deepBlue}
66
+ title={'go'}
67
+ titleColor='white'
68
+ accessibilityLabel={'go'}
69
+ onPress={() => this.confirm()} />
70
+ </View>
71
+ </View>
72
+ </View>
73
+ </Modal>
74
+ )
75
+ }
76
+ }
77
+
78
+ UrlInputDialog.propTypes = {
79
+ onConfirm: propTypes.func.isRequired
80
+ }
@@ -0,0 +1,80 @@
1
+ import React, { Component } from 'react'
2
+ import propTypes from 'prop-types'
3
+
4
+ import { View, Modal, Text, TextInput } from 'react-native'
5
+ import { Styles } from '../common/Styles'
6
+ import CustomButton from './CustomButton'
7
+ import { Colors } from '../common/Colors'
8
+
9
+ import CustomTextInput from './CustomTextInput'
10
+
11
+ export default class ValueInputDialog extends Component {
12
+
13
+ constructor(props) {
14
+ super(props)
15
+ this.state = {
16
+ visible: false,
17
+ value: ''
18
+ }
19
+ }
20
+
21
+ show = () => {
22
+ this.setState({ visible: true })
23
+ }
24
+
25
+ close = () => {
26
+ this.setState({
27
+ visible: false,
28
+ value: ''
29
+ })
30
+ }
31
+
32
+ confirm = () => {
33
+ if (this.props.onConfirm != null) {
34
+ this.props.onConfirm(this.state.value)
35
+ }
36
+ this.close()
37
+ }
38
+
39
+ render() {
40
+ return (
41
+ <Modal
42
+ visible={this.state.visible}
43
+ transparent={true}>
44
+ <View style={Styles.centeredView}>
45
+ <View style={Styles.modalView}>
46
+ <Text style={ Styles.h2 }>Input Value</Text>
47
+ <View style={{ margin: 4 }} />
48
+ <CustomTextInput
49
+ title={'VALUE'}
50
+ placeholder={'Enter value'}
51
+ accessibilityLabel='value'
52
+ onChangeText={newText => this.setState({ value: newText })}
53
+ value={this.state.value} />
54
+ <View style={{ margin: 4 }} />
55
+
56
+ <View style={{ flexDirection: 'row'}}>
57
+ <CustomButton
58
+ buttonColor={Colors.deepBlue}
59
+ title={'cancel'}
60
+ titleColor='white'
61
+ accessibilityLabel={'cancel'}
62
+ onPress={() => this.close()} />
63
+ <View style={{ margin: 4 }} />
64
+ <CustomButton
65
+ buttonColor={Colors.deepBlue}
66
+ title={'save'}
67
+ titleColor='white'
68
+ accessibilityLabel={'save'}
69
+ onPress={() => this.confirm()} />
70
+ </View>
71
+ </View>
72
+ </View>
73
+ </Modal>
74
+ )
75
+ }
76
+ }
77
+
78
+ ValueInputDialog.propTypes = {
79
+ onConfirm: propTypes.func.isRequired
80
+ }