Migrate ConversationInfo to Controller

This commit is contained in:
Moez Bhatti
2018-07-31 02:36:32 -04:00
parent e0e50c98f3
commit ae2246c43d
16 changed files with 382 additions and 355 deletions
@@ -38,7 +38,6 @@ import com.moez.QKSMS.feature.notificationprefs.NotificationPrefsActivity
import com.moez.QKSMS.feature.plus.PlusActivity
import com.moez.QKSMS.feature.scheduled.ScheduledActivity
import com.moez.QKSMS.feature.settings.SettingsActivity
import com.moez.QKSMS.feature.themepicker.ThemePickerActivity
import com.moez.QKSMS.manager.AnalyticsManager
import com.moez.QKSMS.manager.NotificationManager
import com.moez.QKSMS.manager.PermissionManager
@@ -163,12 +162,6 @@ class Navigator @Inject constructor(
startActivity(intent)
}
fun showThemePicker(threadId: Long = 0) {
val intent = Intent(context, ThemePickerActivity::class.java)
intent.putExtra("threadId", threadId)
startActivity(intent)
}
fun makePhoneCall(address: String) {
val action = if (permissions.hasCalling()) Intent.ACTION_CALL else Intent.ACTION_DIAL
val intent = Intent(action, Uri.parse("tel:$address"))
@@ -21,6 +21,9 @@ abstract class QkController<ViewContract : QkViewContract<State>, State, Present
private val appCompatActivity: AppCompatActivity?
get() = activity as? AppCompatActivity
protected val themedActivity: QkThemedActivity?
get() = activity as? QkThemedActivity
override var containerView: View? = null
@LayoutRes
@@ -53,12 +53,12 @@ abstract class QkThemedActivity : QkActivity() {
* In case the activity should be themed for a specific conversation, the selected conversation
* can be changed by pushing the threadId to this subject
*/
protected val threadId: Subject<Long> = BehaviorSubject.createDefault(0)
val threadId: Subject<Long> = BehaviorSubject.createDefault(0)
/**
* Switch the theme if the threadId changes
*/
protected val theme = threadId
val theme = threadId
.distinctUntilChanged()
.switchMap { threadId -> colors.themeObservable(threadId) }