@capacitor/ios 6.0.0-rc.1 → 6.0.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.
@@ -293,10 +293,11 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol {
293
293
 
294
294
  for plugin in registrationList.packageClassList {
295
295
  if let pluginClass = NSClassFromString(plugin) {
296
- if class_getSuperclass(pluginClass) == CDVPlugin.self {
296
+ if pluginClass == CDVPlugin.self {
297
297
  injectCordovaFiles = true
298
+ } else {
299
+ pluginList.append(pluginClass)
298
300
  }
299
- pluginList.append(pluginClass)
300
301
  }
301
302
  }
302
303
  }
@@ -232,13 +232,13 @@ private class FileStore: KeyValueStoreBackend {
232
232
  static func with(name: String) -> FileStore {
233
233
  if let existing = instances[name] { return existing }
234
234
  guard let library = try? FileManager
235
- .default
236
- .url(
237
- for: .libraryDirectory,
238
- in: .userDomainMask,
239
- appropriateFor: nil,
240
- create: true
241
- )
235
+ .default
236
+ .url(
237
+ for: .libraryDirectory,
238
+ in: .userDomainMask,
239
+ appropriateFor: nil,
240
+ create: true
241
+ )
242
242
  else { fatalError("⚡️ ❌ Library URL unable to be accessed or created by the current application. This is an impossible state.") }
243
243
 
244
244
  let url = library.appendingPathComponent("kvstore").appendingPathComponent(name)
@@ -257,12 +257,12 @@ private class InMemoryStore: KeyValueStoreBackend {
257
257
  private let decoder = JSONDecoder()
258
258
  private let encoder = JSONEncoder()
259
259
 
260
- func get<T>(_ key: String, as type: T.Type) throws -> T? where T : Decodable {
260
+ func get<T>(_ key: String, as type: T.Type) throws -> T? where T: Decodable {
261
261
  guard let data = storage[key] else { return nil }
262
262
  return try decoder.decode(type, from: data)
263
263
  }
264
264
 
265
- func set<T>(_ key: String, value: T) throws where T : Encodable {
265
+ func set<T>(_ key: String, value: T) throws where T: Encodable {
266
266
  let data = try encoder.encode(value)
267
267
  storage[key] = data
268
268
  }
@@ -109,6 +109,12 @@ var nativeBridge = (function (exports) {
109
109
  headers: { 'Content-Type': contentType || 'application/octet-stream' },
110
110
  };
111
111
  }
112
+ else if (body instanceof URLSearchParams) {
113
+ return {
114
+ data: body.toString(),
115
+ type: 'text',
116
+ };
117
+ }
112
118
  else if (body instanceof FormData) {
113
119
  const formData = await convertFormData(body);
114
120
  return {
@@ -141,13 +147,10 @@ var nativeBridge = (function (exports) {
141
147
  const proxyUrl = new URL(url);
142
148
  const bridgeUrl = new URL((_b = (_a = win.Capacitor) === null || _a === void 0 ? void 0 : _a.getServerUrl()) !== null && _b !== void 0 ? _b : '');
143
149
  const isHttps = proxyUrl.protocol === 'https:';
144
- const originalHost = encodeURIComponent(proxyUrl.host);
145
- const originalPathname = proxyUrl.pathname;
146
- proxyUrl.protocol = bridgeUrl.protocol;
147
- proxyUrl.hostname = bridgeUrl.hostname;
148
- proxyUrl.port = bridgeUrl.port;
149
- proxyUrl.pathname = `${isHttps ? CAPACITOR_HTTPS_INTERCEPTOR : CAPACITOR_HTTP_INTERCEPTOR}/${originalHost}${originalPathname}`;
150
- return proxyUrl.toString();
150
+ bridgeUrl.search = proxyUrl.search;
151
+ bridgeUrl.hash = proxyUrl.hash;
152
+ bridgeUrl.pathname = `${isHttps ? CAPACITOR_HTTPS_INTERCEPTOR : CAPACITOR_HTTP_INTERCEPTOR}/${encodeURIComponent(proxyUrl.host)}${proxyUrl.pathname}`;
153
+ return bridgeUrl.toString();
151
154
  };
152
155
  const initBridge = (w) => {
153
156
  const getPlatformId = (win) => {
@@ -378,15 +381,15 @@ var nativeBridge = (function (exports) {
378
381
  typeof c.dir === 'function');
379
382
  };
380
383
  const serializeConsoleMessage = (msg) => {
381
- if (typeof msg === 'object') {
382
- try {
384
+ try {
385
+ if (typeof msg === 'object') {
383
386
  msg = JSON.stringify(msg);
384
387
  }
385
- catch (e) {
386
- // ignore
387
- }
388
+ return String(msg);
389
+ }
390
+ catch (e) {
391
+ return '';
388
392
  }
389
- return String(msg);
390
393
  };
391
394
  const platform = getPlatformId(win);
392
395
  if (platform == 'android' || platform == 'ios') {
@@ -495,11 +498,11 @@ var nativeBridge = (function (exports) {
495
498
  if (request.url.startsWith(`${cap.getServerUrl()}/`)) {
496
499
  return win.CapacitorWebFetch(resource, options);
497
500
  }
498
- if (!(options === null || options === void 0 ? void 0 : options.method) ||
499
- options.method.toLocaleUpperCase() === 'GET' ||
500
- options.method.toLocaleUpperCase() === 'HEAD' ||
501
- options.method.toLocaleUpperCase() === 'OPTIONS' ||
502
- options.method.toLocaleUpperCase() === 'TRACE') {
501
+ const { method } = request;
502
+ if (method.toLocaleUpperCase() === 'GET' ||
503
+ method.toLocaleUpperCase() === 'HEAD' ||
504
+ method.toLocaleUpperCase() === 'OPTIONS' ||
505
+ method.toLocaleUpperCase() === 'TRACE') {
503
506
  if (typeof resource === 'string') {
504
507
  return await win.CapacitorWebFetch(createProxyUrl(resource, win), options);
505
508
  }
@@ -511,7 +514,7 @@ var nativeBridge = (function (exports) {
511
514
  const tag = `CapacitorHttp fetch ${Date.now()} ${resource}`;
512
515
  console.time(tag);
513
516
  try {
514
- const { body, method } = request;
517
+ const { body } = request;
515
518
  const optionHeaders = Object.fromEntries(request.headers.entries());
516
519
  const { data: requestData, type, headers, } = await convertBody((options === null || options === void 0 ? void 0 : options.body) || body || undefined, optionHeaders['Content-Type'] || optionHeaders['content-type']);
517
520
  const nativeResponse = await cap.nativePromise('CapacitorHttp', 'request', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/ios",
3
- "version": "6.0.0-rc.1",
3
+ "version": "6.0.0",
4
4
  "description": "Capacitor: Cross-platform apps with JavaScript and the web",
5
5
  "homepage": "https://capacitorjs.com",
6
6
  "author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
@@ -26,7 +26,7 @@
26
26
  "xc:build:xcframework": "scripts/build.sh xcframework"
27
27
  },
28
28
  "peerDependencies": {
29
- "@capacitor/core": "^6.0.0-rc.1"
29
+ "@capacitor/core": "^6.0.0"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"