mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 03:28:52 +01:00
Append source to QKSMS+ views
This commit is contained in:
@@ -40,13 +40,18 @@ import com.moez.QKSMS.feature.scheduled.ScheduledActivity
|
||||
import com.moez.QKSMS.feature.settings.SettingsActivity
|
||||
import com.moez.QKSMS.feature.settings.about.AboutActivity
|
||||
import com.moez.QKSMS.feature.themepicker.ThemePickerActivity
|
||||
import com.moez.QKSMS.manager.AnalyticsManager
|
||||
import com.moez.QKSMS.manager.NotificationManager
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
|
||||
@Singleton
|
||||
class Navigator @Inject constructor(private val context: Context, private val notificationManager: NotificationManager) {
|
||||
class Navigator @Inject constructor(
|
||||
private val context: Context,
|
||||
private val analyticsManager: AnalyticsManager,
|
||||
private val notificationManager: NotificationManager
|
||||
) {
|
||||
|
||||
private fun startActivity(intent: Intent) {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
@@ -61,7 +66,12 @@ class Navigator @Inject constructor(private val context: Context, private val no
|
||||
}
|
||||
}
|
||||
|
||||
fun showQksmsPlusActivity() {
|
||||
/**
|
||||
* @param source String to indicate where this QKSMS+ screen was launched from. This should be
|
||||
* one of [main_menu, compose_schedule, settings_night, settings_theme]
|
||||
*/
|
||||
fun showQksmsPlusActivity(source: String) {
|
||||
analyticsManager.track("Viewed QKSMS+", Pair("source", source))
|
||||
val intent = Intent(context, PlusActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
@@ -618,7 +618,7 @@ class ComposeViewModel @Inject constructor(
|
||||
// View QKSMS+
|
||||
view.viewQksmsPlusIntent
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { navigator.showQksmsPlusActivity() }
|
||||
.subscribe { navigator.showQksmsPlusActivity("compose_schedule") }
|
||||
|
||||
// Navigate back
|
||||
view.optionsItemIntent
|
||||
|
||||
@@ -183,7 +183,7 @@ class MainViewModel @Inject constructor(
|
||||
.doOnNext { if (it == DrawerItem.SCHEDULED) navigator.showScheduled() }
|
||||
.doOnNext { if (it == DrawerItem.BLOCKING) navigator.showBlockedConversations() }
|
||||
.doOnNext { if (it == DrawerItem.SETTINGS) navigator.showSettings() }
|
||||
.doOnNext { if (it == DrawerItem.PLUS) navigator.showQksmsPlusActivity() }
|
||||
.doOnNext { if (it == DrawerItem.PLUS) navigator.showQksmsPlusActivity("main_menu") }
|
||||
.doOnNext { if (it == DrawerItem.HELP) navigator.showSupport() }
|
||||
.distinctUntilChanged()
|
||||
.doOnNext {
|
||||
|
||||
@@ -35,8 +35,6 @@ class PlusViewModel @Inject constructor(
|
||||
) : QkViewModel<PlusView, PlusState>(PlusState()) {
|
||||
|
||||
init {
|
||||
analyticsManager.track("Viewed QKSMS+")
|
||||
|
||||
disposables += billingManager.upgradeStatus
|
||||
.subscribe { upgraded -> newState { copy(upgraded = upgraded) } }
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ class SettingsViewModel @Inject constructor(
|
||||
|
||||
view.viewQksmsPlusIntent
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { navigator.showQksmsPlusActivity() }
|
||||
.subscribe { navigator.showQksmsPlusActivity("settings_night") }
|
||||
|
||||
view.startTimeSelectedIntent
|
||||
.autoDisposable(view.scope())
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ class ThemePickerViewModel @Inject constructor(
|
||||
// Show QKSMS+ activity
|
||||
view.viewQksmsPlusIntent
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { navigator.showQksmsPlusActivity() }
|
||||
.subscribe { navigator.showQksmsPlusActivity("settings_theme") }
|
||||
|
||||
// Reset the theme
|
||||
view.hsvThemeClearedIntent
|
||||
|
||||
Reference in New Issue
Block a user