react-native-appwrite 0.2.0 → 0.2.1

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.0",
5
+ "version": "0.2.1",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "dist/cjs/sdk.js",
8
8
  "exports": {
@@ -3,6 +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
7
 
7
8
  export class Storage extends Service {
8
9
 
@@ -139,8 +140,12 @@ export class Storage extends Service {
139
140
  position: offset,
140
141
  length: Service.CHUNK_SIZE
141
142
  });
142
-
143
- payload['file'] = {uri: `data:${file.type};base64,${chunk}`, name: file.name, type: file.type};
143
+ var path = `data:${file.type};base64,${chunk}`;
144
+ if (Device.osName == 'Android') {
145
+ path = FileSystem.cacheDirectory + '/tmp_chunk';
146
+ await FileSystem.writeAsStringAsync(path, chunk, {encoding: FileSystem.EncodingType.Base64});
147
+ }
148
+ payload['file'] = {uri: path, name: file.name, type: file.type};
144
149
  response = await this.client.call('post', uri, apiHeaders, payload);
145
150
 
146
151
  if (onProgress) {