diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt index 05bda5590fd5154c7ce401e13412f1c2c930e1d7..34244534670251ccf170e080c6af9856ef6a86aa 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt @@ -23,6 +23,7 @@ import android.animation.ObjectAnimator import android.app.AlertDialog import android.content.Intent import android.content.res.ColorStateList +import android.opengl.Visibility import android.os.Build import android.os.Bundle import android.view.Gravity @@ -132,12 +133,6 @@ class MainActivity : QkThemedActivity(), MainView { viewModel.bindView(this) onNewIntentIntent.onNext(intent) - (snackbar as? ViewStub)?.setOnInflateListener { _, _ -> - snackbarButton.clicks() - .autoDisposable(scope(Lifecycle.Event.ON_DESTROY)) - .subscribe(snackbarButtonIntent) - } - (syncing as? ViewStub)?.setOnInflateListener { _, _ -> syncingProgress?.progressTintList = ColorStateList.valueOf(theme.blockingFirst().theme) syncingProgress?.indeterminateTintList = ColorStateList.valueOf(theme.blockingFirst().theme) @@ -292,10 +287,6 @@ class MainActivity : QkThemedActivity(), MainView { } when (state.syncing) { - is SyncRepository.SyncProgress.Idle -> { - syncing.isVisible = false - snackbar.isVisible = !state.defaultSms || !state.smsPermission || !state.contactPermission - } is SyncRepository.SyncProgress.Running -> { syncing.isVisible = true @@ -307,7 +298,7 @@ class MainActivity : QkThemedActivity(), MainView { } when { - !state.defaultSms -> { + !state.defaultSms -> { snackbarTitle?.setText(R.string.main_default_sms_title) snackbarMessage?.setText(R.string.main_default_sms_message) snackbarButton?.setText(R.string.main_default_sms_change) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/main/MainViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/main/MainViewModel.kt index 11bd3e09cc5c2f4e59d6fb3aa3b0d3733bf07d0d..c6092ea9cc47f683293f480cf999e396998fcb23 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/main/MainViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/main/MainViewModel.kt @@ -131,7 +131,7 @@ class MainViewModel @Inject constructor( super.bindView(view) when { - !permissionManager.isDefaultSms() -> view.requestDefaultSms() + !permissionManager.hasReadSms() || !permissionManager.hasContacts() -> view.requestPermissions() } diff --git a/presentation/src/main/res/layout/main_activity.xml b/presentation/src/main/res/layout/main_activity.xml index 560b00c99a77ad3ed224941cb16178f0d289d6cc..809d9595907a8661f0220713038b604806ae17a2 100644 --- a/presentation/src/main/res/layout/main_activity.xml +++ b/presentation/src/main/res/layout/main_activity.xml @@ -119,6 +119,7 @@ app:layout_constraintBottom_toTopOf="@id/snackbar" />