react-native-acoustic-connect-beta 18.0.14 โ 18.0.15
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.
- package/Examples/SampleUI/.detoxrc.js +83 -0
- package/Examples/SampleUI/ConnectConfig.json +2 -2
- package/Examples/SampleUI/android/app/build.gradle +3 -0
- package/Examples/SampleUI/android/app/src/main/java/com/sampleui/MainActivity.kt +0 -35
- package/Examples/SampleUI/android/settings.gradle +1 -1
- package/Examples/SampleUI/package.json +8 -6
- package/Examples/SampleUI/scripts/integration-test-android.sh +292 -0
- package/Examples/SampleUI/src/Examples/DialogExample.tsx +88 -2
- package/Examples/SampleUI/src/Examples/Dialogs/DialogTrackingTest.tsx +307 -0
- package/Examples/SampleUI/src/Examples/Dialogs/index.tsx +37 -0
- package/Examples/SampleUI/src/index.native.tsx +4 -5
- package/android/build.gradle +2 -2
- package/android/src/main/assets/ConnectAdvancedConfig.json +1 -1
- package/android/src/main/java/com/acousticconnectrn/HybridAcousticConnectRN.kt +787 -490
- package/ios/HybridAcousticConnectRN.swift +75 -0
- package/lib/commonjs/TLTRN.js +69 -0
- package/lib/commonjs/TLTRN.js.map +1 -1
- package/lib/commonjs/components/Connect.js +5 -1
- package/lib/commonjs/components/Connect.js.map +1 -1
- package/lib/commonjs/docs/DialogTracking.md +252 -0
- package/lib/commonjs/docs/NativeImplementation.md +176 -0
- package/lib/commonjs/examples/DialogTrackingExample.js +175 -0
- package/lib/commonjs/examples/DialogTrackingExample.js.map +1 -0
- package/lib/commonjs/examples/HOCDialogExample.js +296 -0
- package/lib/commonjs/examples/HOCDialogExample.js.map +1 -0
- package/lib/commonjs/index.js +28 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/DialogDebugger.js +216 -0
- package/lib/commonjs/utils/DialogDebugger.js.map +1 -0
- package/lib/commonjs/utils/DialogListener.js +203 -0
- package/lib/commonjs/utils/DialogListener.js.map +1 -0
- package/lib/commonjs/utils/useDialogTracking.js +107 -0
- package/lib/commonjs/utils/useDialogTracking.js.map +1 -0
- package/lib/commonjs/utils/withAcousticAutoDialog.js +282 -0
- package/lib/commonjs/utils/withAcousticAutoDialog.js.map +1 -0
- package/lib/module/TLTRN.js +69 -0
- package/lib/module/TLTRN.js.map +1 -1
- package/lib/module/components/Connect.js +5 -1
- package/lib/module/components/Connect.js.map +1 -1
- package/lib/module/docs/DialogTracking.md +252 -0
- package/lib/module/docs/NativeImplementation.md +176 -0
- package/lib/module/examples/DialogTrackingExample.js +172 -0
- package/lib/module/examples/DialogTrackingExample.js.map +1 -0
- package/lib/module/examples/HOCDialogExample.js +292 -0
- package/lib/module/examples/HOCDialogExample.js.map +1 -0
- package/lib/module/index.js +5 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/DialogDebugger.js +211 -0
- package/lib/module/utils/DialogDebugger.js.map +1 -0
- package/lib/module/utils/DialogListener.js +199 -0
- package/lib/module/utils/DialogListener.js.map +1 -0
- package/lib/module/utils/useDialogTracking.js +102 -0
- package/lib/module/utils/useDialogTracking.js.map +1 -0
- package/lib/module/utils/withAcousticAutoDialog.js +275 -0
- package/lib/module/utils/withAcousticAutoDialog.js.map +1 -0
- package/lib/typescript/src/TLTRN.d.ts +7 -0
- package/lib/typescript/src/TLTRN.d.ts.map +1 -1
- package/lib/typescript/src/components/Connect.d.ts +1 -0
- package/lib/typescript/src/components/Connect.d.ts.map +1 -1
- package/lib/typescript/src/examples/DialogTrackingExample.d.ts +17 -0
- package/lib/typescript/src/examples/DialogTrackingExample.d.ts.map +1 -0
- package/lib/typescript/src/examples/HOCDialogExample.d.ts +21 -0
- package/lib/typescript/src/examples/HOCDialogExample.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +5 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts +4 -0
- package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts.map +1 -1
- package/lib/typescript/src/utils/DialogDebugger.d.ts +58 -0
- package/lib/typescript/src/utils/DialogDebugger.d.ts.map +1 -0
- package/lib/typescript/src/utils/DialogListener.d.ts +85 -0
- package/lib/typescript/src/utils/DialogListener.d.ts.map +1 -0
- package/lib/typescript/src/utils/useDialogTracking.d.ts +25 -0
- package/lib/typescript/src/utils/useDialogTracking.d.ts.map +1 -0
- package/lib/typescript/src/utils/withAcousticAutoDialog.d.ts +37 -0
- package/lib/typescript/src/utils/withAcousticAutoDialog.d.ts.map +1 -0
- package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.cpp +26 -0
- package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.hpp +4 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/HybridAcousticConnectRNSpec.kt +16 -0
- package/nitrogen/generated/ios/c++/HybridAcousticConnectRNSpecSwift.hpp +32 -0
- package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec.swift +4 -0
- package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec_cxx.swift +71 -0
- package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.hpp +4 -0
- package/package.json +1 -1
- package/scripts/ConnectConfig.json +1 -1
- package/src/TLTRN.ts +75 -0
- package/src/components/Connect.tsx +6 -1
- package/src/docs/DialogTracking.md +252 -0
- package/src/docs/NativeImplementation.md +176 -0
- package/src/examples/DialogTrackingExample.tsx +163 -0
- package/src/examples/HOCDialogExample.tsx +253 -0
- package/src/index.ts +5 -1
- package/src/specs/react-native-acoustic-connect.nitro.ts +5 -0
- package/src/utils/DialogDebugger.ts +224 -0
- package/src/utils/DialogListener.ts +238 -0
- package/src/utils/useDialogTracking.ts +102 -0
- package/src/utils/withAcousticAutoDialog.tsx +312 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** @type {Detox.DetoxConfig} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
testRunner: {
|
|
4
|
+
args: {
|
|
5
|
+
'$0': 'jest',
|
|
6
|
+
config: 'e2e/jest.config.js'
|
|
7
|
+
},
|
|
8
|
+
jest: {
|
|
9
|
+
setupTimeout: 120000
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
apps: {
|
|
13
|
+
'ios.debug': {
|
|
14
|
+
type: 'ios.app',
|
|
15
|
+
binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/SampleUI.app',
|
|
16
|
+
build: 'xcodebuild -workspace ios/SampleUI.xcworkspace -scheme SampleUI -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build'
|
|
17
|
+
},
|
|
18
|
+
'ios.release': {
|
|
19
|
+
type: 'ios.app',
|
|
20
|
+
binaryPath: 'ios/build/Build/Products/Release-iphonesimulator/SampleUI.app',
|
|
21
|
+
build: 'xcodebuild -workspace ios/SampleUI.xcworkspace -scheme SampleUI -configuration Release -sdk iphonesimulator -derivedDataPath ios/build'
|
|
22
|
+
},
|
|
23
|
+
'android.debug': {
|
|
24
|
+
type: 'android.apk',
|
|
25
|
+
binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk',
|
|
26
|
+
build: 'cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug',
|
|
27
|
+
reversePorts: [
|
|
28
|
+
8081
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
'android.release': {
|
|
32
|
+
type: 'android.apk',
|
|
33
|
+
binaryPath: 'android/app/build/outputs/apk/release/app-release.apk',
|
|
34
|
+
build: 'cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release'
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
devices: {
|
|
38
|
+
simulator: {
|
|
39
|
+
type: 'ios.simulator',
|
|
40
|
+
device: {
|
|
41
|
+
type: 'iPhone 15'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
attached: {
|
|
45
|
+
type: 'android.attached',
|
|
46
|
+
device: {
|
|
47
|
+
adbName: '.*'
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
emulator: {
|
|
51
|
+
type: 'android.emulator',
|
|
52
|
+
device: {
|
|
53
|
+
avdName: 'Pixel_3a_API_30_x86'
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
configurations: {
|
|
58
|
+
'ios.sim.debug': {
|
|
59
|
+
device: 'simulator',
|
|
60
|
+
app: 'ios.debug'
|
|
61
|
+
},
|
|
62
|
+
'ios.sim.release': {
|
|
63
|
+
device: 'simulator',
|
|
64
|
+
app: 'ios.release'
|
|
65
|
+
},
|
|
66
|
+
'android.att.debug': {
|
|
67
|
+
device: 'attached',
|
|
68
|
+
app: 'android.debug'
|
|
69
|
+
},
|
|
70
|
+
'android.att.release': {
|
|
71
|
+
device: 'attached',
|
|
72
|
+
app: 'android.release'
|
|
73
|
+
},
|
|
74
|
+
'android.emu.debug': {
|
|
75
|
+
device: 'emulator',
|
|
76
|
+
app: 'android.debug'
|
|
77
|
+
},
|
|
78
|
+
'android.emu.release': {
|
|
79
|
+
device: 'emulator',
|
|
80
|
+
app: 'android.release'
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Connect": {
|
|
3
|
-
"AndroidVersion": "10.4.
|
|
4
|
-
"AppKey": "
|
|
3
|
+
"AndroidVersion": "10.4.48",
|
|
4
|
+
"AppKey": "fa47722a7fef4bcd8677fd8d6d113a0d",
|
|
5
5
|
"KillSwitchUrl": "https://lib-us-2.brilliantcollector.com/collector/switch/b6c3709b7a4c479bb4b5a9fb8fec324c",
|
|
6
6
|
"PostMessageUrl": "https://lib-us-2.brilliantcollector.com/collector/collectorPost",
|
|
7
7
|
"iOSVersion": "",
|
|
@@ -116,6 +116,9 @@ dependencies {
|
|
|
116
116
|
// The version of react-native is set by the React Native Gradle Plugin
|
|
117
117
|
implementation("com.facebook.react:react-android")
|
|
118
118
|
|
|
119
|
+
// Connect SDK libraries
|
|
120
|
+
implementation 'io.github.go-acoustic:connect:10.4.48'
|
|
121
|
+
|
|
119
122
|
if (hermesEnabled.toBoolean()) {
|
|
120
123
|
implementation("com.facebook.react:hermes-android")
|
|
121
124
|
} else {
|
|
@@ -26,40 +26,5 @@ class MainActivity : ReactActivity() {
|
|
|
26
26
|
Connect.dispatchTouchEvent(this, e)
|
|
27
27
|
return super.dispatchTouchEvent(e)
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
override fun dispatchTouchEvent(e: MotionEvent?): Boolean {
|
|
31
|
-
Connect.dispatchTouchEvent(this, e)
|
|
32
|
-
return super.dispatchTouchEvent(e)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
override fun dispatchTouchEvent(e: MotionEvent?): Boolean {
|
|
36
|
-
Connect.dispatchTouchEvent(this, e)
|
|
37
|
-
return super.dispatchTouchEvent(e)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
override fun dispatchTouchEvent(e: MotionEvent?): Boolean {
|
|
41
|
-
Connect.dispatchTouchEvent(this, e)
|
|
42
|
-
return super.dispatchTouchEvent(e)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
override fun dispatchTouchEvent(e: MotionEvent?): Boolean {
|
|
46
|
-
Connect.dispatchTouchEvent(this, e)
|
|
47
|
-
return super.dispatchTouchEvent(e)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
override fun dispatchTouchEvent(e: MotionEvent?): Boolean {
|
|
51
|
-
Connect.dispatchTouchEvent(this, e)
|
|
52
|
-
return super.dispatchTouchEvent(e)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
override fun dispatchTouchEvent(e: MotionEvent?): Boolean {
|
|
56
|
-
Connect.dispatchTouchEvent(this, e)
|
|
57
|
-
return super.dispatchTouchEvent(e)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
override fun dispatchTouchEvent(e: MotionEvent?): Boolean {
|
|
61
|
-
Connect.dispatchTouchEvent(this, e)
|
|
62
|
-
return super.dispatchTouchEvent(e)
|
|
63
|
-
}
|
|
64
29
|
}
|
|
65
30
|
|
|
@@ -18,4 +18,4 @@ include ':app'
|
|
|
18
18
|
includeBuild('../node_modules/@react-native/gradle-plugin')
|
|
19
19
|
|
|
20
20
|
apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
|
|
21
|
-
useExpoModules()
|
|
21
|
+
useExpoModules()
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"lint": "eslint .",
|
|
9
9
|
"start": "react-native start",
|
|
10
10
|
"test": "jest",
|
|
11
|
-
"updateYalc": "yalc update react-native-acoustic-connect-beta && cd ios && pod install && cd .."
|
|
11
|
+
"updateYalc": "yalc update react-native-acoustic-connect-beta && cd ios && pod install && cd ..",
|
|
12
|
+
"test:integration:android": "bash scripts/integration-test-android.sh"
|
|
12
13
|
},
|
|
13
14
|
"dependencies": {
|
|
14
15
|
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
|
|
15
|
-
"@expo/vector-icons": "
|
|
16
|
-
"@expo/webpack-config": "^19.0.1",
|
|
16
|
+
"@expo/vector-icons": "~14.0.4",
|
|
17
17
|
"@pchmn/expo-material3-theme": "^1.3.2",
|
|
18
18
|
"@react-native-async-storage/async-storage": "1.23.1",
|
|
19
19
|
"@react-native-masked-view/masked-view": "^0.3.2",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"@react-navigation/native": "^7.1.6",
|
|
23
23
|
"@react-navigation/stack": "^7.2.10",
|
|
24
24
|
"expo": "~52.0.0",
|
|
25
|
-
"expo-font": "
|
|
26
|
-
"expo-status-bar": "
|
|
25
|
+
"expo-font": "~13.0.4",
|
|
26
|
+
"expo-status-bar": "~2.0.1",
|
|
27
27
|
"react": "18.3.1",
|
|
28
28
|
"react-native": "0.76.9",
|
|
29
29
|
"react-native-acoustic-connect-beta": "file:.yalc/react-native-acoustic-connect-beta",
|
|
@@ -51,10 +51,12 @@
|
|
|
51
51
|
"@types/react-test-renderer": "^18.0.0",
|
|
52
52
|
"babel-jest": "^29.6.3",
|
|
53
53
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
54
|
+
"detox": "^20.40.2",
|
|
54
55
|
"eslint": "^8.19.0",
|
|
55
56
|
"jest": "^29.6.3",
|
|
56
57
|
"prettier": "2.8.8",
|
|
57
|
-
"react-
|
|
58
|
+
"react-devtools": "^6.1.2",
|
|
59
|
+
"react-test-renderer": "^18.2.0",
|
|
58
60
|
"typescript": "^5.3.3"
|
|
59
61
|
},
|
|
60
62
|
"engines": {
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
APP_ID="com.sampleui" # <-- Update if your appId is different
|
|
5
|
+
APK_PATH="android/app/build/outputs/apk/debug/app-debug.apk"
|
|
6
|
+
|
|
7
|
+
# Function to find and tap element by text
|
|
8
|
+
find_and_tap_by_text() {
|
|
9
|
+
local text="$1"
|
|
10
|
+
local max_attempts="${2:-3}"
|
|
11
|
+
local attempt=1
|
|
12
|
+
|
|
13
|
+
echo "Looking for element with text: '$text'"
|
|
14
|
+
|
|
15
|
+
while [ $attempt -le $max_attempts ]; do
|
|
16
|
+
# Dump UI hierarchy
|
|
17
|
+
adb shell uiautomator dump /sdcard/window_dump.xml
|
|
18
|
+
|
|
19
|
+
# Extract coordinates for the text
|
|
20
|
+
local coords=$(adb shell "cat /sdcard/window_dump.xml | grep -A 5 -B 5 '$text' | grep 'bounds=' | head -1 | sed 's/.*bounds=\"\[\([0-9]*\),\([0-9]*\)\]\[\([0-9]*\),\([0-9]*\)\].*/\1 \2 \3 \4/'")
|
|
21
|
+
|
|
22
|
+
if [ -n "$coords" ]; then
|
|
23
|
+
# Parse coordinates
|
|
24
|
+
local x1=$(echo $coords | awk '{print $1}')
|
|
25
|
+
local y1=$(echo $coords | awk '{print $2}')
|
|
26
|
+
local x2=$(echo $coords | awk '{print $3}')
|
|
27
|
+
local y2=$(echo $coords | awk '{print $4}')
|
|
28
|
+
|
|
29
|
+
# Calculate center point
|
|
30
|
+
local center_x=$(( (x1 + x2) / 2 ))
|
|
31
|
+
local center_y=$(( (y1 + y2) / 2 ))
|
|
32
|
+
|
|
33
|
+
echo "Found '$text' at coordinates: ($center_x, $center_y)"
|
|
34
|
+
adb shell input tap $center_x $center_y
|
|
35
|
+
return 0
|
|
36
|
+
else
|
|
37
|
+
echo "Attempt $attempt: Element '$text' not found, retrying..."
|
|
38
|
+
sleep 2
|
|
39
|
+
attempt=$((attempt + 1))
|
|
40
|
+
fi
|
|
41
|
+
done
|
|
42
|
+
|
|
43
|
+
echo "ERROR: Could not find element with text '$text' after $max_attempts attempts"
|
|
44
|
+
return 1
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# Function to find and tap one of multiple possible button texts
|
|
48
|
+
find_and_tap_button() {
|
|
49
|
+
local button_texts=("$@")
|
|
50
|
+
|
|
51
|
+
for text in "${button_texts[@]}"; do
|
|
52
|
+
if find_and_tap_by_text "$text" 1; then
|
|
53
|
+
echo "Successfully tapped button: '$text'"
|
|
54
|
+
return 0
|
|
55
|
+
fi
|
|
56
|
+
done
|
|
57
|
+
|
|
58
|
+
echo "ERROR: Could not find any of the button texts: ${button_texts[*]}"
|
|
59
|
+
return 1
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
# Function to scroll and find element
|
|
63
|
+
scroll_and_find_element() {
|
|
64
|
+
local text="$1"
|
|
65
|
+
local max_scrolls="${2:-5}"
|
|
66
|
+
local scroll_count=0
|
|
67
|
+
|
|
68
|
+
while [ $scroll_count -lt $max_scrolls ]; do
|
|
69
|
+
if find_and_tap_by_text "$text" 1; then
|
|
70
|
+
return 0
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
echo "Scrolling to find '$text'..."
|
|
74
|
+
adb shell input swipe 500 800 500 200 # Scroll down
|
|
75
|
+
sleep 2
|
|
76
|
+
scroll_count=$((scroll_count + 1))
|
|
77
|
+
done
|
|
78
|
+
|
|
79
|
+
echo "ERROR: Could not find '$text' after scrolling $max_scrolls times"
|
|
80
|
+
return 1
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
# Function to debug current screen content
|
|
84
|
+
debug_screen_content() {
|
|
85
|
+
echo "=== DEBUG: Current screen content ==="
|
|
86
|
+
adb shell uiautomator dump /sdcard/window_dump.xml
|
|
87
|
+
adb shell "cat /sdcard/window_dump.xml | grep -E 'text=|content-desc=' | head -20"
|
|
88
|
+
echo "=== END DEBUG ==="
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
# 1. Start emulator if not running
|
|
92
|
+
if ! adb devices | grep -w emulator >/dev/null; then
|
|
93
|
+
echo "No emulator running. Attempting to start the first available AVD..."
|
|
94
|
+
EMULATOR_NAME=$(emulator -list-avds | head -n 1)
|
|
95
|
+
if [ -z "$EMULATOR_NAME" ]; then
|
|
96
|
+
echo "No Android emulators found. Please create one via AVD Manager."
|
|
97
|
+
exit 1
|
|
98
|
+
fi
|
|
99
|
+
nohup emulator -avd "$EMULATOR_NAME" -no-snapshot-save -no-window > /dev/null 2>&1 &
|
|
100
|
+
echo "Waiting for emulator to boot..."
|
|
101
|
+
adb wait-for-device
|
|
102
|
+
sleep 30 # Give extra time for boot
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
# 2. Build the app
|
|
106
|
+
cd android
|
|
107
|
+
./gradlew assembleDebug
|
|
108
|
+
cd ..
|
|
109
|
+
|
|
110
|
+
# 3. Install the APK
|
|
111
|
+
adb install -r "$APK_PATH"
|
|
112
|
+
|
|
113
|
+
# 4. Launch the app
|
|
114
|
+
adb shell monkey -p "$APP_ID" -c android.intent.category.LAUNCHER 1
|
|
115
|
+
|
|
116
|
+
# Wait for the app to start
|
|
117
|
+
sleep 10
|
|
118
|
+
|
|
119
|
+
# 5. Verify the app process is running
|
|
120
|
+
if adb shell pidof "$APP_ID" | grep -q '[0-9]'; then
|
|
121
|
+
echo "App launched successfully!"
|
|
122
|
+
else
|
|
123
|
+
echo "App did not launch."
|
|
124
|
+
exit 1
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
# 6. Test Dialog functionality
|
|
128
|
+
echo "Testing Dialog functionality..."
|
|
129
|
+
|
|
130
|
+
# Wait for app to fully load
|
|
131
|
+
sleep 5
|
|
132
|
+
|
|
133
|
+
# Navigate to Dialog example
|
|
134
|
+
echo "Navigating to Dialog example..."
|
|
135
|
+
if ! scroll_and_find_element "Dialog"; then
|
|
136
|
+
echo "ERROR: Could not find Dialog example"
|
|
137
|
+
exit 1
|
|
138
|
+
fi
|
|
139
|
+
|
|
140
|
+
# Wait for Dialog screen to load and verify we're on the right screen
|
|
141
|
+
echo "Waiting for Dialog screen to load..."
|
|
142
|
+
sleep 5
|
|
143
|
+
|
|
144
|
+
# Debug current screen
|
|
145
|
+
debug_screen_content
|
|
146
|
+
|
|
147
|
+
# Verify we're on the Dialog screen by checking for the header
|
|
148
|
+
echo "Verifying we're on the Dialog screen..."
|
|
149
|
+
if ! find_and_tap_by_text "Dialog" 1; then
|
|
150
|
+
echo "ERROR: Not on Dialog screen - Dialog header not found"
|
|
151
|
+
exit 1
|
|
152
|
+
fi
|
|
153
|
+
|
|
154
|
+
# Wait a bit more for the screen to fully load
|
|
155
|
+
sleep 2
|
|
156
|
+
|
|
157
|
+
# Debug screen again to see what's available
|
|
158
|
+
echo "Final screen content before testing dialogs:"
|
|
159
|
+
debug_screen_content
|
|
160
|
+
|
|
161
|
+
# Test each dialog button
|
|
162
|
+
echo "Testing dialog buttons..."
|
|
163
|
+
|
|
164
|
+
# Test "Long text" dialog
|
|
165
|
+
echo "Testing 'Long text' dialog..."
|
|
166
|
+
if find_and_tap_by_text "Long text"; then
|
|
167
|
+
echo "Tapped 'Long text' button, waiting for dialog to appear..."
|
|
168
|
+
sleep 3 # Wait longer for dialog to appear
|
|
169
|
+
|
|
170
|
+
# Debug screen after tapping
|
|
171
|
+
debug_screen_content
|
|
172
|
+
|
|
173
|
+
if find_and_tap_button "Ok" "OK"; then
|
|
174
|
+
echo "โ Long text dialog test passed"
|
|
175
|
+
else
|
|
176
|
+
echo "โ Failed to close Long text dialog"
|
|
177
|
+
exit 1
|
|
178
|
+
fi
|
|
179
|
+
else
|
|
180
|
+
echo "โ Failed to open Long text dialog"
|
|
181
|
+
exit 1
|
|
182
|
+
fi
|
|
183
|
+
sleep 1
|
|
184
|
+
|
|
185
|
+
# Test "Radio buttons" dialog
|
|
186
|
+
echo "Testing 'Radio buttons' dialog..."
|
|
187
|
+
if find_and_tap_by_text "Radio buttons"; then
|
|
188
|
+
echo "Tapped 'Radio buttons' button, waiting for dialog to appear..."
|
|
189
|
+
sleep 3 # Wait longer for dialog to appear
|
|
190
|
+
|
|
191
|
+
if find_and_tap_button "Ok" "OK" "Cancel"; then
|
|
192
|
+
echo "โ Radio buttons dialog test passed"
|
|
193
|
+
else
|
|
194
|
+
echo "โ Failed to close Radio buttons dialog"
|
|
195
|
+
exit 1
|
|
196
|
+
fi
|
|
197
|
+
else
|
|
198
|
+
echo "โ Failed to open Radio buttons dialog"
|
|
199
|
+
exit 1
|
|
200
|
+
fi
|
|
201
|
+
sleep 1
|
|
202
|
+
|
|
203
|
+
# Test "Progress indicator" dialog
|
|
204
|
+
echo "Testing 'Progress indicator' dialog..."
|
|
205
|
+
if find_and_tap_by_text "Progress indicator"; then
|
|
206
|
+
sleep 3 # Progress dialogs usually auto-dismiss
|
|
207
|
+
echo "โ Progress indicator dialog test passed"
|
|
208
|
+
else
|
|
209
|
+
echo "โ Failed to open Progress indicator dialog"
|
|
210
|
+
exit 1
|
|
211
|
+
fi
|
|
212
|
+
sleep 1
|
|
213
|
+
|
|
214
|
+
# Test "Undismissable Dialog"
|
|
215
|
+
echo "Testing 'Undismissable Dialog'..."
|
|
216
|
+
if find_and_tap_by_text "Undismissable Dialog"; then
|
|
217
|
+
sleep 3 # Wait longer for dialog to appear
|
|
218
|
+
if find_and_tap_button "Agree" "OK" "Ok"; then
|
|
219
|
+
echo "โ Undismissable Dialog test passed"
|
|
220
|
+
else
|
|
221
|
+
echo "โ Failed to close Undismissable Dialog"
|
|
222
|
+
exit 1
|
|
223
|
+
fi
|
|
224
|
+
else
|
|
225
|
+
echo "โ Failed to open Undismissable Dialog"
|
|
226
|
+
exit 1
|
|
227
|
+
fi
|
|
228
|
+
sleep 1
|
|
229
|
+
|
|
230
|
+
# Test "Custom colors" dialog
|
|
231
|
+
echo "Testing 'Custom colors' dialog..."
|
|
232
|
+
if find_and_tap_by_text "Custom colors"; then
|
|
233
|
+
sleep 3 # Wait longer for dialog to appear
|
|
234
|
+
if find_and_tap_button "Ok" "OK"; then
|
|
235
|
+
echo "โ Custom colors dialog test passed"
|
|
236
|
+
else
|
|
237
|
+
echo "โ Failed to close Custom colors dialog"
|
|
238
|
+
exit 1
|
|
239
|
+
fi
|
|
240
|
+
else
|
|
241
|
+
echo "โ Failed to open Custom colors dialog"
|
|
242
|
+
exit 1
|
|
243
|
+
fi
|
|
244
|
+
sleep 1
|
|
245
|
+
|
|
246
|
+
# Test "Dialog Tracking Test" (most important for Acoustic Connect)
|
|
247
|
+
echo "Testing 'Dialog Tracking Test'..."
|
|
248
|
+
if find_and_tap_by_text "Dialog Tracking Test"; then
|
|
249
|
+
sleep 3 # Wait longer for dialog to appear
|
|
250
|
+
if find_and_tap_button "Close" "OK" "Ok"; then
|
|
251
|
+
echo "โ Dialog Tracking Test passed"
|
|
252
|
+
else
|
|
253
|
+
echo "โ Failed to close Dialog Tracking Test"
|
|
254
|
+
exit 1
|
|
255
|
+
fi
|
|
256
|
+
else
|
|
257
|
+
echo "โ Failed to open Dialog Tracking Test"
|
|
258
|
+
exit 1
|
|
259
|
+
fi
|
|
260
|
+
sleep 1
|
|
261
|
+
|
|
262
|
+
# Test "With icon" dialog (if available in MD3)
|
|
263
|
+
echo "Testing 'With icon' dialog..."
|
|
264
|
+
if find_and_tap_by_text "With icon"; then
|
|
265
|
+
sleep 3 # Wait longer for dialog to appear
|
|
266
|
+
if find_and_tap_button "Agree" "Disagree" "OK" "Ok"; then
|
|
267
|
+
echo "โ With icon dialog test passed"
|
|
268
|
+
else
|
|
269
|
+
echo "โ Failed to close With icon dialog"
|
|
270
|
+
exit 1
|
|
271
|
+
fi
|
|
272
|
+
else
|
|
273
|
+
echo "โ With icon dialog not available (V3 theme not enabled)"
|
|
274
|
+
fi
|
|
275
|
+
sleep 1
|
|
276
|
+
|
|
277
|
+
# Test "Dismissable back button" dialog (Android specific)
|
|
278
|
+
echo "Testing 'Dismissable back button' dialog..."
|
|
279
|
+
if find_and_tap_by_text "Dismissable back button"; then
|
|
280
|
+
sleep 3 # Wait longer for dialog to appear
|
|
281
|
+
# Try to dismiss with back button
|
|
282
|
+
adb shell input keyevent 4 # KEYCODE_BACK
|
|
283
|
+
sleep 1
|
|
284
|
+
echo "โ Dismissable back button dialog test passed"
|
|
285
|
+
else
|
|
286
|
+
echo "โ Dismissable back button dialog not available (iOS)"
|
|
287
|
+
fi
|
|
288
|
+
sleep 1
|
|
289
|
+
|
|
290
|
+
echo "All dialog tests completed successfully!"
|
|
291
|
+
echo "Integration test passed!"
|
|
292
|
+
exit 0
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Platform, StyleSheet } from 'react-native';
|
|
2
|
+
import { Platform, StyleSheet, Alert } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { Button } from 'react-native-paper';
|
|
5
5
|
|
|
@@ -11,9 +11,11 @@ import {
|
|
|
11
11
|
DialogWithLongText,
|
|
12
12
|
DialogWithRadioBtns,
|
|
13
13
|
UndismissableDialog,
|
|
14
|
+
DialogTrackingTest,
|
|
14
15
|
} from './Dialogs';
|
|
15
16
|
import { useExampleTheme } from '..';
|
|
16
17
|
import ScreenWrapper from '../ScreenWrapper';
|
|
18
|
+
import { useDialogTracking } from 'react-native-acoustic-connect-beta';
|
|
17
19
|
|
|
18
20
|
type ButtonVisibility = {
|
|
19
21
|
[key: string]: boolean | undefined;
|
|
@@ -22,9 +24,54 @@ type ButtonVisibility = {
|
|
|
22
24
|
const DialogExample = () => {
|
|
23
25
|
const [visible, setVisible] = React.useState<ButtonVisibility>({});
|
|
24
26
|
const { isV3 } = useExampleTheme();
|
|
27
|
+
|
|
28
|
+
// Add dialog tracking
|
|
29
|
+
const { generateDialogId, trackDialogShow, trackDialogDismiss } = useDialogTracking();
|
|
30
|
+
const [dialogIds, setDialogIds] = React.useState<Record<string, string>>({});
|
|
25
31
|
|
|
26
|
-
const _toggleDialog = (name: string) => () =>
|
|
32
|
+
const _toggleDialog = (name: string) => () => {
|
|
33
|
+
const isCurrentlyVisible = !!visible[name];
|
|
34
|
+
|
|
35
|
+
if (!isCurrentlyVisible) {
|
|
36
|
+
// Dialog is being shown - track it
|
|
37
|
+
const dialogId = generateDialogId();
|
|
38
|
+
setDialogIds(prev => ({ ...prev, [name]: dialogId }));
|
|
39
|
+
|
|
40
|
+
// Get dialog title based on the dialog type
|
|
41
|
+
const getDialogTitle = (dialogName: string): string => {
|
|
42
|
+
switch (dialogName) {
|
|
43
|
+
case 'dialog1': return 'Long Text Dialog';
|
|
44
|
+
case 'dialog2': return 'Radio Buttons Dialog';
|
|
45
|
+
case 'dialog3': return 'Progress Indicator Dialog';
|
|
46
|
+
case 'dialog4': return 'Undismissable Dialog';
|
|
47
|
+
case 'dialog5': return 'Custom Colors Dialog';
|
|
48
|
+
case 'dialog6': return 'Dialog with Icon';
|
|
49
|
+
case 'dialog7': return 'Dismissable Back Button Dialog';
|
|
50
|
+
case 'dialogTracking': return 'Dialog Tracking Test';
|
|
51
|
+
default: return 'Dialog';
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const title = getDialogTitle(name);
|
|
56
|
+
trackDialogShow(dialogId, title, []);
|
|
57
|
+
|
|
58
|
+
console.log(`๐ DialogExample: Showing dialog - ${title} (${dialogId})`);
|
|
59
|
+
} else {
|
|
60
|
+
// Dialog is being hidden - track dismiss
|
|
61
|
+
const dialogId = dialogIds[name];
|
|
62
|
+
if (dialogId) {
|
|
63
|
+
trackDialogDismiss(dialogId, 'user_action');
|
|
64
|
+
console.log(`๐ DialogExample: Dismissing dialog - ${dialogIds[name]} (${dialogId})`);
|
|
65
|
+
setDialogIds(prev => {
|
|
66
|
+
const newIds = { ...prev };
|
|
67
|
+
delete newIds[name];
|
|
68
|
+
return newIds;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
27
73
|
setVisible({ ...visible, [name]: !visible[name] });
|
|
74
|
+
};
|
|
28
75
|
|
|
29
76
|
const _getVisible = (name: string) => !!visible[name];
|
|
30
77
|
|
|
@@ -34,6 +81,7 @@ const DialogExample = () => {
|
|
|
34
81
|
mode="outlined"
|
|
35
82
|
onPress={_toggleDialog('dialog1')}
|
|
36
83
|
style={styles.button}
|
|
84
|
+
testID="dialog-long-text-button"
|
|
37
85
|
>
|
|
38
86
|
Long text
|
|
39
87
|
</Button>
|
|
@@ -41,6 +89,7 @@ const DialogExample = () => {
|
|
|
41
89
|
mode="outlined"
|
|
42
90
|
onPress={_toggleDialog('dialog2')}
|
|
43
91
|
style={styles.button}
|
|
92
|
+
testID="dialog-radio-buttons-button"
|
|
44
93
|
>
|
|
45
94
|
Radio buttons
|
|
46
95
|
</Button>
|
|
@@ -48,6 +97,7 @@ const DialogExample = () => {
|
|
|
48
97
|
mode="outlined"
|
|
49
98
|
onPress={_toggleDialog('dialog3')}
|
|
50
99
|
style={styles.button}
|
|
100
|
+
testID="dialog-progress-indicator-button"
|
|
51
101
|
>
|
|
52
102
|
Progress indicator
|
|
53
103
|
</Button>
|
|
@@ -55,6 +105,7 @@ const DialogExample = () => {
|
|
|
55
105
|
mode="outlined"
|
|
56
106
|
onPress={_toggleDialog('dialog4')}
|
|
57
107
|
style={styles.button}
|
|
108
|
+
testID="dialog-undismissable-button"
|
|
58
109
|
>
|
|
59
110
|
Undismissable Dialog
|
|
60
111
|
</Button>
|
|
@@ -62,6 +113,7 @@ const DialogExample = () => {
|
|
|
62
113
|
mode="outlined"
|
|
63
114
|
onPress={_toggleDialog('dialog5')}
|
|
64
115
|
style={styles.button}
|
|
116
|
+
testID="dialog-custom-colors-button"
|
|
65
117
|
>
|
|
66
118
|
Custom colors
|
|
67
119
|
</Button>
|
|
@@ -70,6 +122,7 @@ const DialogExample = () => {
|
|
|
70
122
|
mode="outlined"
|
|
71
123
|
onPress={_toggleDialog('dialog6')}
|
|
72
124
|
style={styles.button}
|
|
125
|
+
testID="dialog-with-icon-button"
|
|
73
126
|
>
|
|
74
127
|
With icon
|
|
75
128
|
</Button>
|
|
@@ -79,10 +132,37 @@ const DialogExample = () => {
|
|
|
79
132
|
mode="outlined"
|
|
80
133
|
onPress={_toggleDialog('dialog7')}
|
|
81
134
|
style={styles.button}
|
|
135
|
+
testID="dialog-dismissable-back-button"
|
|
82
136
|
>
|
|
83
137
|
Dismissable back button
|
|
84
138
|
</Button>
|
|
85
139
|
)}
|
|
140
|
+
<Button
|
|
141
|
+
mode="outlined"
|
|
142
|
+
onPress={_toggleDialog('dialogTracking')}
|
|
143
|
+
style={styles.button}
|
|
144
|
+
testID="dialog-tracking-test-button"
|
|
145
|
+
>
|
|
146
|
+
Dialog Tracking Test
|
|
147
|
+
</Button>
|
|
148
|
+
<Button
|
|
149
|
+
mode="outlined"
|
|
150
|
+
onPress={() => {
|
|
151
|
+
console.log('๐งช Testing Alert.alert tracking...');
|
|
152
|
+
Alert.alert(
|
|
153
|
+
'Test Alert',
|
|
154
|
+
'This is a test alert for dialog tracking',
|
|
155
|
+
[
|
|
156
|
+
{ text: 'Cancel', style: 'cancel' },
|
|
157
|
+
{ text: 'OK', onPress: () => console.log('โ
OK pressed') }
|
|
158
|
+
]
|
|
159
|
+
);
|
|
160
|
+
}}
|
|
161
|
+
style={styles.button}
|
|
162
|
+
testID="test-alert-button"
|
|
163
|
+
>
|
|
164
|
+
Test Alert
|
|
165
|
+
</Button>
|
|
86
166
|
<DialogWithLongText
|
|
87
167
|
visible={_getVisible('dialog1')}
|
|
88
168
|
close={_toggleDialog('dialog1')}
|
|
@@ -113,6 +193,12 @@ const DialogExample = () => {
|
|
|
113
193
|
visible={_getVisible('dialog7')}
|
|
114
194
|
close={_toggleDialog('dialog7')}
|
|
115
195
|
/>
|
|
196
|
+
|
|
197
|
+
{/* Dialog Tracking Test Component */}
|
|
198
|
+
<DialogTrackingTest
|
|
199
|
+
visible={_getVisible('dialogTracking')}
|
|
200
|
+
close={_toggleDialog('dialogTracking')}
|
|
201
|
+
/>
|
|
116
202
|
</ScreenWrapper>
|
|
117
203
|
);
|
|
118
204
|
};
|