Skip to content

Commit

Permalink
release v1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristiyan Petrov committed Sep 20, 2019
1 parent adab22d commit e260e4e
Show file tree
Hide file tree
Showing 16 changed files with 263 additions and 169 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,6 +8,7 @@ Thumbs.db
# Built application files
*.apk
*.ap_
*.aab

# Files for the ART/Dalvik VM
*.dex
Expand Down
6 changes: 4 additions & 2 deletions build.gradle
Expand Up @@ -9,7 +9,7 @@ apply plugin: 'com.github.ben-manes.versions'
buildscript {

ext.sdkVersion = 28
ext.buildToolsVersion = "28.0.3"
ext.buildToolsVersion = "28.0.4"
ext.stethoVersion = "1.5.0"

ext.keyStoreAlias = { buildType -> return " " }
Expand All @@ -22,6 +22,8 @@ buildscript {
ext.fabricApiSecret = { -> return "" }
ext.crashlyticsAppId = { -> return "" }

ext.playStoreCredentialsFilePath = { return " " }

repositories {
google()
jcenter()
Expand All @@ -33,7 +35,7 @@ buildscript {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.21.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.google.gms:google-services:4.3.0' // Google Services plugin
classpath 'com.google.gms:google-services:4.3.2' // Google Services plugin
}
}

Expand Down
49 changes: 31 additions & 18 deletions demo_app/app/build.gradle
Expand Up @@ -5,41 +5,41 @@

buildscript {
repositories {
google()
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'https://maven.fabric.io/public' }
google()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath "com.github.triplet.gradle:play-publisher:2.2.1"
}
}

apply plugin: 'com.android.application'
apply from: 'versions.gradle'
apply plugin: 'io.fabric'

repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: "com.github.triplet.play"

def gsonVersion = '2.8.5'
def okHttpVersion = '3.12.0'
def stethoVersion = "1.5.1"
def retrofitVersion = '2.6.0'
def retrofitVersion = '2.6.1'
def leakCanaryVersion = "2.0-alpha-3"
def butterKnifeVersion = "10.1.0"
def fastAdapterVersion = "3.3.1"
def picassoLibVersion = "2.71828"
def jUnitLibVersion = "4.12"
def multiDexLibVersion = "2.0.1"
def crashlyticsLibVersion = "2.10.1"
def firebaseMessagingLibVersion = '19.0.1'
def firebaseMessagingLibVersion = '20.0.0'
def phoenixProcessLibVersion = "2.0.0"
def work_version = "2.1.0"
def bandyerLibVersion = "1.3.0"
def androidX = "1.0.0"
def androidXPreference = "1.1.0-rc01"
def work_version = '2.2.0'
def bandyerLibVersion = "1.3.1"
def androidX = '1.0.2'
def androidDesign = '1.0.0'
def androidXPreference = "1.1.0"
def constraintLayoutVersion = "1.1.3"
def lifecycleVersion = "2.0.0"
def lifecycleVersion = "2.1.0"
def expansionLayoutVersion = "1.2.2"

android {
Expand All @@ -49,7 +49,7 @@ android {
applicationId "com.bandyer.demo_android_sdk"
minSdkVersion 16
targetSdkVersion sdkVersion
versionCode 1
versionCode VERSION_CODE.toInteger()
versionName bandyerLibVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [
Expand Down Expand Up @@ -99,8 +99,14 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

// Optionally configures multiple APKs based on screen density and cpu architecture.
// For further information see: https://developer.android.com/studio/build/configure-apk-splits
// If you are not building an AAB, which we recommend you to do.
// You can optionally configures multiple APKs based on screen density and cpu architecture.
// Be aware that you will need to handle the versionCode differently for each split.

// For further information see:
// https://developer.android.com/studio/build/configure-apk-splits
// and to see a more in depth guide:
// https://androidbycode.wordpress.com/2015/06/30/android-ndk-version-code-scheme-for-publishing-apks-per-architecture/
splits {

abi {
Expand All @@ -124,8 +130,8 @@ dependencies {
implementation "androidx.multidex:multidex:$multiDexLibVersion"

implementation "androidx.appcompat:appcompat:$androidX"
implementation "com.google.android.material:material:$androidX"
implementation "androidx.recyclerview:recyclerview:$androidX"
implementation "com.google.android.material:material:$androidDesign"
implementation "androidx.recyclerview:recyclerview:$androidDesign"
implementation "androidx.preference:preference:$androidXPreference"
implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycleVersion"
Expand All @@ -148,7 +154,7 @@ dependencies {
implementation "com.google.code.gson:gson:$gsonVersion"
implementation "com.jakewharton:butterknife:$butterKnifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$butterKnifeVersion"
implementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"

/*** UI ***/
implementation "com.mikepenz:fastadapter:$fastAdapterVersion"
Expand All @@ -165,13 +171,20 @@ dependencies {
implementation "com.bandyer:bandyer-android-sdk:$bandyerLibVersion"
}

play {
if (playStoreCredentialsFilePath()?.trim()) serviceAccountCredentials = file(playStoreCredentialsFilePath())
track = "beta"
defaultToAppBundles = true
}

/**
* The following code is used to release the demo App on fabric
* This code is also prepared to be tweaked to support different flavors
*/
File crashlyticsProperties = new File("${project.projectDir.absolutePath}/fabric.properties")

android.applicationVariants.all { variant ->
versions.apply(variant)
variant.outputs.each { output ->
// Filter is null for universal APKs.
def filter = output.getFilter(com.android.build.OutputFile.ABI)
Expand Down
Expand Up @@ -125,6 +125,45 @@ public class MainActivity extends CollapsingToolbarActivity implements BandyerSD

private ArrayList<UserSelectionItem> usersList = new ArrayList<>();

private CallObserver callObserver = new CallObserver() {
@Override
public void onCallStarted() {
Log.d(TAG, "onCallStarted");
showOngoingCallLabel();
}

@Override
public void onCallEnded() {
Log.d(TAG, "onCallEnded");
hideOngoingCallLabel();
}

@Override
public void onCallEndedWithError(@NonNull CallException callException) {
Log.d(TAG, "onCallEnded with error: " + callException.getMessage());
hideOngoingCallLabel();
showErrorDialog(callException.getMessage());
}
};

private ChatObserver chatObserver = new ChatObserver() {
@Override
public void onChatStarted() {
Log.d(TAG, "onChatStarted");
}

@Override
public void onChatEnded() {
Log.d(TAG, "onChatEnded");
}

@Override
public void onChatEndedWithError(@NonNull ChatException chatException) {
Log.d(TAG, "onChatEndedWithError: " + chatException.getMessage());
showErrorDialog(chatException.getMessage());
}
};

public static void show(Activity context) {
Intent intent = new Intent(context, MainActivity.class);
context.startActivity(intent);
Expand Down Expand Up @@ -173,6 +212,8 @@ protected void onPause() {

BandyerSDKClient.getInstance().removeObserver(this);
BandyerSDKClient.getInstance().removeModuleObserver(this);

hideKeyboard(true);
}

@Override
Expand Down Expand Up @@ -207,9 +248,6 @@ protected void onResume() {
private void startBandyerSdk(String userAlias) {
Log.d(TAG, "startBandyerSDK");

if (BandyerSDKClient.getInstance().getState() != BandyerSDKClientState.UNINITIALIZED)
return;

if (chatButton != null) chatButton.setEnabled(false);
if (callButton != null) callButton.setEnabled(false);

Expand All @@ -221,67 +259,34 @@ private void startBandyerSdk(String userAlias) {
});
}

BandyerSDKClientOptions options = new BandyerSDKClientOptions.Builder()
.keepListeningForEventsInBackground(false)
.build();
BandyerSDKClient.getInstance().init(userAlias, options);
if (BandyerSDKClient.getInstance().getState() == BandyerSDKClientState.UNINITIALIZED) {
BandyerSDKClientOptions options = new BandyerSDKClientOptions.Builder()
.keepListeningForEventsInBackground(false)
.build();
BandyerSDKClient.getInstance().init(userAlias, options);
}

// Start listening for events
BandyerSDKClient.getInstance().startListening();

addModulesObservers();
}

/**
* Adds chat and call modules observers.
* The observers will be notified when a chat or a call UI will be started, closed or closed with errors.
*/
private void addModulesObservers() {
// set an observer for the call to show ongoing call label
CallModule callModule = BandyerSDKClient.getInstance().getCallModule();
setCallObserver(callModule);
if (callModule != null) {
callModule.addCallObserver(this, callObserver);
}

// set an observer for the chat
ChatModule chatModule = BandyerSDKClient.getInstance().getChatModule();
setChatObserver(chatModule);
}

private void setCallObserver(CallModule callModule) {
if (callModule == null) return;
callModule.addCallObserver(this, new CallObserver() {
@Override
public void onCallStarted() {
Log.d(TAG, "onCallStarted");
showOngoingCallLabel();
}

@Override
public void onCallEnded() {
Log.d(TAG, "onCallEnded");
hideOngoingCallLabel();
}

@Override
public void onCallEndedWithError(@NonNull CallException callException) {
Log.d(TAG, "onCallEnded with error: " + callException.getMessage());
hideOngoingCallLabel();
showErrorDialog(callException.getMessage());
}
});
}


private void setChatObserver(ChatModule chatModule) {
if (chatModule == null) return;
chatModule.addChatObserver(this, new ChatObserver() {
@Override
public void onChatStarted() {
Log.d(TAG, "onChatStarted");
}

@Override
public void onChatEnded() {
Log.d(TAG, "onChatEnded");
}

@Override
public void onChatEndedWithError(@NonNull ChatException chatException) {
Log.d(TAG, "onChatEndedWithError: " + chatException.getMessage());
showErrorDialog(chatException.getMessage());
}
});
if (chatModule != null)
chatModule.addChatObserver(this, chatObserver);
}

/**
Expand Down
@@ -1,14 +1,11 @@
package com.bandyer.demo_android_sdk.adapter_items;

import android.graphics.Color;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;

import com.bandyer.demo_android_sdk.R;
import com.bandyer.demo_android_sdk.utils.Utils;
import com.mikepenz.fastadapter.items.AbstractItem;
import java.util.List;

Expand Down

0 comments on commit e260e4e

Please sign in to comment.