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
@@ -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,