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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "react-native-appwrite",
3
3
  "homepage": "https://appwrite.io/support",
4
4
  "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
5
- "version": "0.2.1",
5
+ "version": "0.2.2",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "dist/cjs/sdk.js",
8
8
  "exports": {
@@ -34,9 +34,10 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "expo-file-system": "16.0.8",
37
- "expo-device": "5.9.3"
37
+ "react-native": "^0.73.6"
38
38
  },
39
39
  "peerDependencies": {
40
- "expo": "*"
40
+ "expo": "*",
41
+ "react-native": "*"
41
42
  }
42
43
  }
package/src/client.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Models } from './models';
2
2
  import { Service } from './service';
3
- import * as Device from 'expo-device';
3
+ import { Platform } from 'react-native';
4
4
 
5
5
  type Payload = {
6
6
  [key: string]: any;
@@ -249,7 +249,7 @@ class Client {
249
249
  // @ts-ignore
250
250
  this.realtime.socket = new WebSocket(url, undefined, {
251
251
  headers: {
252
- Origin: `appwrite-${Device.osName}://${this.config.platform}`
252
+ Origin: `appwrite-${Platform.OS}://${this.config.platform}`
253
253
  }
254
254
  });
255
255
  this.realtime.socket.addEventListener('message', this.realtime.onMessage);
@@ -367,7 +367,7 @@ class Client {
367
367
  method = method.toUpperCase();
368
368
 
369
369
  headers = Object.assign({}, this.headers, headers);
370
- headers.Origin = `appwrite-${Device.osName}://${this.config.platform}`;
370
+ headers.Origin = `appwrite-${Platform.OS}://${this.config.platform}`;
371
371
  let options: RequestInit = {
372
372
  method,
373
373
  headers,
@@ -3,7 +3,7 @@ import { AppwriteException, Client } from '../client';
3
3
  import type { Models } from '../models';
4
4
  import type { UploadProgress, Payload } from '../client';
5
5
  import * as FileSystem from 'expo-file-system';
6
- import * as Device from 'expo-device'
6
+ import { Platform } from 'react-native';
7
7
 
8
8
  export class Storage extends Service {
9
9
 
@@ -141,7 +141,7 @@ export class Storage extends Service {
141
141
  length: Service.CHUNK_SIZE
142
142
  });
143
143
  var path = `data:${file.type};base64,${chunk}`;
144
- if (Device.osName == 'Android') {
144
+ if (Platform.OS.toLowerCase() == 'android') {
145
145
  path = FileSystem.cacheDirectory + '/tmp_chunk';
146
146
  await FileSystem.writeAsStringAsync(path, chunk, {encoding: FileSystem.EncodingType.Base64});
147
147
  }