forked from upstream-mirrors/quik
Move packages to com.moez.QKSMS
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.moez.QKSMS.repository
|
||||
|
||||
import android.net.Uri
|
||||
import com.moez.QKSMS.model.Contact
|
||||
import io.reactivex.Flowable
|
||||
import io.reactivex.Single
|
||||
|
||||
interface ContactRepository {
|
||||
|
||||
fun findContactUri(address: String): Single<Uri>
|
||||
|
||||
fun getUnmanagedContacts(): Flowable<List<Contact>>
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.moez.QKSMS.repository
|
||||
|
||||
import com.moez.QKSMS.model.Conversation
|
||||
import com.moez.QKSMS.model.SearchResult
|
||||
import io.realm.RealmResults
|
||||
|
||||
interface ConversationRepository {
|
||||
|
||||
fun getConversations(archived: Boolean = false): RealmResults<Conversation>
|
||||
|
||||
fun getConversationsSnapshot(): List<Conversation>
|
||||
|
||||
fun setConversationName(id: Long, name: String)
|
||||
|
||||
fun searchConversations(query: String): List<SearchResult>
|
||||
|
||||
fun getBlockedConversations(): RealmResults<Conversation>
|
||||
|
||||
fun getConversationAsync(threadId: Long): Conversation
|
||||
|
||||
fun getConversation(threadId: Long): Conversation?
|
||||
|
||||
fun getThreadId(recipient: String): Long?
|
||||
|
||||
fun getThreadId(recipients: Collection<String>): Long?
|
||||
|
||||
fun getOrCreateConversation(threadId: Long): Conversation?
|
||||
|
||||
fun getOrCreateConversation(address: String): Conversation?
|
||||
|
||||
fun getOrCreateConversation(addresses: List<String>): Conversation?
|
||||
|
||||
fun saveDraft(threadId: Long, draft: String)
|
||||
|
||||
/**
|
||||
* Updates message-related fields in the conversation, like the date and snippet
|
||||
*/
|
||||
fun updateConversations(vararg threadIds: Long)
|
||||
|
||||
fun markArchived(vararg threadIds: Long)
|
||||
|
||||
fun markUnarchived(vararg threadIds: Long)
|
||||
|
||||
fun markBlocked(vararg threadIds: Long)
|
||||
|
||||
fun markUnblocked(vararg threadIds: Long)
|
||||
|
||||
fun deleteConversations(vararg threadIds: Long)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.moez.QKSMS.repository
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
|
||||
interface ImageRepository {
|
||||
|
||||
fun loadImage(uri: Uri): Bitmap?
|
||||
|
||||
fun saveImage(uri: Uri)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.moez.QKSMS.repository
|
||||
|
||||
import com.moez.QKSMS.model.Attachment
|
||||
import com.moez.QKSMS.model.Message
|
||||
import com.moez.QKSMS.model.MmsPart
|
||||
import io.realm.RealmResults
|
||||
|
||||
interface MessageRepository {
|
||||
|
||||
fun getMessages(threadId: Long, query: String = ""): RealmResults<Message>
|
||||
|
||||
fun getMessage(id: Long): Message?
|
||||
|
||||
fun getMessageForPart(id: Long): Message?
|
||||
|
||||
fun getUnreadCount(): Long
|
||||
|
||||
fun getPart(id: Long): MmsPart?
|
||||
|
||||
fun getPartsForConversation(threadId: Long): RealmResults<MmsPart>
|
||||
|
||||
/**
|
||||
* Retrieves the list of messages which should be shown in the notification
|
||||
* for a given conversation
|
||||
*/
|
||||
fun getUnreadUnseenMessages(threadId: Long): RealmResults<Message>
|
||||
|
||||
/**
|
||||
* Retrieves the list of messages which should be shown in the quickreply popup
|
||||
* for a given conversation
|
||||
*/
|
||||
fun getUnreadMessages(threadId: Long): RealmResults<Message>
|
||||
|
||||
fun markAllSeen()
|
||||
|
||||
fun markSeen(threadId: Long)
|
||||
|
||||
fun markRead(vararg threadIds: Long)
|
||||
|
||||
fun markUnread(vararg threadIds: Long)
|
||||
|
||||
/**
|
||||
* Persists the SMS and attempts to send it
|
||||
*/
|
||||
fun sendSmsAndPersist(subId: Int, threadId: Long, address: String, body: String)
|
||||
|
||||
/**
|
||||
* Attempts to send the SMS message. This can be called if the message has already been persisted
|
||||
*/
|
||||
fun sendSms(message: Message)
|
||||
|
||||
fun sendMms(subId: Int, threadId: Long, addresses: List<String>, body: String, attachments: List<Attachment>)
|
||||
|
||||
/**
|
||||
* Attempts to cancel sending the message with the given id
|
||||
*/
|
||||
fun cancelDelayedSms(id: Long)
|
||||
|
||||
fun insertSentSms(subId: Int, threadId: Long, address: String, body: String, date: Long): Message
|
||||
|
||||
fun insertReceivedSms(subId: Int, address: String, body: String, sentTime: Long): Message
|
||||
|
||||
/**
|
||||
* Marks the message as sending, in case we need to retry sending it
|
||||
*/
|
||||
fun markSending(id: Long)
|
||||
|
||||
fun markSent(id: Long)
|
||||
|
||||
fun markFailed(id: Long, resultCode: Int)
|
||||
|
||||
fun markDelivered(id: Long)
|
||||
|
||||
fun markDeliveryFailed(id: Long, resultCode: Int)
|
||||
|
||||
fun deleteMessages(vararg messageIds: Long)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.moez.QKSMS.repository
|
||||
|
||||
import android.net.Uri
|
||||
import com.moez.QKSMS.model.Message
|
||||
import io.reactivex.Observable
|
||||
|
||||
interface SyncRepository {
|
||||
|
||||
sealed class SyncProgress {
|
||||
class Idle : SyncProgress()
|
||||
class Running(progress: Float) : SyncProgress()
|
||||
}
|
||||
|
||||
val syncProgress: Observable<SyncProgress>
|
||||
|
||||
fun syncMessages()
|
||||
|
||||
fun syncMessage(uri: Uri): Message?
|
||||
|
||||
fun syncContacts()
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user