File tree Expand file tree Collapse file tree 4 files changed +13
-19
lines changed Expand file tree Collapse file tree 4 files changed +13
-19
lines changed Original file line number Diff line number Diff line change 25
25
To install
26
26
27
27
```bash
28
- npm install react-native-appwrite react-native-fs react-native- url-polyfill --save
28
+ npx expo install react-native-appwrite react-native-url-polyfill
29
29
```
30
30
31
31
{% if sdk .gettingStarted %}
Original file line number Diff line number Diff line change 33
33
"typescript": "4.7.2"
34
34
},
35
35
"dependencies": {
36
- "cross-fetch ": "3.1.5 ",
37
- "isomorphic-form-data ": "2.0.0",
38
- "react-native": "^0.73.5" ,
39
- "react-native-fs ": "^2.20.0",
40
- "react-native-url-polyfill ": "^2.0.0 "
36
+ "expo-file-system ": "16.0.8 ",
37
+ "expo-device ": "5.9.3"
38
+ } ,
39
+ "peerDependencies ": {
40
+ "expo ": "* "
41
41
}
42
42
}
Original file line number Diff line number Diff line change @@ -17,15 +17,5 @@ export default {
17
17
file: pkg.module,
18
18
sourcemap: true,
19
19
},
20
- {
21
- format: "iife",
22
- file: pkg.jsdelivr,
23
- name: "Appwrite",
24
- extend: true,
25
- globals: {
26
- "cross-fetch": "window",
27
- "FormData": "FormData",
28
- },
29
- },
30
20
],
31
21
};
Original file line number Diff line number Diff line change 1
- import 'isomorphic-form-data';
2
- import { fetch } from 'cross-fetch';
3
1
import { Models } from './models';
4
2
import { Service } from './service';
3
+ import * as Device from 'expo-device'
5
4
6
5
type Payload = {
7
6
[key: string]: any;
@@ -210,7 +209,11 @@ class Client {
210
209
}
211
210
212
211
this.realtime.url = url;
213
- this.realtime.socket = new WebSocket(url);
212
+ this.realtime.socket = new WebSocket(url, undefined, {
213
+ headers: {
214
+ Origin: `{{ spec .title | caseLower }}-${Device.osName}://${this.config.platform}`
215
+ }
216
+ });
214
217
this.realtime.socket.addEventListener('message', this.realtime.onMessage);
215
218
this.realtime.socket.addEventListener('open', _event => {
216
219
this.realtime.reconnectAttempts = 0;
@@ -327,6 +330,7 @@ class Client {
327
330
328
331
329
332
headers = Object.assign({}, this.headers, headers);
333
+ headers.Origin = `{{ spec .title | caseLower }}-${Device.osName}://${this.config.platform}`
330
334
331
335
let options: RequestInit = {
332
336
method,
You can’t perform that action at this time.
0 commit comments