Skip to content

Commit

Permalink
Merge pull request #266 from saltedge/dev
Browse files Browse the repository at this point in the history
Dev->Master
  • Loading branch information
ConstantinKV authored Oct 23, 2020
2 parents e2b21f5 + 5f85912 commit c073e20
Show file tree
Hide file tree
Showing 37 changed files with 303 additions and 227 deletions.
43 changes: 21 additions & 22 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of the Salt Edge Authenticator distribution
* (https://github.com/saltedge/sca-authenticator-android).
* Copyright (c) 2019 Salt Edge Inc.
* Copyright (c) 2020 Salt Edge Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -22,10 +22,10 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
apply plugin: 'idea'
apply plugin: 'realm-android'
apply plugin: 'androidx.navigation.safeargs.kotlin'
apply plugin: 'com.google.firebase.crashlytics'
apply from: './jacoco.gradle'
apply from: './common-methods.gradle'

Expand Down Expand Up @@ -61,13 +61,13 @@ android {
multiDexEnabled = true
vectorDrawables.useSupportLibrary = true

buildToolsVersion '29.0.2'
buildToolsVersion '30.0.2'
minSdkVersion 21
compileSdkVersion 29
targetSdkVersion 29
compileSdkVersion 30
targetSdkVersion 30

versionCode 48
versionName '3.1.1'
versionCode 49
versionName '3.2.0'

renderscriptTargetApi 21
renderscriptSupportModeEnabled true
Expand Down Expand Up @@ -126,10 +126,10 @@ androidExtensions {
dependencies { //TODO After changing dependencies list, review third-party libraries licenses list
implementation fileTree(include: ['*.jar'], dir: 'libs')

kapt 'com.google.dagger:dagger-compiler:2.24'
implementation 'com.google.dagger:dagger:2.24'
kapt 'com.google.dagger:dagger-compiler:2.28.3'
implementation 'com.google.dagger:dagger:2.28.3'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
Expand All @@ -138,16 +138,15 @@ dependencies { //TODO After changing dependencies list, review third-party libra
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.android.gms:play-services-base:17.3.0'
implementation 'com.google.android.gms:play-services-vision:20.1.0'
implementation 'com.google.firebase:firebase-core:17.4.4'
implementation 'com.google.firebase:firebase-messaging:20.2.4'
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.google.android.gms:play-services-base:17.4.0'
implementation 'com.google.android.gms:play-services-vision:20.1.2'
implementation 'com.google.firebase:firebase-core:17.5.0'
implementation 'com.google.firebase:firebase-messaging:20.3.0'
implementation 'com.google.firebase:firebase-crashlytics:17.2.2'
implementation 'com.google.firebase:firebase-analytics:17.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.7.1'
implementation 'net.danlew:android.joda:2.10.2'
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1') {
transitive = true
}
implementation('com.github.bumptech.glide:glide:4.11.0') {
exclude group: "com.android.support"
}
Expand All @@ -159,16 +158,16 @@ dependencies { //TODO After changing dependencies list, review third-party libra

androidTestUtil 'com.android.support.test:orchestrator:1.0.2'
testImplementation 'junit:junit:4.13'
testImplementation 'androidx.test:core:1.2.0'
testImplementation 'androidx.test:core:1.3.0'
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.8'
testImplementation 'org.robolectric:robolectric:4.3.1'
testImplementation 'org.robolectric:shadows-playservices:4.3'
testImplementation 'org.mockito:mockito-core:3.2.4'
testImplementation "io.mockk:mockk:1.9.3"
testImplementation "io.mockk:mockk:1.10.2"
testImplementation project(':test_tools')

androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'org.hamcrest:hamcrest-core:1.3'
androidTestImplementation 'org.hamcrest:hamcrest-integration:1.3'
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
Expand Down
6 changes: 6 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,9 @@

# Blur effect
-keep class androidx.renderscript.** { *; }

# Solve module-info conflicts
-dontwarn module-info

# Solve https://github.com/Kotlin/kotlinx.coroutines/issues/2046
-dontwarn kotlin.time.Duration$Companion
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import android.app.Application
import android.os.Bundle
import androidx.appcompat.app.AppCompatDelegate
import com.google.android.gms.security.ProviderInstaller
import com.saltedge.android.security.BuildConfig
import com.google.firebase.FirebaseApp
import com.saltedge.authenticator.BuildConfig
import com.saltedge.authenticator.app.di.AppComponent
import com.saltedge.authenticator.app.di.AppModule
import com.saltedge.authenticator.app.di.DaggerAppComponent
Expand All @@ -34,7 +35,6 @@ import com.saltedge.authenticator.sdk.AuthenticatorApiManager
import com.saltedge.authenticator.tools.AppTools
import com.saltedge.authenticator.tools.createCrashlyticsKit
import com.saltedge.authenticator.tools.log
import io.fabric.sdk.android.Fabric
import net.danlew.android.joda.JodaTimeAndroid

open class AuthenticatorApplication : Application(), Application.ActivityLifecycleCallbacks {
Expand Down Expand Up @@ -66,26 +66,27 @@ open class AuthenticatorApplication : Application(), Application.ActivityLifecyc
setupNightMode()
}

override fun onActivityPaused(activity: Activity?) {
override fun onActivityPaused(activity: Activity) {
currentActivityName = ""
}

override fun onActivityResumed(activity: Activity?) {
currentActivityName = activity?.javaClass?.name ?: ""
override fun onActivityResumed(activity: Activity) {
currentActivityName = activity.javaClass.name ?: ""
}

override fun onActivityStarted(activity: Activity?) {}
override fun onActivityStarted(activity: Activity) {}

override fun onActivityDestroyed(activity: Activity?) {}
override fun onActivityDestroyed(activity: Activity) {}

override fun onActivitySaveInstanceState(activity: Activity?, outState: Bundle?) {}
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}

override fun onActivityStopped(activity: Activity?) {}
override fun onActivityStopped(activity: Activity) {}

override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?) {}
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {}

private fun initFirebaseModules() {
Fabric.with(this, createCrashlyticsKit())
FirebaseApp.initializeApp(this);
createCrashlyticsKit()
}

private fun patchSecurityProvider() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,10 @@ package com.saltedge.authenticator.app
import android.content.Context
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import androidx.appcompat.app.AppCompatDelegate
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.navigation.NavOptions
import androidx.navigation.fragment.findNavController
import androidx.navigation.navOptions
import com.saltedge.authenticator.R
import com.saltedge.authenticator.tools.ResId
import com.saltedge.authenticator.tools.buildVersion28orGreater
import com.saltedge.authenticator.widget.security.KEY_SKIP_PIN

Expand Down Expand Up @@ -73,7 +68,3 @@ val defaultTransition = navOptions {
popExit = R.anim.slide_out_right
}
}

fun Fragment.navigateTo(actionRes: ResId, bundle: Bundle? = null, transition: NavOptions = defaultTransition) {
findNavController().navigate(actionRes, bundle, transition)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,29 @@
*/
package com.saltedge.authenticator.features.actions

import android.content.DialogInterface
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import com.saltedge.authenticator.R
import com.saltedge.authenticator.app.ViewModelsFactory
import com.saltedge.authenticator.app.navigateTo
import com.saltedge.authenticator.databinding.SubmitActionBinding
import com.saltedge.authenticator.features.main.SharedViewModel
import com.saltedge.authenticator.features.main.newAuthorizationListener
import com.saltedge.authenticator.interfaces.DialogHandlerListener
import com.saltedge.authenticator.models.ViewModelEvent
import com.saltedge.authenticator.sdk.constants.KEY_DATA
import com.saltedge.authenticator.sdk.model.GUID
import com.saltedge.authenticator.sdk.model.appLink.ActionAppLinkData
import com.saltedge.authenticator.sdk.model.authorization.AuthorizationIdentifier
import com.saltedge.authenticator.tools.authenticatorApp
import com.saltedge.authenticator.tools.showWarningDialog
import com.saltedge.authenticator.tools.navigateTo
import com.saltedge.authenticator.tools.popBackStack
import com.saltedge.authenticator.widget.fragment.BaseFragment
import kotlinx.android.synthetic.main.fragment_submit_action.*
import javax.inject.Inject
Expand Down Expand Up @@ -99,7 +95,7 @@ class SubmitActionFragment : BaseFragment() {
lifecycle.addObserver(viewModel)

viewModel.onCloseEvent.observe(this, Observer<ViewModelEvent<Unit>> {
it.getContentIfNotHandled()?.let { findNavController().popBackStack() }
it.getContentIfNotHandled()?.let { popBackStack() }
})
viewModel.onOpenLinkEvent.observe(this, Observer<ViewModelEvent<Uri>> {
it.getContentIfNotHandled()?.let { url ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import com.google.android.material.snackbar.Snackbar
import com.saltedge.authenticator.R
import com.saltedge.authenticator.app.KEY_CLOSE_APP
Expand All @@ -40,6 +39,7 @@ import com.saltedge.authenticator.models.ViewModelEvent
import com.saltedge.authenticator.sdk.constants.KEY_TITLE
import com.saltedge.authenticator.sdk.model.authorization.AuthorizationIdentifier
import com.saltedge.authenticator.tools.authenticatorApp
import com.saltedge.authenticator.tools.popBackStack
import com.saltedge.authenticator.widget.fragment.BaseFragment
import kotlinx.android.synthetic.main.fragment_authorization_details.*
import java.util.*
Expand Down Expand Up @@ -124,7 +124,7 @@ class AuthorizationDetailsFragment : BaseFragment(),
event.getContentIfNotHandled()?.let { activity?.finish() }
})
viewModel.onCloseViewEvent.observe(this, Observer<ViewModelEvent<Unit>> { event ->
event.getContentIfNotHandled()?.let { findNavController().popBackStack() }
event.getContentIfNotHandled()?.let { popBackStack() }
})
viewModel.authorizationModel.observe(this, Observer<AuthorizationItemViewModel> {
headerView?.setTitleAndLogo(title = it.connectionName, logoUrl = it.connectionLogoUrl ?: "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ import androidx.fragment.app.DialogFragment
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import com.google.android.material.snackbar.Snackbar
import com.saltedge.authenticator.R
import com.saltedge.authenticator.app.ViewModelsFactory
import com.saltedge.authenticator.app.navigateTo
import com.saltedge.authenticator.cloud.clearNotifications
import com.saltedge.authenticator.databinding.AuthorizationsListBinding
import com.saltedge.authenticator.features.authorizations.common.AuthorizationItemViewModel
Expand All @@ -45,9 +43,7 @@ import com.saltedge.authenticator.interfaces.AppbarMenuItemClickListener
import com.saltedge.authenticator.interfaces.DialogHandlerListener
import com.saltedge.authenticator.interfaces.MenuItem
import com.saltedge.authenticator.models.ViewModelEvent
import com.saltedge.authenticator.tools.ResId
import com.saltedge.authenticator.tools.authenticatorApp
import com.saltedge.authenticator.tools.showQrScannerActivity
import com.saltedge.authenticator.tools.*
import com.saltedge.authenticator.widget.fragment.BaseFragment
import kotlinx.android.synthetic.main.fragment_authorizations_list.*
import javax.inject.Inject
Expand Down Expand Up @@ -145,7 +141,7 @@ class AuthorizationsListFragment : BaseFragment(), AppbarMenuItemClickListener,
})
viewModel.onMoreMenuClickEvent.observe(this, Observer { event ->
event.getContentIfNotHandled()?.let { menuItems ->
findNavController().navigate(R.id.bottom_menu_dialog, menuItems)
navigateToDialog(R.id.bottom_menu_dialog, menuItems)
}
})
viewModel.onShowConnectionsListEvent.observe(this, Observer { event ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import androidx.appcompat.app.AlertDialog
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import com.saltedge.authenticator.R
import com.saltedge.authenticator.app.ViewModelsFactory
Expand Down Expand Up @@ -134,7 +133,7 @@ class ConnectProviderFragment : BaseFragment(),
lifecycle.addObserver(viewModel)

viewModel.onCloseEvent.observe(this, Observer<ViewModelEvent<Unit>> {
it.getContentIfNotHandled()?.let { findNavController().popBackStack() }
it.getContentIfNotHandled()?.let { popBackStack() }
})
viewModel.onShowErrorEvent.observe(this, Observer<ViewModelEvent<String>> {
it.getContentIfNotHandled()?.let { message ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class ConnectProviderViewModel(
} else {
sessionFailMessage ?: appContext.getString(
R.string.errors_connection_failed_description
) ?: ""
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import com.saltedge.authenticator.R
import com.saltedge.authenticator.app.ViewModelsFactory
import com.saltedge.authenticator.app.navigateTo
import com.saltedge.authenticator.databinding.ConnectionsListBinding
import com.saltedge.authenticator.features.connections.common.ConnectionItemViewModel
import com.saltedge.authenticator.features.connections.list.menu.MenuData
Expand All @@ -44,10 +43,7 @@ import com.saltedge.authenticator.interfaces.DialogHandlerListener
import com.saltedge.authenticator.interfaces.ListItemClickListener
import com.saltedge.authenticator.models.ViewModelEvent
import com.saltedge.authenticator.sdk.model.GUID
import com.saltedge.authenticator.tools.authenticatorApp
import com.saltedge.authenticator.tools.showQrScannerActivity
import com.saltedge.authenticator.tools.startMailApp
import com.saltedge.authenticator.tools.stopRefresh
import com.saltedge.authenticator.tools.*
import com.saltedge.authenticator.widget.fragment.BaseFragment
import com.saltedge.authenticator.widget.list.SpaceItemDecoration
import kotlinx.android.synthetic.main.fragment_connections_list.*
Expand Down Expand Up @@ -132,7 +128,7 @@ class ConnectionsListFragment : BaseFragment(),
})
viewModel.onRenameClickEvent.observe(this, Observer<ViewModelEvent<Bundle>> { event ->
event.getContentIfNotHandled()?.let { bundle ->
findNavController().navigate(R.id.edit_connection_name_dialog, bundle)
navigateToDialog(R.id.edit_connection_name_dialog, bundle)
}
})
viewModel.onDeleteClickEvent.observe(this, Observer<ViewModelEvent<String>> { event ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import android.view.ViewGroup
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import com.saltedge.authenticator.R
import com.saltedge.authenticator.app.ViewModelsFactory
Expand All @@ -41,6 +40,7 @@ import com.saltedge.authenticator.interfaces.OnBackPressListener
import com.saltedge.authenticator.models.ViewModelEvent
import com.saltedge.authenticator.sdk.model.GUID
import com.saltedge.authenticator.tools.authenticatorApp
import com.saltedge.authenticator.tools.popBackStack
import com.saltedge.authenticator.tools.setVisible
import com.saltedge.authenticator.widget.fragment.BaseFragment
import com.saltedge.authenticator.widget.list.SpaceItemDecoration
Expand Down Expand Up @@ -119,7 +119,7 @@ class SelectConnectionsFragment : BaseFragment(), OnBackPressListener, ListItemC
})
viewModel.onProceedClickEvent.observe(this, Observer<GUID> { connectionGuid ->
sharedViewModel.onSelectConnection(connectionGuid)
findNavController().popBackStack()
popBackStack()
})

(arguments?.getSerializable(KEY_CONNECTIONS) as? List<ConnectionItemViewModel>)?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ import androidx.databinding.DataBindingUtil
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import com.saltedge.authenticator.R
import com.saltedge.authenticator.app.ViewModelsFactory
import com.saltedge.authenticator.databinding.ConsentDetailsBinding
import com.saltedge.authenticator.features.main.SharedViewModel
import com.saltedge.authenticator.models.ViewModelEvent
import com.saltedge.authenticator.tools.authenticatorApp
import com.saltedge.authenticator.tools.popBackStack
import com.saltedge.authenticator.tools.showConfirmRevokeConsentDialog
import com.saltedge.authenticator.tools.showWarningDialog
import com.saltedge.authenticator.widget.fragment.BaseFragment
Expand Down Expand Up @@ -97,7 +97,7 @@ class ConsentDetailsFragment : BaseFragment() {
viewModel.revokeSuccessEvent.observe(this, Observer<ViewModelEvent<String>> { event ->
event.getContentIfNotHandled()?.let { consentId ->
sharedViewModel.onRevokeConsent(consentId)
findNavController().popBackStack()
popBackStack()
}

})
Expand Down
Loading

0 comments on commit c073e20

Please sign in to comment.