@craft-native/ios 0.0.77 → 0.0.78

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@craft-native/ios",
3
- "version": "0.0.77",
3
+ "version": "0.0.78",
4
4
  "homepage": "https://github.com/craft-native/craft/tree/main/packages/ios#readme",
5
5
  "repository": {
6
6
  "type": "git",
@@ -2222,41 +2222,33 @@ struct CraftWebView: UIViewRepresentable {
2222
2222
  _progressCallbacks: [],
2223
2223
  _statusCallbacks: [],
2224
2224
 
2225
+ // OTA is not implemented natively. These five used to post
2226
+ // to actions the switch below does not handle, and register
2227
+ // a resolve/reject pair that nothing would ever call — they
2228
+ // also bypassed _createCallback, which is what owns the 30s
2229
+ // timeout, so the promises hung forever rather than
2230
+ // rejecting. An immediate rejection is the honest answer:
2231
+ // an app can catch it, where it could never catch a hang.
2232
+ _unavailable: function(name) {
2233
+ return Promise.reject(new Error(
2234
+ 'craft.ota.' + name + ' is not implemented on this platform'
2235
+ ));
2236
+ },
2225
2237
  configure: function(options) {
2226
2238
  this._config = options;
2227
- window.webkit.messageHandlers.craft.postMessage({action: 'otaConfigure', config: options});
2239
+ console.warn('[craft] ota.configure stored locally; OTA is not implemented natively');
2228
2240
  },
2229
2241
  checkForUpdate: function() {
2230
- var self = window.craft;
2231
- var id = 'cb_' + (++self._callbackId);
2232
- window.webkit.messageHandlers.craft.postMessage({action: 'otaCheckForUpdate', callbackId: id});
2233
- return new Promise(function(resolve, reject) {
2234
- self._callbacks[id] = {resolve: resolve, reject: reject};
2235
- });
2242
+ return window.craft.ota._unavailable('checkForUpdate');
2236
2243
  },
2237
2244
  downloadUpdate: function(options) {
2238
- var self = window.craft;
2239
- var id = 'cb_' + (++self._callbackId);
2240
- window.webkit.messageHandlers.craft.postMessage({action: 'otaDownloadUpdate', options: options || {}, callbackId: id});
2241
- return new Promise(function(resolve, reject) {
2242
- self._callbacks[id] = {resolve: resolve, reject: reject};
2243
- });
2245
+ return window.craft.ota._unavailable('downloadUpdate');
2244
2246
  },
2245
2247
  applyUpdate: function() {
2246
- var self = window.craft;
2247
- var id = 'cb_' + (++self._callbackId);
2248
- window.webkit.messageHandlers.craft.postMessage({action: 'otaApplyUpdate', callbackId: id});
2249
- return new Promise(function(resolve, reject) {
2250
- self._callbacks[id] = {resolve: resolve, reject: reject};
2251
- });
2248
+ return window.craft.ota._unavailable('applyUpdate');
2252
2249
  },
2253
2250
  rollback: function() {
2254
- var self = window.craft;
2255
- var id = 'cb_' + (++self._callbackId);
2256
- window.webkit.messageHandlers.craft.postMessage({action: 'otaRollback', callbackId: id});
2257
- return new Promise(function(resolve, reject) {
2258
- self._callbacks[id] = {resolve: resolve, reject: reject};
2259
- });
2251
+ return window.craft.ota._unavailable('rollback');
2260
2252
  },
2261
2253
  getCurrentBundle: function() {
2262
2254
  // This returns synchronously from stored data