Skip to content

feat: SDK update for version 24.0.0#121

Open
ArnabChatterjee20k wants to merge 6 commits intomainfrom
dev
Open

feat: SDK update for version 24.0.0#121
ArnabChatterjee20k wants to merge 6 commits intomainfrom
dev

Conversation

@ArnabChatterjee20k
Copy link
Copy Markdown
Member

@ArnabChatterjee20k ArnabChatterjee20k commented Apr 20, 2026

This PR contains updates to the SDK for version 24.0.0.

What's Changed

  • Breaking: Added unsubscribe(), update(), and close() for Realtime subscription lifecycle.
  • Added: Added userPhone to the Membership model.
  • Updated: Updated X-Appwrite-Response-Format header to 1.9.2.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 20, 2026

Greptile Summary

This PR bumps the Android SDK to v24.0.0, upgrades x-appwrite-response-format to 1.9.2, adds userPhone to Membership, and significantly redesigns the Realtime service — replacing numeric slot-based subscription tracking with client-generated UUID subscription IDs and introducing unsubscribe(), update(), and disconnect() lifecycle methods.

The new LinkedHashMap-based pendingSubscribes approach is self-healing on reconnect (because handleResponseConnected re-enqueues all active subscriptions by key, overwriting any stale entries), which addresses the class of stale-queue bugs present in the previous implementation. Two P2 findings remain: updateFn is missing the double-checked lock before createSocket() that the subscribe() path uses, and RealtimeSubscriptionUpdate.channels is typed as Collection<Any>? where Collection<String>? would be safer.

Confidence Score: 4/5

Safe to merge with awareness of the previously-flagged userPhone nullable crash and the minor updateFn concurrency inconsistency.

The userPhone: String non-nullable crash remains unaddressed and can cause a ClassCastException when membership privacy is enabled. All other new findings are P2. The Realtime redesign itself is architecturally sound.

Membership.kt (non-nullable userPhone) and Realtime.kt (updateFn double-check).

Important Files Changed

Filename Overview
library/src/main/java/io/appwrite/services/Realtime.kt Major redesign: replaced slot-based int keys with client-generated UUID subscription IDs; updateFn is missing the double-checked lock before createSocket() that subscribe() uses.
library/src/main/java/io/appwrite/models/RealtimeModels.kt Added RealtimeSubscriptionUpdate and unsubscribe/update lambdas to RealtimeSubscription; channels typed as Collection? weakens compile-time safety.
library/src/main/java/io/appwrite/models/Membership.kt Added userPhone: String (non-nullable); from() will throw ClassCastException when the server omits this field due to privacy settings.
library/src/main/java/io/appwrite/Client.kt Bumped x-sdk-version to 24.0.0 and x-appwrite-response-format to 1.9.2; consistent with CHANGELOG.
README.md Updated API version badge to 1.9.2 and dependency version to 24.0.0.
CHANGELOG.md Added 24.0.0 entry documenting Realtime lifecycle API, userPhone addition, and response-format header bump.

Reviews (5): Last reviewed commit: "chore: update Android SDK to 24.0.0" | Re-trigger Greptile

Comment thread library/src/main/java/io/appwrite/Client.kt Outdated
Comment thread README.md Outdated
@ArnabChatterjee20k ArnabChatterjee20k changed the title feat: Android SDK update for version 23.1.0 feat: Android SDK update for version 23.2.0 Apr 20, 2026
Comment thread library/src/main/java/io/appwrite/services/Realtime.kt Outdated
Comment thread library/src/main/java/io/appwrite/services/Realtime.kt Outdated
@ArnabChatterjee20k ArnabChatterjee20k changed the title feat: Android SDK update for version 23.2.0 feat: Android SDK update for version 24.0.0 Apr 23, 2026
Comment on lines +49 to +50
@SerializedName("userPhone")
val userPhone: String,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 userPhone declared non-nullable, will crash when privacy is enabled

userPhone is typed as String (non-nullable). The API docs note "Hide this attribute by toggling membership privacy in the Console," meaning the field can be absent or null in the response. When Membership.from(map) executes map["userPhone"] as String against a response that omits this key, map["userPhone"] returns null, and the unchecked cast throws a ClassCastException, crashing the caller.

Declare the field as String? (nullable) and update from() accordingly:

Suggested change
@SerializedName("userPhone")
val userPhone: String,
@SerializedName("userPhone")
val userPhone: String?

@ArnabChatterjee20k ArnabChatterjee20k changed the title feat: Android SDK update for version 24.0.0 feat: SDK update for version 24.0.0 Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants