Skip to content

Commit f2b4fb5

Browse files
authored
Merge pull request #42 from appwrite/dev
fix: pong response & chunked upload
2 parents b14b4a3 + dee5ef6 commit f2b4fb5

File tree

7 files changed

+28
-16
lines changed

7 files changed

+28
-16
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors.
1+
Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Appwrite React Native SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-react-native.svg?style=flat-square)
4-
![Version](https://img.shields.io/badge/api%20version-1.6.0-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-1.6.1-blue.svg?style=flat-square)
55
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "react-native-appwrite",
33
"homepage": "https://appwrite.io/support",
44
"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.6.0",
5+
"version": "0.7.0",
66
"license": "BSD-3-Clause",
77
"main": "dist/cjs/sdk.js",
88
"exports": {

src/client.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ type Headers = {
1111
}
1212

1313
type RealtimeResponse = {
14-
type: 'error' | 'event' | 'connected' | 'response';
15-
data: RealtimeResponseAuthenticated | RealtimeResponseConnected | RealtimeResponseError | RealtimeResponseEvent<unknown>;
14+
type: 'error' | 'event' | 'connected' | 'response' | 'pong';
15+
data: RealtimeResponseAuthenticated | RealtimeResponseConnected | RealtimeResponseError | RealtimeResponseEvent<unknown> | undefined;
1616
}
1717

1818
type RealtimeRequest = {
@@ -114,7 +114,7 @@ class Client {
114114
'x-sdk-name': 'React Native',
115115
'x-sdk-platform': 'client',
116116
'x-sdk-language': 'reactnative',
117-
'x-sdk-version': '0.6.0',
117+
'x-sdk-version': '0.7.0',
118118
'X-Appwrite-Response-Format': '1.6.0',
119119
};
120120

@@ -339,6 +339,8 @@ class Client {
339339
})
340340
}
341341
break;
342+
case 'pong':
343+
break; // Handle pong response if needed
342344
case 'error':
343345
throw message.data;
344346
default:

src/enums/image-format.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ export enum ImageFormat {
44
Gif = 'gif',
55
Png = 'png',
66
Webp = 'webp',
7+
Heic = 'heic',
78
Avif = 'avif',
89
}

src/services/account.ts

+15-4
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ export class Account extends Service {
378378
* @throws {AppwriteException}
379379
* @returns {Promise}
380380
*/
381-
async updateMfaChallenge(challengeId: string, otp: string): Promise<{}> {
381+
async updateMfaChallenge(challengeId: string, otp: string): Promise<Models.Session> {
382382
if (typeof challengeId === 'undefined') {
383383
throw new AppwriteException('Missing required parameter: "challengeId"');
384384
}
@@ -1104,6 +1104,11 @@ export class Account extends Service {
11041104
/**
11051105
* Create push target
11061106
*
1107+
* Use this endpoint to register a device for push notifications. Provide a
1108+
* target ID (custom or generated using ID.unique()), a device identifier
1109+
* (usually a device token), and optionally specify which provider should send
1110+
* notifications to this target. The target is automatically linked to the
1111+
* current session and includes device information like brand and model.
11071112
*
11081113
* @param {string} targetId
11091114
* @param {string} identifier
@@ -1144,6 +1149,11 @@ export class Account extends Service {
11441149
/**
11451150
* Update push target
11461151
*
1152+
* Update the currently logged in user's push notification target. You can
1153+
* modify the target's identifier (device token) and provider ID (token,
1154+
* email, phone etc.). The target must exist and belong to the current user.
1155+
* If you change the provider ID, notifications will be sent through the new
1156+
* messaging provider instead.
11471157
*
11481158
* @param {string} targetId
11491159
* @param {string} identifier
@@ -1175,6 +1185,9 @@ export class Account extends Service {
11751185
/**
11761186
* Delete push target
11771187
*
1188+
* Delete a push notification target for the currently logged in user. After
1189+
* deletion, the device will no longer receive push notifications. The target
1190+
* must exist and belong to the current user.
11781191
*
11791192
* @param {string} targetId
11801193
* @throws {AppwriteException}
@@ -1255,9 +1268,7 @@ export class Account extends Service {
12551268
* [POST
12561269
* /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
12571270
* endpoint to complete the login process. The link sent to the user's email
1258-
* address is valid for 1 hour. If you are on a mobile device you can leave
1259-
* the URL parameter empty, so that the login completion will be handled by
1260-
* your Appwrite instance by default.
1271+
* address is valid for 1 hour.
12611272
*
12621273
* A user is limited to 10 active sessions at a time by default. [Learn more
12631274
* about session

src/services/storage.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,10 @@ export class Storage extends Service {
122122

123123
let offset = 0;
124124
let response = undefined;
125-
if(fileId != 'unique()') {
126-
try {
127-
response = await this.client.call('GET', new URL(this.client.config.endpoint + apiPath + '/' + fileId), apiHeaders);
128-
offset = response.chunksUploaded * Service.CHUNK_SIZE;
129-
} catch(e) {
130-
}
125+
try {
126+
response = await this.client.call('GET', new URL(this.client.config.endpoint + apiPath + '/' + fileId), apiHeaders);
127+
offset = response.chunksUploaded * Service.CHUNK_SIZE;
128+
} catch(e) {
131129
}
132130

133131
let timestamp = new Date().getTime();

0 commit comments

Comments
 (0)