Skip to content

Commit a8bf4d5

Browse files
authored
Merge pull request #37 from appwrite/dev
fix: for appwrite 1.4.x
2 parents 618eb55 + a0ded72 commit a8bf4d5

File tree

11 files changed

+340
-297
lines changed

11 files changed

+340
-297
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ repositories {
3838
Next, add the dependency to your project's `build.gradle(.kts)` file:
3939

4040
```groovy
41-
implementation("io.appwrite:sdk-for-android:3.0.0")
41+
implementation("io.appwrite:sdk-for-android:3.0.1")
4242
```
4343

4444
### Maven
@@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file:
4949
<dependency>
5050
<groupId>io.appwrite</groupId>
5151
<artifactId>sdk-for-android</artifactId>
52-
<version>3.0.0</version>
52+
<version>3.0.1</version>
5353
</dependency>
5454
</dependencies>
5555
```

library/src/main/java/io/appwrite/Client.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class Client @JvmOverloads constructor(
8888
"x-sdk-name" to "Android",
8989
"x-sdk-platform" to "client",
9090
"x-sdk-language" to "android",
91-
"x-sdk-version" to "3.0.0",
91+
"x-sdk-version" to "3.0.1",
9292
"x-appwrite-response-format" to "1.4.0"
9393
)
9494
config = mutableMapOf()
@@ -394,7 +394,7 @@ class Client @JvmOverloads constructor(
394394
responseType = Map::class.java,
395395
)
396396
val chunksUploaded = current["chunksUploaded"] as Long
397-
offset = (chunksUploaded * CHUNK_SIZE).coerceAtMost(size)
397+
offset = chunksUploaded * CHUNK_SIZE
398398
}
399399

400400
while (offset < size) {
@@ -405,7 +405,7 @@ class Client @JvmOverloads constructor(
405405
}
406406
"bytes" -> {
407407
val end = if (offset + CHUNK_SIZE < size) {
408-
offset + CHUNK_SIZE
408+
offset + CHUNK_SIZE - 1
409409
} else {
410410
size - 1
411411
}
@@ -425,7 +425,7 @@ class Client @JvmOverloads constructor(
425425
)
426426

427427
headers["Content-Range"] =
428-
"bytes $offset-${((offset + CHUNK_SIZE) - 1).coerceAtMost(size)}/$size"
428+
"bytes $offset-${((offset + CHUNK_SIZE) - 1).coerceAtMost(size - 1)}/$size"
429429

430430
result = call(
431431
method = "POST",
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,72 @@
11
package io.appwrite
22

3+
/**
4+
* Helper class to generate role strings for [Permission].
5+
*/
36
class Role {
47
companion object {
8+
9+
/**
10+
* Grants access to anyone.
11+
*
12+
* This includes authenticated and unauthenticated users.
13+
*/
514
fun any(): String = "any"
615

16+
/**
17+
* Grants access to a specific user by user ID.
18+
*
19+
* You can optionally pass verified or unverified for
20+
* [status] to target specific types of users.
21+
*/
722
fun user(id: String, status: String = ""): String = if(status.isEmpty()) {
823
"user:$id"
924
} else {
1025
"user:$id/$status"
1126
}
1227

28+
/**
29+
* Grants access to any authenticated or anonymous user.
30+
*
31+
* You can optionally pass verified or unverified for
32+
* [status] to target specific types of users.
33+
*/
1334
fun users(status: String = ""): String = if(status.isEmpty()) {
1435
"users"
1536
} else {
1637
"users/$status"
1738
}
1839

40+
/**
41+
* Grants access to any guest user without a session.
42+
*
43+
* Authenticated users don't have access to this role.
44+
*/
1945
fun guests(): String = "guests"
2046

47+
/**
48+
* Grants access to a team by team ID.
49+
*
50+
* You can optionally pass a role for [role] to target
51+
* team members with the specified role.
52+
*/
2153
fun team(id: String, role: String = ""): String = if(role.isEmpty()) {
2254
"team:$id"
2355
} else {
2456
"team:$id/$role"
2557
}
2658

59+
/**
60+
* Grants access to a specific member of a team.
61+
*
62+
* When the member is removed from the team, they will
63+
* no longer have access.
64+
*/
2765
fun member(id: String): String = "member:$id"
66+
67+
/**
68+
* Grants access to a user with the specified label.
69+
*/
70+
fun label(name: String): String = "label:$name"
2871
}
2972
}

0 commit comments

Comments
 (0)