react-native-appwrite 0.2.1 → 0.2.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/dist/cjs/sdk.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var Device = require('expo-device');
3
+ var reactNative = require('react-native');
4
4
  var FileSystem = require('expo-file-system');
5
5
 
6
6
  function _interopNamespace(e) {
@@ -21,7 +21,6 @@ function _interopNamespace(e) {
21
21
  return Object.freeze(n);
22
22
  }
23
23
 
24
- var Device__namespace = /*#__PURE__*/_interopNamespace(Device);
25
24
  var FileSystem__namespace = /*#__PURE__*/_interopNamespace(FileSystem);
26
25
 
27
26
  /******************************************************************************
@@ -179,7 +178,7 @@ class Client {
179
178
  // @ts-ignore
180
179
  this.realtime.socket = new WebSocket(url, undefined, {
181
180
  headers: {
182
- Origin: `appwrite-${Device__namespace.osName}://${this.config.platform}`
181
+ Origin: `appwrite-${reactNative.Platform.OS}://${this.config.platform}`
183
182
  }
184
183
  });
185
184
  this.realtime.socket.addEventListener('message', this.realtime.onMessage);
@@ -368,7 +367,7 @@ class Client {
368
367
  return __awaiter(this, void 0, void 0, function* () {
369
368
  method = method.toUpperCase();
370
369
  headers = Object.assign({}, this.headers, headers);
371
- headers.Origin = `appwrite-${Device__namespace.osName}://${this.config.platform}`;
370
+ headers.Origin = `appwrite-${reactNative.Platform.OS}://${this.config.platform}`;
372
371
  let options = {
373
372
  method,
374
373
  headers,
@@ -2311,7 +2310,7 @@ class Storage extends Service {
2311
2310
  length: Service.CHUNK_SIZE
2312
2311
  });
2313
2312
  var path = `data:${file.type};base64,${chunk}`;
2314
- if (Device__namespace.osName == 'Android') {
2313
+ if (reactNative.Platform.OS.toLowerCase() == 'android') {
2315
2314
  path = FileSystem__namespace.cacheDirectory + '/tmp_chunk';
2316
2315
  yield FileSystem__namespace.writeAsStringAsync(path, chunk, { encoding: FileSystem__namespace.EncodingType.Base64 });
2317
2316
  }