@oxy.so/services 14.24.0 → 14.24.2
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/lib/commonjs/ui/navigation/surfaceBackBridge.js +21 -9
- package/lib/commonjs/ui/navigation/surfaceBackBridge.js.map +1 -1
- package/lib/commonjs/ui/session/cachedBoot.js +9 -2
- package/lib/commonjs/ui/session/cachedBoot.js.map +1 -1
- package/lib/commonjs/ui/utils/persistedDataVersion.js +1 -1
- package/lib/module/ui/navigation/surfaceBackBridge.js +21 -9
- package/lib/module/ui/navigation/surfaceBackBridge.js.map +1 -1
- package/lib/module/ui/session/cachedBoot.js +9 -2
- package/lib/module/ui/session/cachedBoot.js.map +1 -1
- package/lib/module/ui/utils/persistedDataVersion.js +1 -1
- package/lib/typescript/commonjs/ui/navigation/surfaceBackBridge.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/session/cachedBoot.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/persistedDataVersion.d.ts +1 -1
- package/lib/typescript/module/ui/navigation/surfaceBackBridge.d.ts.map +1 -1
- package/lib/typescript/module/ui/session/cachedBoot.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/persistedDataVersion.d.ts +1 -1
- package/package.json +3 -3
- package/src/ui/navigation/__tests__/surfaceBackBridge.test.ts +44 -0
- package/src/ui/navigation/surfaceBackBridge.ts +20 -9
- package/src/ui/session/__tests__/cachedBoot.test.ts +31 -0
- package/src/ui/session/cachedBoot.ts +8 -2
- package/src/ui/utils/persistedDataVersion.ts +1 -1
|
@@ -17,19 +17,29 @@ var _reactNative = require("react-native");
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
const handlerStack = [];
|
|
20
|
-
let
|
|
20
|
+
let androidSubscription = null;
|
|
21
21
|
let escapeInstalled = false;
|
|
22
22
|
function invokeTopHandler() {
|
|
23
23
|
const handler = handlerStack[handlerStack.length - 1];
|
|
24
24
|
return handler ? handler() : false;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The Android listener is registered only while a surface is open. Any
|
|
29
|
+
* registered `hardwareBackPress` listener hands Back to JavaScript (React
|
|
30
|
+
* Native's native Back ownership counts listeners, not their answers), so a
|
|
31
|
+
* listener left behind after the first sheet closed routed every later Back
|
|
32
|
+
* through JavaScript: a pushed screen popped only after the JavaScript thread
|
|
33
|
+
* got to it (about 200 ms on a Pixel 8a) instead of natively at once.
|
|
34
|
+
*/
|
|
35
|
+
function syncAndroidHandler() {
|
|
36
|
+
if (_reactNative.Platform.OS !== 'android') return;
|
|
37
|
+
if (handlerStack.length > 0 && !androidSubscription) {
|
|
38
|
+
androidSubscription = _reactNative.BackHandler.addEventListener('hardwareBackPress', invokeTopHandler);
|
|
39
|
+
} else if (handlerStack.length === 0 && androidSubscription) {
|
|
40
|
+
androidSubscription.remove();
|
|
41
|
+
androidSubscription = null;
|
|
42
|
+
}
|
|
33
43
|
}
|
|
34
44
|
function installEscapeHandler() {
|
|
35
45
|
if (escapeInstalled || _reactNative.Platform.OS !== 'web') return;
|
|
@@ -49,10 +59,11 @@ installEscapeHandler();
|
|
|
49
59
|
/** Push a handler for one live surface; returns unregister. */
|
|
50
60
|
function pushSurfaceBackHandler(handler) {
|
|
51
61
|
handlerStack.push(handler);
|
|
52
|
-
|
|
62
|
+
syncAndroidHandler();
|
|
53
63
|
return () => {
|
|
54
64
|
const index = handlerStack.lastIndexOf(handler);
|
|
55
65
|
if (index >= 0) handlerStack.splice(index, 1);
|
|
66
|
+
syncAndroidHandler();
|
|
56
67
|
};
|
|
57
68
|
}
|
|
58
69
|
|
|
@@ -64,5 +75,6 @@ function __invokeTopSurfaceBackForTests() {
|
|
|
64
75
|
/** Test-only reset. */
|
|
65
76
|
function __resetSurfaceBackBridgeForTests() {
|
|
66
77
|
handlerStack.length = 0;
|
|
78
|
+
syncAndroidHandler();
|
|
67
79
|
}
|
|
68
80
|
//# sourceMappingURL=surfaceBackBridge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","handlerStack","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","handlerStack","androidSubscription","escapeInstalled","invokeTopHandler","handler","length","syncAndroidHandler","Platform","OS","BackHandler","addEventListener","remove","installEscapeHandler","window","event","key","stopImmediatePropagation","preventDefault","pushSurfaceBackHandler","push","index","lastIndexOf","splice","__invokeTopSurfaceBackForTests","__resetSurfaceBackBridgeForTests"],"sourceRoot":"../../../../src","sources":["ui/navigation/surfaceBackBridge.ts"],"mappings":";;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,MAAMC,YAAkC,GAAG,EAAE;AAC7C,IAAIC,mBAA8C,GAAG,IAAI;AACzD,IAAIC,eAAe,GAAG,KAAK;AAE3B,SAASC,gBAAgBA,CAAA,EAAY;EACnC,MAAMC,OAAO,GAAGJ,YAAY,CAACA,YAAY,CAACK,MAAM,GAAG,CAAC,CAAC;EACrD,OAAOD,OAAO,GAAGA,OAAO,CAAC,CAAC,GAAG,KAAK;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,kBAAkBA,CAAA,EAAS;EAClC,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;EAC/B,IAAIR,YAAY,CAACK,MAAM,GAAG,CAAC,IAAI,CAACJ,mBAAmB,EAAE;IACnDA,mBAAmB,GAAGQ,wBAAW,CAACC,gBAAgB,CAAC,mBAAmB,EAAEP,gBAAgB,CAAC;EAC3F,CAAC,MAAM,IAAIH,YAAY,CAACK,MAAM,KAAK,CAAC,IAAIJ,mBAAmB,EAAE;IAC3DA,mBAAmB,CAACU,MAAM,CAAC,CAAC;IAC5BV,mBAAmB,GAAG,IAAI;EAC5B;AACF;AAEA,SAASW,oBAAoBA,CAAA,EAAS;EACpC,IAAIV,eAAe,IAAIK,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;EAC9C,IAAI,OAAOK,MAAM,KAAK,WAAW,EAAE;EACnCX,eAAe,GAAG,IAAI;EACtBW,MAAM,CAACH,gBAAgB,CACrB,SAAS,EACRI,KAAK,IAAK;IACT,IAAIA,KAAK,CAACC,GAAG,KAAK,QAAQ,IAAIf,YAAY,CAACK,MAAM,KAAK,CAAC,EAAE;IACzD,IAAI,CAACF,gBAAgB,CAAC,CAAC,EAAE;IACzBW,KAAK,CAACE,wBAAwB,CAAC,CAAC;IAChCF,KAAK,CAACG,cAAc,CAAC,CAAC;EACxB,CAAC,EACD,IACF,CAAC;AACH;;AAEA;AACAL,oBAAoB,CAAC,CAAC;;AAEtB;AACO,SAASM,sBAAsBA,CAACd,OAA2B,EAAc;EAC9EJ,YAAY,CAACmB,IAAI,CAACf,OAAO,CAAC;EAC1BE,kBAAkB,CAAC,CAAC;EACpB,OAAO,MAAM;IACX,MAAMc,KAAK,GAAGpB,YAAY,CAACqB,WAAW,CAACjB,OAAO,CAAC;IAC/C,IAAIgB,KAAK,IAAI,CAAC,EAAEpB,YAAY,CAACsB,MAAM,CAACF,KAAK,EAAE,CAAC,CAAC;IAC7Cd,kBAAkB,CAAC,CAAC;EACtB,CAAC;AACH;;AAEA;AACO,SAASiB,8BAA8BA,CAAA,EAAY;EACxD,OAAOpB,gBAAgB,CAAC,CAAC;AAC3B;;AAEA;AACO,SAASqB,gCAAgCA,CAAA,EAAS;EACvDxB,YAAY,CAACK,MAAM,GAAG,CAAC;EACvBC,kBAAkB,CAAC,CAAC;AACtB","ignoreList":[]}
|
|
@@ -78,8 +78,15 @@ function createCachedBootStore(storage, prefix, now = Date.now) {
|
|
|
78
78
|
if (!persisted?.sessionId || !persisted.deviceId || !persisted.deviceSecret || persisted.userId !== user.id) {
|
|
79
79
|
return null;
|
|
80
80
|
}
|
|
81
|
-
//
|
|
82
|
-
|
|
81
|
+
// The sign-out intent (`isAutomaticIdentitySignInSuppressed`) is not read
|
|
82
|
+
// here. It keeps the boot from CREATING a session on its own (the shared
|
|
83
|
+
// adopt and identity-key lanes), not from resuming this holder's: the
|
|
84
|
+
// device-secret mint runs either way. A sign-out deletes the cached
|
|
85
|
+
// profile, so nothing reaches this point after one, and the background
|
|
86
|
+
// check still ends the session if the server does. The flag is not cleared
|
|
87
|
+
// when the device signs back in through another app, so reading it here
|
|
88
|
+
// held every later cold boot of a signed-in account behind the network.
|
|
89
|
+
|
|
83
90
|
const expiresAtMs = persisted.expiresAt ? new Date(persisted.expiresAt).getTime() : NaN;
|
|
84
91
|
const warmToken = persisted.accessToken && Number.isFinite(expiresAtMs) && expiresAtMs > now() + _session.TOKEN_REFRESH_LEAD_MS ? persisted.accessToken : null;
|
|
85
92
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_session","require","SCHEMA_VERSION","parse","raw","value","JSON","isUser","Boolean","id","length","createCachedBootStore","storage","prefix","now","Date","laneKey","accountKey","write","key","setItem","stringify","v","catch","saveLane","clientId","lane","saveAccount","user","clearAccount","removeItem","readSession","authStore","laneEntry","accountEntry","Promise","all","getItem","then","persisted","load","sessionId","deviceId","deviceSecret","userId","
|
|
1
|
+
{"version":3,"names":["_session","require","SCHEMA_VERSION","parse","raw","value","JSON","isUser","Boolean","id","length","createCachedBootStore","storage","prefix","now","Date","laneKey","accountKey","write","key","setItem","stringify","v","catch","saveLane","clientId","lane","saveAccount","user","clearAccount","removeItem","readSession","authStore","laneEntry","accountEntry","Promise","all","getItem","then","persisted","load","sessionId","deviceId","deviceSecret","userId","expiresAtMs","expiresAt","getTime","NaN","warmToken","accessToken","Number","isFinite","TOKEN_REFRESH_LEAD_MS"],"sourceRoot":"../../../../src","sources":["ui/session/cachedBoot.ts"],"mappings":";;;;;;AAuBA,IAAAA,QAAA,GAAAC,OAAA;AAvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AAMC,SAAS,GACbV,SAAS,CAACW,WAAW,IACrBC,MAAM,CAACC,QAAQ,CAACP,WAAW,CAAC,IAC5BA,WAAW,GAAG/B,GAAG,CAAC,CAAC,GAAGuC,8BAAqB,GACvCd,SAAS,CAACW,WAAW,GACrB,IAAI;MACV,OAAO;QACLT,SAAS,EAAEF,SAAS,CAACE,SAAS;QAC9BG,MAAM,EAAEL,SAAS,CAACK,MAAM;QACxBF,QAAQ,EAAEH,SAAS,CAACG,QAAQ;QAC5Bd,IAAI;QACJqB;MACF,CAAC;IACH;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -12,5 +12,5 @@ exports.SERVICES_PERSISTED_DATA_VERSION = void 0;
|
|
|
12
12
|
* `__tests__/hooks/persistedDataVersion.test.ts` keeps it equal to `package.json`'s `version`, so a
|
|
13
13
|
* release cannot forget it.
|
|
14
14
|
*/
|
|
15
|
-
const SERVICES_PERSISTED_DATA_VERSION = exports.SERVICES_PERSISTED_DATA_VERSION = '14.24.
|
|
15
|
+
const SERVICES_PERSISTED_DATA_VERSION = exports.SERVICES_PERSISTED_DATA_VERSION = '14.24.2';
|
|
16
16
|
//# sourceMappingURL=persistedDataVersion.js.map
|
|
@@ -12,19 +12,29 @@ import { BackHandler, Platform } from 'react-native';
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
const handlerStack = [];
|
|
15
|
-
let
|
|
15
|
+
let androidSubscription = null;
|
|
16
16
|
let escapeInstalled = false;
|
|
17
17
|
function invokeTopHandler() {
|
|
18
18
|
const handler = handlerStack[handlerStack.length - 1];
|
|
19
19
|
return handler ? handler() : false;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The Android listener is registered only while a surface is open. Any
|
|
24
|
+
* registered `hardwareBackPress` listener hands Back to JavaScript (React
|
|
25
|
+
* Native's native Back ownership counts listeners, not their answers), so a
|
|
26
|
+
* listener left behind after the first sheet closed routed every later Back
|
|
27
|
+
* through JavaScript: a pushed screen popped only after the JavaScript thread
|
|
28
|
+
* got to it (about 200 ms on a Pixel 8a) instead of natively at once.
|
|
29
|
+
*/
|
|
30
|
+
function syncAndroidHandler() {
|
|
31
|
+
if (Platform.OS !== 'android') return;
|
|
32
|
+
if (handlerStack.length > 0 && !androidSubscription) {
|
|
33
|
+
androidSubscription = BackHandler.addEventListener('hardwareBackPress', invokeTopHandler);
|
|
34
|
+
} else if (handlerStack.length === 0 && androidSubscription) {
|
|
35
|
+
androidSubscription.remove();
|
|
36
|
+
androidSubscription = null;
|
|
37
|
+
}
|
|
28
38
|
}
|
|
29
39
|
function installEscapeHandler() {
|
|
30
40
|
if (escapeInstalled || Platform.OS !== 'web') return;
|
|
@@ -44,10 +54,11 @@ installEscapeHandler();
|
|
|
44
54
|
/** Push a handler for one live surface; returns unregister. */
|
|
45
55
|
export function pushSurfaceBackHandler(handler) {
|
|
46
56
|
handlerStack.push(handler);
|
|
47
|
-
|
|
57
|
+
syncAndroidHandler();
|
|
48
58
|
return () => {
|
|
49
59
|
const index = handlerStack.lastIndexOf(handler);
|
|
50
60
|
if (index >= 0) handlerStack.splice(index, 1);
|
|
61
|
+
syncAndroidHandler();
|
|
51
62
|
};
|
|
52
63
|
}
|
|
53
64
|
|
|
@@ -59,5 +70,6 @@ export function __invokeTopSurfaceBackForTests() {
|
|
|
59
70
|
/** Test-only reset. */
|
|
60
71
|
export function __resetSurfaceBackBridgeForTests() {
|
|
61
72
|
handlerStack.length = 0;
|
|
73
|
+
syncAndroidHandler();
|
|
62
74
|
}
|
|
63
75
|
//# sourceMappingURL=surfaceBackBridge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BackHandler","Platform","handlerStack","
|
|
1
|
+
{"version":3,"names":["BackHandler","Platform","handlerStack","androidSubscription","escapeInstalled","invokeTopHandler","handler","length","syncAndroidHandler","OS","addEventListener","remove","installEscapeHandler","window","event","key","stopImmediatePropagation","preventDefault","pushSurfaceBackHandler","push","index","lastIndexOf","splice","__invokeTopSurfaceBackForTests","__resetSurfaceBackBridgeForTests"],"sourceRoot":"../../../../src","sources":["ui/navigation/surfaceBackBridge.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,cAAc;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,MAAMC,YAAkC,GAAG,EAAE;AAC7C,IAAIC,mBAA8C,GAAG,IAAI;AACzD,IAAIC,eAAe,GAAG,KAAK;AAE3B,SAASC,gBAAgBA,CAAA,EAAY;EACnC,MAAMC,OAAO,GAAGJ,YAAY,CAACA,YAAY,CAACK,MAAM,GAAG,CAAC,CAAC;EACrD,OAAOD,OAAO,GAAGA,OAAO,CAAC,CAAC,GAAG,KAAK;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,kBAAkBA,CAAA,EAAS;EAClC,IAAIP,QAAQ,CAACQ,EAAE,KAAK,SAAS,EAAE;EAC/B,IAAIP,YAAY,CAACK,MAAM,GAAG,CAAC,IAAI,CAACJ,mBAAmB,EAAE;IACnDA,mBAAmB,GAAGH,WAAW,CAACU,gBAAgB,CAAC,mBAAmB,EAAEL,gBAAgB,CAAC;EAC3F,CAAC,MAAM,IAAIH,YAAY,CAACK,MAAM,KAAK,CAAC,IAAIJ,mBAAmB,EAAE;IAC3DA,mBAAmB,CAACQ,MAAM,CAAC,CAAC;IAC5BR,mBAAmB,GAAG,IAAI;EAC5B;AACF;AAEA,SAASS,oBAAoBA,CAAA,EAAS;EACpC,IAAIR,eAAe,IAAIH,QAAQ,CAACQ,EAAE,KAAK,KAAK,EAAE;EAC9C,IAAI,OAAOI,MAAM,KAAK,WAAW,EAAE;EACnCT,eAAe,GAAG,IAAI;EACtBS,MAAM,CAACH,gBAAgB,CACrB,SAAS,EACRI,KAAK,IAAK;IACT,IAAIA,KAAK,CAACC,GAAG,KAAK,QAAQ,IAAIb,YAAY,CAACK,MAAM,KAAK,CAAC,EAAE;IACzD,IAAI,CAACF,gBAAgB,CAAC,CAAC,EAAE;IACzBS,KAAK,CAACE,wBAAwB,CAAC,CAAC;IAChCF,KAAK,CAACG,cAAc,CAAC,CAAC;EACxB,CAAC,EACD,IACF,CAAC;AACH;;AAEA;AACAL,oBAAoB,CAAC,CAAC;;AAEtB;AACA,OAAO,SAASM,sBAAsBA,CAACZ,OAA2B,EAAc;EAC9EJ,YAAY,CAACiB,IAAI,CAACb,OAAO,CAAC;EAC1BE,kBAAkB,CAAC,CAAC;EACpB,OAAO,MAAM;IACX,MAAMY,KAAK,GAAGlB,YAAY,CAACmB,WAAW,CAACf,OAAO,CAAC;IAC/C,IAAIc,KAAK,IAAI,CAAC,EAAElB,YAAY,CAACoB,MAAM,CAACF,KAAK,EAAE,CAAC,CAAC;IAC7CZ,kBAAkB,CAAC,CAAC;EACtB,CAAC;AACH;;AAEA;AACA,OAAO,SAASe,8BAA8BA,CAAA,EAAY;EACxD,OAAOlB,gBAAgB,CAAC,CAAC;AAC3B;;AAEA;AACA,OAAO,SAASmB,gCAAgCA,CAAA,EAAS;EACvDtB,YAAY,CAACK,MAAM,GAAG,CAAC;EACvBC,kBAAkB,CAAC,CAAC;AACtB","ignoreList":[]}
|
|
@@ -75,8 +75,15 @@ export function createCachedBootStore(storage, prefix, now = Date.now) {
|
|
|
75
75
|
if (!persisted?.sessionId || !persisted.deviceId || !persisted.deviceSecret || persisted.userId !== user.id) {
|
|
76
76
|
return null;
|
|
77
77
|
}
|
|
78
|
-
//
|
|
79
|
-
|
|
78
|
+
// The sign-out intent (`isAutomaticIdentitySignInSuppressed`) is not read
|
|
79
|
+
// here. It keeps the boot from CREATING a session on its own (the shared
|
|
80
|
+
// adopt and identity-key lanes), not from resuming this holder's: the
|
|
81
|
+
// device-secret mint runs either way. A sign-out deletes the cached
|
|
82
|
+
// profile, so nothing reaches this point after one, and the background
|
|
83
|
+
// check still ends the session if the server does. The flag is not cleared
|
|
84
|
+
// when the device signs back in through another app, so reading it here
|
|
85
|
+
// held every later cold boot of a signed-in account behind the network.
|
|
86
|
+
|
|
80
87
|
const expiresAtMs = persisted.expiresAt ? new Date(persisted.expiresAt).getTime() : NaN;
|
|
81
88
|
const warmToken = persisted.accessToken && Number.isFinite(expiresAtMs) && expiresAtMs > now() + TOKEN_REFRESH_LEAD_MS ? persisted.accessToken : null;
|
|
82
89
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TOKEN_REFRESH_LEAD_MS","SCHEMA_VERSION","parse","raw","value","JSON","isUser","Boolean","id","length","createCachedBootStore","storage","prefix","now","Date","laneKey","accountKey","write","key","setItem","stringify","v","catch","saveLane","clientId","lane","saveAccount","user","clearAccount","removeItem","readSession","authStore","laneEntry","accountEntry","Promise","all","getItem","then","persisted","load","sessionId","deviceId","deviceSecret","userId","
|
|
1
|
+
{"version":3,"names":["TOKEN_REFRESH_LEAD_MS","SCHEMA_VERSION","parse","raw","value","JSON","isUser","Boolean","id","length","createCachedBootStore","storage","prefix","now","Date","laneKey","accountKey","write","key","setItem","stringify","v","catch","saveLane","clientId","lane","saveAccount","user","clearAccount","removeItem","readSession","authStore","laneEntry","accountEntry","Promise","all","getItem","then","persisted","load","sessionId","deviceId","deviceSecret","userId","expiresAtMs","expiresAt","getTime","NaN","warmToken","accessToken","Number","isFinite"],"sourceRoot":"../../../../src","sources":["ui/session/cachedBoot.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,qBAAqB,QAA6B,sBAAsB;;AAKjF;;AAsBA,MAAMC,cAAc,GAAG,CAAC;AAExB,SAASC,KAAKA,CAACC,GAAkB,EAAkC;EACjE,IAAI,CAACA,GAAG,EAAE,OAAO,IAAI;EACrB,IAAI;IACF,MAAMC,KAAc,GAAGC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AAS;QAC9BG,MAAM,EAAEL,SAAS,CAACK,MAAM;QACxBF,QAAQ,EAAEH,SAAS,CAACG,QAAQ;QAC5Bd,IAAI;QACJqB;MACF,CAAC;IACH;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
* `__tests__/hooks/persistedDataVersion.test.ts` keeps it equal to `package.json`'s `version`, so a
|
|
9
9
|
* release cannot forget it.
|
|
10
10
|
*/
|
|
11
|
-
export const SERVICES_PERSISTED_DATA_VERSION = '14.24.
|
|
11
|
+
export const SERVICES_PERSISTED_DATA_VERSION = '14.24.2';
|
|
12
12
|
//# sourceMappingURL=persistedDataVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surfaceBackBridge.d.ts","sourceRoot":"","sources":["../../../../../src/ui/navigation/surfaceBackBridge.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"surfaceBackBridge.d.ts","sourceRoot":"","sources":["../../../../../src/ui/navigation/surfaceBackBridge.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC;AAgD/C,+DAA+D;AAC/D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,IAAI,CAQ9E;AAED,yCAAyC;AACzC,wBAAgB,8BAA8B,IAAI,OAAO,CAExD;AAED,uBAAuB;AACvB,wBAAgB,gCAAgC,IAAI,IAAI,CAGvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cachedBoot.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/cachedBoot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAyB,KAA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O,CAAC;AAE7C,uEAAuE;AACvE,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,IAAI,EAAE,IAAI,CAAC;IACX,gFAAgF;IAChF,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;CACzF;AAuBD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,MAAM,EACd,GAAG,GAAE,MAAM,MAAiB,GAC3B,eAAe,CAqEjB"}
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* `__tests__/hooks/persistedDataVersion.test.ts` keeps it equal to `package.json`'s `version`, so a
|
|
7
7
|
* release cannot forget it.
|
|
8
8
|
*/
|
|
9
|
-
export declare const SERVICES_PERSISTED_DATA_VERSION = "14.24.
|
|
9
|
+
export declare const SERVICES_PERSISTED_DATA_VERSION = "14.24.2";
|
|
10
10
|
//# sourceMappingURL=persistedDataVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surfaceBackBridge.d.ts","sourceRoot":"","sources":["../../../../../src/ui/navigation/surfaceBackBridge.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"surfaceBackBridge.d.ts","sourceRoot":"","sources":["../../../../../src/ui/navigation/surfaceBackBridge.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC;AAgD/C,+DAA+D;AAC/D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,IAAI,CAQ9E;AAED,yCAAyC;AACzC,wBAAgB,8BAA8B,IAAI,OAAO,CAExD;AAED,uBAAuB;AACvB,wBAAgB,gCAAgC,IAAI,IAAI,CAGvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cachedBoot.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/cachedBoot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAAyB,CAAC;AAEhE,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE7C,uEAAuE;AACvE,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,IAAI,EAAE,IAAI,CAAC;IACX,gFAAgF;IAChF,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC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D,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,MAAM,EACd,GAAG,GAAE,MAAM,MAAiB,GAC3B,eAAe,CAqEjB"}
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* `__tests__/hooks/persistedDataVersion.test.ts` keeps it equal to `package.json`'s `version`, so a
|
|
7
7
|
* release cannot forget it.
|
|
8
8
|
*/
|
|
9
|
-
export declare const SERVICES_PERSISTED_DATA_VERSION = "14.24.
|
|
9
|
+
export declare const SERVICES_PERSISTED_DATA_VERSION = "14.24.2";
|
|
10
10
|
//# sourceMappingURL=persistedDataVersion.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxy.so/services",
|
|
3
|
-
"version": "14.24.
|
|
3
|
+
"version": "14.24.2",
|
|
4
4
|
"description": "OxyHQ Expo/React Native SDK — UI components, screens, and native features",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -176,14 +176,14 @@
|
|
|
176
176
|
"delete-dts.js": "find ./lib/commonjs ./lib/module \\( -name '*.d.js*' -o -name '*.d.ts' \\) -delete"
|
|
177
177
|
},
|
|
178
178
|
"dependencies": {
|
|
179
|
-
"@oxy.so/contracts": "^7.
|
|
179
|
+
"@oxy.so/contracts": "^7.5.0",
|
|
180
180
|
"color": "^5.0.3",
|
|
181
181
|
"@peable.to/sdk": "^4.0.0"
|
|
182
182
|
},
|
|
183
183
|
"devDependencies": {
|
|
184
184
|
"@expo/app-integrity": "~58.0.2",
|
|
185
185
|
"@expo/vector-icons": "^15.1.1",
|
|
186
|
-
"@oxy.so/core": "7.
|
|
186
|
+
"@oxy.so/core": "7.55.0",
|
|
187
187
|
"@react-native-async-storage/async-storage": "^3.1.1",
|
|
188
188
|
"@react-native-community/netinfo": "^12.0.1",
|
|
189
189
|
"@react-native/babel-preset": "^0.88.1",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const listeners = new Set<() => boolean>();
|
|
2
|
+
|
|
3
|
+
jest.mock('react-native', () => ({
|
|
4
|
+
Platform: { OS: 'android' },
|
|
5
|
+
BackHandler: {
|
|
6
|
+
addEventListener: (_event: string, listener: () => boolean) => {
|
|
7
|
+
listeners.add(listener);
|
|
8
|
+
return { remove: () => listeners.delete(listener) };
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
import { __resetSurfaceBackBridgeForTests, pushSurfaceBackHandler } from '../surfaceBackBridge';
|
|
14
|
+
|
|
15
|
+
const press = () => [...listeners].some((listener) => listener());
|
|
16
|
+
|
|
17
|
+
afterEach(() => __resetSurfaceBackBridgeForTests());
|
|
18
|
+
|
|
19
|
+
it('holds Android Back only while a surface is open', () => {
|
|
20
|
+
expect(listeners.size).toBe(0);
|
|
21
|
+
const close = jest.fn(() => true);
|
|
22
|
+
const unregister = pushSurfaceBackHandler(close);
|
|
23
|
+
expect(listeners.size).toBe(1);
|
|
24
|
+
expect(press()).toBe(true);
|
|
25
|
+
expect(close).toHaveBeenCalledTimes(1);
|
|
26
|
+
unregister();
|
|
27
|
+
expect(listeners.size).toBe(0);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('routes Back to the topmost surface and keeps one listener for a stack', () => {
|
|
31
|
+
const lower = jest.fn(() => true);
|
|
32
|
+
const upper = jest.fn(() => true);
|
|
33
|
+
const releaseLower = pushSurfaceBackHandler(lower);
|
|
34
|
+
const releaseUpper = pushSurfaceBackHandler(upper);
|
|
35
|
+
expect(listeners.size).toBe(1);
|
|
36
|
+
press();
|
|
37
|
+
expect(upper).toHaveBeenCalledTimes(1);
|
|
38
|
+
expect(lower).not.toHaveBeenCalled();
|
|
39
|
+
releaseUpper();
|
|
40
|
+
press();
|
|
41
|
+
expect(lower).toHaveBeenCalledTimes(1);
|
|
42
|
+
releaseLower();
|
|
43
|
+
expect(listeners.size).toBe(0);
|
|
44
|
+
});
|
|
@@ -12,7 +12,7 @@ import { BackHandler, Platform } from 'react-native';
|
|
|
12
12
|
export type SurfaceBackHandler = () => boolean;
|
|
13
13
|
|
|
14
14
|
const handlerStack: SurfaceBackHandler[] = [];
|
|
15
|
-
let
|
|
15
|
+
let androidSubscription: { remove(): void } | null = null;
|
|
16
16
|
let escapeInstalled = false;
|
|
17
17
|
|
|
18
18
|
function invokeTopHandler(): boolean {
|
|
@@ -20,13 +20,22 @@ function invokeTopHandler(): boolean {
|
|
|
20
20
|
return handler ? handler() : false;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The Android listener is registered only while a surface is open. Any
|
|
25
|
+
* registered `hardwareBackPress` listener hands Back to JavaScript (React
|
|
26
|
+
* Native's native Back ownership counts listeners, not their answers), so a
|
|
27
|
+
* listener left behind after the first sheet closed routed every later Back
|
|
28
|
+
* through JavaScript: a pushed screen popped only after the JavaScript thread
|
|
29
|
+
* got to it (about 200 ms on a Pixel 8a) instead of natively at once.
|
|
30
|
+
*/
|
|
31
|
+
function syncAndroidHandler(): void {
|
|
32
|
+
if (Platform.OS !== 'android') return;
|
|
33
|
+
if (handlerStack.length > 0 && !androidSubscription) {
|
|
34
|
+
androidSubscription = BackHandler.addEventListener('hardwareBackPress', invokeTopHandler);
|
|
35
|
+
} else if (handlerStack.length === 0 && androidSubscription) {
|
|
36
|
+
androidSubscription.remove();
|
|
37
|
+
androidSubscription = null;
|
|
38
|
+
}
|
|
30
39
|
}
|
|
31
40
|
|
|
32
41
|
function installEscapeHandler(): void {
|
|
@@ -51,10 +60,11 @@ installEscapeHandler();
|
|
|
51
60
|
/** Push a handler for one live surface; returns unregister. */
|
|
52
61
|
export function pushSurfaceBackHandler(handler: SurfaceBackHandler): () => void {
|
|
53
62
|
handlerStack.push(handler);
|
|
54
|
-
|
|
63
|
+
syncAndroidHandler();
|
|
55
64
|
return () => {
|
|
56
65
|
const index = handlerStack.lastIndexOf(handler);
|
|
57
66
|
if (index >= 0) handlerStack.splice(index, 1);
|
|
67
|
+
syncAndroidHandler();
|
|
58
68
|
};
|
|
59
69
|
}
|
|
60
70
|
|
|
@@ -66,4 +76,5 @@ export function __invokeTopSurfaceBackForTests(): boolean {
|
|
|
66
76
|
/** Test-only reset. */
|
|
67
77
|
export function __resetSurfaceBackBridgeForTests(): void {
|
|
68
78
|
handlerStack.length = 0;
|
|
79
|
+
syncAndroidHandler();
|
|
69
80
|
}
|
|
@@ -30,3 +30,34 @@ it('offers a cached session only for the account the saved session belongs to',
|
|
|
30
30
|
await cache.saveLane('client', 'oauth');
|
|
31
31
|
expect(await cache.readSession('client', authStore(saved))).toBeNull();
|
|
32
32
|
});
|
|
33
|
+
|
|
34
|
+
it('offers the cached session while an old sign-out intent is still recorded', async () => {
|
|
35
|
+
// A device signed back in through another app keeps the intent this app
|
|
36
|
+
// recorded at an earlier sign-out; the mint still resumes this holder, so the
|
|
37
|
+
// paint must not wait for it. The sign-out itself deleted the cached profile.
|
|
38
|
+
const cache = createCachedBootStore(createMemoryStorage(), 'oxy_session');
|
|
39
|
+
const expiresAt = new Date(Date.now() + 60 * 60 * 1000).toISOString();
|
|
40
|
+
const saved = {
|
|
41
|
+
sessionId: 's1',
|
|
42
|
+
userId: 'u1',
|
|
43
|
+
deviceId: 'd1',
|
|
44
|
+
deviceSecret: 'secret',
|
|
45
|
+
accessToken: 'token',
|
|
46
|
+
expiresAt,
|
|
47
|
+
};
|
|
48
|
+
const store: AuthStateStore = {
|
|
49
|
+
...authStore(saved),
|
|
50
|
+
isAutomaticIdentitySignInSuppressed: async () => true,
|
|
51
|
+
};
|
|
52
|
+
await cache.saveLane('client', 'device');
|
|
53
|
+
await cache.saveAccount({ id: 'u1', username: 'me' } as User);
|
|
54
|
+
|
|
55
|
+
expect(await cache.readSession('client', store)).toMatchObject({
|
|
56
|
+
sessionId: 's1',
|
|
57
|
+
user: { id: 'u1' },
|
|
58
|
+
warmToken: 'token',
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
await cache.clearAccount();
|
|
62
|
+
expect(await cache.readSession('client', store)).toBeNull();
|
|
63
|
+
});
|
|
@@ -117,8 +117,14 @@ export function createCachedBootStore(
|
|
|
117
117
|
) {
|
|
118
118
|
return null;
|
|
119
119
|
}
|
|
120
|
-
//
|
|
121
|
-
|
|
120
|
+
// The sign-out intent (`isAutomaticIdentitySignInSuppressed`) is not read
|
|
121
|
+
// here. It keeps the boot from CREATING a session on its own (the shared
|
|
122
|
+
// adopt and identity-key lanes), not from resuming this holder's: the
|
|
123
|
+
// device-secret mint runs either way. A sign-out deletes the cached
|
|
124
|
+
// profile, so nothing reaches this point after one, and the background
|
|
125
|
+
// check still ends the session if the server does. The flag is not cleared
|
|
126
|
+
// when the device signs back in through another app, so reading it here
|
|
127
|
+
// held every later cold boot of a signed-in account behind the network.
|
|
122
128
|
|
|
123
129
|
const expiresAtMs = persisted.expiresAt ? new Date(persisted.expiresAt).getTime() : NaN;
|
|
124
130
|
const warmToken =
|