mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 11:38:51 +01:00
Add email support option in hamburger menu
This commit is contained in:
@@ -82,6 +82,13 @@ class Navigator @Inject constructor(val context: Context) {
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
fun showSupport() {
|
||||
val intent = Intent(Intent.ACTION_SENDTO)
|
||||
intent.data = Uri.parse("mailto:")
|
||||
intent.putExtra(Intent.EXTRA_EMAIL, arrayOf("team@qklabs.com"))
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.O)
|
||||
fun showNotificationSettings() {
|
||||
val intent = Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS)
|
||||
@@ -95,23 +102,10 @@ class Navigator @Inject constructor(val context: Context) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
|
||||
return when (modelClass) {
|
||||
|
||||
MainViewModel::class.java -> {
|
||||
MainViewModel()
|
||||
}
|
||||
|
||||
SetupViewModel::class.java -> {
|
||||
SetupViewModel()
|
||||
}
|
||||
|
||||
ComposeViewModel::class.java -> {
|
||||
ComposeViewModel(intent)
|
||||
}
|
||||
|
||||
SettingsViewModel::class.java -> {
|
||||
SettingsViewModel()
|
||||
}
|
||||
|
||||
MainViewModel::class.java -> MainViewModel()
|
||||
SetupViewModel::class.java -> SetupViewModel()
|
||||
ComposeViewModel::class.java -> ComposeViewModel(intent)
|
||||
SettingsViewModel::class.java -> SettingsViewModel()
|
||||
else -> throw IllegalArgumentException("Invalid ViewModel class. If this is a new ViewModel, please add it to Navigator.kt")
|
||||
} as T
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ class MainActivity : QkActivity<MainViewModel>(), MainView {
|
||||
archived.clicks().map { DrawerItem.ARCHIVED },
|
||||
scheduled.clicks().map { DrawerItem.SCHEDULED },
|
||||
blocked.clicks().map { DrawerItem.BLOCKED },
|
||||
settings.clicks().map { DrawerItem.SETTINGS }))
|
||||
settings.clicks().map { DrawerItem.SETTINGS },
|
||||
help.clicks().map { DrawerItem.HELP }))
|
||||
}
|
||||
override val conversationClickIntent by lazy { conversationsAdapter.clicks }
|
||||
override val conversationLongClickIntent by lazy { conversationsAdapter.longClicks }
|
||||
@@ -134,14 +135,17 @@ class MainActivity : QkActivity<MainViewModel>(), MainView {
|
||||
}
|
||||
}
|
||||
|
||||
// Set the theme color tint to the progressbar and FAB
|
||||
disposables += colors.theme
|
||||
.doOnNext { color -> syncingProgress.indeterminateTintList = ColorStateList.valueOf(color) }
|
||||
.doOnNext { color -> compose.setBackgroundTint(color) }
|
||||
.subscribe()
|
||||
|
||||
// Set the hamburger icon color
|
||||
disposables += colors.textSecondary
|
||||
.subscribe { color -> toggle.drawerArrowDrawable.color = color }
|
||||
|
||||
// Set the color for the drawer icons
|
||||
disposables += Observables
|
||||
.combineLatest(colors.theme, colors.textSecondary, { theme, textSecondary ->
|
||||
ColorStateList(states, intArrayOf(theme, textSecondary))
|
||||
@@ -151,8 +155,10 @@ class MainActivity : QkActivity<MainViewModel>(), MainView {
|
||||
.doOnNext { tintList -> scheduledIcon.imageTintList = tintList }
|
||||
.doOnNext { tintList -> blockedIcon.imageTintList = tintList }
|
||||
.doOnNext { tintList -> settingsIcon.imageTintList = tintList }
|
||||
.doOnNext { tintList -> helpIcon.imageTintList = tintList }
|
||||
.subscribe()
|
||||
|
||||
// Set the background highlight for the drawer options
|
||||
disposables += colors.separator
|
||||
.doOnNext { color -> inbox.background = rowBackground(color) }
|
||||
.doOnNext { color -> archived.background = rowBackground(color) }
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
package presentation.feature.main
|
||||
|
||||
import presentation.common.base.QkView
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.subjects.Subject
|
||||
import presentation.common.base.QkView
|
||||
|
||||
interface MainView : QkView<MainState> {
|
||||
|
||||
@@ -39,4 +39,4 @@ interface MainView : QkView<MainState> {
|
||||
|
||||
}
|
||||
|
||||
enum class DrawerItem { INBOX, ARCHIVED, SCHEDULED, BLOCKED, SETTINGS }
|
||||
enum class DrawerItem { INBOX, ARCHIVED, SCHEDULED, BLOCKED, SETTINGS, HELP }
|
||||
@@ -125,6 +125,7 @@ class MainViewModel : QkViewModel<MainView, MainState>(MainState()) {
|
||||
intents += view.drawerItemIntent
|
||||
.doOnNext { newState { it.copy(drawerOpen = false) } }
|
||||
.doOnNext { if (it == DrawerItem.SETTINGS) navigator.showSettings() }
|
||||
.doOnNext { if (it == DrawerItem.HELP) navigator.showSupport() }
|
||||
.distinctUntilChanged()
|
||||
.doOnNext {
|
||||
when (it) {
|
||||
|
||||
Reference in New Issue
Block a user