-
Notifications
You must be signed in to change notification settings - Fork 190
Feat android/kotlin realtime #243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
32caa99
Add kotlin realtime models
4b94c1f
Add kotlin foreach async function
427e981
Add realtime endpoint to kotlin client
60add68
Add WIP kotlin realtime service
c8a4074
Add realtime files to android template
f342383
Move JSON extensions to top level functions
4d64875
Fix setting default realtime endpoint
41e3e80
Make realtime subscription closeable for try-with-resources or .use e…
d0d0cc7
Make service name pattern consistent, make client protected in services
c6358f1
Add unsubscribe + subscription returns, fix message parsing, channel …
6c66937
Add unknown error code
d676994
Fix reentry locking on subscribe to defer socket connection, fix unsu…
abnegate ef06bc6
Add Kotlin realtime files
abnegate 6014687
Merge remote-tracking branch 'origin/master' into feat-android-realtime
abnegate 135866f
add tests
TorstenDittmann 09fa1f0
fix tets
TorstenDittmann 5e65044
WIP add realtime tests
abnegate 12a9fc8
Fix Android + Kotlin coroutine dispatchers for realtime tests
abnegate ee2a790
Add Android + Kotlin JSON cast extension to simplify casts to client …
abnegate ef4fada
Remove web changes
abnegate 38a2f6c
Review fixes
abnegate eb84bc1
Use spec exception instead of `RealtimeError`
abnegate c4fe45d
Fix unsubscribe
abnegate a3af790
Remove realtime from Kotlin
abnegate a905d20
Fix kotlin removal
abnegate da4fae3
Remove redundant template
abnegate 2641fa2
WIP adapt for realtime updates
abnegate c404e46
Package updates
abnegate 735d16b
Add generic event model
abnegate 3162fa5
Add more JSON helpers
abnegate d618499
Remove redundant error class
abnegate 5f9c92a
Add typed response/payload support
abnegate 8a551f2
Upload test to support realtime payload typing
abnegate 2ca9c25
Fix realtime URL parsing for more than one occurence of `http`
abnegate e74478c
Merge remote-tracking branch 'origin/master' into feat-android-realtime
abnegate 0857e5c
Set publish version from release tag
abnegate 6f37805
Merge branch 'master' into feat-android-realtime
TorstenDittmann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
templates/android/library/src/main/java/io/appwrite/extensions/CollectionExtensions.kt.twig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package {{ sdk.namespace | caseDot }}.extensions | ||
|
|
||
| import kotlinx.coroutines.Dispatchers.IO | ||
| import kotlinx.coroutines.async | ||
| import kotlinx.coroutines.awaitAll | ||
| import kotlinx.coroutines.withContext | ||
|
|
||
| suspend fun <T> Collection<T>.forEachAsync( | ||
| callback: suspend (T) -> Unit | ||
| ) = withContext(IO) { | ||
| map { async { callback.invoke(it) } }.awaitAll() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
templates/android/library/src/main/java/io/appwrite/models/RealtimeModels.kt.twig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package {{ sdk.namespace | caseDot }}.models | ||
|
|
||
| import java.io.Closeable | ||
|
|
||
| data class RealtimeSubscription( | ||
| private val close: () -> Unit | ||
| ) : Closeable { | ||
| override fun close() = close.invoke() | ||
| } | ||
|
|
||
| data class RealtimeCallback( | ||
| val payloadClass: Class<*>, | ||
| val callback: (RealtimeResponseEvent<*>) -> Unit | ||
| ) | ||
|
|
||
| open class RealtimeResponse( | ||
| val type: String, | ||
| val data: Any | ||
| ) | ||
|
|
||
| data class RealtimeResponseEvent<T>( | ||
| val event: String, | ||
| val channels: Collection<String>, | ||
| val timestamp: Long, | ||
| var payload: T | ||
| ) | ||
|
|
||
| enum class RealtimeCode(val value: Int) { | ||
| POLICY_VIOLATION(1008), | ||
| UNKNOWN_ERROR(-1) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.