├── client
├── .gitignore
├── src
│ ├── test
│ │ ├── resources
│ │ │ ├── mockito-extensions
│ │ │ │ └── org.mockito.plugins.MockMaker
│ │ │ ├── model.member.json
│ │ │ └── message.json
│ │ └── java
│ │ │ └── io
│ │ │ └── getstream
│ │ │ └── chat
│ │ │ └── android
│ │ │ └── client
│ │ │ ├── token
│ │ │ ├── FakeTokenProvider.kt
│ │ │ └── FakeTokenManager.kt
│ │ │ ├── Mother.kt
│ │ │ ├── parser
│ │ │ ├── MapAdapterTest.kt
│ │ │ ├── SkipExtraDataGson.kt
│ │ │ ├── DateAdapterTest.kt
│ │ │ ├── EventAdapterTest.kt
│ │ │ └── ChatParserImplTest.kt
│ │ │ ├── utils
│ │ │ ├── VerifyUtils.kt
│ │ │ ├── RetroSuccess.kt
│ │ │ ├── observable
│ │ │ │ ├── FakeChatSocket.kt
│ │ │ │ └── FakeSocketService.kt
│ │ │ └── RetroError.kt
│ │ │ ├── testing
│ │ │ └── utils.kt
│ │ │ ├── api
│ │ │ ├── FakeResponse.kt
│ │ │ └── FakeChain.kt
│ │ │ └── DatesTests.kt
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── strings.xml
│ │ │ └── drawable
│ │ │ │ ├── stream_ic_file_csv.xml
│ │ │ │ ├── stream_ic_file_doc.xml
│ │ │ │ ├── stream_ic_file_mov.xml
│ │ │ │ ├── stream_ic_file_mp3.xml
│ │ │ │ ├── stream_ic_file_pdf.xml
│ │ │ │ ├── stream_ic_file_ppt.xml
│ │ │ │ ├── stream_ic_file_tar.xml
│ │ │ │ ├── stream_ic_file_xls.xml
│ │ │ │ ├── stream_ic_file_zip.xml
│ │ │ │ └── stream_ic_notification.xml
│ │ ├── java
│ │ │ └── io
│ │ │ │ └── getstream
│ │ │ │ └── chat
│ │ │ │ └── android
│ │ │ │ └── client
│ │ │ │ ├── models
│ │ │ │ ├── GuestUser.kt
│ │ │ │ ├── ModelFields.kt
│ │ │ │ ├── Command.kt
│ │ │ │ ├── UserEntity.kt
│ │ │ │ ├── Device.kt
│ │ │ │ ├── ChannelMute.kt
│ │ │ │ ├── Mute.kt
│ │ │ │ ├── ChannelUserRead.kt
│ │ │ │ ├── CustomObject.kt
│ │ │ │ ├── Member.kt
│ │ │ │ ├── Flag.kt
│ │ │ │ ├── Config.kt
│ │ │ │ ├── Reaction.kt
│ │ │ │ ├── User.kt
│ │ │ │ ├── Attachment.kt
│ │ │ │ ├── Extensions.kt
│ │ │ │ └── Channel.kt
│ │ │ │ ├── api
│ │ │ │ ├── models
│ │ │ │ │ ├── UploadFileResponse.kt
│ │ │ │ │ ├── SendEventRequest.kt
│ │ │ │ │ ├── UpdateCooldownRequest.kt
│ │ │ │ │ ├── MuteChannelRequest.kt
│ │ │ │ │ ├── CompletableResponse.kt
│ │ │ │ │ ├── MarkReadRequest.kt
│ │ │ │ │ ├── TranslateMessageRequest.kt
│ │ │ │ │ ├── HideChannelRequest.kt
│ │ │ │ │ ├── SearchMessagesResponse.kt
│ │ │ │ │ ├── FlagResponse.kt
│ │ │ │ │ ├── MessageRequest.kt
│ │ │ │ │ ├── MessageResponse.kt
│ │ │ │ │ ├── ReactionRequest.kt
│ │ │ │ │ ├── ReactionResponse.kt
│ │ │ │ │ ├── UpdateUsersResponse.kt
│ │ │ │ │ ├── GetSyncHistory.kt
│ │ │ │ │ ├── UpdateUsersRequest.kt
│ │ │ │ │ ├── GetDevicesResponse.kt
│ │ │ │ │ ├── GetRepliesResponse.kt
│ │ │ │ │ ├── QueryMembersResponse.kt
│ │ │ │ │ ├── QueryUserListResponse.kt
│ │ │ │ │ ├── GetReactionsResponse.kt
│ │ │ │ │ ├── GetSyncHistoryResponse.kt
│ │ │ │ │ ├── UpdateChannelRequest.kt
│ │ │ │ │ ├── EventResponse.kt
│ │ │ │ │ ├── AddMembersRequest.kt
│ │ │ │ │ ├── RemoveMembersRequest.kt
│ │ │ │ │ ├── RejectInviteRequest.kt
│ │ │ │ │ ├── AddDeviceRequest.kt
│ │ │ │ │ ├── MuteUserRequest.kt
│ │ │ │ │ ├── TokenResponse.kt
│ │ │ │ │ ├── AcceptInviteRequest.kt
│ │ │ │ │ ├── MuteUserResponse.kt
│ │ │ │ │ ├── SendActionRequest.kt
│ │ │ │ │ ├── BanUserRequest.kt
│ │ │ │ │ ├── MuteResponse.kt
│ │ │ │ │ ├── GuestUserRequest.kt
│ │ │ │ │ ├── Pagination.kt
│ │ │ │ │ ├── SearchMessagesRequest.kt
│ │ │ │ │ ├── QueryUsersRequest.kt
│ │ │ │ │ ├── QuerySort.kt
│ │ │ │ │ ├── ChannelResponse.kt
│ │ │ │ │ ├── QueryMembersRequest.kt
│ │ │ │ │ ├── ChannelRequest.kt
│ │ │ │ │ ├── RetroProgressCallback.kt
│ │ │ │ │ ├── WatchChannelRequest.kt
│ │ │ │ │ ├── QueryChannelsRequest.kt
│ │ │ │ │ ├── ProgressRequestBody.kt
│ │ │ │ │ └── QueryChannelRequest.kt
│ │ │ │ ├── QueryChannelsResponse.kt
│ │ │ │ ├── RetrofitCallMapper.kt
│ │ │ │ ├── ErrorCall.kt
│ │ │ │ ├── ChatClientConfig.kt
│ │ │ │ ├── HeadersInterceptor.kt
│ │ │ │ ├── RetrofitCdnApi.kt
│ │ │ │ └── TokenAuthInterceptor.kt
│ │ │ │ ├── utils
│ │ │ │ ├── UuidGenerator.kt
│ │ │ │ ├── UuidGeneratorImpl.kt
│ │ │ │ ├── ImmediateTokenProvider.kt
│ │ │ │ ├── ProgressCallback.kt
│ │ │ │ ├── SystemTimeProvider.kt
│ │ │ │ ├── SyncStatus.kt
│ │ │ │ ├── ChatUtils.kt
│ │ │ │ ├── Result.kt
│ │ │ │ ├── observable
│ │ │ │ │ ├── Subscriptions.kt
│ │ │ │ │ ├── Subscription.kt
│ │ │ │ │ └── ChatObservable.kt
│ │ │ │ └── FilterObject.kt
│ │ │ │ ├── socket
│ │ │ │ ├── SocketErrorMessage.kt
│ │ │ │ ├── ErrorResponse.kt
│ │ │ │ ├── InitConnectionListener.kt
│ │ │ │ ├── Socket.kt
│ │ │ │ ├── SocketListener.kt
│ │ │ │ ├── ChatSocket.kt
│ │ │ │ ├── ChatSocketService.kt
│ │ │ │ ├── ChatSocketImpl.kt
│ │ │ │ └── SocketFactory.kt
│ │ │ │ ├── errors
│ │ │ │ ├── ChatError.kt
│ │ │ │ ├── ChatParsingError.kt
│ │ │ │ ├── ChatRequestError.kt
│ │ │ │ ├── ChatNetworkError.kt
│ │ │ │ └── ChatErrorCode.kt
│ │ │ │ ├── parser
│ │ │ │ ├── IgnoreSerialisation.kt
│ │ │ │ ├── IgnoreDeserialisation.kt
│ │ │ │ ├── UrlQueryPayload.kt
│ │ │ │ ├── MapAdapter.kt
│ │ │ │ ├── ChatParser.kt
│ │ │ │ ├── adapters
│ │ │ │ │ └── QuerySortAdapter.kt
│ │ │ │ ├── FilterObjectAdapter.kt
│ │ │ │ ├── UrlQueryPayloadFactory.kt
│ │ │ │ ├── DateAdapter.kt
│ │ │ │ └── TypeAdapterFactory.kt
│ │ │ │ ├── token
│ │ │ │ ├── TokenProvider.kt
│ │ │ │ ├── TokenManager.kt
│ │ │ │ └── TokenManagerImpl.kt
│ │ │ │ ├── notifications
│ │ │ │ ├── DeviceRegisteredListener.kt
│ │ │ │ ├── FirebaseMessageParser.kt
│ │ │ │ ├── NotificationLoadDataListener.kt
│ │ │ │ ├── ChatFirebaseMessagingService.kt
│ │ │ │ ├── handler
│ │ │ │ │ └── NotificationConfig.kt
│ │ │ │ └── FirebaseMessageParserImpl.kt
│ │ │ │ ├── ClientState.kt
│ │ │ │ ├── extensions
│ │ │ │ ├── FileExtensions.kt
│ │ │ │ └── CommonExtensions.kt
│ │ │ │ ├── logger
│ │ │ │ ├── ChatLoggerHandler.kt
│ │ │ │ ├── TaggedLogger.kt
│ │ │ │ ├── ChatLogLevel.kt
│ │ │ │ ├── ChatSilentLogger.kt
│ │ │ │ ├── TaggedLoggerImpl.kt
│ │ │ │ └── ChatLogger.kt
│ │ │ │ ├── call
│ │ │ │ └── Call.kt
│ │ │ │ ├── helpers
│ │ │ │ └── AttachmentHelper.kt
│ │ │ │ ├── ClientExtensions.kt
│ │ │ │ └── controllers
│ │ │ │ └── ChannelControllerExtensions.kt
│ │ └── AndroidManifest.xml
│ ├── release
│ │ └── java
│ │ │ └── io.getstream.chat.android.client.di
│ │ │ └── ChatModule.kt
│ ├── androidTest
│ │ └── java
│ │ │ └── io
│ │ │ └── getstream
│ │ │ └── chat
│ │ │ └── android
│ │ │ └── client
│ │ │ └── utils
│ │ │ ├── Utils.kt
│ │ │ ├── TestChatUtils.kt
│ │ │ ├── TestInitListener.kt
│ │ │ └── EventsConsumer.kt
│ └── debug
│ │ └── java
│ │ └── io
│ │ └── getstream
│ │ └── chat
│ │ └── android
│ │ └── client
│ │ └── di
│ │ └── ChatModule.kt
├── scripts
│ └── docs.gradle
├── proguard-rules.pro
└── consumer-proguard-rules.pro
├── sample
├── .gitignore
├── consumer-rules.pro
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ └── strings.xml
│ │ │ └── layout
│ │ │ │ ├── activity_sync_channel.xml
│ │ │ │ ├── channel_list_item.xml
│ │ │ │ ├── activity_push.xml
│ │ │ │ ├── activity_home.xml
│ │ │ │ ├── fragment_channels.xml
│ │ │ │ ├── activity_channels.xml
│ │ │ │ └── activity_socket_tests.xml
│ │ ├── java
│ │ │ └── io
│ │ │ │ └── getstream
│ │ │ │ └── chat
│ │ │ │ └── android
│ │ │ │ └── client
│ │ │ │ └── sample
│ │ │ │ ├── common
│ │ │ │ ├── CachedResult.kt
│ │ │ │ ├── Page.kt
│ │ │ │ ├── ChatChannel.kt
│ │ │ │ ├── SyncHistoryActivity.kt
│ │ │ │ ├── ApiMapper.kt
│ │ │ │ ├── KeyValue.kt
│ │ │ │ ├── Channel.kt
│ │ │ │ ├── DiffCallback.kt
│ │ │ │ ├── OneToOneActivity.kt
│ │ │ │ ├── HomeActivity.kt
│ │ │ │ ├── DbUtils.kt
│ │ │ │ └── BaseChannelsListFragment.kt
│ │ │ │ ├── ViewState.kt
│ │ │ │ ├── utils
│ │ │ │ ├── UserConfig.kt
│ │ │ │ ├── LiveDataUtils.kt
│ │ │ │ ├── UtilsMessages.kt
│ │ │ │ └── PaginationListener.kt
│ │ │ │ ├── examples
│ │ │ │ ├── basic
│ │ │ │ │ └── ChannelsListFragment.kt
│ │ │ │ ├── livedata
│ │ │ │ │ ├── ChannelsViewModel.kt
│ │ │ │ │ └── ChannelsListFragment.kt
│ │ │ │ ├── coroutines
│ │ │ │ │ ├── ChannelsListFragment.kt
│ │ │ │ │ └── ChannelsViewModel.kt
│ │ │ │ └── rx
│ │ │ │ │ └── ChannelsViewModelRx.kt
│ │ │ │ ├── repositories
│ │ │ │ ├── ChannelsRepositorySync.kt
│ │ │ │ ├── ChannelsRepositoryLive.kt
│ │ │ │ └── ChannelsRepositoryRx.kt
│ │ │ │ ├── cache
│ │ │ │ └── AppDatabase.kt
│ │ │ │ └── ChannelsCache.kt
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── io
│ │ │ └── getstream
│ │ │ └── chat
│ │ │ └── android
│ │ │ └── client
│ │ │ └── sample
│ │ │ └── ExampleUnitTest.kt
│ └── androidTest
│ │ └── java
│ │ └── io
│ │ └── getstream
│ │ └── chat
│ │ └── android
│ │ └── client
│ │ └── sample
│ │ └── ExampleInstrumentedTest.kt
├── proguard-rules.pro
├── app-config.json
└── google-services.json
├── settings.gradle
├── docs
├── client-lifecycle.md
├── client-lifecycle.png
├── logging.md
├── token-provider.md
├── example-basic-async.md
├── example-pagination-channels.md
├── example-pagination-messages.md
├── issues.md
├── unread-messages.md
├── client-lifecycle.drawio
├── example-mvvm-livedata.md
├── example-mvvm-coroutines.md
└── example-mvvm-rxjava.md
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── .github
├── workflows
│ ├── check-docs-snippets.yml
│ └── android.yml
├── pull_request_template.md
└── ISSUE_TEMPLATE
│ └── bug_report.md
└── gradle.properties
/client/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/sample/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/sample/consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':client', ':sample'
2 |
--------------------------------------------------------------------------------
/docs/client-lifecycle.md:
--------------------------------------------------------------------------------
1 | # Client life cycle
2 |
3 | 
--------------------------------------------------------------------------------
/client/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker:
--------------------------------------------------------------------------------
1 | mock-maker-inline
--------------------------------------------------------------------------------
/client/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/client/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/docs/client-lifecycle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GetStream/stream-chat-android-client/HEAD/docs/client-lifecycle.png
--------------------------------------------------------------------------------
/sample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | sample
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GetStream/stream-chat-android-client/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/client/src/main/res/drawable/stream_ic_file_csv.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/client/src/main/res/drawable/stream_ic_file_doc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/client/src/main/res/drawable/stream_ic_file_mov.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/client/src/main/res/drawable/stream_ic_file_mp3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/client/src/main/res/drawable/stream_ic_file_pdf.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/client/src/main/res/drawable/stream_ic_file_ppt.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/client/src/main/res/drawable/stream_ic_file_tar.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/client/src/main/res/drawable/stream_ic_file_xls.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/client/src/main/res/drawable/stream_ic_file_zip.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/models/GuestUser.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.models
2 |
3 | public data class GuestUser(val user: User, val token: String)
4 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/UploadFileResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | internal data class UploadFileResponse(val file: String)
4 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/utils/UuidGenerator.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.utils
2 |
3 | internal interface UuidGenerator {
4 | fun generate(): String
5 | }
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/SendEventRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | internal data class SendEventRequest(val event: Map)
4 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/UpdateCooldownRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | public data class UpdateCooldownRequest(val cooldown: Int)
4 |
--------------------------------------------------------------------------------
/sample/src/main/java/io/getstream/chat/android/client/sample/common/CachedResult.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.sample.common
2 |
3 | class CachedResult(val data: T, val isUpdating: Boolean)
4 |
--------------------------------------------------------------------------------
/sample/src/main/java/io/getstream/chat/android/client/sample/common/Page.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.sample.common
2 |
3 | class Page(val offset: Int, val limit: Int, val data: List)
4 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/MuteChannelRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | internal data class MuteChannelRequest(val channel_cid: String)
4 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/socket/SocketErrorMessage.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.socket
2 |
3 | public data class SocketErrorMessage(val error: ErrorResponse? = null)
4 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/CompletableResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | internal data class CompletableResponse(val duration: String = "")
4 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/MarkReadRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | internal data class MarkReadRequest(
4 | val message_id: String
5 | )
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/TranslateMessageRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | internal data class TranslateMessageRequest(val language: String)
4 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/HideChannelRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | internal data class HideChannelRequest(val clearHistory: Boolean = false)
4 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/SearchMessagesResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | internal data class SearchMessagesResponse(val results: List = emptyList())
4 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/models/ModelFields.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.models
2 |
3 | internal class ModelFields {
4 | companion object {
5 | const val MEMBERS = "members"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .composite
3 | .gradle
4 | /local.properties
5 | /.idea/
6 | /projectFilesBackup/
7 | /projectFilesBackup1/
8 | .DS_Store
9 | /build
10 | /captures
11 | .externalNativeBuild
12 | .cxx
13 | /sample/app-config-custom.json
14 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/FlagResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.models.Flag
4 |
5 | internal data class FlagResponse(val flag: Flag)
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/errors/ChatError.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.errors
2 |
3 | public open class ChatError(
4 | public val message: String? = null,
5 | public val cause: Throwable? = null
6 | )
7 |
--------------------------------------------------------------------------------
/sample/src/main/java/io/getstream/chat/android/client/sample/common/ChatChannel.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.sample.common
2 |
3 | data class ChatChannel(
4 | val id: String,
5 | val name: String,
6 | val updatedAt: Int
7 | )
8 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/sample/src/main/java/io/getstream/chat/android/client/sample/common/SyncHistoryActivity.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.sample.common
2 |
3 | import androidx.appcompat.app.AppCompatActivity
4 |
5 | class SyncHistoryActivity : AppCompatActivity()
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/MessageRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.models.Message
4 |
5 | internal data class MessageRequest(val message: Message)
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/MessageResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.models.Message
4 |
5 | internal data class MessageResponse(val message: Message)
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/ReactionRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.models.Reaction
4 |
5 | internal data class ReactionRequest(val reaction: Reaction)
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/parser/IgnoreSerialisation.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.parser
2 |
3 | @Retention(AnnotationRetention.RUNTIME)
4 | @Target(AnnotationTarget.FIELD)
5 | internal annotation class IgnoreSerialisation
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/ReactionResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.models.Reaction
4 |
5 | internal data class ReactionResponse(val reaction: Reaction)
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/models/Command.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.models
2 |
3 | public data class Command(
4 | val name: String,
5 | val description: String,
6 | val args: String,
7 | val set: String
8 | )
9 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/parser/IgnoreDeserialisation.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.parser
2 |
3 | @Retention(AnnotationRetention.RUNTIME)
4 | @Target(AnnotationTarget.FIELD)
5 | internal annotation class IgnoreDeserialisation
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/UpdateUsersResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.models.User
4 |
5 | internal data class UpdateUsersResponse(val users: Map)
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/token/TokenProvider.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.token
2 |
3 | import androidx.annotation.WorkerThread
4 |
5 | public interface TokenProvider {
6 | @WorkerThread
7 | public fun loadToken(): String
8 | }
9 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/GetSyncHistory.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import java.util.Date
4 |
5 | internal data class GetSyncHistory(
6 | val channel_cids: List,
7 | val last_sync_at: Date
8 | )
9 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/UpdateUsersRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.models.User
4 |
5 | public data class UpdateUsersRequest(
6 | val users: Map
7 | )
8 |
--------------------------------------------------------------------------------
/client/src/main/res/drawable/stream_ic_notification.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/docs/logging.md:
--------------------------------------------------------------------------------
1 | # Logging
2 |
3 | ```kotlin
4 | val client = StreamChatClient.Builder()
5 | .loggingLevel(BuildConfig.DEBUG ? ALL : NOTHING)
6 | .loggerHandler(object: LoggerHandler() {
7 | override fun logExeption(t:Throwable) {
8 | //log exception
9 | }
10 | })
11 | ```
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/GetDevicesResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.models.Device
4 |
5 | internal data class GetDevicesResponse(val devices: List = emptyList())
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/GetRepliesResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.models.Message
4 |
5 | internal data class GetRepliesResponse(val messages: List = emptyList())
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/QueryMembersResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.models.Member
4 |
5 | internal data class QueryMembersResponse(val members: List = emptyList())
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/QueryUserListResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.models.User
4 |
5 | internal data class QueryUserListResponse(val users: List = emptyList())
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/models/UserEntity.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.models
2 |
3 | public interface UserEntity {
4 |
5 | public var user: User
6 |
7 | public fun getUserId(): String {
8 | return user.id
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/GetReactionsResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.models.Reaction
4 |
5 | internal data class GetReactionsResponse(val reactions: List = emptyList())
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/GetSyncHistoryResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.events.ChatEvent
4 |
5 | internal data class GetSyncHistoryResponse(
6 | val events: List
7 | )
8 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/UpdateChannelRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.models.Message
4 |
5 | internal data class UpdateChannelRequest(val data: Map, val message: Message?)
6 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/EventResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.events.ChatEvent
4 |
5 | internal data class EventResponse(
6 | val event: ChatEvent,
7 | var duration: String = ""
8 | )
9 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/QueryChannelsResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api
2 |
3 | import io.getstream.chat.android.client.api.models.ChannelResponse
4 |
5 | internal data class QueryChannelsResponse(
6 | var channels: List = emptyList()
7 | )
8 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/AddMembersRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | internal data class AddMembersRequest(
6 | @SerializedName("add_members")
7 | val members: List
8 | )
9 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/errors/ChatParsingError.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.errors
2 |
3 | internal class ChatParsingError : Exception {
4 | constructor(message: String?) : super(message)
5 | constructor(message: String?, cause: Throwable?) : super(message, cause)
6 | }
7 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/RemoveMembersRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | internal data class RemoveMembersRequest(
6 | @SerializedName("remove_members")
7 | val members: List
8 | )
9 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/utils/UuidGeneratorImpl.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.utils
2 |
3 | import java.util.UUID
4 |
5 | internal class UuidGeneratorImpl : UuidGenerator {
6 | override fun generate(): String {
7 | return UUID.randomUUID().toString()
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/sample/src/main/java/io/getstream/chat/android/client/sample/ViewState.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.sample
2 |
3 | sealed class ViewState {
4 | data class Success(val data: T) : ViewState()
5 | data class Error(val error: Throwable) : ViewState()
6 | class Loading : ViewState()
7 | }
8 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/RejectInviteRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | internal data class RejectInviteRequest(
6 | @SerializedName("reject_invite")
7 | val rejectInvite: Boolean = true
8 | )
9 |
--------------------------------------------------------------------------------
/client/src/release/java/io.getstream.chat.android.client.di/ChatModule.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.di
2 |
3 | import android.content.Context
4 | import io.getstream.chat.android.client.api.ChatClientConfig
5 |
6 | internal class ChatModule(appContext: Context, config: ChatClientConfig) : BaseChatModule(appContext, config)
7 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/utils/ImmediateTokenProvider.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.utils
2 |
3 | import io.getstream.chat.android.client.token.TokenProvider
4 |
5 | internal class ImmediateTokenProvider(private val token: String) : TokenProvider {
6 | override fun loadToken(): String = token
7 | }
8 |
--------------------------------------------------------------------------------
/client/src/test/java/io/getstream/chat/android/client/token/FakeTokenProvider.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.token
2 |
3 | internal class FakeTokenProvider(vararg val tokens: String) : TokenProvider {
4 |
5 | var tokenId = 0
6 |
7 | override fun loadToken(): String {
8 | return tokens[tokenId++]
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/models/Device.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | public data class Device(
6 | @SerializedName("id")
7 | val id: String,
8 | @SerializedName("push_provider")
9 | var pushProvider: String = ""
10 | )
11 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/AddDeviceRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | internal data class AddDeviceRequest(
6 | @SerializedName("id")
7 | val firebaseToken: String
8 | ) {
9 | val push_provider = "firebase"
10 | }
11 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/notifications/DeviceRegisteredListener.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.notifications
2 |
3 | import io.getstream.chat.android.client.errors.ChatError
4 |
5 | public interface DeviceRegisteredListener {
6 | public fun onDeviceRegisteredSuccess()
7 | public fun onDeviceRegisteredError(error: ChatError)
8 | }
9 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/MuteUserRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | internal data class MuteUserRequest(
6 | @SerializedName("target_id")
7 | val targetId: String,
8 | @SerializedName("user_id")
9 | val userId: String
10 | )
11 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/models/ChannelMute.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import java.util.Date
5 |
6 | public data class ChannelMute(
7 | val user: User,
8 | val channel: Channel,
9 | @SerializedName("created_at")
10 | val createdAt: Date
11 | )
12 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/utils/ProgressCallback.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.utils
2 |
3 | import io.getstream.chat.android.client.errors.ChatError
4 |
5 | public interface ProgressCallback {
6 | public fun onSuccess(file: String)
7 | public fun onError(error: ChatError)
8 | public fun onProgress(progress: Long)
9 | }
10 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/TokenResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import io.getstream.chat.android.client.models.User
5 |
6 | internal data class TokenResponse(
7 | val user: User,
8 | @SerializedName("access_token")
9 | val accessToken: String
10 | )
11 |
--------------------------------------------------------------------------------
/sample/src/main/java/io/getstream/chat/android/client/sample/utils/UserConfig.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.sample.utils
2 |
3 | import io.getstream.chat.android.client.models.User
4 |
5 | data class UserConfig(
6 | val userId: String,
7 | val token: String,
8 | val apiKey: String
9 | ) {
10 | fun getUser(): User {
11 | return User(userId)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/socket/ErrorResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.socket
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | public data class ErrorResponse(
6 | val code: Int = -1,
7 | var message: String = "",
8 | @SerializedName("StatusCode")
9 | var statusCode: Int = -1
10 | ) {
11 | var duration: String = ""
12 | }
13 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/utils/SystemTimeProvider.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.utils
2 |
3 | public class SystemTimeProvider {
4 | public fun provideCurrentTimeInSeconds(): Long {
5 | return System.currentTimeMillis() / MILLIS_TO_SECONDS_FACTOR
6 | }
7 |
8 | private companion object {
9 | const val MILLIS_TO_SECONDS_FACTOR = 1000L
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/ClientState.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client
2 |
3 | import io.getstream.chat.android.client.models.User
4 |
5 | internal class ClientState {
6 | var user: User? = null
7 | var connectionId: String? = null
8 | var socketConnected: Boolean = false
9 |
10 | fun reset() {
11 | user = null
12 | connectionId = null
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/models/Mute.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import java.util.Date
5 |
6 | public data class Mute(
7 | var user: User,
8 | var target: User,
9 | @SerializedName("created_at")
10 | var createdAt: Date,
11 | @SerializedName("updated_at")
12 | var updatedAt: Date
13 | )
14 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/AcceptInviteRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.models.User
4 |
5 | internal data class AcceptInviteRequest(
6 | val user: User,
7 | val message: AcceptInviteMessage,
8 | val accept_invite: Boolean = true
9 | ) {
10 | data class AcceptInviteMessage(val text: String? = null)
11 | }
12 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/MuteUserResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import io.getstream.chat.android.client.models.Mute
5 | import io.getstream.chat.android.client.models.User
6 |
7 | internal data class MuteUserResponse(
8 | var mute: Mute,
9 | @SerializedName("own_user")
10 | var ownUser: User
11 | )
12 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/models/ChannelUserRead.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import java.util.Date
5 |
6 | public data class ChannelUserRead(
7 | override var user: User,
8 | @SerializedName("last_read")
9 | var lastRead: Date? = null,
10 | @SerializedName("unread_messages")
11 | var unreadMessages: Int = 0
12 | ) : UserEntity
13 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/parser/UrlQueryPayload.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.parser
2 |
3 | /**
4 | * Some requests passing payload as url query parameter.
5 | * This annotations tells gson to convert it to json, rather that call [toString]
6 | * See [UrlQueryPayloadFactory]
7 | */
8 | @Retention(AnnotationRetention.RUNTIME)
9 | @Target(AnnotationTarget.VALUE_PARAMETER)
10 | internal annotation class UrlQueryPayload
11 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/SendActionRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | public data class SendActionRequest(
6 | @SerializedName("channel_id")
7 | val channelId: String,
8 | @SerializedName("message_id")
9 | val messageId: String,
10 | val type: String,
11 | @SerializedName("form_data")
12 | val formData: Map
13 | )
14 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/notifications/FirebaseMessageParser.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.notifications
2 |
3 | import com.google.firebase.messaging.RemoteMessage
4 |
5 | public interface FirebaseMessageParser {
6 | public fun isValid(message: RemoteMessage): Boolean
7 | public fun parse(message: RemoteMessage): Data
8 |
9 | public data class Data(val messageId: String, val channelType: String, val channelId: String)
10 | }
11 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/BanUserRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | internal data class BanUserRequest(
6 | @SerializedName("target_user_id")
7 | var targetUserId: String,
8 | var timeout: Int,
9 | var reason: String,
10 | @SerializedName("type")
11 | var channelType: String,
12 | @SerializedName("id")
13 | var channelId: String
14 | )
15 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/activity_sync_channel.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
9 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/RetrofitCallMapper.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api
2 |
3 | import io.getstream.chat.android.client.call.Call
4 | import io.getstream.chat.android.client.call.RetrofitCall
5 | import io.getstream.chat.android.client.parser.ChatParser
6 |
7 | internal class RetrofitCallMapper(private val chatParser: ChatParser) {
8 | fun map(call: retrofit2.Call): Call {
9 | return RetrofitCall(call, chatParser)
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/extensions/FileExtensions.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.extensions
2 |
3 | import android.webkit.MimeTypeMap
4 | import okhttp3.MediaType
5 | import okhttp3.MediaType.Companion.toMediaType
6 | import java.io.File
7 |
8 | internal fun File.getMimeType(): String =
9 | MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension) ?: "application/octet-stream"
10 |
11 | internal fun File.getMediaType(): MediaType = getMimeType().toMediaType()
12 |
--------------------------------------------------------------------------------
/sample/src/test/java/io/getstream/chat/android/client/sample/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.sample
2 |
3 | import org.junit.Assert.assertEquals
4 | import org.junit.Test
5 |
6 | /**
7 | * Example local unit test, which will execute on the development machine (host).
8 | *
9 | * See [testing documentation](http://d.android.com/tools/testing).
10 | */
11 | class ExampleUnitTest {
12 | @Test
13 | fun addition_isCorrect() {
14 | assertEquals(4, 2 + 2)
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/docs/token-provider.md:
--------------------------------------------------------------------------------
1 | # Token Provider
2 |
3 | 1. For tokens without expiration
4 |
5 | ```kotlin
6 | val token = "token"
7 | client.setUser(User("id"), token)
8 | ```
9 |
10 | 2. For tokens with expiration
11 |
12 | ```kotlin
13 | val tokenProvider = object: TokenProvider() {
14 | // Executed in background thread
15 | override fun loadToken(): String {
16 | return api.getChatToken().execute()
17 | }
18 | }
19 | client.setUser(User("id"), tokenProvider)
20 | ```
21 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/MuteResponse.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import io.getstream.chat.android.client.models.Mute
5 | import io.getstream.chat.android.client.models.User
6 |
7 | internal data class MuteResponse(
8 | @SerializedName("own_user")
9 | val user: User,
10 | @SerializedName("channel_mute")
11 | val mute: Mute,
12 | @SerializedName("channel_mutes")
13 | val mutes: List
14 | )
15 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/notifications/NotificationLoadDataListener.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.notifications
2 |
3 | import io.getstream.chat.android.client.errors.ChatError
4 | import io.getstream.chat.android.client.models.Channel
5 | import io.getstream.chat.android.client.models.Message
6 |
7 | public interface NotificationLoadDataListener {
8 |
9 | public fun onLoadSuccess(channel: Channel, message: Message)
10 |
11 | public fun onLoadFail(messageId: String, error: ChatError)
12 | }
13 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/socket/InitConnectionListener.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.socket
2 |
3 | import io.getstream.chat.android.client.errors.ChatError
4 | import io.getstream.chat.android.client.models.User
5 |
6 | public abstract class InitConnectionListener {
7 |
8 | public open fun onSuccess(data: ConnectionData) {
9 | }
10 |
11 | public open fun onError(error: ChatError) {
12 | }
13 |
14 | public data class ConnectionData(val user: User, val connectionId: String)
15 | }
16 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/models/GuestUserRequest.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api.models
2 |
3 | import io.getstream.chat.android.client.parser.IgnoreSerialisation
4 |
5 | internal data class GuestUserRequest constructor(
6 | @IgnoreSerialisation
7 | val id: String,
8 | @IgnoreSerialisation
9 | val name: String
10 | ) {
11 |
12 | var user = GuestUserBody(id, name)
13 |
14 | data class GuestUserBody(
15 | val id: String,
16 | val name: String
17 | )
18 | }
19 |
--------------------------------------------------------------------------------
/docs/example-basic-async.md:
--------------------------------------------------------------------------------
1 | # Basic async example
2 | ```kotlin
3 | class ChannelsActivity: AppCompatActivity() {
4 | fun onCreate() {
5 | val client = StreamChatClient("api-key", "token")
6 | client.setUser(ChatUser("id"), { result ->
7 | if(result.isSuccess())
8 | showChannels(result.data())
9 | else
10 | showError(result.error())
11 | }
12 | }
13 |
14 | fun showChannels(channels:List) {
15 | val adapter = ChannelsAdapter(channels)
16 | channelsView.setAdapter(adapter)
17 | }
18 | }
19 | ```
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/socket/Socket.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.socket
2 |
3 | import io.getstream.chat.android.client.events.ChatEvent
4 | import io.getstream.chat.android.client.parser.ChatParser
5 | import okhttp3.WebSocket
6 |
7 | internal class Socket(val socket: WebSocket, val parser: ChatParser) {
8 |
9 | fun send(event: ChatEvent) {
10 | socket.send(parser.toJson(event))
11 | }
12 |
13 | fun close(code: Int, reason: String) {
14 | socket.close(code, reason)
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/docs/example-pagination-channels.md:
--------------------------------------------------------------------------------
1 | # Channels pagination
2 |
3 | Get first page
4 |
5 | ```kotlin
6 | val channel = ChatChannel("id")
7 | val limit = 25
8 | val result = client.queryChannels(channel, ChannelsQuery(limit)).execute()
9 | val channels = result.getData()
10 | ```
11 |
12 | Get subsequent pages
13 |
14 | ```kotlin
15 | val channel = ChatChannel("id")
16 | val limit = 25
17 | val offset = 25
18 | val lastMessage = "message-id"
19 | val result = client.queryChannels(channel, ChannelsQuery(limit, offset)).execute()
20 | val channels = result.getData()
21 | ```
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/extensions/CommonExtensions.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.extensions
2 |
3 | internal fun safeLet(
4 | p1: T1?,
5 | p2: T2?,
6 | p3: T3?,
7 | block: (T1, T2, T3) -> R?
8 | ): R? {
9 | return if (p1 != null && p2 != null && p3 != null) block(p1, p2, p3) else null
10 | }
11 |
12 | internal fun safeLet(p1: T1?, p2: T2?, block: (T1, T2) -> R?): R? {
13 | return if (p1 != null && p2 != null) block(p1, p2) else null
14 | }
15 |
--------------------------------------------------------------------------------
/client/src/test/resources/model.member.json:
--------------------------------------------------------------------------------
1 | {
2 | "user_id": "stream-eugene",
3 | "user": {
4 | "id": "stream-eugene",
5 | "role": "user",
6 | "created_at": "2020-04-02T17:55:03.278292Z",
7 | "updated_at": "2020-05-22T12:49:26.739314Z",
8 | "last_active": "2020-05-22T12:31:04.710067Z",
9 | "banned": false,
10 | "online": true,
11 | "image": "https://bit.ly/321RmWb",
12 | "invisible": false,
13 | "name": "stream-eugene"
14 | },
15 | "created_at": "2020-04-25T02:49:33.953141Z",
16 | "updated_at": "2020-04-25T02:49:33.953141Z"
17 | }
--------------------------------------------------------------------------------
/sample/src/main/java/io/getstream/chat/android/client/sample/common/ApiMapper.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.sample.common
2 |
3 | object ApiMapper {
4 |
5 | fun mapChannel(channel: ChatChannel): Channel {
6 | return Channel().apply {
7 | remoteId = channel.id
8 | name = channel.name
9 | updatedAt = channel.updatedAt
10 | }
11 | }
12 |
13 | fun mapChannels(channels: List): List {
14 | return channels.map {
15 | mapChannel(it)
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/.github/workflows/check-docs-snippets.yml:
--------------------------------------------------------------------------------
1 | name: Check documentation snippets
2 |
3 | on:
4 | release:
5 | types: [published]
6 |
7 |
8 | jobs:
9 | notifiy-snippets-repository:
10 |
11 | runs-on: ubuntu-latest
12 | steps:
13 | - name: Call curl
14 | run: |
15 | curl -XPOST -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/GetStream/docs-snippets-android/dispatches --data '{"event_type": "check-on-new-release"}'
16 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | < Jira issue link, if applicable >
2 |
3 | ### Description
4 |
5 | Describe what this PR changes, why we're making the change, how it should be tested...
6 |
7 | ### Checklist
8 |
9 | - [ ] I have signed the [Stream CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) (required)
10 | - [ ] PR targets the `develop` branch
11 | - [ ] Changelog updated with client-facing changes
12 | - [ ] New code is covered by unit tests
13 | - [ ] Comparison screenshots added for visual changes
14 | - [ ] Reviewers added
15 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/api/ErrorCall.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.api
2 |
3 | import io.getstream.chat.android.client.call.ChatCallImpl
4 | import io.getstream.chat.android.client.errors.ChatError
5 | import io.getstream.chat.android.client.utils.Result
6 |
7 | internal class ErrorCall(val e: ChatError) : ChatCallImpl() {
8 | override fun execute(): Result {
9 | return Result(null, e)
10 | }
11 |
12 | override fun enqueue(callback: (Result) -> Unit) {
13 | callback(Result(null, e))
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/logger/ChatLoggerHandler.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.logger
2 |
3 | public interface ChatLoggerHandler {
4 | public fun logT(throwable: Throwable)
5 |
6 | public fun logT(tag: Any, throwable: Throwable)
7 |
8 | public fun logI(tag: Any, message: String)
9 |
10 | public fun logD(tag: Any, message: String)
11 |
12 | public fun logW(tag: Any, message: String)
13 |
14 | public fun logE(tag: Any, message: String)
15 |
16 | public fun logE(tag: Any, message: String, throwable: Throwable)
17 | }
18 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/models/CustomObject.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.models
2 |
3 | public interface CustomObject {
4 | public var extraData: MutableMap
5 |
6 | @Suppress("UNCHECKED_CAST")
7 | public fun getExtraValue(key: String, default: T): T {
8 | return if (extraData.containsKey(key)) {
9 | extraData[key] as T
10 | } else {
11 | default
12 | }
13 | }
14 |
15 | public fun putExtraValue(key: String, value: Any) {
16 | extraData[key] = value
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/docs/example-pagination-messages.md:
--------------------------------------------------------------------------------
1 | # Messages pagination
2 |
3 | Get first page
4 |
5 | ```kotlin
6 | val channel = ChatChannel("id")
7 | val limit = 25
8 | val result = client.queryChannel(channel, ChannelQuery().withMessages(limit)).execute()
9 | val messages = result.getData().getMessages()
10 | ```
11 |
12 | Get subsequent pages
13 |
14 | ```kotlin
15 | val channel = ChatChannel("id")
16 | val limit = 25
17 | val lastMessage = "message-id"
18 | val result = client.queryChannel(channel, ChannelQuery().withMessages(lastMessage, limit)).execute()
19 | val messages = result.getData().getMessages()
20 | ```
--------------------------------------------------------------------------------
/client/src/androidTest/java/io/getstream/chat/android/client/utils/Utils.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.utils
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 |
5 | class Utils {
6 | companion object {
7 | fun runOnUi(call: () -> Unit): ThenVerify {
8 | InstrumentationRegistry.getInstrumentation().runOnMainSync {
9 | call()
10 | }
11 | return ThenVerify()
12 | }
13 | }
14 |
15 | class ThenVerify {
16 | fun andThen(call: () -> Unit) {
17 | call()
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/errors/ChatRequestError.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.errors
2 |
3 | import java.io.IOException
4 |
5 | /**
6 | * Used to interrupt okhttp request.
7 | * Only descendant [IOException] of can propagate call execution
8 | */
9 | internal class ChatRequestError(
10 | message: String,
11 | val streamCode: Int,
12 | val statusCode: Int,
13 | cause: Throwable? = null
14 | ) : IOException(message, cause) {
15 | override fun toString(): String {
16 | return "streamCode: $streamCode, statusCode: $statusCode, message: $message"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/client/src/main/java/io/getstream/chat/android/client/parser/MapAdapter.kt:
--------------------------------------------------------------------------------
1 | package io.getstream.chat.android.client.parser
2 |
3 | import com.google.gson.TypeAdapter
4 | import com.google.gson.stream.JsonReader
5 | import com.google.gson.stream.JsonWriter
6 |
7 | internal class MapAdapter(private val delegateMapAdapter: TypeAdapter