Skip to content

Commit

Permalink
Merge pull request #792 from QuickBlox/sample-push-kotlin
Browse files Browse the repository at this point in the history
4.0.2-push-kotlin
  • Loading branch information
vdovbnya-qb authored May 31, 2022
2 parents 9512299 + 244cdd8 commit e9a5a90
Show file tree
Hide file tree
Showing 16 changed files with 101 additions and 293 deletions.
26 changes: 8 additions & 18 deletions sample-pushnotifications-kotlin/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinGradlePluginVersion"
classpath "io.fabric.tools:gradle:$fabricToolsVersion"
}
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'
apply from: "../artifacts.gradle"
apply plugin: 'com.google.gms.google-services'

Expand All @@ -23,27 +20,25 @@ androidExtensions {

repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/"
}
maven { url 'https://maven.fabric.io/public' }
flatDir { dirs 'libs' }
}

android {
def versionQACode = 1

compileSdkVersion 28
buildToolsVersion "28.0.3"
compileSdkVersion 31
buildToolsVersion "31.0.0"
flavorDimensions dimensionDefault

defaultConfig {
applicationId "com.quickblox.sample.pushnotifications.kotlin"
minSdkVersion 14
targetSdkVersion 28
versionCode 401000
versionName '4.0.1-kotlin'
minSdkVersion 21
targetSdkVersion 31
versionCode 402000
versionName '4.0.2-kotlin'
multiDexEnabled true
}

Expand Down Expand Up @@ -97,14 +92,9 @@ android {
}

dependencies {

implementation("com.quickblox:quickblox-android-sdk-messages:$qbSdkVersion")

implementation "com.google.firebase:firebase-core:$firebaseCoreVersion"
implementation("com.google.android.material:material:$materialVersion")
implementation("com.github.johnkil.android-robototextview:robototextview:$robotoTextViewVersion")
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinGradlePluginVersion")
implementation("com.crashlytics.sdk.android:crashlytics:$crashlyticsVersion@aar") {
transitive = true
}
}
145 changes: 10 additions & 135 deletions sample-pushnotifications-kotlin/app/google-services.json
Original file line number Diff line number Diff line change
@@ -1,154 +1,29 @@
{
"project_info": {
"project_number": "247738611464",
"firebase_url": "https://qb-prod-samples.firebaseio.com",
"project_id": "qb-prod-samples",
"storage_bucket": "qb-prod-samples.appspot.com"
"project_number": "Put here your value",
"firebase_url": "https://qb-samples.firebaseio.com",
"project_id": "qb-samples",
"storage_bucket": "qb-samples.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:247738611464:android:beb270faa2c3a789",
"android_client_info": {
"package_name": "com.quickblox.sample.chat.java"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyBFXAfVr6kkFJdDNOm8U-c7iju0qIUkc_A"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "247738611464-v2nvd29bmqum7niosnfuh28oq3beh9f6.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:247738611464:android:1cdc72e9ffd29448",
"android_client_info": {
"package_name": "com.quickblox.sample.chat.kotlin"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyBFXAfVr6kkFJdDNOm8U-c7iju0qIUkc_A"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "247738611464-v2nvd29bmqum7niosnfuh28oq3beh9f6.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:247738611464:android:06cb0de4c719ad84",
"android_client_info": {
"package_name": "com.quickblox.sample.pushnotifications.java"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyBFXAfVr6kkFJdDNOm8U-c7iju0qIUkc_A"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "247738611464-v2nvd29bmqum7niosnfuh28oq3beh9f6.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:247738611464:android:c2749661061637f0",
"mobilesdk_app_id": "Put here your value",
"android_client_info": {
"package_name": "com.quickblox.sample.pushnotifications.kotlin"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyBFXAfVr6kkFJdDNOm8U-c7iju0qIUkc_A"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "247738611464-v2nvd29bmqum7niosnfuh28oq3beh9f6.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:247738611464:android:99e5b55a490c901c",
"android_client_info": {
"package_name": "com.quickblox.sample.videochat.java"
}
},
"oauth_client": [],
"api_key": [
"oauth_client": [
{
"current_key": "AIzaSyBFXAfVr6kkFJdDNOm8U-c7iju0qIUkc_A"
"client_id": "Put here your value",
"client_type": 3
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "247738611464-v2nvd29bmqum7niosnfuh28oq3beh9f6.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:247738611464:android:ac22e0d1b3a3e86b",
"android_client_info": {
"package_name": "com.quickblox.sample.videochat.kotlin"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyBFXAfVr6kkFJdDNOm8U-c7iju0qIUkc_A"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "247738611464-v2nvd29bmqum7niosnfuh28oq3beh9f6.apps.googleusercontent.com",
"client_type": 3
}
]
"current_key": "Put here your value"
}
}
]
}
],
"configuration_version": "1"
Expand Down
52 changes: 9 additions & 43 deletions sample-pushnotifications-kotlin/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/tereha/Android/sdk/tools/proguard/proguard-android.txt

# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
Expand All @@ -23,48 +21,16 @@
##---------------Begin: proguard configuration for Gson ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes EnclosingMethod
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes Exceptions

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-keep class sun.misc.Unsafe { *; }
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class com.quickblox.core.account.model.** { *; }


##---------------End: proguard configuration for Gson ----------
#quickblox sample chat

-keep class com.quickblox.auth.parsers.** { *; }
-keep class com.quickblox.auth.model.** { *; }
-keep class com.quickblox.core.parser.** { *; }
-keep class com.quickblox.core.model.** { *; }
-keep class com.quickblox.core.server.** { *; }
-keep class com.quickblox.core.rest.** { *; }
-keep class com.quickblox.core.error.** { *; }
-keep class com.quickblox.core.Query { *; }

-keep class com.quickblox.users.parsers.** { *; }
-keep class com.quickblox.users.model.** { *; }

-keep class com.quickblox.chat.parser.** { *; }
-keep class com.quickblox.chat.model.** { *; }

-keep class com.quickblox.messages.parsers.** { *; }
-keep class com.quickblox.messages.model.** { *; }

-keep class com.quickblox.content.parsers.** { *; }
-keep class com.quickblox.content.model.** { *; }

-keep class org.jivesoftware.** { *; }

#sample chat
-keep class android.support.v7.** { *; }
-keep class com.bumptech.** { *; }
#quickblox sdk
-keep class com.quickblox.** { *; }

-dontwarn org.jivesoftware.smackx.**
-dontwarn android.support.v4.app.**
#google gms
-keep class com.google.android.gms.** { *; }
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

<activity
android:name=".activities.SplashActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down Expand Up @@ -45,13 +46,17 @@
</intent-filter>
</service>

<service android:name="com.quickblox.messages.services.fcm.QBFcmPushListenerService">
<service
android:name="com.quickblox.messages.services.fcm.QBFcmPushListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

<service android:name="com.quickblox.messages.services.fcm.QBFcmPushInstanceIDService">
<service
android:name="com.quickblox.messages.services.fcm.QBFcmPushInstanceIDService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.quickblox.sample.pushnotifications.kotlin

import android.app.Application
import android.util.Log
import com.crashlytics.android.Crashlytics
import com.google.android.gms.common.GoogleApiAvailability
import com.quickblox.auth.session.QBSession
import com.quickblox.auth.session.QBSessionManager
Expand All @@ -11,15 +10,14 @@ import com.quickblox.auth.session.QBSettings
import com.quickblox.messages.services.QBPushManager
import com.quickblox.sample.pushnotifications.kotlin.utils.ActivityLifecycle
import com.quickblox.sample.pushnotifications.kotlin.utils.shortToast
import io.fabric.sdk.android.Fabric

//App Credentials
// app credentials
private const val APPLICATION_ID = ""
private const val AUTH_KEY = ""
private const val AUTH_SECRET = ""
private const val ACCOUNT_KEY = ""

//Default user config
// default user config
const val DEFAULT_USER_PASSWORD = "quickblox"

class App : Application() {
Expand All @@ -38,7 +36,6 @@ class App : Application() {
checkConfig()
initCredentials()
initQBSessionManager()
initFabric()
initPushManager()
}

Expand All @@ -53,7 +50,7 @@ class App : Application() {
QBSettings.getInstance().init(applicationContext, APPLICATION_ID, AUTH_KEY, AUTH_SECRET)
QBSettings.getInstance().accountKey = ACCOUNT_KEY

// Uncomment and put your Api and Chat servers endpoints if you want to point the sample
// uncomment and put your Api and Chat servers endpoints if you want to point the sample
// against your own server.
//
// QBSettings.getInstance().setEndpoints("https://your_api_endpoint.com", "your_chat_endpoint", ServiceZone.PRODUCTION);
Expand Down Expand Up @@ -109,10 +106,4 @@ class App : Application() {
}
})
}

private fun initFabric() {
if (!BuildConfig.DEBUG) {
Fabric.with(this, Crashlytics())
}
}
}
Loading

0 comments on commit e9a5a90

Please sign in to comment.