├── .gitignore ├── LICENSE.md ├── README.md ├── app ├── .gitignore ├── build.gradle ├── debug.keystore ├── google-services.json ├── keystore │ ├── debug.keystore │ └── debug.keystore.properties ├── proguard-rules.txt └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── sdk │ │ └── chat │ │ ├── MainApplication.java │ │ └── StartActivity.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-mdpi │ └── ic_launcher.png │ ├── drawable-xhdpi │ └── ic_launcher.png │ ├── values-es │ └── strings.xml │ ├── values-nl │ └── strings.xml │ ├── values-pt │ └── strings.xml │ ├── values-zh │ └── strings.xml │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── demo ├── .gitignore ├── build.gradle ├── google-services.json ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── sdk │ │ └── chat │ │ └── demo │ │ ├── ChatActivity.java │ │ ├── MainApplication.java │ │ ├── Message.java │ │ ├── MessageMemoryStore.java │ │ ├── StartActivity.java │ │ ├── Thread.java │ │ └── User.java │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── layout │ ├── activity_chat.xml │ └── activity_start.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── firestream-firestore ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── firestream │ │ └── chat │ │ └── firestore │ │ ├── FirestoreChatHandler.java │ │ ├── FirestoreCoreHandler.java │ │ ├── FirestoreService.java │ │ └── Ref.java │ └── res │ └── values │ └── strings.xml ├── firestream-realtime ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── firestream │ │ └── chat │ │ └── realtime │ │ ├── RealtimeChatHandler.java │ │ ├── RealtimeCoreHandler.java │ │ ├── RealtimeService.java │ │ └── Ref.java │ └── res │ └── values │ └── strings.xml ├── firestream ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── firestream │ │ └── chat │ │ ├── FireStream.java │ │ ├── FirestreamConfig.java │ │ ├── chat │ │ ├── AbstractChat.java │ │ ├── Chat.java │ │ ├── Events.java │ │ ├── Meta.java │ │ └── User.java │ │ ├── events │ │ ├── ConnectionEvent.java │ │ ├── ListData.java │ │ └── UserEvent.java │ │ ├── filter │ │ └── Filter.java │ │ ├── firebase │ │ ├── rx │ │ │ └── MultiRelay.java │ │ └── service │ │ │ ├── FirebaseChatHandler.java │ │ │ ├── FirebaseCoreHandler.java │ │ │ ├── FirebaseService.java │ │ │ ├── Keys.java │ │ │ ├── Path.java │ │ │ └── Paths.java │ │ ├── interfaces │ │ ├── IAbstractChat.java │ │ ├── IChat.java │ │ └── IFireStream.java │ │ ├── message │ │ ├── BaseMessage.java │ │ ├── Body.java │ │ ├── CustomMessage.java │ │ ├── DeliveryReceipt.java │ │ ├── Invitation.java │ │ ├── Message.java │ │ ├── Presence.java │ │ ├── Sendable.java │ │ ├── TextMessage.java │ │ └── TypingState.java │ │ ├── namespace │ │ ├── Fire.java │ │ ├── FireStreamMessage.java │ │ └── FireStreamUser.java │ │ ├── test │ │ ├── Result.java │ │ ├── Test.java │ │ ├── TestScript.java │ │ ├── chat │ │ │ ├── CreateChatTest.java │ │ │ ├── MessageChatTest.java │ │ │ └── ModifyChatTest.java │ │ └── contact │ │ │ ├── AddContactTest.java │ │ │ ├── DeleteContactTest.java │ │ │ ├── GetContactAddedTest.java │ │ │ └── GetContactRemovedTest.java │ │ ├── types │ │ ├── BaseType.java │ │ ├── ContactType.java │ │ ├── DeliveryReceiptType.java │ │ ├── InvitationType.java │ │ ├── PresenceType.java │ │ ├── RoleType.java │ │ ├── SendableType.java │ │ └── TypingStateType.java │ │ └── util │ │ ├── Typing.java │ │ └── TypingMap.java │ └── res │ └── values │ └── strings.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── graphics ├── android-phone-images.png ├── chat-sdk-play.png └── en_badge_web_generic.png ├── issue_template.md ├── sdk-guru-common ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── sdk │ │ └── guru │ │ └── common │ │ ├── BaseConfig.java │ │ ├── BiAction.java │ │ ├── DisposableMap.java │ │ ├── Event.java │ │ ├── EventType.java │ │ ├── Optional.java │ │ └── RX.java │ └── res │ └── values │ └── strings.xml ├── sdk-guru-firestore ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── sdk │ │ └── guru │ │ └── firestore │ │ └── RXFirestore.java │ └── res │ └── values │ └── strings.xml ├── sdk-guru-licensing ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── sdk │ │ └── chat │ │ └── licensing │ │ └── Report.java │ └── res │ └── values │ └── strings.xml ├── sdk-guru-realtime ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── sdk │ │ └── guru │ │ └── realtime │ │ ├── DocumentChange.java │ │ ├── Generic.java │ │ ├── RXRealtime.java │ │ ├── RealtimeEventListener.java │ │ └── RealtimeReferenceManager.java │ └── res │ └── values │ └── strings.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Local configuration files 2 | /local.properties 3 | /.idea/workspace.xml 4 | .DS_Store 5 | 6 | # Generated files 7 | **/bin/ 8 | **/gen/ 9 | **/out/ 10 | **/build/ 11 | .project 12 | .classpath 13 | org.eclipse.buildship.core.prefs 14 | 15 | #Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Files for the Dalvik VM 20 | *.dex 21 | 22 | # Intellij 23 | *.iml 24 | .idea 25 | /out/ 26 | /captures 27 | app/release 28 | 29 | # Java .class files 30 | **/*.class 31 | *.diff 32 | 33 | # Premium Modules 34 | chat-sdk-audio-message 35 | chat-sdk-contact-book 36 | chat-sdk-file-message 37 | chat-sdk-firebase-blocking 38 | chat-sdk-firebase-nearby-users 39 | chat-sdk-read-receipts 40 | chat-sdk-sticker-message 41 | chat-sdk-typing-indicator 42 | chat-sdk-video-message 43 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /release 3 | /development 4 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.google.gms.google-services' 3 | apply plugin: 'com.google.firebase.crashlytics' 4 | apply plugin: 'com.google.firebase.firebase-perf' 5 | 6 | android { 7 | compileSdkVersion Integer.parseInt(project.ANDROID_COMPILE_SDK_VERSION) 8 | 9 | defaultConfig { 10 | applicationId "sdk.chat.android.live" 11 | 12 | multiDexEnabled = true 13 | minSdkVersion Integer.parseInt(project.MIN_SDK) 14 | targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION) 15 | 16 | versionName CHAT_SDK_VERSION 17 | versionCode CHAT_SDK_BUILD_NUMBER as int 18 | } 19 | 20 | signingConfigs { 21 | debug { 22 | keyAlias 'androiddebugkey' 23 | keyPassword 'D3bug123' 24 | storeFile file('debug.keystore') 25 | storePassword 'D3bug123' 26 | } 27 | } 28 | 29 | if(project.hasProperty('devBuild')) { 30 | splits.abi.enable = false 31 | splits.density.enable = false 32 | aaptOptions.cruncherEnabled = false 33 | } 34 | 35 | buildTypes { 36 | // release { 37 | // proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 38 | // signingConfig signingConfigs.release 39 | // debuggable false 40 | // jniDebuggable false 41 | // zipAlignEnabled true 42 | // } 43 | debug { 44 | debuggable true 45 | jniDebuggable true 46 | ext.alwaysUpdateBuildId = false 47 | } 48 | } 49 | 50 | packagingOptions { 51 | exclude 'META-INF/DEPENDENCIES' 52 | exclude 'META-INF/NOTICE' 53 | exclude 'META-INF/LICENSE' 54 | exclude 'META-INF/LICENSE.txt' 55 | exclude 'META-INF/NOTICE.txt' 56 | } 57 | 58 | dexOptions { 59 | javaMaxHeapSize "6g" 60 | preDexLibraries = false 61 | } 62 | 63 | flavorDimensions "default" 64 | productFlavors { 65 | development { 66 | dimension "default" 67 | minSdkVersion 21 68 | resConfigs("en", "xxhdpi") 69 | } 70 | } 71 | 72 | compileOptions { 73 | sourceCompatibility JavaVersion.VERSION_1_8 74 | targetCompatibility JavaVersion.VERSION_1_8 75 | } 76 | 77 | lintOptions { 78 | abortOnError false 79 | checkReleaseBuilds false 80 | lintConfig file('lint.xml') 81 | } 82 | } 83 | 84 | dependencies { 85 | implementation project(':firestream') 86 | implementation project(':firestream-realtime') 87 | implementation project(':firestream-firestore') 88 | 89 | api "com.google.android.material:material:$materialVersion" 90 | implementation "com.firebaseui:firebase-ui-auth:$firebaseUiVersion" 91 | 92 | } 93 | 94 | 95 | task copyDependencies(type: Copy) { 96 | from configurations.compile 97 | into 'dependencies' 98 | } 99 | -------------------------------------------------------------------------------- /app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chat-sdk/firestream-android/334b2e74b098277a3a3ab0e1632f04f3e01b04f0/app/debug.keystore -------------------------------------------------------------------------------- /app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "1088435112418", 4 | "firebase_url": "https://chat-sdk-v4.firebaseio.com", 5 | "project_id": "chat-sdk-v4", 6 | "storage_bucket": "chat-sdk-v4.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:1088435112418:android:813ea9bf20e0a13f5611bb", 12 | "android_client_info": { 13 | "package_name": "sdk.chat.android.live" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "1088435112418-900e65u7oloc6tvbf9cl9qv5fjctv4t7.apps.googleusercontent.com", 19 | "client_type": 1, 20 | "android_info": { 21 | "package_name": "sdk.chat.android.live", 22 | "certificate_hash": "e4e36b1e2f9ac7d7b8e867e08c94cb1dbfaaf9c4" 23 | } 24 | }, 25 | { 26 | "client_id": "1088435112418-e3t77t8jl2ucs8efeqs72o696in8soui.apps.googleusercontent.com", 27 | "client_type": 3 28 | } 29 | ], 30 | "api_key": [ 31 | { 32 | "current_key": "AIzaSyAf-dkxZw1m-mP_E-jpTvk1lFtGioev6m0" 33 | } 34 | ], 35 | "services": { 36 | "appinvite_service": { 37 | "other_platform_oauth_client": [ 38 | { 39 | "client_id": "1088435112418-7gfr9061rqnlg5fj1d510unql3mu5qjp.apps.googleusercontent.com", 40 | "client_type": 3 41 | }, 42 | { 43 | "client_id": "1088435112418-94j149s4i4q32u4m8s0dqt5ctdpfd235.apps.googleusercontent.com", 44 | "client_type": 2, 45 | "ios_info": { 46 | "bundle_id": "org.cocoapods.FireStream-Tests" 47 | } 48 | } 49 | ] 50 | } 51 | } 52 | } 53 | ], 54 | "configuration_version": "1" 55 | } -------------------------------------------------------------------------------- /app/keystore/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chat-sdk/firestream-android/334b2e74b098277a3a3ab0e1632f04f3e01b04f0/app/keystore/debug.keystore -------------------------------------------------------------------------------- /app/keystore/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | store.file=debug.keystore 2 | key.alias=androiddebugkey 3 | key.alias.password=android 4 | key.store.password=android 5 | -------------------------------------------------------------------------------- /app/proguard-rules.txt: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:/Work/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the ProGuard 5 | # include property in project.properties. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView from JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | -dontwarn org.joda.convert.** -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/java/sdk/chat/MainApplication.java: -------------------------------------------------------------------------------- 1 | package sdk.chat; 2 | 3 | import android.app.Application; 4 | 5 | import com.google.firebase.auth.FirebaseAuth; 6 | 7 | import firestream.chat.firestore.FirestoreService; 8 | import firestream.chat.namespace.Fire; 9 | import firestream.chat.test.TestScript; 10 | import firestream.chat.types.ContactType; 11 | 12 | /** 13 | * Created by Ben Smiley on 6/8/2014. 14 | */ 15 | //public class MainApplication extends MultiDexApplication { 16 | public class MainApplication extends Application { 17 | 18 | @Override 19 | public void onCreate() { 20 | super.onCreate(); 21 | 22 | TestScript ts = new TestScript(new FirestoreService(), this, "firestream"); 23 | ts.onFinish = () -> { 24 | Fire.stream().block(TestScript.testUser1()).subscribe(); 25 | Fire.stream().addContact(TestScript.testUser1(), ContactType.contact()).subscribe(); 26 | }; 27 | 28 | FirebaseAuth.getInstance().addAuthStateListener(firebaseAuth -> { 29 | // We are connecting for the first time 30 | if (firebaseAuth.getCurrentUser() == null) { 31 | firebaseAuth.signInAnonymously().addOnCompleteListener(task -> { 32 | 33 | }); 34 | } 35 | }); 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/sdk/chat/StartActivity.java: -------------------------------------------------------------------------------- 1 | package sdk.chat; 2 | 3 | import android.app.Activity; 4 | 5 | public class StartActivity extends Activity { 6 | } 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chat-sdk/firestream-android/334b2e74b098277a3a3ab0e1632f04f3e01b04f0/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chat-sdk/firestream-android/334b2e74b098277a3a3ab0e1632f04f3e01b04f0/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chat-sdk/firestream-android/334b2e74b098277a3a3ab0e1632f04f3e01b04f0/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-es/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Chat SDK 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values-nl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Chat SDK 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values-pt/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Chat SDK 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values-zh/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Chat SDK 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Firestream 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | import org.gradle.internal.os.OperatingSystem 3 | 4 | buildscript { 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.6.3' 11 | classpath "com.google.gms:google-services:4.3.3" 12 | classpath 'com.novoda:bintray-release:0.9.2' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.71" 14 | classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.1' 15 | classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1' 16 | classpath 'com.google.firebase:perf-plugin:1.3.1' 17 | } 18 | } 19 | 20 | ext { 21 | bintrayVersion = "1.8.4" 22 | mavenGradleVersion = "2.1" 23 | androidxAppcompatVersion = "1.1.0" 24 | androidxConstraintLayoutVersion = "2.0.0-beta5" 25 | androidxLifecycleExtensionsVersion = "2.2.0" 26 | androidxRecyclerViewVersion = "1.1.0" 27 | androidxMultidexVersion = "2.0.1" 28 | materialVersion = "1.1.0" 29 | playAuthVersion = "17.0.0" 30 | playMapsVersion = "17.0.0" 31 | playLocationVersion = "17.0.0" 32 | firebaseUiVersion = "6.2.0" 33 | firebaseCoreVersion = "17.4.1" 34 | firebaseDatabaseVersion = "19.3.0" 35 | firebaseFirestoreVersion = "21.4.3" 36 | firebaseAuthVersion = "19.3.1" 37 | firebaseStorageVersion = "19.1.1" 38 | firebaseMessagingVersion = "20.1.7" 39 | firebaseFunctionsVersion = "19.0.2" 40 | firebaseIIDVersion = "18.0.0" 41 | firebasePerformanceVersion = "19.0.7" 42 | firebaseCrashlyticsVersion = "17.0.0" 43 | firebaseAnalyticsVersion = "17.4.1" 44 | greenDaoVersion = "3.2.2" 45 | frescoVersion = "1.13.0" 46 | rxJavaVersion = "2.2.17" 47 | rxAndroidVersion = "2.1.1" 48 | rxRelayVersion = "2.1.1" 49 | rxQueueVersion = "2.0.0" 50 | compressorVersion = "2.1.0" 51 | okHttpVersion = "3.11.0" 52 | okHttpDownloaderVersion = "1.1.0" 53 | prettyTimeVersion = "4.0.1.Final" 54 | imageCropperVersion = "2.8.0" 55 | photoViewVersion = "2.3.0" 56 | androidDatabaseSQLCipher = "4.3.0" 57 | matisseVersion = "0.5.3-beta3b1" 58 | chatKit = "0.3.3b11" 59 | shapeImageViewVersion = "0.9.+@aar" 60 | circleImageViewVersion = "3.1.0" 61 | dexterVersion = "6.0.2" 62 | tinyLogVersion = "1.3.6" 63 | butterKnifeVersion = "10.2.1" 64 | 65 | iconicsVersion = "5.0.0-a01" 66 | materialDrawerVersion = "8.0.0-a07" 67 | // iconicsMaterialDesignIconsVersion = "5.0.1.0-kotlin@aar" 68 | iconicsGoogleMaterialIconsVersion = "3.0.1.4.original-kotlin@aar" 69 | iconicsFontAwesomeTypefaceVersion = "5.3.1.2-kotlin@aar" 70 | materialSearchVersion = "1.4.0" 71 | materialSpinnerVersion = "1.3.1" 72 | keyboardVisibilityEventVersion = "3.0.0-RC2" 73 | androidAudioRecorderVersion = "0.3.0" 74 | glideVersion = "4.11.0" 75 | exoplayerVersion = "2.11.3" 76 | androidAudioConverterVersion = "0.0.8" 77 | 78 | // Used by file messages 79 | androidNetworkingVersion = "1.0.2" 80 | pdfiumVersion = "1.9.0" 81 | 82 | smackVersion = "4.3.4" 83 | 84 | } 85 | 86 | allprojects { 87 | if (OperatingSystem.current().isWindows()) { 88 | buildDir = "C:/tmp/${rootProject.name}/${project.name}" 89 | } 90 | repositories { 91 | google() 92 | maven { url "https://jitpack.io" } 93 | jcenter() 94 | maven { url "http://dl.bintray.com/chat-sdk/chat-sdk-android" } 95 | } 96 | } 97 | 98 | subprojects { 99 | tasks.withType(Javadoc).all { enabled = false } 100 | } 101 | 102 | 103 | -------------------------------------------------------------------------------- /demo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /demo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.google.gms.google-services' 3 | apply plugin: 'com.jakewharton.butterknife' 4 | 5 | android { 6 | 7 | compileSdkVersion Integer.parseInt(project.ANDROID_COMPILE_SDK_VERSION) 8 | 9 | defaultConfig { 10 | applicationId "sdk.chat.android.live" 11 | 12 | multiDexEnabled = true 13 | minSdkVersion Integer.parseInt(project.MIN_SDK) 14 | targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION) 15 | 16 | versionName CHAT_SDK_VERSION 17 | versionCode CHAT_SDK_BUILD_NUMBER as int 18 | } 19 | 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | 27 | compileOptions { 28 | sourceCompatibility JavaVersion.VERSION_1_8 29 | targetCompatibility JavaVersion.VERSION_1_8 30 | } 31 | 32 | } 33 | 34 | dependencies { 35 | implementation fileTree(dir: 'libs', include: ['*.jar']) 36 | 37 | implementation "com.firebaseui:firebase-ui-auth:$firebaseUiVersion" 38 | implementation 'com.github.stfalcon:chatkit:0.3.3' 39 | 40 | implementation "com.jakewharton:butterknife:$butterKnifeVersion" 41 | annotationProcessor "com.jakewharton:butterknife-compiler:$butterKnifeVersion" 42 | implementation 'androidmads.library.qrgenearator:QRGenearator:1.0.4' 43 | api "androidx.constraintlayout:constraintlayout:$androidxConstraintLayoutVersion" 44 | implementation 'com.github.blikoon:QRCodeScanner:0.1.2' 45 | implementation "androidx.recyclerview:recyclerview:$androidxRecyclerViewVersion" 46 | implementation "com.karumi:dexter:$dexterVersion" 47 | 48 | implementation project(':firestream') 49 | implementation project(':firestream-realtime') 50 | implementation project(':firestream-firestore') 51 | 52 | 53 | // implementation "sdk.chat:firestream:5.0.4" 54 | // implementation "sdk.chat:firestream-realtime:5.0.4" 55 | // implementation "sdk.chat:firestream-firestore:5.0.4" 56 | 57 | } 58 | -------------------------------------------------------------------------------- /demo/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "1088435112418", 4 | "firebase_url": "https://chat-sdk-v4.firebaseio.com", 5 | "project_id": "chat-sdk-v4", 6 | "storage_bucket": "chat-sdk-v4.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:1088435112418:android:813ea9bf20e0a13f5611bb", 12 | "android_client_info": { 13 | "package_name": "sdk.chat.android.live" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "1088435112418-900e65u7oloc6tvbf9cl9qv5fjctv4t7.apps.googleusercontent.com", 19 | "client_type": 1, 20 | "android_info": { 21 | "package_name": "sdk.chat.android.live", 22 | "certificate_hash": "e4e36b1e2f9ac7d7b8e867e08c94cb1dbfaaf9c4" 23 | } 24 | }, 25 | { 26 | "client_id": "1088435112418-e3t77t8jl2ucs8efeqs72o696in8soui.apps.googleusercontent.com", 27 | "client_type": 3 28 | } 29 | ], 30 | "api_key": [ 31 | { 32 | "current_key": "AIzaSyAf-dkxZw1m-mP_E-jpTvk1lFtGioev6m0" 33 | } 34 | ], 35 | "services": { 36 | "appinvite_service": { 37 | "other_platform_oauth_client": [ 38 | { 39 | "client_id": "1088435112418-7gfr9061rqnlg5fj1d510unql3mu5qjp.apps.googleusercontent.com", 40 | "client_type": 3 41 | }, 42 | { 43 | "client_id": "1088435112418-94j149s4i4q32u4m8s0dqt5ctdpfd235.apps.googleusercontent.com", 44 | "client_type": 2, 45 | "ios_info": { 46 | "bundle_id": "org.cocoapods.FireStream-Tests" 47 | } 48 | } 49 | ] 50 | } 51 | } 52 | } 53 | ], 54 | "configuration_version": "1" 55 | } -------------------------------------------------------------------------------- /demo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /demo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /demo/src/main/java/sdk/chat/demo/ChatActivity.java: -------------------------------------------------------------------------------- 1 | package sdk.chat.demo; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.widget.ImageView; 6 | 7 | import androidx.annotation.Nullable; 8 | 9 | import com.stfalcon.chatkit.commons.ImageLoader; 10 | import com.stfalcon.chatkit.dialogs.DialogsListAdapter; 11 | import com.stfalcon.chatkit.messages.MessageInput; 12 | import com.stfalcon.chatkit.messages.MessagesList; 13 | import com.stfalcon.chatkit.messages.MessagesListAdapter; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | import androidmads.library.qrgenearator.QRGContents; 19 | import androidmads.library.qrgenearator.QRGEncoder; 20 | import butterknife.BindView; 21 | import butterknife.ButterKnife; 22 | import firestream.chat.message.Body; 23 | import firestream.chat.message.Sendable; 24 | import firestream.chat.message.TextMessage; 25 | import firestream.chat.namespace.Fire; 26 | import io.reactivex.disposables.Disposable; 27 | import io.reactivex.functions.Consumer; 28 | import sdk.guru.common.DisposableMap; 29 | import sdk.guru.common.Event; 30 | import sdk.guru.common.RX; 31 | 32 | import static firestream.chat.message.TextMessage.TextKey; 33 | 34 | public class ChatActivity extends Activity { 35 | 36 | @BindView(R.id.messagesList) 37 | MessagesList messagesList; 38 | @BindView(R.id.input) 39 | MessageInput input; 40 | 41 | MessagesListAdapter adapter; 42 | 43 | String otherUserId; 44 | 45 | @Override 46 | protected void onCreate(Bundle savedInstanceState) { 47 | super.onCreate(savedInstanceState); 48 | 49 | otherUserId = getIntent().getStringExtra("id"); 50 | if (otherUserId == null || otherUserId.isEmpty()) { 51 | finish(); 52 | } 53 | 54 | setContentView(R.layout.activity_chat); 55 | ButterKnife.bind(this); 56 | 57 | adapter = new MessagesListAdapter<>(Fire.stream().currentUserId(), new ImageLoader() { 58 | @Override 59 | public void loadImage(ImageView imageView, @Nullable String url, @Nullable Object payload) { 60 | QRGEncoder qrgEncoder = new QRGEncoder(url, null, QRGContents.Type.TEXT, 200); 61 | imageView.setImageBitmap(qrgEncoder.getBitmap()); 62 | } 63 | }); 64 | messagesList.setAdapter(adapter); 65 | 66 | input.setInputListener(input -> { 67 | //validate and send message 68 | Fire.stream().sendMessageWithText(otherUserId, input.toString(), s -> { 69 | Sendable sendable = new Sendable(s, Fire.stream().currentUserId()); 70 | TextMessage message = TextMessage.fromSendable(sendable); 71 | message.getBody().put(TextKey, input.toString()); 72 | MessageMemoryStore.instance.addMessage(otherUserId, message); 73 | RX.main().scheduleDirect(this::reload); 74 | }).subscribe(); 75 | return true; 76 | }); 77 | 78 | Disposable d = Fire.stream().getSendableEvents().getMessages().observeOn(RX.main()).subscribe(messageEvent -> { 79 | if (messageEvent.isAdded()) { 80 | MessageMemoryStore.instance.addMessage(otherUserId, messageEvent.get()); 81 | } 82 | reload(); 83 | }); 84 | 85 | reload(); 86 | 87 | } 88 | 89 | public void reload() { 90 | adapter.clear(); 91 | for (Sendable s: MessageMemoryStore.instance.sendablesForUser(otherUserId)) { 92 | adapter.addToStart(new Message(s), true); 93 | } 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /demo/src/main/java/sdk/chat/demo/MainApplication.java: -------------------------------------------------------------------------------- 1 | package sdk.chat.demo; 2 | 3 | import android.app.Application; 4 | 5 | import firestream.chat.FirestreamConfig; 6 | import firestream.chat.firestore.FirestoreService; 7 | import firestream.chat.namespace.Fire; 8 | import sdk.guru.common.DisposableMap; 9 | 10 | /** 11 | * Created by Ben Smiley on 6/8/2014. 12 | */ 13 | //public class MainApplication extends MultiDexApplication { 14 | public class MainApplication extends Application { 15 | 16 | protected DisposableMap dm = new DisposableMap(); 17 | 18 | @Override 19 | public void onCreate() { 20 | super.onCreate(); 21 | 22 | Fire.stream().initialize(this, new FirestreamConfig(this).setRoot("firestream").setSandbox("demo"), new FirestoreService()); 23 | 24 | 25 | // Fire.stream().sendMessageWithText("userId", "Hello World!"); 26 | // 27 | // Disposable d = Fire.stream().getSendableEvents().getMessages().pastAndNewEvents().subscribe(messageEvent -> { 28 | // if (messageEvent.isAdded()) { 29 | // // Message received 30 | // String text = messageEvent.get().toTextMessage().getText(); 31 | // Logger.debug(text); 32 | // } 33 | // if (messageEvent.isRemoved()) { 34 | // // Message removed 35 | // } 36 | // }); 37 | // 38 | // // If you want to stop listening 39 | // d.dispose(); 40 | // 41 | // // Get the current user's id 42 | // Fire.stream().currentUserId(); 43 | // 44 | // // Create a new chat room 45 | // dm.add(Fire.stream().createChat("name", "url", new User("1"), new User("2")).subscribe(chat -> { 46 | // 47 | // // Send a message 48 | // chat.sendMessageWithText("Hello World!"); 49 | // 50 | // // Add a user 51 | // chat.addUser(true, new User("3")).subscribe(); 52 | // 53 | // // Make a user an admin 54 | // chat.setRole(new User("2"), RoleType.admin()).subscribe(); 55 | // 56 | // })); 57 | // 58 | // // Listen for new chat rooms we have been added to 59 | // dm.add(Fire.stream().getChatEvents().pastAndNewEvents().subscribe(chatEvent -> { 60 | // if (chatEvent.isAdded()) { 61 | // IChat chat = chatEvent.get(); 62 | // 63 | // // Get a message listener 64 | // chat.manage(chat.getSendableEvents().getMessages().pastAndNewEvents().subscribe(messageEvent -> { 65 | // String text = messageEvent.get().toTextMessage().getText(); 66 | // Logger.debug(text); 67 | // })); 68 | // } 69 | // })); 70 | 71 | 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /demo/src/main/java/sdk/chat/demo/Message.java: -------------------------------------------------------------------------------- 1 | package sdk.chat.demo; 2 | 3 | import com.stfalcon.chatkit.commons.models.IMessage; 4 | import com.stfalcon.chatkit.commons.models.IUser; 5 | 6 | import java.util.Date; 7 | 8 | import firestream.chat.message.Sendable; 9 | 10 | public class Message implements IMessage { 11 | 12 | Sendable sendable; 13 | 14 | public Message(Sendable sendable) { 15 | this.sendable = sendable; 16 | } 17 | 18 | @Override 19 | public String getId() { 20 | return sendable.getId(); 21 | } 22 | 23 | @Override 24 | public String getText() { 25 | return sendable.toTextMessage().getText(); 26 | } 27 | 28 | @Override 29 | public IUser getUser() { 30 | return new User(sendable.getFrom()); 31 | } 32 | 33 | @Override 34 | public Date getCreatedAt() { 35 | return sendable.getDate(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /demo/src/main/java/sdk/chat/demo/MessageMemoryStore.java: -------------------------------------------------------------------------------- 1 | package sdk.chat.demo; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import firestream.chat.message.Sendable; 9 | 10 | public class MessageMemoryStore { 11 | 12 | public static final MessageMemoryStore instance = new MessageMemoryStore(); 13 | Map> messages = new HashMap<>(); 14 | 15 | public void addMessage(String userId, Sendable sendable) { 16 | List list = messages.get(userId); 17 | if (list == null) { 18 | list = new ArrayList<>(); 19 | messages.put(userId, list); 20 | } 21 | for (Sendable s: list) { 22 | if (s.getId().equals(sendable.getId())) { 23 | return; 24 | } 25 | } 26 | list.add(sendable); 27 | } 28 | 29 | public List sendablesForUser(String userId) { 30 | List sendables = messages.get(userId); 31 | if (sendables == null) { 32 | return new ArrayList<>(); 33 | } 34 | return messages.get(userId); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /demo/src/main/java/sdk/chat/demo/Thread.java: -------------------------------------------------------------------------------- 1 | package sdk.chat.demo; 2 | 3 | import com.stfalcon.chatkit.commons.models.IDialog; 4 | import com.stfalcon.chatkit.commons.models.IUser; 5 | 6 | import java.util.Arrays; 7 | import java.util.List; 8 | 9 | import firestream.chat.message.Sendable; 10 | import firestream.chat.namespace.Fire; 11 | 12 | public class Thread implements IDialog { 13 | 14 | String id; 15 | Message lastMessage; 16 | 17 | public Thread(String id) { 18 | this.id = id; 19 | } 20 | 21 | 22 | @Override 23 | public String getId() { 24 | return id; 25 | } 26 | 27 | @Override 28 | public String getDialogPhoto() { 29 | return id; 30 | } 31 | 32 | @Override 33 | public String getDialogName() { 34 | return id; 35 | } 36 | 37 | @Override 38 | public List getUsers() { 39 | return Arrays.asList(new User(id)); 40 | } 41 | 42 | @Override 43 | public Message getLastMessage() { 44 | List sendables = MessageMemoryStore.instance.sendablesForUser(id); 45 | if (sendables != null && sendables.size() > 0) { 46 | return new Message(sendables.get(sendables.size() - 1)); 47 | } 48 | return null; 49 | } 50 | 51 | @Override 52 | public void setLastMessage(Message message) { 53 | lastMessage = message; 54 | } 55 | 56 | @Override 57 | public int getUnreadCount() { 58 | return 0; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /demo/src/main/java/sdk/chat/demo/User.java: -------------------------------------------------------------------------------- 1 | package sdk.chat.demo; 2 | 3 | import com.stfalcon.chatkit.commons.models.IUser; 4 | 5 | public class User implements IUser { 6 | 7 | public User(String id) { 8 | this.id = id; 9 | } 10 | 11 | String id; 12 | 13 | @Override 14 | public String getId() { 15 | return id; 16 | } 17 | 18 | @Override 19 | public String getName() { 20 | return id; 21 | } 22 | 23 | @Override 24 | public String getAvatar() { 25 | return id; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_chat.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 13 | 22 | 23 | 28 | 29 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_start.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 13 | 14 | 19 | 20 | 24 | 25 |