Fix indentation for constructor params

This commit is contained in:
moezbhatti
2018-12-25 18:13:17 -05:00
parent a1dfba2e4b
commit 728af5168c
96 changed files with 482 additions and 476 deletions
@@ -22,9 +22,9 @@ import com.moez.QKSMS.model.Recipient
import javax.inject.Inject
class RecipientFilter @Inject constructor(
private val contactFilter: ContactFilter,
private val phoneNumberFilter: PhoneNumberFilter)
: Filter<Recipient>() {
private val contactFilter: ContactFilter,
private val phoneNumberFilter: PhoneNumberFilter
) : Filter<Recipient>() {
override fun filter(item: Recipient, query: CharSequence) = when {
item.contact?.let { contactFilter.filter(it, query) } == true -> true
@@ -34,8 +34,8 @@ import javax.inject.Inject
* TODO: Stop listening automatically. Currently, this will only happen if the contact is added
*/
class ContactAddedListenerImpl @Inject constructor(
private val context: Context,
private val syncRepo: SyncRepository
private val context: Context,
private val syncRepo: SyncRepository
) : ContactAddedListener {
companion object {
@@ -35,8 +35,8 @@ import timber.log.Timber
import javax.inject.Inject
class ExternalBlockingManagerImpl @Inject constructor(
private val context: Context,
private val prefs: Preferences
private val context: Context,
private val prefs: Preferences
) : ExternalBlockingManager {
companion object {
@@ -56,9 +56,9 @@ class ExternalBlockingManagerImpl @Inject constructor(
}
private class Binder(
private val context: Context,
private val prefs: Preferences,
private val address: String
private val context: Context,
private val prefs: Preferences,
private val address: String
) : ServiceConnection {
private val subject: SingleSubject<Boolean> = SingleSubject.create()
@@ -27,8 +27,8 @@ import com.moez.QKSMS.model.PhoneNumber
import javax.inject.Inject
class CursorToContactImpl @Inject constructor(
private val context: Context,
private val permissionManager: PermissionManager
private val context: Context,
private val permissionManager: PermissionManager
) : CursorToContact {
companion object {
@@ -28,8 +28,8 @@ import com.moez.QKSMS.model.Recipient
import javax.inject.Inject
class CursorToConversationImpl @Inject constructor(
private val context: Context,
private val permissionManager: PermissionManager
private val context: Context,
private val permissionManager: PermissionManager
) : CursorToConversation {
companion object {
@@ -35,11 +35,11 @@ import com.moez.QKSMS.util.tryOrNull
import javax.inject.Inject
class CursorToMessageImpl @Inject constructor(
private val context: Context,
private val cursorToPart: CursorToPart,
private val keys: KeyManager,
private val permissionManager: PermissionManager,
private val preferences: Preferences
private val context: Context,
private val cursorToPart: CursorToPart,
private val keys: KeyManager,
private val permissionManager: PermissionManager,
private val preferences: Preferences
) : CursorToMessage {
private val uri = Uri.parse("content://mms-sms/complete-conversations")
@@ -26,8 +26,8 @@ import com.moez.QKSMS.model.Recipient
import javax.inject.Inject
class CursorToRecipientImpl @Inject constructor(
private val context: Context,
private val permissionManager: PermissionManager
private val context: Context,
private val permissionManager: PermissionManager
) : CursorToRecipient {
companion object {
@@ -28,9 +28,9 @@ import io.reactivex.rxkotlin.Observables
import javax.inject.Inject
class RatingManagerImpl @Inject constructor(
rxPrefs: RxSharedPreferences,
private val analyticsManager: AnalyticsManager,
private val ratingThresholdExperiment: RatingThresholdExperiment
rxPrefs: RxSharedPreferences,
private val analyticsManager: AnalyticsManager,
private val ratingThresholdExperiment: RatingThresholdExperiment
) : RatingManager {
private val sessions = rxPrefs.getInteger("sessions", 0)
@@ -62,8 +62,8 @@ class RatingManagerImpl @Inject constructor(
}
class RatingThresholdExperiment @Inject constructor(
context: Context,
analytics: AnalyticsManager
context: Context,
analytics: AnalyticsManager
) : Experiment<Int>(context, analytics) {
override val key: String = "Rating Threshold"
@@ -49,7 +49,9 @@ class RemoteMessagingReceiver : BroadcastReceiver() {
markRead.execute(listOf(threadId))
val lastMessage = messageRepo.getMessages(threadId).lastOrNull()
val subId = subscriptionManager.activeSubscriptionInfoList.firstOrNull { it.subscriptionId == lastMessage?.subId }?.subscriptionId ?: -1
val subId = subscriptionManager.activeSubscriptionInfoList
.firstOrNull { it.subscriptionId == lastMessage?.subId }
?.subscriptionId ?: -1
val addresses = conversationRepo.getConversation(threadId)?.recipients?.map { it.address } ?: return
val pendingRepository = goAsync()
@@ -43,13 +43,13 @@ class SmsDeliveredReceiver : BroadcastReceiver() {
val id = intent.getLongExtra("id", 0L)
when (resultCode) {
// TODO notify about delivery
// TODO notify about delivery
Activity.RESULT_OK -> {
val pendingResult = goAsync()
markDelivered.execute(id) { pendingResult.finish() }
}
// TODO notify about delivery failure
// TODO notify about delivery failure
Activity.RESULT_CANCELED -> {
val pendingResult = goAsync()
markDeliveryFailed.execute(MarkDeliveryFailed.Params(id, resultCode)) { pendingResult.finish() }
@@ -45,9 +45,9 @@ import kotlin.concurrent.schedule
@Singleton
class BackupRepositoryImpl @Inject constructor(
private val context: Context,
private val moshi: Moshi,
private val syncRepo: SyncRepository
private val context: Context,
private val moshi: Moshi,
private val syncRepo: SyncRepository
) : BackupRepository {
companion object {
@@ -55,8 +55,8 @@ class BackupRepositoryImpl @Inject constructor(
}
data class Backup(
val messageCount: Int = 0,
val messages: List<BackupMessage> = listOf()
val messageCount: Int = 0,
val messages: List<BackupMessage> = listOf()
)
/**
@@ -64,21 +64,21 @@ class BackupRepositoryImpl @Inject constructor(
* needing to parse the entire file
*/
data class BackupMetadata(
val messageCount: Int = 0
val messageCount: Int = 0
)
data class BackupMessage(
val type: Int,
val address: String,
val date: Long,
val dateSent: Long,
val read: Boolean,
val status: Int,
val body: String,
val protocol: Int,
val serviceCenter: String?,
val locked: Boolean,
val subId: Int)
val type: Int,
val address: String,
val date: Long,
val dateSent: Long,
val read: Boolean,
val status: Int,
val body: String,
val protocol: Int,
val serviceCenter: String?,
val locked: Boolean,
val subId: Int)
// Subjects to emit our progress events to
private val backupProgress: Subject<BackupRepository.Progress> = BehaviorSubject.createDefault(BackupRepository.Progress.Idle())
@@ -39,8 +39,8 @@ import javax.inject.Singleton
@Singleton
class ContactRepositoryImpl @Inject constructor(
private val context: Context,
private val prefs: Preferences
private val context: Context,
private val prefs: Preferences
) : ContactRepository {
override fun findContactUri(address: String): Single<Uri> {
@@ -41,10 +41,10 @@ import java.util.concurrent.TimeUnit
import javax.inject.Inject
class ConversationRepositoryImpl @Inject constructor(
private val context: Context,
private val conversationFilter: ConversationFilter,
private val cursorToConversation: CursorToConversation,
private val cursorToRecipient: CursorToRecipient
private val context: Context,
private val conversationFilter: ConversationFilter,
private val cursorToConversation: CursorToConversation,
private val cursorToRecipient: CursorToRecipient
) : ConversationRepository {
override fun getConversations(archived: Boolean): RealmResults<Conversation> {
@@ -58,12 +58,13 @@ import javax.inject.Singleton
@Singleton
class MessageRepositoryImpl @Inject constructor(
private val activeConversationManager: ActiveConversationManager,
private val context: Context,
private val messageIds: KeyManager,
private val imageRepository: ImageRepository,
private val prefs: Preferences,
private val syncRepository: SyncRepository) : MessageRepository {
private val activeConversationManager: ActiveConversationManager,
private val context: Context,
private val messageIds: KeyManager,
private val imageRepository: ImageRepository,
private val prefs: Preferences,
private val syncRepository: SyncRepository
) : MessageRepository {
override fun getMessages(threadId: Long, query: String): RealmResults<Message> {
return Realm.getDefaultInstance()
@@ -47,25 +47,25 @@ import javax.inject.Singleton
@Singleton
class SyncRepositoryImpl @Inject constructor(
private val contentResolver: ContentResolver,
private val conversationRepo: ConversationRepository,
private val cursorToConversation: CursorToConversation,
private val cursorToMessage: CursorToMessage,
private val cursorToRecipient: CursorToRecipient,
private val cursorToContact: CursorToContact,
private val keys: KeyManager,
private val rxPrefs: RxSharedPreferences
private val contentResolver: ContentResolver,
private val conversationRepo: ConversationRepository,
private val cursorToConversation: CursorToConversation,
private val cursorToMessage: CursorToMessage,
private val cursorToRecipient: CursorToRecipient,
private val cursorToContact: CursorToContact,
private val keys: KeyManager,
private val rxPrefs: RxSharedPreferences
) : SyncRepository {
/**
* Holds data that should be persisted across full syncs
*/
private data class PersistedData(
val id: Long,
val archived: Boolean,
val blocked: Boolean,
val pinned: Boolean,
val name: String)
val id: Long,
val archived: Boolean,
val blocked: Boolean,
val pinned: Boolean,
val name: String)
override val syncProgress: Subject<SyncRepository.SyncProgress> = BehaviorSubject.createDefault(SyncRepository.SyncProgress.Idle())
@@ -25,7 +25,7 @@ import io.reactivex.Observer
import io.reactivex.disposables.Disposable
class ActiveSubscriptionObservable(
private val subscriptionManager: SubscriptionManagerCompat
private val subscriptionManager: SubscriptionManagerCompat
) : Observable<List<SubscriptionInfoCompat>>() {
override fun subscribeActual(observer: Observer<in List<SubscriptionInfoCompat>>) {
@@ -37,8 +37,8 @@ class ActiveSubscriptionObservable(
}
internal class Listener(
private val subscriptionManager: SubscriptionManagerCompat,
private val observer: Observer<in List<SubscriptionInfoCompat>>
private val subscriptionManager: SubscriptionManagerCompat,
private val observer: Observer<in List<SubscriptionInfoCompat>>
) : Disposable, SubscriptionManagerCompat.OnSubscriptionsChangedListener() {
private var disposed: Boolean = false
@@ -38,8 +38,8 @@ import java.security.MessageDigest
class ContactImageLoader(
private val context: Context,
private val contactRepo: ContactRepository
private val context: Context,
private val contactRepo: ContactRepository
) : ModelLoader<String, InputStream> {
override fun handles(model: String): Boolean {
@@ -60,9 +60,9 @@ class ContactImageLoader(
}
class ContactImageFetcher(
private val context: Context,
private val contactRepo: ContactRepository,
private val address: String
private val context: Context,
private val contactRepo: ContactRepository,
private val address: String
) : DataFetcher<InputStream> {
private var loadPhotoDisposable: Disposable? = null
@@ -39,9 +39,9 @@ import java.nio.ByteBuffer
* Based on Glide's ReEncodingGifResourceEncoder
*/
class GifEncoder internal constructor(
private val context: Context,
private val bitmapPool: BitmapPool,
private val factory: Factory = Factory()
private val context: Context,
private val bitmapPool: BitmapPool,
private val factory: Factory = Factory()
) {
private val provider = GifBitmapProvider(bitmapPool)
@@ -32,9 +32,10 @@ import javax.inject.Singleton
@Singleton
class NightModeManager @Inject constructor(
private val context: Context,
private val prefs: Preferences,
private val widgetManager: WidgetManager) {
private val context: Context,
private val prefs: Preferences,
private val widgetManager: WidgetManager
) {
fun updateCurrentTheme() {
// If night mode is not on auto, then there's nothing to do here
@@ -30,13 +30,13 @@ import timber.log.Timber
object SqliteWrapper {
fun query(
context: Context,
uri: Uri,
projection: Array<String>? = null,
selection: String? = null,
selectionArgs: Array<String>? = null,
sortOrder: String? = null,
logError: Boolean = true
context: Context,
uri: Uri,
projection: Array<String>? = null,
selection: String? = null,
selectionArgs: Array<String>? = null,
sortOrder: String? = null,
logError: Boolean = true
): Cursor? {
return try {
context.contentResolver.query(uri, projection, selection, selectionArgs, sortOrder)
@@ -26,13 +26,11 @@ data class Optional<out T>(val value: T?) {
fun notNull() = value != null
}
fun <T, R> Flowable<T>.mapNotNull(mapper: (T) -> R?): Flowable<R>
= map { input -> Optional(mapper(input)) }
fun <T, R> Flowable<T>.mapNotNull(mapper: (T) -> R?): Flowable<R> = map { input -> Optional(mapper(input)) }
.filter { optional -> optional.notNull() }
.map { optional -> optional.value }
fun <T, R> Observable<T>.mapNotNull(mapper: (T) -> R?): Observable<R>
= map { input -> Optional(mapper(input)) }
fun <T, R> Observable<T>.mapNotNull(mapper: (T) -> R?): Observable<R> = map { input -> Optional(mapper(input)) }
.filter { optional -> optional.notNull() }
.map { optional -> optional.value }
@@ -23,8 +23,8 @@ import io.reactivex.Flowable
import javax.inject.Inject
class AddScheduledMessage @Inject constructor(
private val scheduledMessageRepo: ScheduledMessageRepository,
private val updateScheduledMessageAlarms: UpdateScheduledMessageAlarms
private val scheduledMessageRepo: ScheduledMessageRepository,
private val updateScheduledMessageAlarms: UpdateScheduledMessageAlarms
) : Interactor<AddScheduledMessage.Params>() {
data class Params(val date: Long,
@@ -24,9 +24,9 @@ import io.reactivex.Flowable
import javax.inject.Inject
class DeleteConversations @Inject constructor(
private val conversationRepo: ConversationRepository,
private val notificationManager: NotificationManager,
private val updateBadge: UpdateBadge
private val conversationRepo: ConversationRepository,
private val notificationManager: NotificationManager,
private val updateBadge: UpdateBadge
) : Interactor<List<Long>>() {
override fun buildObservable(params: List<Long>): Flowable<*> {
@@ -25,10 +25,10 @@ import io.reactivex.Flowable
import javax.inject.Inject
class DeleteMessages @Inject constructor(
private val conversationRepo: ConversationRepository,
private val messageRepo: MessageRepository,
private val notificationManager: NotificationManager,
private val updateBadge: UpdateBadge
private val conversationRepo: ConversationRepository,
private val messageRepo: MessageRepository,
private val notificationManager: NotificationManager,
private val updateBadge: UpdateBadge
) : Interactor<DeleteMessages.Params>() {
data class Params(val messageIds: List<Long>, val threadId: Long? = null)
@@ -23,8 +23,8 @@ import io.reactivex.Flowable
import javax.inject.Inject
class MarkArchived @Inject constructor(
private val conversationRepo: ConversationRepository,
private val markRead: MarkRead
private val conversationRepo: ConversationRepository,
private val markRead: MarkRead
) : Interactor<List<Long>>() {
override fun buildObservable(params: List<Long>): Flowable<*> {
@@ -23,7 +23,7 @@ import io.reactivex.Flowable
import javax.inject.Inject
class MarkDeliveryFailed @Inject constructor(
private val messageRepo: MessageRepository
private val messageRepo: MessageRepository
) : Interactor<MarkDeliveryFailed.Params>() {
data class Params(val id: Long, val resultCode: Int)
@@ -24,8 +24,8 @@ import io.reactivex.Flowable
import javax.inject.Inject
class MarkFailed @Inject constructor(
private val messageRepo: MessageRepository,
private val notificationManager: NotificationManager
private val messageRepo: MessageRepository,
private val notificationManager: NotificationManager
) : Interactor<MarkFailed.Params>() {
data class Params(val id: Long, val resultCode: Int)
@@ -25,10 +25,10 @@ import io.reactivex.Flowable
import javax.inject.Inject
class MarkRead @Inject constructor(
private val conversationRepo: ConversationRepository,
private val messageRepo: MessageRepository,
private val notificationManager: NotificationManager,
private val updateBadge: UpdateBadge
private val conversationRepo: ConversationRepository,
private val messageRepo: MessageRepository,
private val notificationManager: NotificationManager,
private val updateBadge: UpdateBadge
) : Interactor<List<Long>>() {
override fun buildObservable(params: List<Long>): Flowable<*> {
@@ -23,8 +23,8 @@ import io.reactivex.Flowable
import javax.inject.Inject
class MarkUnread @Inject constructor(
private val messageRepo: MessageRepository,
private val updateBadge: UpdateBadge
private val messageRepo: MessageRepository,
private val updateBadge: UpdateBadge
) : Interactor<List<Long>>() {
override fun buildObservable(params: List<Long>): Flowable<*> {
@@ -23,7 +23,7 @@ import io.reactivex.Flowable
import javax.inject.Inject
class PerformBackup @Inject constructor(
private val backupRepo: BackupRepository
private val backupRepo: BackupRepository
) : Interactor<Unit>() {
override fun buildObservable(params: Unit): Flowable<*> {
@@ -23,7 +23,7 @@ import io.reactivex.Flowable
import javax.inject.Inject
class PerformRestore @Inject constructor(
private val backupRepo: BackupRepository
private val backupRepo: BackupRepository
) : Interactor<String>() {
override fun buildObservable(params: String): Flowable<*> {
@@ -30,13 +30,13 @@ import io.reactivex.Flowable
import javax.inject.Inject
class ReceiveMms @Inject constructor(
private val activeConversationManager: ActiveConversationManager,
private val conversationRepo: ConversationRepository,
private val externalBlockingManager: ExternalBlockingManager,
private val syncManager: SyncRepository,
private val messageRepo: MessageRepository,
private val notificationManager: NotificationManager,
private val updateBadge: UpdateBadge
private val activeConversationManager: ActiveConversationManager,
private val conversationRepo: ConversationRepository,
private val externalBlockingManager: ExternalBlockingManager,
private val syncManager: SyncRepository,
private val messageRepo: MessageRepository,
private val notificationManager: NotificationManager,
private val updateBadge: UpdateBadge
) : Interactor<Uri>() {
override fun buildObservable(params: Uri): Flowable<*> {
@@ -29,12 +29,12 @@ import io.reactivex.Flowable
import javax.inject.Inject
class ReceiveSms @Inject constructor(
private val conversationRepo: ConversationRepository,
private val externalBlockingManager: ExternalBlockingManager,
private val messageRepo: MessageRepository,
private val notificationManager: NotificationManager,
private val updateBadge: UpdateBadge,
private val shortcutManager: ShortcutManager
private val conversationRepo: ConversationRepository,
private val externalBlockingManager: ExternalBlockingManager,
private val messageRepo: MessageRepository,
private val notificationManager: NotificationManager,
private val updateBadge: UpdateBadge,
private val shortcutManager: ShortcutManager
) : Interactor<ReceiveSms.Params>() {
class Params(val subId: Int, val messages: Array<SmsMessage>)
@@ -24,8 +24,8 @@ import io.reactivex.Flowable
import javax.inject.Inject
class SaveImage @Inject constructor(
private val imageRepository: ImageRepository,
private val messageRepo: MessageRepository
private val imageRepository: ImageRepository,
private val messageRepo: MessageRepository
) : Interactor<Long>() {
override fun buildObservable(params: Long): Flowable<*> {
@@ -26,18 +26,18 @@ import io.reactivex.Flowable
import javax.inject.Inject
class SendMessage @Inject constructor(
private val conversationRepo: ConversationRepository,
private val messageRepo: MessageRepository,
private val syncRepo: SyncRepository
private val conversationRepo: ConversationRepository,
private val messageRepo: MessageRepository,
private val syncRepo: SyncRepository
) : Interactor<SendMessage.Params>() {
data class Params(
val subId: Int,
val threadId: Long,
val addresses: List<String>,
val body: String,
val attachments: List<Attachment> = listOf(),
val delay: Int = 0)
val subId: Int,
val threadId: Long,
val addresses: List<String>,
val body: String,
val attachments: List<Attachment> = listOf(),
val delay: Int = 0)
override fun buildObservable(params: Params): Flowable<*> = Flowable.just(Unit)
.filter { params.addresses.isNotEmpty() }
@@ -30,9 +30,9 @@ import io.realm.RealmList
import javax.inject.Inject
class SendScheduledMessage @Inject constructor(
private val context: Context,
private val scheduledMessageRepo: ScheduledMessageRepository,
private val sendMessage: SendMessage
private val context: Context,
private val scheduledMessageRepo: ScheduledMessageRepository,
private val sendMessage: SendMessage
) : Interactor<Long>() {
override fun buildObservable(params: Long): Flowable<*> {
@@ -26,9 +26,9 @@ import io.reactivex.Flowable
import javax.inject.Inject
class SyncMessage @Inject constructor(
private val conversationRepo: ConversationRepository,
private val syncManager: SyncRepository,
private val updateBadge: UpdateBadge
private val conversationRepo: ConversationRepository,
private val syncManager: SyncRepository,
private val updateBadge: UpdateBadge
) : Interactor<Uri>() {
override fun buildObservable(params: Uri): Flowable<*> {
@@ -25,8 +25,8 @@ import java.util.concurrent.TimeUnit
import javax.inject.Inject
class SyncMessages @Inject constructor(
private val syncManager: SyncRepository,
private val updateBadge: UpdateBadge
private val syncManager: SyncRepository,
private val updateBadge: UpdateBadge
) : Interactor<Unit>() {
override fun buildObservable(params: Unit): Flowable<*> {
@@ -24,8 +24,8 @@ import io.reactivex.Flowable
import javax.inject.Inject
class UpdateBadge @Inject constructor(
private val shortcutManager: ShortcutManager,
private val widgetManager: WidgetManager
private val shortcutManager: ShortcutManager,
private val widgetManager: WidgetManager
) : Interactor<Unit>() {
override fun buildObservable(params: Unit): Flowable<*> {
@@ -24,9 +24,9 @@ import io.reactivex.Flowable
import javax.inject.Inject
class UpdateScheduledMessageAlarms @Inject constructor(
private val alarmManager: AlarmManager,
private val scheduledMessageRepo: ScheduledMessageRepository,
private val sendScheduledMessage: SendScheduledMessage
private val alarmManager: AlarmManager,
private val scheduledMessageRepo: ScheduledMessageRepository,
private val sendScheduledMessage: SendScheduledMessage
) : Interactor<Unit>() {
override fun buildObservable(params: Unit): Flowable<*> {
@@ -19,8 +19,8 @@
package com.moez.QKSMS.model
data class BackupFile(
val path: String,
val date: Long,
val messages: Int,
val size: Long
val path: String,
val date: Long,
val messages: Int,
val size: Long
)
@@ -23,8 +23,8 @@ import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
open class Contact(
@PrimaryKey var lookupKey: String = "",
var numbers: RealmList<PhoneNumber> = RealmList(),
var name: String = "",
var lastUpdate: Long = 0
@PrimaryKey var lookupKey: String = "",
var numbers: RealmList<PhoneNumber> = RealmList(),
var name: String = "",
var lastUpdate: Long = 0
) : RealmObject()
@@ -24,20 +24,20 @@ import io.realm.annotations.Index
import io.realm.annotations.PrimaryKey
open class Conversation(
@PrimaryKey var id: Long = 0,
@Index var archived: Boolean = false,
@Index var blocked: Boolean = false,
@Index var pinned: Boolean = false,
var recipients: RealmList<Recipient> = RealmList(),
var count: Int = 0,
var date: Long = 0,
var snippet: String = "",
var read: Boolean = true,
var me: Boolean = false,
var draft: String = "",
@PrimaryKey var id: Long = 0,
@Index var archived: Boolean = false,
@Index var blocked: Boolean = false,
@Index var pinned: Boolean = false,
var recipients: RealmList<Recipient> = RealmList(),
var count: Int = 0,
var date: Long = 0,
var snippet: String = "",
var read: Boolean = true,
var me: Boolean = false,
var draft: String = "",
// For group chats, the user is allowed to set a custom title for the conversation
var name: String = ""
// For group chats, the user is allowed to set a custom title for the conversation
var name: String = ""
) : RealmObject() {
fun getTitle(): String {
@@ -21,6 +21,6 @@ package com.moez.QKSMS.model
import io.realm.RealmObject
open class PhoneNumber(
var address: String = "",
var type: String = ""
var address: String = "",
var type: String = ""
) : RealmObject()
@@ -24,10 +24,10 @@ import io.realm.annotations.PrimaryKey
import java.util.*
open class Recipient(
@PrimaryKey var id: Long = 0,
var address: String = "",
var contact: Contact? = null,
var lastUpdate: Long = 0
@PrimaryKey var id: Long = 0,
var address: String = "",
var contact: Contact? = null,
var lastUpdate: Long = 0
) : RealmObject() {
/**
@@ -23,13 +23,13 @@ import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
open class ScheduledMessage(
@PrimaryKey var id: Long = 0,
var date: Long = 0,
var subId: Int = -1,
var recipients: RealmList<String> = RealmList(),
var sendAsGroup: Boolean = true,
var body: String = "",
var attachments: RealmList<String> = RealmList()
@PrimaryKey var id: Long = 0,
var date: Long = 0,
var subId: Int = -1,
var recipients: RealmList<String> = RealmList(),
var sendAsGroup: Boolean = true,
var body: String = "",
var attachments: RealmList<String> = RealmList()
) : RealmObject() {
fun copy(id: Long = this.id,
@@ -45,10 +45,10 @@ import javax.inject.Singleton
@Singleton
class Navigator @Inject constructor(
private val context: Context,
private val analyticsManager: AnalyticsManager,
private val notificationManager: NotificationManager,
private val permissions: PermissionManager
private val context: Context,
private val analyticsManager: AnalyticsManager,
private val notificationManager: NotificationManager,
private val permissions: PermissionManager
) {
private fun startActivity(intent: Intent) {
@@ -37,8 +37,8 @@ inline fun LifecycleOwner.scope(): LifecycleScopeProvider<*> = AndroidLifecycleS
* @param untilEvent the event until the scope is valid.
*/
@CheckReturnValue
inline fun LifecycleOwner.scope(untilEvent: Lifecycle.Event): LifecycleScopeProvider<*>
= AndroidLifecycleScopeProvider.from(this, untilEvent)
inline fun LifecycleOwner.scope(untilEvent: Lifecycle.Event): LifecycleScopeProvider<*> =
AndroidLifecycleScopeProvider.from(this, untilEvent)
/**
* Extension that returns a [LifecycleScopeProvider] for this [LifecycleOwner].
@@ -46,8 +46,8 @@ inline fun LifecycleOwner.scope(untilEvent: Lifecycle.Event): LifecycleScopeProv
* @param boundaryResolver function that resolves the event boundary.
*/
@CheckReturnValue
inline fun LifecycleOwner.scope(boundaryResolver: Function<Event, Event>): LifecycleScopeProvider<*>
= AndroidLifecycleScopeProvider.from(this, boundaryResolver)
inline fun LifecycleOwner.scope(boundaryResolver: Function<Event, Event>): LifecycleScopeProvider<*> =
AndroidLifecycleScopeProvider.from(this, boundaryResolver)
/**
* Extension that returns a [LifecycleScopeProvider] for this [Lifecycle].
@@ -61,8 +61,8 @@ inline fun Lifecycle.scope(): LifecycleScopeProvider<*> = AndroidLifecycleScopeP
* @param untilEvent the event until the scope is valid.
*/
@CheckReturnValue
inline fun Lifecycle.scope(untilEvent: Lifecycle.Event): LifecycleScopeProvider<*>
= AndroidLifecycleScopeProvider.from(this, untilEvent)
inline fun Lifecycle.scope(untilEvent: Lifecycle.Event): LifecycleScopeProvider<*> =
AndroidLifecycleScopeProvider.from(this, untilEvent)
/**
* Extension that returns a [LifecycleScopeProvider] for this [Lifecycle].
@@ -70,5 +70,5 @@ inline fun Lifecycle.scope(untilEvent: Lifecycle.Event): LifecycleScopeProvider<
* @param boundaryResolver function that resolves the event boundary.
*/
@CheckReturnValue
inline fun Lifecycle.scope(boundaryResolver: Function<Event, Event>): LifecycleScopeProvider<*>
= AndroidLifecycleScopeProvider.from(this, boundaryResolver)
inline fun Lifecycle.scope(boundaryResolver: Function<Event, Event>): LifecycleScopeProvider<*> =
AndroidLifecycleScopeProvider.from(this, boundaryResolver)
@@ -42,8 +42,8 @@ import javax.inject.Singleton
@Singleton
class BillingManager @Inject constructor(
context: Context,
private val analyticsManager: AnalyticsManager
context: Context,
private val analyticsManager: AnalyticsManager
) : PurchasesUpdatedListener {
companion object {
@@ -28,8 +28,8 @@ import com.moez.QKSMS.util.tryOrNull
import javax.inject.Inject
class MessageDetailsFormatter @Inject constructor(
private val context: Context,
private val dateFormatter: DateFormatter
private val context: Context,
private val dateFormatter: DateFormatter
) {
fun format(message: Message): String {
@@ -54,12 +54,12 @@ import javax.inject.Singleton
@Singleton
class NotificationManagerImpl @Inject constructor(
private val context: Context,
private val colors: Colors,
private val conversationRepo: ConversationRepository,
private val prefs: Preferences,
private val messageRepo: MessageRepository,
private val permissions: PermissionManager
private val context: Context,
private val colors: Colors,
private val conversationRepo: ConversationRepository,
private val prefs: Preferences,
private val messageRepo: MessageRepository,
private val permissions: PermissionManager
) : com.moez.QKSMS.manager.NotificationManager {
companion object {
@@ -37,9 +37,9 @@ import me.leolin.shortcutbadger.ShortcutBadger
import javax.inject.Inject
class ShortcutManagerImpl @Inject constructor(
private val context: Context,
private val conversationRepo: ConversationRepository,
private val messageRepo: MessageRepository
private val context: Context,
private val conversationRepo: ConversationRepository,
private val messageRepo: MessageRepository
) : com.moez.QKSMS.manager.ShortcutManager {
override fun updateBadge() {
@@ -34,9 +34,9 @@ import com.moez.QKSMS.util.Preferences
import javax.inject.Inject
class TextViewStyler @Inject constructor(
private val prefs: Preferences,
private val colors: Colors,
private val fontProvider: FontProvider
private val prefs: Preferences,
private val colors: Colors,
private val fontProvider: FontProvider
) {
companion object {
@@ -33,8 +33,8 @@ import kotlinx.android.synthetic.main.backup_list_item.view.*
import javax.inject.Inject
class BackupAdapter @Inject constructor(
private val context: Context,
private val dateFormatter: DateFormatter
private val context: Context,
private val dateFormatter: DateFormatter
) : FlowableAdapter<BackupFile>() {
val backupSelected: Subject<BackupFile> = PublishSubject.create()
@@ -37,13 +37,13 @@ import java.util.concurrent.TimeUnit
import javax.inject.Inject
class BackupPresenter @Inject constructor(
private val backupRepo: BackupRepository,
private val billingManager: BillingManager,
private val context: Context,
private val dateFormatter: DateFormatter,
private val navigator: Navigator,
private val performBackup: PerformBackup,
private val permissionManager: PermissionManager
private val backupRepo: BackupRepository,
private val billingManager: BillingManager,
private val context: Context,
private val dateFormatter: DateFormatter,
private val navigator: Navigator,
private val performBackup: PerformBackup,
private val permissionManager: PermissionManager
) : QkPresenter<BackupView, BackupState>(BackupState()) {
private val storagePermissionSubject: Subject<Boolean> = BehaviorSubject.createDefault(permissionManager.hasStorage())
@@ -22,9 +22,9 @@ import com.moez.QKSMS.model.BackupFile
import com.moez.QKSMS.repository.BackupRepository
data class BackupState(
val backupProgress: BackupRepository.Progress = BackupRepository.Progress.Idle(),
val restoreProgress: BackupRepository.Progress = BackupRepository.Progress.Idle(),
val lastBackup: String = "",
val backups: List<BackupFile> = listOf(),
val upgraded: Boolean = false
val backupProgress: BackupRepository.Progress = BackupRepository.Progress.Idle(),
val restoreProgress: BackupRepository.Progress = BackupRepository.Progress.Idle(),
val lastBackup: String = "",
val backups: List<BackupFile> = listOf(),
val upgraded: Boolean = false
)
@@ -22,6 +22,6 @@ import com.moez.QKSMS.model.Conversation
import io.realm.RealmResults
data class BlockedState(
val siaEnabled: Boolean = false,
val data: RealmResults<Conversation>? = null
val siaEnabled: Boolean = false,
val data: RealmResults<Conversation>? = null
)
@@ -33,12 +33,12 @@ import io.reactivex.rxkotlin.withLatestFrom
import javax.inject.Inject
class BlockedViewModel @Inject constructor(
private val context: Context,
private val analytics: AnalyticsManager,
private val conversationRepo: ConversationRepository,
private val markUnblocked: MarkUnblocked,
private val navigator: Navigator,
private val prefs: Preferences
private val context: Context,
private val analytics: AnalyticsManager,
private val conversationRepo: ConversationRepository,
private val markUnblocked: MarkUnblocked,
private val navigator: Navigator,
private val prefs: Preferences
) : QkViewModel<BlockedView, BlockedState>(BlockedState()) {
init {
@@ -32,7 +32,7 @@ import kotlinx.android.synthetic.main.attachment_list_item.view.*
import javax.inject.Inject
class AttachmentAdapter @Inject constructor(
private val context: Context
private val context: Context
) : QkAdapter<Attachment>() {
val attachmentDeleted: Subject<Attachment> = PublishSubject.create()
@@ -26,25 +26,25 @@ import com.moez.QKSMS.model.Message
import io.realm.RealmResults
data class ComposeState(
val hasError: Boolean = false,
val editingMode: Boolean = false,
val contacts: List<Contact> = ArrayList(),
val contactsVisible: Boolean = false,
val selectedConversation: Long = 0,
val selectedContacts: List<Contact> = ArrayList(),
val sendAsGroup: Boolean = true,
val conversationtitle: String = "",
val loading: Boolean = false,
val query: String = "",
val searchSelectionId: Long = -1,
val searchSelectionPosition: Int = 0,
val searchResults: Int = 0,
val messages: Pair<Conversation, RealmResults<Message>>? = null,
val selectedMessages: Int = 0,
val scheduled: Long = 0,
val attachments: List<Attachment> = ArrayList(),
val attaching: Boolean = false,
val remaining: String = "",
val subscription: SubscriptionInfoCompat? = null,
val canSend: Boolean = false
val hasError: Boolean = false,
val editingMode: Boolean = false,
val contacts: List<Contact> = ArrayList(),
val contactsVisible: Boolean = false,
val selectedConversation: Long = 0,
val selectedContacts: List<Contact> = ArrayList(),
val sendAsGroup: Boolean = true,
val conversationtitle: String = "",
val loading: Boolean = false,
val query: String = "",
val searchSelectionId: Long = -1,
val searchSelectionPosition: Int = 0,
val searchResults: Int = 0,
val messages: Pair<Conversation, RealmResults<Message>>? = null,
val selectedMessages: Int = 0,
val scheduled: Long = 0,
val attachments: List<Attachment> = ArrayList(),
val attaching: Boolean = false,
val remaining: String = "",
val subscription: SubscriptionInfoCompat? = null,
val canSend: Boolean = false
)
@@ -73,30 +73,30 @@ import javax.inject.Inject
import javax.inject.Named
class ComposeViewModel @Inject constructor(
@Named("query") private val query: String,
@Named("threadId") private val threadId: Long,
@Named("address") private val address: String,
@Named("text") private val sharedText: String,
@Named("attachments") private val sharedAttachments: List<Attachment>,
private val context: Context,
private val activeConversationManager: ActiveConversationManager,
private val addScheduledMessage: AddScheduledMessage,
private val billingManager: BillingManager,
private val cancelMessage: CancelDelayedMessage,
private val contactFilter: ContactFilter,
private val contactsRepo: ContactRepository,
private val conversationRepo: ConversationRepository,
private val deleteMessages: DeleteMessages,
private val markRead: MarkRead,
private val messageDetailsFormatter: MessageDetailsFormatter,
private val messageRepo: MessageRepository,
private val navigator: Navigator,
private val permissionManager: PermissionManager,
private val prefs: Preferences,
private val retrySending: RetrySending,
private val sendMessage: SendMessage,
private val subscriptionManager: SubscriptionManagerCompat,
private val syncContacts: ContactSync
@Named("query") private val query: String,
@Named("threadId") private val threadId: Long,
@Named("address") private val address: String,
@Named("text") private val sharedText: String,
@Named("attachments") private val sharedAttachments: List<Attachment>,
private val context: Context,
private val activeConversationManager: ActiveConversationManager,
private val addScheduledMessage: AddScheduledMessage,
private val billingManager: BillingManager,
private val cancelMessage: CancelDelayedMessage,
private val contactFilter: ContactFilter,
private val contactsRepo: ContactRepository,
private val conversationRepo: ConversationRepository,
private val deleteMessages: DeleteMessages,
private val markRead: MarkRead,
private val messageDetailsFormatter: MessageDetailsFormatter,
private val messageRepo: MessageRepository,
private val navigator: Navigator,
private val permissionManager: PermissionManager,
private val prefs: Preferences,
private val retrySending: RetrySending,
private val sendMessage: SendMessage,
private val subscriptionManager: SubscriptionManagerCompat,
private val syncContacts: ContactSync
) : QkViewModel<ComposeView, ComposeState>(ComposeState(
editingMode = threadId == 0L && address.isBlank(),
selectedConversation = threadId,
@@ -64,12 +64,12 @@ import java.util.concurrent.TimeUnit
import javax.inject.Inject
class MessagesAdapter @Inject constructor(
private val context: Context,
private val colors: Colors,
private val dateFormatter: DateFormatter,
private val navigator: Navigator,
private val prefs: Preferences,
private val subscriptionManager: SubscriptionManagerCompat
private val context: Context,
private val colors: Colors,
private val dateFormatter: DateFormatter,
private val navigator: Navigator,
private val prefs: Preferences,
private val subscriptionManager: SubscriptionManagerCompat
) : QkRealmAdapter<Message>() {
companion object {
@@ -28,7 +28,7 @@ import com.moez.QKSMS.model.PhoneNumber
import kotlinx.android.synthetic.main.contact_list_item.view.*
class PhoneNumberAdapter(
private val numberClicked: (Contact, Int) -> Unit
private val numberClicked: (Contact, Int) -> Unit
) : QkAdapter<PhoneNumber>() {
lateinit var contact: Contact
@@ -40,9 +40,9 @@ import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.mms_vcard_list_item.view.*
class VCardBinder(
private val context: Context,
private val navigator: Navigator,
private val theme: Colors.Theme
private val context: Context,
private val navigator: Navigator,
private val theme: Colors.Theme
) : PartBinder {
override val partLayout = R.layout.mms_vcard_list_item
@@ -38,15 +38,15 @@ import javax.inject.Inject
import javax.inject.Named
class ConversationInfoPresenter @Inject constructor(
@Named("threadId") threadId: Long,
messageRepo: MessageRepository,
private val conversationRepo: ConversationRepository,
private val deleteConversations: DeleteConversations,
private val markArchived: MarkArchived,
private val markUnarchived: MarkUnarchived,
private val markBlocked: MarkBlocked,
private val markUnblocked: MarkUnblocked,
private val navigator: Navigator
@Named("threadId") threadId: Long,
messageRepo: MessageRepository,
private val conversationRepo: ConversationRepository,
private val deleteConversations: DeleteConversations,
private val markArchived: MarkArchived,
private val markUnarchived: MarkUnarchived,
private val markBlocked: MarkBlocked,
private val markUnblocked: MarkUnblocked,
private val navigator: Navigator
) : QkPresenter<ConversationInfoView, ConversationInfoState>(
ConversationInfoState(threadId = threadId, media = messageRepo.getPartsForConversation(threadId))
) {
@@ -24,11 +24,11 @@ import io.realm.RealmList
import io.realm.RealmResults
data class ConversationInfoState(
val name: String = "",
val recipients: RealmList<Recipient>? = null,
val threadId: Long = 0,
val archived: Boolean = false,
val blocked: Boolean = false,
val media: RealmResults<MmsPart>? = null,
val hasError: Boolean = false
val name: String = "",
val recipients: RealmList<Recipient>? = null,
val threadId: Long = 0,
val archived: Boolean = false,
val blocked: Boolean = false,
val media: RealmResults<MmsPart>? = null,
val hasError: Boolean = false
)
@@ -33,8 +33,8 @@ import kotlinx.android.synthetic.main.conversation_media_list_item.view.*
import javax.inject.Inject
class ConversationMediaAdapter @Inject constructor(
private val context: Context,
private val navigator: Navigator
private val context: Context,
private val navigator: Navigator
) : QkRealmAdapter<MmsPart>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder {
@@ -32,7 +32,7 @@ import kotlinx.android.synthetic.main.conversation_recipient_list_item.view.*
import javax.inject.Inject
class ConversationRecipientAdapter @Inject constructor(
private val navigator: Navigator
private val navigator: Navigator
) : QkRealmAdapter<Recipient>() {
var threadId: Long = 0L
@@ -42,10 +42,10 @@ import javax.inject.Inject
class ConversationItemTouchCallback @Inject constructor(
colors: Colors,
disposables: CompositeDisposable,
prefs: Preferences,
private val context: Context
colors: Colors,
disposables: CompositeDisposable,
prefs: Preferences,
private val context: Context
) : ItemTouchHelper.SimpleCallback(0, 0) {
val swipes: Subject<Pair<Long, Int>> = PublishSubject.create()
@@ -34,9 +34,9 @@ import kotlinx.android.synthetic.main.conversation_list_item.view.*
import javax.inject.Inject
class ConversationsAdapter @Inject constructor(
private val context: Context,
private val dateFormatter: DateFormatter,
private val navigator: Navigator
private val context: Context,
private val dateFormatter: DateFormatter,
private val navigator: Navigator
) : QkRealmAdapter<Conversation>() {
init {
@@ -48,9 +48,9 @@ import javax.inject.Inject
import javax.inject.Named
class GalleryPagerAdapter @Inject constructor(
context: Context,
@Named("partId") private val partId: Long,
private val dateFormatter: DateFormatter
context: Context,
@Named("partId") private val partId: Long,
private val dateFormatter: DateFormatter
) : PagerAdapter() {
var parts: RealmResults<MmsPart>? = null
@@ -22,6 +22,7 @@ import com.moez.QKSMS.model.MmsPart
import io.realm.RealmResults
data class GalleryState(
val navigationVisible: Boolean = true,
val title: String? = "",
val parts: RealmResults<MmsPart>? = null)
val navigationVisible: Boolean = true,
val title: String? = "",
val parts: RealmResults<MmsPart>? = null
)
@@ -35,11 +35,11 @@ import javax.inject.Inject
import javax.inject.Named
class GalleryViewModel @Inject constructor(
conversationRepo: ConversationRepository,
messageRepo: MessageRepository,
@Named("partId") private val partId: Long,
private val context: Context,
private val saveImage: SaveImage
conversationRepo: ConversationRepository,
messageRepo: MessageRepository,
@Named("partId") private val partId: Long,
private val context: Context,
private val saveImage: SaveImage
) : QkViewModel<GalleryView, GalleryState>(GalleryState()) {
init {
@@ -25,8 +25,8 @@ import com.moez.QKSMS.manager.AnalyticsManager
import javax.inject.Inject
class DrawerBadgesExperiment @Inject constructor(
context: Context,
analyticsManager: AnalyticsManager
context: Context,
analyticsManager: AnalyticsManager
) : Experiment<Boolean>(context, analyticsManager) {
override val key: String = "Drawer Badges"
@@ -24,32 +24,34 @@ import com.moez.QKSMS.repository.SyncRepository
import io.realm.RealmResults
data class MainState(
val hasError: Boolean = false,
val page: MainPage = Inbox(),
val drawerOpen: Boolean = false,
val upgraded: Boolean = true,
val showRating: Boolean = false,
val syncing: SyncRepository.SyncProgress = SyncRepository.SyncProgress.Idle(),
val defaultSms: Boolean = true,
val smsPermission: Boolean = true,
val contactPermission: Boolean = true
val hasError: Boolean = false,
val page: MainPage = Inbox(),
val drawerOpen: Boolean = false,
val upgraded: Boolean = true,
val showRating: Boolean = false,
val syncing: SyncRepository.SyncProgress = SyncRepository.SyncProgress.Idle(),
val defaultSms: Boolean = true,
val smsPermission: Boolean = true,
val contactPermission: Boolean = true
)
sealed class MainPage
data class Inbox(
val markPinned: Boolean = true,
val markRead: Boolean = false,
val data: RealmResults<Conversation>? = null,
val selected: Int = 0) : MainPage()
val markPinned: Boolean = true,
val markRead: Boolean = false,
val data: RealmResults<Conversation>? = null,
val selected: Int = 0
) : MainPage()
data class Searching(
val loading: Boolean = false,
val data: List<SearchResult>? = null
val loading: Boolean = false,
val data: List<SearchResult>? = null
) : MainPage()
data class Archived(
val markPinned: Boolean = true,
val markRead: Boolean = false,
val data: RealmResults<Conversation>? = null,
val selected: Int = 0) : MainPage()
val markPinned: Boolean = true,
val markRead: Boolean = false,
val data: RealmResults<Conversation>? = null,
val selected: Int = 0
) : MainPage()
@@ -53,24 +53,24 @@ import java.util.concurrent.TimeUnit
import javax.inject.Inject
class MainViewModel @Inject constructor(
billingManager: BillingManager,
markAllSeen: MarkAllSeen,
migratePreferences: MigratePreferences,
syncRepository: SyncRepository,
private val conversationRepo: ConversationRepository,
private val deleteConversations: DeleteConversations,
private val markArchived: MarkArchived,
private val markBlocked: MarkBlocked,
private val markPinned: MarkPinned,
private val markRead: MarkRead,
private val markUnarchived: MarkUnarchived,
private val markUnpinned: MarkUnpinned,
private val markUnread: MarkUnread,
private val navigator: Navigator,
private val permissionManager: PermissionManager,
private val prefs: Preferences,
private val ratingManager: RatingManager,
private val syncMessages: SyncMessages
billingManager: BillingManager,
markAllSeen: MarkAllSeen,
migratePreferences: MigratePreferences,
syncRepository: SyncRepository,
private val conversationRepo: ConversationRepository,
private val deleteConversations: DeleteConversations,
private val markArchived: MarkArchived,
private val markBlocked: MarkBlocked,
private val markPinned: MarkPinned,
private val markRead: MarkRead,
private val markUnarchived: MarkUnarchived,
private val markUnpinned: MarkUnpinned,
private val markUnread: MarkUnread,
private val navigator: Navigator,
private val permissionManager: PermissionManager,
private val prefs: Preferences,
private val ratingManager: RatingManager,
private val syncMessages: SyncMessages
) : QkViewModel<MainView, MainState>(MainState(page = Inbox(data = conversationRepo.getConversations()))) {
init {
@@ -36,10 +36,10 @@ import kotlinx.android.synthetic.main.search_list_item.view.*
import javax.inject.Inject
class SearchAdapter @Inject constructor(
colors: Colors,
private val context: Context,
private val dateFormatter: DateFormatter,
private val navigator: Navigator
colors: Colors,
private val context: Context,
private val dateFormatter: DateFormatter,
private val navigator: Navigator
) : QkAdapter<SearchResult>() {
private val highlightColor: Int by lazy { colors.theme().highlight }
@@ -22,15 +22,16 @@ import android.os.Build
import com.moez.QKSMS.util.Preferences
data class NotificationPrefsState(
val threadId: Long = 0,
val conversationTitle: String = "",
val notificationsEnabled: Boolean = true,
val previewSummary: String = "",
val previewId: Int = Preferences.NOTIFICATION_PREVIEWS_ALL,
val action1Summary: String = "",
val action2Summary: String = "",
val action3Summary: String = "",
val vibrationEnabled: Boolean = true,
val ringtoneName: String = "",
val qkReplyEnabled: Boolean = Build.VERSION.SDK_INT < Build.VERSION_CODES.N,
val qkReplyTapDismiss: Boolean = true)
val threadId: Long = 0,
val conversationTitle: String = "",
val notificationsEnabled: Boolean = true,
val previewSummary: String = "",
val previewId: Int = Preferences.NOTIFICATION_PREVIEWS_ALL,
val action1Summary: String = "",
val action2Summary: String = "",
val action3Summary: String = "",
val vibrationEnabled: Boolean = true,
val ringtoneName: String = "",
val qkReplyEnabled: Boolean = Build.VERSION.SDK_INT < Build.VERSION_CODES.N,
val qkReplyTapDismiss: Boolean = true
)
@@ -37,11 +37,11 @@ import javax.inject.Inject
import javax.inject.Named
class NotificationPrefsViewModel @Inject constructor(
@Named("threadId") private val threadId: Long,
private val context: Context,
private val conversationRepo: ConversationRepository,
private val navigator: Navigator,
private val prefs: Preferences
@Named("threadId") private val threadId: Long,
private val context: Context,
private val conversationRepo: ConversationRepository,
private val navigator: Navigator,
private val prefs: Preferences
) : QkViewModel<NotificationPrefsView, NotificationPrefsState>(NotificationPrefsState(threadId = threadId)) {
private val notifications = prefs.notifications(threadId)
@@ -19,8 +19,8 @@
package com.moez.QKSMS.feature.plus
data class PlusState(
val upgraded: Boolean = false,
val upgradePrice: String = "",
val upgradeDonatePrice: String = "",
val currency: String = ""
val upgraded: Boolean = false,
val upgradePrice: String = "",
val upgradeDonatePrice: String = "",
val currency: String = ""
)
@@ -29,9 +29,9 @@ import io.reactivex.rxkotlin.plusAssign
import javax.inject.Inject
class PlusViewModel @Inject constructor(
private val analyticsManager: AnalyticsManager,
private val billingManager: BillingManager,
private val navigator: Navigator
private val analyticsManager: AnalyticsManager,
private val billingManager: BillingManager,
private val navigator: Navigator
) : QkViewModel<PlusView, PlusState>(PlusState()) {
init {
@@ -27,8 +27,8 @@ import com.moez.QKSMS.manager.AnalyticsManager
import javax.inject.Inject
class UpgradeButtonExperiment @Inject constructor(
context: Context,
analytics: AnalyticsManager
context: Context,
analytics: AnalyticsManager
) : Experiment<@StringRes Int>(context, analytics) {
override val key: String = "Upgrade Button"
@@ -24,12 +24,12 @@ import com.moez.QKSMS.model.Message
import io.realm.RealmResults
data class QkReplyState(
val hasError: Boolean = false,
val selectedConversation: Long = 0,
val title: String = "",
val expanded: Boolean = false,
val data: Pair<Conversation, RealmResults<Message>>? = null,
val remaining: String = "",
val subscription: SubscriptionInfoCompat? = null,
val canSend: Boolean = false
val hasError: Boolean = false,
val selectedConversation: Long = 0,
val title: String = "",
val expanded: Boolean = false,
val data: Pair<Conversation, RealmResults<Message>>? = null,
val remaining: String = "",
val subscription: SubscriptionInfoCompat? = null,
val canSend: Boolean = false
)
@@ -46,14 +46,14 @@ import javax.inject.Inject
import javax.inject.Named
class QkReplyViewModel @Inject constructor(
@Named("threadId") private val threadId: Long,
private val conversationRepo: ConversationRepository,
private val deleteMessages: DeleteMessages,
private val markRead: MarkRead,
private val messageRepo: MessageRepository,
private val navigator: Navigator,
private val sendMessage: SendMessage,
private val subscriptionManager: SubscriptionManagerCompat
@Named("threadId") private val threadId: Long,
private val conversationRepo: ConversationRepository,
private val deleteMessages: DeleteMessages,
private val markRead: MarkRead,
private val messageRepo: MessageRepository,
private val navigator: Navigator,
private val sendMessage: SendMessage,
private val subscriptionManager: SubscriptionManagerCompat
) : QkViewModel<QkReplyView, QkReplyState>(QkReplyState(selectedConversation = threadId)) {
private val conversation by lazy {
@@ -38,8 +38,8 @@ import kotlinx.android.synthetic.main.scheduled_message_list_item.view.*
import javax.inject.Inject
class ScheduledMessageAdapter @Inject constructor(
private val contactRepo: ContactRepository,
private val dateFormatter: DateFormatter
private val contactRepo: ContactRepository,
private val dateFormatter: DateFormatter
) : QkRealmAdapter<ScheduledMessage>() {
private val contacts by lazy { contactRepo.getContacts() }
@@ -22,6 +22,6 @@ import com.moez.QKSMS.model.ScheduledMessage
import io.realm.RealmResults
data class ScheduledState(
val scheduledMessages: RealmResults<ScheduledMessage>? = null,
val upgraded: Boolean = false
val scheduledMessages: RealmResults<ScheduledMessage>? = null,
val upgraded: Boolean = false
)
@@ -30,10 +30,10 @@ import io.reactivex.rxkotlin.withLatestFrom
import javax.inject.Inject
class ScheduledViewModel @Inject constructor(
billingManager: BillingManager,
private val navigator: Navigator,
private val scheduledMessageRepo: ScheduledMessageRepository,
private val sendScheduledMessage: SendScheduledMessage
billingManager: BillingManager,
private val navigator: Navigator,
private val scheduledMessageRepo: ScheduledMessageRepository,
private val sendScheduledMessage: SendScheduledMessage
) : QkViewModel<ScheduledView, ScheduledState>(ScheduledState(
scheduledMessages = scheduledMessageRepo.getScheduledMessages()
)) {
@@ -39,15 +39,15 @@ import java.util.concurrent.TimeUnit
import javax.inject.Inject
class SettingsPresenter @Inject constructor(
private val context: Context,
private val billingManager: BillingManager,
private val colors: Colors,
private val dateFormatter: DateFormatter,
private val navigator: Navigator,
private val nightModeManager: NightModeManager,
private val prefs: Preferences,
private val syncMessages: SyncMessages,
private val syncRepo: SyncRepository
private val context: Context,
private val billingManager: BillingManager,
private val colors: Colors,
private val dateFormatter: DateFormatter,
private val navigator: Navigator,
private val nightModeManager: NightModeManager,
private val prefs: Preferences,
private val syncMessages: SyncMessages,
private val syncRepo: SyncRepository
) : QkPresenter<SettingsView, SettingsState>(SettingsState(theme = colors.theme().theme)) {
init {
@@ -22,24 +22,24 @@ import com.moez.QKSMS.repository.SyncRepository
import com.moez.QKSMS.util.Preferences
data class SettingsState(
val theme: Int = 0,
val nightModeSummary: String = "",
val nightModeId: Int = Preferences.NIGHT_MODE_OFF,
val nightStart: String = "",
val nightEnd: String = "",
val black: Boolean = false,
val autoEmojiEnabled: Boolean = true,
val notificationsEnabled: Boolean = true,
val sendDelaySummary: String = "",
val sendDelayId: Int = 0,
val deliveryEnabled: Boolean = false,
val textSizeSummary: String = "",
val textSizeId: Int = Preferences.TEXT_SIZE_NORMAL,
val systemFontEnabled: Boolean = false,
val splitSmsEnabled: Boolean = false,
val stripUnicodeEnabled: Boolean = false,
val mobileOnly: Boolean = false,
val maxMmsSizeSummary: String = "100KB",
val maxMmsSizeId: Int = 100,
val syncProgress: SyncRepository.SyncProgress = SyncRepository.SyncProgress.Idle()
val theme: Int = 0,
val nightModeSummary: String = "",
val nightModeId: Int = Preferences.NIGHT_MODE_OFF,
val nightStart: String = "",
val nightEnd: String = "",
val black: Boolean = false,
val autoEmojiEnabled: Boolean = true,
val notificationsEnabled: Boolean = true,
val sendDelaySummary: String = "",
val sendDelayId: Int = 0,
val deliveryEnabled: Boolean = false,
val textSizeSummary: String = "",
val textSizeId: Int = Preferences.TEXT_SIZE_NORMAL,
val systemFontEnabled: Boolean = false,
val splitSmsEnabled: Boolean = false,
val stripUnicodeEnabled: Boolean = false,
val mobileOnly: Boolean = false,
val maxMmsSizeSummary: String = "100KB",
val maxMmsSizeId: Int = 100,
val syncProgress: SyncRepository.SyncProgress = SyncRepository.SyncProgress.Idle()
)
@@ -25,7 +25,7 @@ import com.uber.autodispose.kotlin.autoDisposable
import javax.inject.Inject
class AboutPresenter @Inject constructor(
private val navigator: Navigator
private val navigator: Navigator
) : QkPresenter<AboutView, Unit>(Unit) {
override fun bindIntents(view: AboutView) {
@@ -29,8 +29,8 @@ import io.reactivex.rxkotlin.withLatestFrom
import javax.inject.Inject
class SwipeActionsPresenter @Inject constructor(
context: Context,
private val prefs: Preferences
context: Context,
private val prefs: Preferences
) : QkPresenter<SwipeActionsView, SwipeActionsState>(SwipeActionsState()) {
init {
@@ -22,9 +22,9 @@ import androidx.annotation.DrawableRes
import com.moez.QKSMS.R
data class SwipeActionsState(
@DrawableRes val rightIcon: Int = R.drawable.ic_archive_black_24dp,
val rightLabel: String = "",
@DrawableRes val rightIcon: Int = R.drawable.ic_archive_black_24dp,
val rightLabel: String = "",
@DrawableRes val leftIcon: Int = R.drawable.ic_archive_black_24dp,
val leftLabel: String = ""
@DrawableRes val leftIcon: Int = R.drawable.ic_archive_black_24dp,
val leftLabel: String = ""
)
@@ -40,8 +40,8 @@ import kotlinx.android.synthetic.main.theme_palette_list_item.view.*
import javax.inject.Inject
class ThemeAdapter @Inject constructor(
private val context: Context,
private val colors: Colors
private val context: Context,
private val colors: Colors
) : QkAdapter<List<Int>>() {
val colorSelected: Subject<Int> = PublishSubject.create()
@@ -32,12 +32,12 @@ import javax.inject.Inject
import javax.inject.Named
class ThemePickerPresenter @Inject constructor(
prefs: Preferences,
@Named("threadId") private val threadId: Long,
private val billingManager: BillingManager,
private val colors: Colors,
private val navigator: Navigator,
private val widgetManager: WidgetManager
prefs: Preferences,
@Named("threadId") private val threadId: Long,
private val billingManager: BillingManager,
private val colors: Colors,
private val navigator: Navigator,
private val widgetManager: WidgetManager
) : QkPresenter<ThemePickerView, ThemePickerState>(ThemePickerState(threadId = threadId)) {
private val theme: Preference<Int> = prefs.theme(threadId)
@@ -19,8 +19,8 @@
package com.moez.QKSMS.feature.themepicker
data class ThemePickerState(
val threadId: Long = 0,
val applyThemeVisible: Boolean = false,
val newColor: Int = -1,
val newTextColor: Int = -1
val threadId: Long = 0,
val applyThemeVisible: Boolean = false,
val newColor: Int = -1,
val newTextColor: Int = -1
)
@@ -30,9 +30,9 @@ import javax.inject.Inject
* Blocked conversations will be migrated in SyncManager
*/
class MigratePreferences @Inject constructor(
private val nightModeManager: NightModeManager,
private val prefs: Preferences,
private val rxPrefs: RxSharedPreferences
private val nightModeManager: NightModeManager,
private val prefs: Preferences,
private val rxPrefs: RxSharedPreferences
) : Interactor<Unit>() {
override fun buildObservable(params: Unit): Flowable<*> {