forked from gojek/courier-android
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from ShareChat/update-fork-courier
Update fork courier
- Loading branch information
Showing
84 changed files
with
898 additions
and
263 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
11 changes: 9 additions & 2 deletions
11
app/src/main/java/com/gojek/courier/app/data/network/CourierService.kt
This file contains 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 |
---|---|---|
@@ -1,21 +1,28 @@ | ||
package com.gojek.courier.app.data.network | ||
|
||
import com.gojek.courier.QoS | ||
import com.gojek.courier.annotation.Callback | ||
import com.gojek.courier.annotation.Data | ||
import com.gojek.courier.annotation.Path | ||
import com.gojek.courier.annotation.Send | ||
import com.gojek.courier.annotation.Subscribe | ||
import com.gojek.courier.annotation.SubscribeMultiple | ||
import com.gojek.courier.annotation.TopicMap | ||
import com.gojek.courier.annotation.Unsubscribe | ||
import com.gojek.courier.app.data.network.model.Message | ||
import com.gojek.courier.callback.SendMessageCallback | ||
import io.reactivex.Observable | ||
|
||
interface CourierService { | ||
@Send(topic = "{topic}", qos = QoS.ONE) | ||
fun publish(@Path("topic") topic: String, @Data message: Message) | ||
fun publish(@Path("topic") topic: String, @Data message: Message, @Callback callback: SendMessageCallback) | ||
|
||
@Subscribe(topic = "{topic}") | ||
fun subscribe(@Path("topic") topic: String): Observable<Message> | ||
fun subscribe(@Path("topic") topic: String): Observable<String> | ||
|
||
@Unsubscribe(topics = ["{topic}"]) | ||
fun unsubscribe(@Path("topic") topic: String) | ||
|
||
@SubscribeMultiple | ||
fun subscribeAll(@TopicMap topicMap: Map<String, QoS>): Observable<String> | ||
} |
This file contains 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 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 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 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 |
---|---|---|
@@ -1,3 +0,0 @@ | ||
public final class com/gojek/courier/utils/extensions/PendingIntentExtensionsKt { | ||
} | ||
|
||
This file contains 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
19 changes: 19 additions & 0 deletions
19
courier-core/src/main/java/com/gojek/courier/callback/NoOpSendMessageCallback.kt
This file contains 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,19 @@ | ||
package com.gojek.courier.callback | ||
|
||
object NoOpSendMessageCallback : SendMessageCallback { | ||
override fun onMessageSendTrigger() { | ||
// no-op | ||
} | ||
|
||
override fun onMessageWrittenOnSocket() { | ||
// no-op | ||
} | ||
|
||
override fun onMessageSendSuccess() { | ||
// no-op | ||
} | ||
|
||
override fun onMessageSendFailure(error: Throwable) { | ||
// no-op | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
courier-core/src/main/java/com/gojek/courier/callback/SendMessageCallback.kt
This file contains 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,8 @@ | ||
package com.gojek.courier.callback | ||
|
||
interface SendMessageCallback { | ||
fun onMessageSendTrigger() | ||
fun onMessageWrittenOnSocket() | ||
fun onMessageSendSuccess() | ||
fun onMessageSendFailure(error: Throwable) | ||
} |
9 changes: 9 additions & 0 deletions
9
courier-core/src/main/java/com/gojek/courier/extensions/StringExtensions.kt
This file contains 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,9 @@ | ||
package com.gojek.courier.extensions | ||
|
||
import androidx.annotation.RestrictTo | ||
|
||
@RestrictTo(RestrictTo.Scope.LIBRARY) | ||
fun String.isWildCardTopic(): Boolean { | ||
return startsWith("+/") || contains("/+/") || endsWith("/+") || equals("+") || | ||
endsWith("/#") || equals("#") | ||
} |
This file contains 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
6 changes: 6 additions & 0 deletions
6
courier/src/main/java/com/gojek/courier/annotation/Callback.kt
This file contains 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,6 @@ | ||
package com.gojek.courier.annotation | ||
|
||
@MustBeDocumented | ||
@Target(AnnotationTarget.VALUE_PARAMETER) | ||
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME) | ||
annotation class Callback |
Oops, something went wrong.