Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/3.5.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
imablanco committed Dec 1, 2021
2 parents e14e1e7 + 0a3d67a commit a10bce9
Show file tree
Hide file tree
Showing 15 changed files with 132 additions and 73 deletions.
18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
![Applivery Logo](https://www.applivery.com/wp-content/uploads/2019/06/applivery-og.png)

![Android CI](https://github.com/applivery/applivery-android-sdk/workflows/Android%20CI/badge.svg)
[![Download](https://api.bintray.com/packages/applivery/maven/applivery-android-sdk/images/download.svg)](https://bintray.com/applivery/maven/applivery-android-sdk/_latestVersion)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.applivery/applivery-sdk/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.applivery/applivery-sdk/)
[![](https://jitpack.io/v/Applivery/applivery-android-sdk.svg)](https://jitpack.io/#Applivery/applivery-android-sdk)
[![Twitter](https://img.shields.io/badge/[email protected]?style=flat)](https://twitter.com/Applivery)

### Quality checks
Expand Down Expand Up @@ -49,13 +50,6 @@ You can get your APP TOKEN in your App -> Settings -> Integrations section.

## SDK Installation

<!--
### Gradle with jCenter dependency
[ ![Download](https://api.bintray.com/packages/applivery/maven/applivery-android-sdk/images/download.svg) ](https://bintray.com/applivery/maven/applivery-android-sdk/_latestVersion)
```groovy
implementation 'com.applivery:applivery-sdk:3.4'
```-->

### Gradle with JitPack Maven dependency
[![](https://jitpack.io/v/Applivery/applivery-android-sdk.svg)](https://jitpack.io/#Applivery/applivery-android-sdk)

Expand All @@ -72,19 +66,17 @@ Add the following repository to your's root gradle:
Add the following dependency to your app gradle:
```groovy
dependencies {
implementation 'com.github.Applivery:applivery-android-sdk:v3.4'
}
implementation 'com.github.Applivery:applivery-android-sdk:${latestVersion}'
```

### Gradle with Nexus/MavenCentral dependency

[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.applivery/applivery-sdk/badge.svg)](https://search.maven.org/#search%7Cga%7C1%7Capplivery)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.applivery/applivery-sdk/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.applivery/applivery-sdk/)

add the following dependency to your app gradle:

```groovy
compile 'com.applivery:applivery-android-sdk:3.4'
implementation 'com.applivery:applivery-android-sdk:${latestVersion}'
```

## SDK Setup
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.applivery.base.domain

import android.content.SharedPreferences
import androidx.core.content.edit
import com.applivery.base.di.InjectorUtils

class PreferencesManager(private val preferences: SharedPreferences) {

var anonymousEmail: String?
get() = preferences.getString(KeyEmail, null)
set(value) = preferences.edit { putString(KeyEmail, value) }

companion object {
private const val KeyEmail = "preferences:anonymous_email"

@Volatile
private var instance: PreferencesManager? = null

fun getInstance() =
instance ?: synchronized(this) {
instance ?: PreferencesManager(InjectorUtils.provideSharedPreferences()).also {
instance = it
}
}
}
}
4 changes: 4 additions & 0 deletions applivery-data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ android {

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'

buildConfigField STRING, "LibraryVersion", "\"$PUBLISH_VERSION\""
buildConfigField STRING, "MinSdk", "\"$versions.minSdk\""
buildConfigField STRING, "TargetSdk", "\"$versions.targetSdk\""
}

buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package com.applivery.data.interceptor

import android.os.Build
import com.applivery.base.util.AndroidCurrentAppInfo
import com.applivery.data.BuildConfig
import okhttp3.Interceptor
import okhttp3.Request
import okhttp3.Response
Expand All @@ -35,16 +36,16 @@ class HeadersInterceptor : Interceptor {

return original.newBuilder()
.addHeader("Accept-Language", Locale.getDefault().language)
.addHeader("x-sdk-version", "ANDROID_" + Build.VERSION.SDK_INT)
.addHeader("x-sdk-version", "ANDROID_" + BuildConfig.LibraryVersion)
.addHeader("x-app-version", packageInfo.versionName)
.addHeader("x-os-version", Build.VERSION.RELEASE)
.addHeader("x-os-name", "android")
.addHeader("x-device-vendor", Build.MANUFACTURER)
.addHeader("x-device-model", Build.MODEL)
.addHeader("x-package-name", packageInfo.name)
.addHeader("x-package-version", packageInfo.version.toString())
.addHeader("x-os-minsdkversion", "TBD") //TODO
.addHeader("x-os-targetsdkversion", "TBD") //TODO
.addHeader("x-os-minsdkversion", BuildConfig.MinSdk)
.addHeader("x-os-targetsdkversion", BuildConfig.TargetSdk)
.build()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import android.util.Log
import com.applivery.applvsdklib.domain.model.ErrorObject
import com.applivery.applvsdklib.tools.executor.InteractorExecutor
import com.applivery.applvsdklib.tools.executor.MainThread
import com.applivery.base.domain.PreferencesManager
import com.applivery.base.domain.SessionManager
import com.applivery.base.domain.model.UserData
import com.applivery.data.AppliveryApiService
Expand All @@ -29,7 +30,8 @@ class BindUserInteractor(
private val interactorExecutor: InteractorExecutor,
private val mainThread: MainThread,
private val apiService: AppliveryApiService,
private val sessionManager: SessionManager
private val sessionManager: SessionManager,
private val preferencesManager: PreferencesManager
) : Runnable {

lateinit var userData: UserData
Expand Down Expand Up @@ -59,6 +61,7 @@ class BindUserInteractor(
val token = apiLoginResponse?.data?.bearer
if (token != null) {
sessionManager.saveSession(token)
preferencesManager.anonymousEmail = null
notifySuccess()
} else {
Log.e(TAG, "Bind user response error")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.applivery.applvsdklib.domain.model.ErrorObject
import com.applivery.applvsdklib.domain.model.UserData
import com.applivery.applvsdklib.tools.executor.InteractorExecutor
import com.applivery.applvsdklib.tools.executor.MainThread
import com.applivery.base.domain.PreferencesManager
import com.applivery.base.domain.SessionManager
import com.applivery.data.AppliveryApiService
import com.applivery.data.request.LoginRequest
Expand All @@ -29,7 +30,8 @@ class LoginInteractor(
private val interactorExecutor: InteractorExecutor,
private val mainThread: MainThread,
private val apiService: AppliveryApiService,
private val sessionManager: SessionManager
private val sessionManager: SessionManager,
private val preferencesManager: PreferencesManager
) : Runnable {

lateinit var userData: UserData
Expand Down Expand Up @@ -59,6 +61,7 @@ class LoginInteractor(
val token = apiLoginResponse?.data?.bearer
if (token != null) {
sessionManager.saveSession(token)
preferencesManager.anonymousEmail = null
notifySuccess()
} else {
Log.e(TAG, "Make login response error")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ import android.util.Log
import com.applivery.applvsdklib.domain.model.ErrorObject
import com.applivery.applvsdklib.tools.executor.InteractorExecutor
import com.applivery.applvsdklib.tools.executor.MainThread
import com.applivery.base.domain.PreferencesManager
import com.applivery.base.domain.SessionManager
import java.io.IOException

class UnBindUserInteractor(
private val interactorExecutor: InteractorExecutor,
private val mainThread: MainThread,
private val sessionManager: SessionManager
private val sessionManager: SessionManager,
private val preferencesManager: PreferencesManager
) : Runnable {

lateinit var onSuccess: () -> Unit
Expand All @@ -44,6 +46,7 @@ class UnBindUserInteractor(
override fun run() {
try {
sessionManager.clearSession()
preferencesManager.anonymousEmail = null
notifySuccess()
} catch (exception: IOException) {
Log.e(TAG, "unBindUser() -> ${exception.message}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.applivery.applvsdklib.tools.executor.ThreadExecutor
import com.applivery.applvsdklib.ui.views.feedback.FeedbackView
import com.applivery.applvsdklib.ui.views.feedback.UserFeedbackPresenter
import com.applivery.applvsdklib.ui.views.login.LoginPresenter
import com.applivery.base.domain.PreferencesManager
import com.applivery.base.domain.SessionManager
import com.applivery.data.AppliveryApiService

Expand All @@ -39,7 +40,8 @@ internal object Injection {
return UserFeedbackPresenter(
feedbackView,
provideSessionManager(),
provideGetUserProfileInteractor()
provideGetUserProfileInteractor(),
providePreferencesManager()
)
}

Expand All @@ -48,25 +50,45 @@ internal object Injection {
val mainThread = provideMainThread()
val apiService = AppliveryApiService.getInstance()
val sessionManager = provideSessionManager()
val preferencesManager = providePreferencesManager()

return LoginInteractor(interactorExecutor, mainThread, apiService, sessionManager)
return LoginInteractor(
interactorExecutor,
mainThread,
apiService,
sessionManager,
preferencesManager
)
}

fun provideBindUserInteractor(): BindUserInteractor {
val interactorExecutor = provideInteractorExecutor()
val mainThread = provideMainThread()
val apiService = AppliveryApiService.getInstance()
val sessionManager = provideSessionManager()
val preferencesManager = providePreferencesManager()

return BindUserInteractor(interactorExecutor, mainThread, apiService, sessionManager)
return BindUserInteractor(
interactorExecutor,
mainThread,
apiService,
sessionManager,
preferencesManager
)
}

fun provideUnBindUserInteractor(): UnBindUserInteractor {
val interactorExecutor = provideInteractorExecutor()
val mainThread = provideMainThread()
val sessionManager = provideSessionManager()
val preferencesManager = providePreferencesManager()

return UnBindUserInteractor(interactorExecutor, mainThread, sessionManager)
return UnBindUserInteractor(
interactorExecutor,
mainThread,
sessionManager,
preferencesManager
)
}

fun provideGetUserProfileInteractor(): GetUserProfileInteractor {
Expand All @@ -89,4 +111,8 @@ internal object Injection {
fun provideSessionManager(): SessionManager {
return SessionManager.getInstance()
}

fun providePreferencesManager(): PreferencesManager {
return PreferencesManager.getInstance()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,50 +18,51 @@

import android.app.Activity;

import androidx.annotation.Nullable;

import com.applivery.applvsdklib.ui.model.ScreenCapture;
import com.applivery.base.domain.model.UserProfile;

/**
* Created by Sergio Martinez Rodriguez
* Date 9/4/16.
*/
public interface FeedbackView {

void show();
void show();

void showFeedbackFormView();
void showFeedbackFormView();

void dismissFeedBack();
void dismissFeedBack();

void cleanScreenData();
void cleanScreenData();

void takeDataFromScreen();
void takeDataFromScreen();

void setBugButtonSelected();
void setBugButtonSelected();

void setFeedbackButtonSelected();
void setFeedbackButtonSelected();

void showFeedbackImage();
void showFeedbackImage();

void hideFeedbackImage();
void hideFeedbackImage();

boolean isNotShowing();
boolean isNotShowing();

void lockRotationOnParentScreen(Activity currentActivity);
void lockRotationOnParentScreen(Activity currentActivity);

void hideScheenShotPreview();
void hideScheenShotPreview();

void showScheenShotPreview();
void showScheenShotPreview();

void setScreenCapture(ScreenCapture screenCapture);
void setScreenCapture(ScreenCapture screenCapture);

void checkScreenshotSwitch(boolean isChecked);
void checkScreenshotSwitch(boolean isChecked);

void retrieveEditedScreenshot();
void retrieveEditedScreenshot();

void requestLogin();
void requestLogin();

void onUserProfileLoaded(UserProfile userProfile);
void onUserEmailLoaded(@Nullable String email, boolean editable);

void onEmailError(boolean hasError);
void onEmailError(boolean hasError);
}
Loading

0 comments on commit a10bce9

Please sign in to comment.