@livx.cc/appwrap 0.25.0 → 0.25.1
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/package.json +1 -1
- package/runtime/app/shell/handlers-push.ts +17 -2
- package/runtime/package.json +1 -1
- package/src/cli.ts +1 -1
package/package.json
CHANGED
|
@@ -166,6 +166,18 @@ export function registerPushHandlers(): void {
|
|
|
166
166
|
if (isAndroid) return androidDeleteToken();
|
|
167
167
|
});
|
|
168
168
|
|
|
169
|
+
// Dev/demo: ask the backend to push THIS device on demand. Goes native (NS Http) → no app:// CORS
|
|
170
|
+
// wall. Requires push.registrationUrl + a registered token; the backend honors `test:true`.
|
|
171
|
+
bridge.register('push.sendTest', () => {
|
|
172
|
+
const url = SHELL_CONFIG.pushRegistrationUrl;
|
|
173
|
+
if (!url) return Promise.reject(Object.assign(new Error('push.registrationUrl not configured'), { code: 'UNSUPPORTED' }));
|
|
174
|
+
if (!cachedToken) return Promise.reject(Object.assign(new Error('no device token yet — register first'), { code: 'NOT_READY' }));
|
|
175
|
+
return Http.request({
|
|
176
|
+
url, method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
177
|
+
content: JSON.stringify({ token: cachedToken, platform: isIOS ? 'ios' : 'android', test: true }),
|
|
178
|
+
}).then((res) => ({ status: res.statusCode }));
|
|
179
|
+
});
|
|
180
|
+
|
|
169
181
|
// Debug: auto-acquire + log the FCM token at boot so it's readable HEADLESSLY (adb logcat / appwrap
|
|
170
182
|
// logs) without a UI tap — the dev loop needs the token to send a test push. Android only (iOS push
|
|
171
183
|
// is off on personal teams); no-op when push isn't configured for this platform.
|
|
@@ -230,8 +242,11 @@ function androidGetToken(): Promise<PushToken> {
|
|
|
230
242
|
const task = fcm().getToken();
|
|
231
243
|
task.addOnCompleteListener(new OnCompleteListener({
|
|
232
244
|
onComplete(t: any) {
|
|
233
|
-
if (t.isSuccessful())
|
|
234
|
-
|
|
245
|
+
if (t.isSuccessful()) {
|
|
246
|
+
const tok = String(t.getResult());
|
|
247
|
+
registerTokenWithBackend('android', tok); // parity with iOS onApnsToken
|
|
248
|
+
resolve({ platform: 'fcm', token: tok });
|
|
249
|
+
} else reject(Object.assign(new Error('FCM token fetch failed'), { code: 'NATIVE_ERROR' }));
|
|
235
250
|
},
|
|
236
251
|
}));
|
|
237
252
|
} catch (e: any) {
|
package/runtime/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -409,7 +409,7 @@ function stampIOSDisplayName(outDir: string, cfg: AppwrapConfig, req: NativeReqs
|
|
|
409
409
|
}
|
|
410
410
|
if (cfg.urlScheme) {
|
|
411
411
|
extras.push(
|
|
412
|
-
` <key>CFBundleURLTypes</key>\n <array>\n <dict>\n <key>CFBundleURLName</key>\n <string>${cfg.id}</string>\n <key>CFBundleURLSchemes</key>\n <array>\n <string>${cfg.urlScheme}</string>\n </array>\n </dict>\n </array>`
|
|
412
|
+
` <key>CFBundleURLTypes</key>\n <array>\n <dict>\n <key>CFBundleTypeRole</key>\n <string>Editor</string>\n <key>CFBundleURLName</key>\n <string>${cfg.id}</string>\n <key>CFBundleURLSchemes</key>\n <array>\n <string>${cfg.urlScheme}</string>\n </array>\n </dict>\n </array>`
|
|
413
413
|
);
|
|
414
414
|
}
|
|
415
415
|
if (extras.length) {
|