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/esm/sdk.js CHANGED
@@ -1,4 +1,4 @@
1
- import * as Device from 'expo-device';
1
+ import { Platform } from 'react-native';
2
2
  import * as FileSystem from 'expo-file-system';
3
3
 
4
4
  /******************************************************************************
@@ -156,7 +156,7 @@ class Client {
156
156
  // @ts-ignore
157
157
  this.realtime.socket = new WebSocket(url, undefined, {
158
158
  headers: {
159
- Origin: `appwrite-${Device.osName}://${this.config.platform}`
159
+ Origin: `appwrite-${Platform.OS}://${this.config.platform}`
160
160
  }
161
161
  });
162
162
  this.realtime.socket.addEventListener('message', this.realtime.onMessage);
@@ -345,7 +345,7 @@ class Client {
345
345
  return __awaiter(this, void 0, void 0, function* () {
346
346
  method = method.toUpperCase();
347
347
  headers = Object.assign({}, this.headers, headers);
348
- headers.Origin = `appwrite-${Device.osName}://${this.config.platform}`;
348
+ headers.Origin = `appwrite-${Platform.OS}://${this.config.platform}`;
349
349
  let options = {
350
350
  method,
351
351
  headers,
@@ -2288,7 +2288,7 @@ class Storage extends Service {
2288
2288
  length: Service.CHUNK_SIZE
2289
2289
  });
2290
2290
  var path = `data:${file.type};base64,${chunk}`;
2291
- if (Device.osName == 'Android') {
2291
+ if (Platform.OS.toLowerCase() == 'android') {
2292
2292
  path = FileSystem.cacheDirectory + '/tmp_chunk';
2293
2293
  yield FileSystem.writeAsStringAsync(path, chunk, { encoding: FileSystem.EncodingType.Base64 });
2294
2294
  }