@quiesco/native 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +17 -2
- package/android/build.gradle +25 -0
- package/android/src/main/java/dev/quiesco/nativemodule/QuiescoNativeModule.kt +498 -0
- package/android/src/main/java/dev/quiesco/nativemodule/QuiescoNativePackage.kt +46 -0
- package/expo-module.config.json +9 -0
- package/ios/QSTouchInjector.h +43 -0
- package/ios/QSTouchInjector.m +293 -0
- package/ios/QuiescoNative.podspec +27 -0
- package/ios/QuiescoNativeModule.swift +877 -0
- package/package.json +51 -3
- package/src/index.ts +195 -0
package/package.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quiesco/native",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Quiesco native touch injection (Expo Module). e2e builds only.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "h2nology",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"quiesco",
|
|
9
|
+
"e2e",
|
|
10
|
+
"testing",
|
|
11
|
+
"expo",
|
|
12
|
+
"react-native",
|
|
13
|
+
"expo-module",
|
|
14
|
+
"touch-injection"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/h2nology/quiesco/tree/main/packages/native#readme",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/h2nology/quiesco.git",
|
|
20
|
+
"directory": "packages/native"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/h2nology/quiesco/issues"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=24"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"main": "./src/index.ts",
|
|
32
|
+
"react-native": "./src/index.ts",
|
|
33
|
+
"types": "./src/index.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": "./src/index.ts",
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"src",
|
|
40
|
+
"android/build.gradle",
|
|
41
|
+
"android/src",
|
|
42
|
+
"expo-module.config.json",
|
|
43
|
+
"ios/*.swift",
|
|
44
|
+
"ios/*.h",
|
|
45
|
+
"ios/*.m",
|
|
46
|
+
"ios/QuiescoNative.podspec"
|
|
47
|
+
],
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"expo-modules-core": "*"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"test": "vitest run"
|
|
53
|
+
}
|
|
6
54
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JS face of the QuiescoNative Expo Module (Android: ./android, iOS: ./ios). `null` when the native code
|
|
3
|
+
* is not linked (JS-only builds, production builds where the config plugin excluded it, web).
|
|
4
|
+
*
|
|
5
|
+
* Coordinates are in the window of the addressed view: dp on Android, pt on iOS — the space of
|
|
6
|
+
* `getBoundingClientRect()` on both. Rejections carry one of {@link NativeErrorCode}.
|
|
7
|
+
*/
|
|
8
|
+
import { requireOptionalNativeModule } from 'expo-modules-core';
|
|
9
|
+
|
|
10
|
+
/** `code` of a rejected call. */
|
|
11
|
+
export type NativeErrorCode =
|
|
12
|
+
/** iOS: the private UIKit API used for touch injection is missing on this iOS version. */
|
|
13
|
+
| 'E_UNSUPPORTED'
|
|
14
|
+
/** The view (or its window) is gone, e.g. unmounted. */
|
|
15
|
+
| 'E_NO_VIEW'
|
|
16
|
+
/** typeText on a view that contains no text field. */
|
|
17
|
+
| 'E_NOT_TEXT_INPUT'
|
|
18
|
+
/** openUrl with an unparsable URL. */
|
|
19
|
+
| 'E_BAD_URL'
|
|
20
|
+
/** gesture / pressKey with malformed arguments. */
|
|
21
|
+
| 'E_BAD_ARGS'
|
|
22
|
+
/** accessibilityAction: the view does not offer the action. */
|
|
23
|
+
| 'E_NO_ACTION';
|
|
24
|
+
|
|
25
|
+
/** Slider geometry in the window of the view (see sliderInfo). */
|
|
26
|
+
export interface SliderInfo {
|
|
27
|
+
found: boolean;
|
|
28
|
+
/** x of the thumb center at the minimum / maximum value. */
|
|
29
|
+
minX?: number;
|
|
30
|
+
maxX?: number;
|
|
31
|
+
/** Current thumb center. */
|
|
32
|
+
thumbX?: number;
|
|
33
|
+
y?: number;
|
|
34
|
+
value?: number;
|
|
35
|
+
minimum?: number;
|
|
36
|
+
maximum?: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** One column of a wheel picker (see wheelInfo). */
|
|
40
|
+
export interface WheelComponent {
|
|
41
|
+
selectedRow: number;
|
|
42
|
+
rows: number;
|
|
43
|
+
rowHeight: number;
|
|
44
|
+
/** Title of the selected row, when it can be read. */
|
|
45
|
+
title: string | null;
|
|
46
|
+
/** The column's rect in the window, when its view was found. */
|
|
47
|
+
x?: number;
|
|
48
|
+
y?: number;
|
|
49
|
+
width?: number;
|
|
50
|
+
height?: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface WheelInfo {
|
|
54
|
+
found: boolean;
|
|
55
|
+
components?: WheelComponent[];
|
|
56
|
+
columnCount?: number;
|
|
57
|
+
/** A wheel is still tracking a finger, dragging or decelerating (values update once it stops). */
|
|
58
|
+
moving?: boolean;
|
|
59
|
+
x?: number;
|
|
60
|
+
y?: number;
|
|
61
|
+
width?: number;
|
|
62
|
+
height?: number;
|
|
63
|
+
/** UIDatePicker: its date (ms since epoch), mode (0 time, 1 date, 2 date and time) and locale. */
|
|
64
|
+
date?: number;
|
|
65
|
+
datePickerMode?: number;
|
|
66
|
+
locale?: string;
|
|
67
|
+
/** Diagnostics: the picker's view hierarchy. */
|
|
68
|
+
tree?: string[];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface LocateResult {
|
|
72
|
+
found: boolean;
|
|
73
|
+
/** In the coordinate space of the view's window (dp on Android, pt on iOS). */
|
|
74
|
+
x?: number;
|
|
75
|
+
y?: number;
|
|
76
|
+
width?: number;
|
|
77
|
+
height?: number;
|
|
78
|
+
shown?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* False when a touch at the center would not reach the view. Android: another window of the app
|
|
81
|
+
* (e.g. a Modal dialog) holds the input focus. iOS (Modals share the window): the topmost view at the
|
|
82
|
+
* center, across all windows, is not the view or one of its descendants.
|
|
83
|
+
*/
|
|
84
|
+
windowHasFocus?: boolean;
|
|
85
|
+
windowIndex?: number;
|
|
86
|
+
windowCount?: number;
|
|
87
|
+
windowClass?: string;
|
|
88
|
+
/**
|
|
89
|
+
* iOS: touches may be dropped or land elsewhere right now — a view controller transition, a Core
|
|
90
|
+
* Animation on the view or an ancestor, or the software keyboard sliding in / out.
|
|
91
|
+
*/
|
|
92
|
+
settling?: boolean;
|
|
93
|
+
/** iOS: class of the native view a touch at the center would reach, its superview chain and their tags. */
|
|
94
|
+
hitClass?: string;
|
|
95
|
+
hitChain?: string[];
|
|
96
|
+
hitTags?: number[];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface TapResult {
|
|
100
|
+
x: number;
|
|
101
|
+
y: number;
|
|
102
|
+
handled: boolean;
|
|
103
|
+
windowHasFocus: boolean;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface QuiescoNativeModule {
|
|
107
|
+
/** `args`: base64 of the test's launch arguments as JSON (Phase 6.5). */
|
|
108
|
+
getLaunchParams(): { port: string | null; session: string | null; args: string | null };
|
|
109
|
+
/** iOS only: leave for the home screen (private `-[UIApplication suspend]`); false when unavailable. */
|
|
110
|
+
suspend?(): Promise<boolean>;
|
|
111
|
+
/** iOS only: rotate the window scene; resolves with "" or iOS's error message (Phase 6.6). */
|
|
112
|
+
setOrientation?(landscape: boolean): Promise<string>;
|
|
113
|
+
/**
|
|
114
|
+
* Android only: post a notification as the app (tapping it opens the app with `data` as intent extras);
|
|
115
|
+
* resolves with whether the app may show notifications (Phase 6.7).
|
|
116
|
+
*/
|
|
117
|
+
postNotification?(title: string, body: string, data: Record<string, string>): Promise<{ enabled: boolean }>;
|
|
118
|
+
/** The clipboard's text ('' when none), read in the app's process (Phase 6.6; absent in older builds). */
|
|
119
|
+
getClipboard?(): Promise<string>;
|
|
120
|
+
/** Put plain text on the clipboard from the app's process (Phase 6.6). */
|
|
121
|
+
setClipboard?(text: string): Promise<void>;
|
|
122
|
+
locate(tag: number): Promise<LocateResult>;
|
|
123
|
+
/** iOS: who would receive a touch at the window point (x, y) of `tag`'s window. */
|
|
124
|
+
hitAt?(tag: number, x: number, y: number): Promise<Pick<LocateResult, 'windowHasFocus' | 'hitClass' | 'hitChain' | 'hitTags'>>;
|
|
125
|
+
/** `tag < 0`: tap the point (x, y) of the main window (Android: activity window; iOS: key window). */
|
|
126
|
+
tap(tag: number, x: number, y: number, holdMs: number, count: number): Promise<TapResult>;
|
|
127
|
+
swipe(tag: number, fromX: number, fromY: number, toX: number, toY: number, durationMs: number): Promise<{ handled: boolean }>;
|
|
128
|
+
typeText(tag: number, text: string, replace: boolean): Promise<{ text: string; inputConnection: boolean; focused: boolean }>;
|
|
129
|
+
/**
|
|
130
|
+
* One finger along a timed path in the window of `tag` (main window when tag < 0): flat
|
|
131
|
+
* `[x, y, tMs, x, y, tMs, ...]`, t from 0 and increasing; down at the first point, up at the last.
|
|
132
|
+
* Equal consecutive points are a hold.
|
|
133
|
+
*/
|
|
134
|
+
gesture?(tag: number, path: number[]): Promise<{ handled: boolean }>;
|
|
135
|
+
/**
|
|
136
|
+
* Several fingers along timed paths in the window of `tag` (main window when tag < 0): `frames` is flat,
|
|
137
|
+
* per frame `[tMs, down0, x0, y0, down1, x1, y1, ...]` for `fingerCount` fingers (down 1 / 0). Absent in
|
|
138
|
+
* apps built before Phase 6.4.
|
|
139
|
+
*/
|
|
140
|
+
multiGesture?(tag: number, fingerCount: number, frames: number[]): Promise<{ handled: boolean }>;
|
|
141
|
+
/** `enter` (return / IME action) or `backspace` on the text field `tag`, the way the software keyboard sends them. */
|
|
142
|
+
pressKey?(tag: number, key: 'enter' | 'backspace'): Promise<{ text: string; focused: boolean }>;
|
|
143
|
+
/**
|
|
144
|
+
* iOS only: open a URL from inside the app (own scheme: routed to RN Linking without the system
|
|
145
|
+
* confirmation alert of `simctl openurl`). Android opens deep links from the host (`am start`).
|
|
146
|
+
*/
|
|
147
|
+
openUrl?(url: string): Promise<{ opened: boolean }>;
|
|
148
|
+
/**
|
|
149
|
+
* iOS only, synchronous: native UI still settling (view controller transition, keyboard moving or
|
|
150
|
+
* just used), sampled every frame. Used by the agent's `native` idle tracker.
|
|
151
|
+
*/
|
|
152
|
+
idleState?(): { settling: boolean; reasons: string[] };
|
|
153
|
+
/** Slider geometry (iOS UISlider, Android SeekBar) inside `tag`'s view. Absent in apps built before Phase 6.3. */
|
|
154
|
+
sliderInfo?(tag: number): Promise<SliderInfo>;
|
|
155
|
+
/** iOS only: the wheel picker (UIPickerView / UIDatePicker wheels) inside `tag`'s view. Absent before Phase 6.3. */
|
|
156
|
+
wheelInfo?(tag: number): Promise<WheelInfo>;
|
|
157
|
+
/**
|
|
158
|
+
* Perform the declared accessibility action `name` as the screen reader does. `label`: its label (or
|
|
159
|
+
* the name); `index`: its position in accessibilityActions (iOS custom actions); `customIndex`: its
|
|
160
|
+
* position among the non-standard actions (Android generated ids). Absent before Phase 6.3.
|
|
161
|
+
*/
|
|
162
|
+
accessibilityAction?(tag: number, name: string, label: string, index: number, customIndex: number): Promise<{ performed: boolean; via: string }>;
|
|
163
|
+
/** The WebView (react-native-webview) inside `tag`'s view: rect in the window and load state. Absent before Phase 6.8. */
|
|
164
|
+
webviewInfo?(tag: number): Promise<WebViewInfo>;
|
|
165
|
+
/** Evaluate a string-valued expression in the WebView's main frame. Absent before Phase 6.8. */
|
|
166
|
+
webviewEval?(tag: number, script: string): Promise<string>;
|
|
167
|
+
/** Run `source` at document start of the WebView's later page loads; false where unsupported. Absent before Phase 6.8. */
|
|
168
|
+
webviewAddStartScript?(tag: number, source: string): Promise<boolean>;
|
|
169
|
+
/** Show / hide a scroll view's indicators (Phase 6.9 full-page screenshots); what they were: 1 shown, 0 hidden, -1 not found. */
|
|
170
|
+
setScrollIndicators?(tag: number, visible: boolean): Promise<number>;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface WebViewInfo {
|
|
174
|
+
found: boolean;
|
|
175
|
+
/** In the window of the view (dp / pt). */
|
|
176
|
+
x?: number;
|
|
177
|
+
y?: number;
|
|
178
|
+
width?: number;
|
|
179
|
+
height?: number;
|
|
180
|
+
loading?: boolean;
|
|
181
|
+
progress?: number;
|
|
182
|
+
url?: string;
|
|
183
|
+
title?: string;
|
|
184
|
+
/** iOS: the scroll view's adjusted content inset and zoom. */
|
|
185
|
+
insetTop?: number;
|
|
186
|
+
insetLeft?: number;
|
|
187
|
+
zoom?: number;
|
|
188
|
+
/** Android: display density, and whether document-start scripts are supported. */
|
|
189
|
+
density?: number;
|
|
190
|
+
documentStartScript?: boolean;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export const QuiescoNative: QuiescoNativeModule | null = requireOptionalNativeModule<QuiescoNativeModule>('QuiescoNative');
|
|
194
|
+
|
|
195
|
+
export default QuiescoNative;
|