forked from upstream-mirrors/quik
Merge tag 'v3.3.4'
This commit is contained in:
+14
-6
@@ -1,14 +1,19 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.androidx_version = '1.0.0-alpha3'
|
||||
ext.androidx_testrunner_version = '1.1.0-alpha3'
|
||||
ext.autodispose_version = '0.5.1'
|
||||
ext.constraintlayout_version = '1.1.0-beta5'
|
||||
ext.constraintlayout_version = '1.1.0'
|
||||
ext.dagger_version = "2.16"
|
||||
ext.espresso_version = '3.1.0-alpha3'
|
||||
ext.exoplayer_version = "2.8.1"
|
||||
ext.glide_version = "4.3.0"
|
||||
ext.kotlin_version = '1.2.31'
|
||||
ext.ktx_version = "0.2"
|
||||
ext.lifecycle_version = '1.1.0'
|
||||
ext.glide_version = "4.8.0-20180619.011009-9"
|
||||
ext.glide_compiler_version = "4.8.0-20180619.011013-9"
|
||||
ext.junit_version = '4.12'
|
||||
ext.kotlin_version = '1.2.50'
|
||||
ext.ktx_version = "1.0.0-alpha1"
|
||||
ext.lifecycle_version = '2.0.0-alpha1'
|
||||
ext.mockito_version = '2.18.3'
|
||||
ext.realm_version = '4.3.1'
|
||||
ext.realm_adapters_version = '2.1.0'
|
||||
@@ -17,7 +22,6 @@ buildscript {
|
||||
ext.rxjava_version = '2.1.4'
|
||||
ext.rxkotlin_version = '2.1.0'
|
||||
ext.rx_preferences_version = '2.0.0-RC3'
|
||||
ext.support_version = '28.0.0-alpha1'
|
||||
ext.timber_version = '4.5.1'
|
||||
|
||||
ext.abiCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2]
|
||||
@@ -41,6 +45,10 @@ allprojects {
|
||||
jcenter()
|
||||
maven { url "https://jitpack.io" }
|
||||
maven { url 'https://maven.google.com' }
|
||||
maven {
|
||||
name 'glide-snapshot'
|
||||
url 'http://oss.sonatype.org/content/repositories/snapshots'
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
+26
-3
@@ -4,22 +4,34 @@ apply plugin: 'kotlin-kapt'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
publishNonDefault true
|
||||
flavorDimensions "analytics"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 28
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
buildConfigField "String", "AMPLITUDE_API_KEY", "\"${System.getenv("AMPLITUDE_API_KEY")}\""
|
||||
buildConfigField "String", "MIXPANEL_API_KEY", "\"${System.getenv("MIXPANEL_API_KEY")}\""
|
||||
}
|
||||
|
||||
productFlavors {
|
||||
withAnalytics { dimension "analytics" }
|
||||
noAnalytics { dimension "analytics" }
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
// support
|
||||
implementation "com.android.support:appcompat-v7:$support_version"
|
||||
implementation "com.android.support:exifinterface:$support_version"
|
||||
// androidx
|
||||
implementation "androidx.appcompat:appcompat:$androidx_version"
|
||||
implementation "androidx.exifinterface:exifinterface:$androidx_version"
|
||||
|
||||
// dagger
|
||||
implementation "com.google.dagger:dagger:$dagger_version"
|
||||
implementation "com.google.dagger:dagger-android-support:$dagger_version"
|
||||
kapt "com.google.dagger:dagger-android-processor:$dagger_version"
|
||||
kapt "com.google.dagger:dagger-compiler:$dagger_version"
|
||||
compileOnly "javax.annotation:jsr250-api:1.0"
|
||||
|
||||
@@ -28,6 +40,15 @@ dependencies {
|
||||
implementation "io.reactivex.rxjava2:rxjava:$rxjava_version"
|
||||
implementation "io.reactivex.rxjava2:rxkotlin:$rxkotlin_version"
|
||||
|
||||
// testing
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:$espresso_version", {
|
||||
exclude group: "com.android.support", module: "support-annotations"
|
||||
})
|
||||
androidTestImplementation "org.mockito:mockito-android:$mockito_version"
|
||||
testImplementation "androidx.test:runner:$androidx_testrunner_version"
|
||||
testImplementation "junit:junit:$junit_version"
|
||||
testImplementation "org.mockito:mockito-core:$mockito_version"
|
||||
|
||||
implementation "androidx.core:core-ktx:$ktx_version"
|
||||
implementation "com.f2prateek.rx.preferences2:rx-preferences:$rx_preferences_version"
|
||||
implementation "com.jakewharton.timber:timber:$timber_version"
|
||||
@@ -35,6 +56,8 @@ dependencies {
|
||||
implementation "me.leolin:ShortcutBadger:1.1.21"
|
||||
implementation project(":android-smsmms")
|
||||
implementation project(':domain')
|
||||
withAnalyticsImplementation "com.amplitude:android-sdk:2.16.0"
|
||||
withAnalyticsImplementation "com.mixpanel.android:mixpanel-android:5.2.1"
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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 androidx.test.runner.AndroidJUnit4
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class MessageRepositoryTest {
|
||||
|
||||
@Test
|
||||
fun testRuns() {
|
||||
assert(1 == 1)
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package compat
|
||||
package com.moez.QKSMS.compat
|
||||
|
||||
import android.annotation.TargetApi
|
||||
import android.os.Build
|
||||
+2
-2
@@ -16,12 +16,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package compat
|
||||
package com.moez.QKSMS.compat
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.telephony.SubscriptionManager
|
||||
import manager.PermissionManager
|
||||
import com.moez.QKSMS.manager.PermissionManager
|
||||
import javax.inject.Inject
|
||||
|
||||
class SubscriptionManagerCompat @Inject constructor(context: Context, private val permissions: PermissionManager) {
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package compat
|
||||
package com.moez.QKSMS.compat
|
||||
|
||||
import android.content.Context
|
||||
import android.database.sqlite.SqliteWrapper
|
||||
+3
-3
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package util.extensions
|
||||
package com.moez.QKSMS.extensions
|
||||
|
||||
import android.database.Cursor
|
||||
import io.reactivex.Flowable
|
||||
@@ -35,10 +35,10 @@ fun Cursor.forEach(closeOnComplete: Boolean = true, method: (Cursor) -> Unit = {
|
||||
}
|
||||
|
||||
fun <T> Cursor.map(map: (Cursor) -> T): List<T> {
|
||||
return List(count, { position ->
|
||||
return List(count) { position ->
|
||||
moveToPosition(position)
|
||||
map(this)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> Cursor.mapWhile(map: (Cursor) -> T, predicate: (T) -> Boolean): ArrayList<T> {
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package util.extensions
|
||||
package com.moez.QKSMS.extensions
|
||||
|
||||
import com.google.android.mms.ContentType
|
||||
import model.MmsPart
|
||||
import com.moez.QKSMS.model.MmsPart
|
||||
|
||||
fun MmsPart.isSmil() = ContentType.APP_SMIL == type
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package util.extensions
|
||||
package com.moez.QKSMS.extensions
|
||||
|
||||
import io.reactivex.Observable
|
||||
import io.realm.Realm
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package util.extensions
|
||||
package com.moez.QKSMS.extensions
|
||||
|
||||
import java.text.Normalizer
|
||||
|
||||
+3
-3
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package filter
|
||||
package com.moez.QKSMS.filter
|
||||
|
||||
import model.Contact
|
||||
import util.extensions.removeAccents
|
||||
import com.moez.QKSMS.extensions.removeAccents
|
||||
import com.moez.QKSMS.model.Contact
|
||||
import javax.inject.Inject
|
||||
|
||||
class ContactFilter @Inject constructor(private val phoneNumberFilter: PhoneNumberFilter) : Filter<Contact>() {
|
||||
+2
-2
@@ -16,9 +16,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package filter
|
||||
package com.moez.QKSMS.filter
|
||||
|
||||
import model.Conversation
|
||||
import com.moez.QKSMS.model.Conversation
|
||||
import javax.inject.Inject
|
||||
|
||||
class ConversationFilter @Inject constructor(private val recipientFilter: RecipientFilter) : Filter<Conversation>() {
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package filter
|
||||
package com.moez.QKSMS.filter
|
||||
|
||||
abstract class Filter<in T> {
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package filter
|
||||
package com.moez.QKSMS.filter
|
||||
|
||||
import android.telephony.PhoneNumberUtils
|
||||
import javax.inject.Inject
|
||||
+2
-2
@@ -16,9 +16,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package filter
|
||||
package com.moez.QKSMS.filter
|
||||
|
||||
import model.Recipient
|
||||
import com.moez.QKSMS.model.Recipient
|
||||
import javax.inject.Inject
|
||||
|
||||
class RecipientFilter @Inject constructor(
|
||||
+4
-4
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package manager
|
||||
package com.moez.QKSMS.manager
|
||||
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
@@ -26,12 +26,12 @@ import android.os.Handler
|
||||
import android.os.IBinder
|
||||
import android.os.Message
|
||||
import android.os.Messenger
|
||||
import androidx.os.bundleOf
|
||||
import androidx.core.os.bundleOf
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
import com.moez.QKSMS.util.tryOrNull
|
||||
import io.reactivex.Single
|
||||
import io.reactivex.subjects.SingleSubject
|
||||
import timber.log.Timber
|
||||
import util.Preferences
|
||||
import util.tryOrNull
|
||||
import javax.inject.Inject
|
||||
|
||||
class ExternalBlockingManagerImpl @Inject constructor(
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package manager
|
||||
package com.moez.QKSMS.manager
|
||||
|
||||
import com.moez.QKSMS.model.Message
|
||||
import io.realm.Realm
|
||||
import model.Message
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
+2
-2
@@ -16,13 +16,13 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package manager
|
||||
package com.moez.QKSMS.manager
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager.PERMISSION_GRANTED
|
||||
import android.provider.Telephony
|
||||
import android.support.v4.content.ContextCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import javax.inject.Inject
|
||||
|
||||
class PermissionManagerImpl @Inject constructor(private val context: Context) : PermissionManager {
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package manager
|
||||
package com.moez.QKSMS.manager
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
+4
-4
@@ -16,14 +16,14 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package mapper
|
||||
package com.moez.QKSMS.mapper
|
||||
|
||||
import android.content.Context
|
||||
import android.database.Cursor
|
||||
import android.provider.ContactsContract.CommonDataKinds.Phone.*
|
||||
import manager.PermissionManager
|
||||
import model.Contact
|
||||
import model.PhoneNumber
|
||||
import com.moez.QKSMS.manager.PermissionManager
|
||||
import com.moez.QKSMS.model.Contact
|
||||
import com.moez.QKSMS.model.PhoneNumber
|
||||
import javax.inject.Inject
|
||||
|
||||
class CursorToContactImpl @Inject constructor(
|
||||
+4
-9
@@ -16,15 +16,15 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package mapper
|
||||
package com.moez.QKSMS.mapper
|
||||
|
||||
import android.content.Context
|
||||
import android.database.Cursor
|
||||
import android.net.Uri
|
||||
import android.provider.Telephony.Threads
|
||||
import manager.PermissionManager
|
||||
import model.Conversation
|
||||
import model.Recipient
|
||||
import com.moez.QKSMS.manager.PermissionManager
|
||||
import com.moez.QKSMS.model.Conversation
|
||||
import com.moez.QKSMS.model.Recipient
|
||||
import javax.inject.Inject
|
||||
|
||||
class CursorToConversationImpl @Inject constructor(
|
||||
@@ -75,9 +75,4 @@ class CursorToConversationImpl @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getConversationCursor(threadId: Long): Cursor? {
|
||||
return context.contentResolver.query(URI, PROJECTION,
|
||||
"_id = ?", arrayOf(threadId.toString()), null)
|
||||
}
|
||||
|
||||
}
|
||||
+5
-5
@@ -16,17 +16,17 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package mapper
|
||||
package com.moez.QKSMS.mapper
|
||||
|
||||
import android.content.Context
|
||||
import android.database.Cursor
|
||||
import android.net.Uri
|
||||
import android.provider.Telephony.*
|
||||
import com.google.android.mms.pdu_alt.PduHeaders
|
||||
import manager.KeyManager
|
||||
import manager.PermissionManager
|
||||
import model.Message
|
||||
import util.extensions.map
|
||||
import com.moez.QKSMS.extensions.map
|
||||
import com.moez.QKSMS.manager.KeyManager
|
||||
import com.moez.QKSMS.manager.PermissionManager
|
||||
import com.moez.QKSMS.model.Message
|
||||
import javax.inject.Inject
|
||||
|
||||
class CursorToMessageImpl @Inject constructor(
|
||||
+6
-6
@@ -16,19 +16,19 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package mapper
|
||||
package com.moez.QKSMS.mapper
|
||||
|
||||
import android.content.ContentUris
|
||||
import android.content.Context
|
||||
import android.database.Cursor
|
||||
import android.net.Uri
|
||||
import android.provider.Telephony
|
||||
import model.MmsPart
|
||||
import com.moez.QKSMS.extensions.isImage
|
||||
import com.moez.QKSMS.extensions.isSmil
|
||||
import com.moez.QKSMS.extensions.isText
|
||||
import com.moez.QKSMS.extensions.isVideo
|
||||
import com.moez.QKSMS.model.MmsPart
|
||||
import timber.log.Timber
|
||||
import util.extensions.isImage
|
||||
import util.extensions.isSmil
|
||||
import util.extensions.isText
|
||||
import util.extensions.isVideo
|
||||
import java.io.BufferedReader
|
||||
import java.io.InputStreamReader
|
||||
import javax.inject.Inject
|
||||
+3
-3
@@ -16,13 +16,13 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package mapper
|
||||
package com.moez.QKSMS.mapper
|
||||
|
||||
import android.content.Context
|
||||
import android.database.Cursor
|
||||
import android.net.Uri
|
||||
import manager.PermissionManager
|
||||
import model.Recipient
|
||||
import com.moez.QKSMS.manager.PermissionManager
|
||||
import com.moez.QKSMS.model.Recipient
|
||||
import javax.inject.Inject
|
||||
|
||||
class CursorToRecipientImpl @Inject constructor(
|
||||
+5
-5
@@ -16,12 +16,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package mapper
|
||||
package com.moez.QKSMS.mapper
|
||||
|
||||
import com.f2prateek.rx.preferences2.RxSharedPreferences
|
||||
import com.moez.QKSMS.manager.AnalyticsManager
|
||||
import com.moez.QKSMS.manager.RatingManager
|
||||
import io.reactivex.rxkotlin.Observables
|
||||
import manager.AnalyticsManager
|
||||
import manager.RatingManager
|
||||
import javax.inject.Inject
|
||||
|
||||
class RatingManagerImpl @Inject constructor(
|
||||
@@ -40,10 +40,10 @@ class RatingManagerImpl @Inject constructor(
|
||||
override val shouldShowRating = Observables.combineLatest(
|
||||
sessions.asObservable(),
|
||||
rated.asObservable(),
|
||||
dismissed.asObservable(), { sessions, rated, dismissed ->
|
||||
dismissed.asObservable()) { sessions, rated, dismissed ->
|
||||
|
||||
sessions > SESSION_THRESHOLD && !rated && !dismissed
|
||||
})
|
||||
}
|
||||
|
||||
override fun addSession() {
|
||||
sessions.set(sessions.get() + 1)
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package migration
|
||||
package com.moez.QKSMS.migration
|
||||
|
||||
import io.realm.DynamicRealm
|
||||
import io.realm.FieldAttribute
|
||||
+5
-5
@@ -16,17 +16,17 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package receiver
|
||||
package com.moez.QKSMS.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.provider.Telephony
|
||||
import android.support.annotation.RequiresApi
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.moez.QKSMS.interactor.SyncMessages
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
import dagger.android.AndroidInjection
|
||||
import interactor.SyncMessages
|
||||
import util.Preferences
|
||||
import javax.inject.Inject
|
||||
|
||||
class DefaultSmsChangedReceiver : BroadcastReceiver() {
|
||||
@@ -40,7 +40,7 @@ class DefaultSmsChangedReceiver : BroadcastReceiver() {
|
||||
|
||||
if (intent.getBooleanExtra(Telephony.Sms.Intents.EXTRA_IS_DEFAULT_SMS_APP, false)) {
|
||||
val pendingResult = goAsync()
|
||||
syncMessages.execute(Unit, { pendingResult.finish() })
|
||||
syncMessages.execute(Unit) { pendingResult.finish() }
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -16,13 +16,13 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package receiver
|
||||
package com.moez.QKSMS.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.moez.QKSMS.interactor.MarkRead
|
||||
import dagger.android.AndroidInjection
|
||||
import interactor.MarkRead
|
||||
import javax.inject.Inject
|
||||
|
||||
class MarkReadReceiver : BroadcastReceiver() {
|
||||
@@ -32,8 +32,9 @@ class MarkReadReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
AndroidInjection.inject(this, context)
|
||||
|
||||
val pendingResult = goAsync()
|
||||
val threadId = intent.getLongExtra("threadId", 0)
|
||||
markRead.execute(listOf(threadId))
|
||||
markRead.execute(listOf(threadId)) { pendingResult.finish() }
|
||||
}
|
||||
|
||||
}
|
||||
+4
-3
@@ -16,13 +16,13 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package receiver
|
||||
package com.moez.QKSMS.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.moez.QKSMS.interactor.MarkSeen
|
||||
import dagger.android.AndroidInjection
|
||||
import interactor.MarkSeen
|
||||
import javax.inject.Inject
|
||||
|
||||
class MarkSeenReceiver : BroadcastReceiver() {
|
||||
@@ -32,8 +32,9 @@ class MarkSeenReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
AndroidInjection.inject(this, context)
|
||||
|
||||
val pendingResult = goAsync()
|
||||
val threadId = intent.getLongExtra("threadId", 0)
|
||||
markSeen.execute(threadId)
|
||||
markSeen.execute(threadId) { pendingResult.finish() }
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -16,14 +16,14 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package receiver
|
||||
package com.moez.QKSMS.receiver
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import com.klinker.android.send_message.MmsReceivedReceiver
|
||||
import com.moez.QKSMS.interactor.ReceiveMms
|
||||
import dagger.android.AndroidInjection
|
||||
import interactor.ReceiveMms
|
||||
import javax.inject.Inject
|
||||
|
||||
class MmsReceivedReceiver : MmsReceivedReceiver() {
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package receiver
|
||||
package com.moez.QKSMS.receiver
|
||||
|
||||
import com.android.mms.transaction.PushReceiver
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package receiver
|
||||
package com.moez.QKSMS.receiver
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.BroadcastReceiver
|
||||
@@ -29,8 +29,8 @@ import android.provider.Telephony
|
||||
import com.google.android.mms.MmsException
|
||||
import com.google.android.mms.util_alt.SqliteWrapper
|
||||
import com.klinker.android.send_message.Transaction
|
||||
import com.moez.QKSMS.interactor.SyncMessage
|
||||
import dagger.android.AndroidInjection
|
||||
import interactor.SyncMessage
|
||||
import timber.log.Timber
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
+2
-2
@@ -16,14 +16,14 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package receiver
|
||||
package com.moez.QKSMS.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import com.moez.QKSMS.interactor.SyncMessage
|
||||
import dagger.android.AndroidInjection
|
||||
import interactor.SyncMessage
|
||||
import javax.inject.Inject
|
||||
|
||||
class MmsUpdatedReceiver : BroadcastReceiver() {
|
||||
+2
-2
@@ -16,13 +16,13 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package receiver
|
||||
package com.moez.QKSMS.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.moez.QKSMS.util.NightModeManager
|
||||
import dagger.android.AndroidInjection
|
||||
import util.NightModeManager
|
||||
import javax.inject.Inject
|
||||
|
||||
class NightModeReceiver : BroadcastReceiver() {
|
||||
+7
-7
@@ -16,18 +16,18 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package receiver
|
||||
package com.moez.QKSMS.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.support.v4.app.RemoteInput
|
||||
import compat.SubscriptionManagerCompat
|
||||
import androidx.core.app.RemoteInput
|
||||
import com.moez.QKSMS.compat.SubscriptionManagerCompat
|
||||
import com.moez.QKSMS.interactor.MarkRead
|
||||
import com.moez.QKSMS.interactor.SendMessage
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import dagger.android.AndroidInjection
|
||||
import interactor.MarkRead
|
||||
import interactor.SendMessage
|
||||
import repository.ConversationRepository
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class RemoteMessagingReceiver : BroadcastReceiver() {
|
||||
+3
-3
@@ -16,14 +16,14 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package receiver
|
||||
package com.moez.QKSMS.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.moez.QKSMS.interactor.RetrySending
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import dagger.android.AndroidInjection
|
||||
import interactor.RetrySending
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class SendSmsReceiver : BroadcastReceiver() {
|
||||
+3
-3
@@ -16,15 +16,15 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package receiver
|
||||
package com.moez.QKSMS.receiver
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.moez.QKSMS.interactor.MarkDelivered
|
||||
import com.moez.QKSMS.interactor.MarkDeliveryFailed
|
||||
import dagger.android.AndroidInjection
|
||||
import interactor.MarkDelivered
|
||||
import interactor.MarkDeliveryFailed
|
||||
import javax.inject.Inject
|
||||
|
||||
class SmsDeliveredReceiver : BroadcastReceiver() {
|
||||
+2
-2
@@ -16,13 +16,13 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package receiver
|
||||
package com.moez.QKSMS.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.moez.QKSMS.interactor.SyncMessage
|
||||
import dagger.android.AndroidInjection
|
||||
import interactor.SyncMessage
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
+3
-3
@@ -16,14 +16,14 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package receiver
|
||||
package com.moez.QKSMS.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.provider.Telephony.Sms
|
||||
import com.moez.QKSMS.interactor.ReceiveSms
|
||||
import dagger.android.AndroidInjection
|
||||
import interactor.ReceiveSms
|
||||
import javax.inject.Inject
|
||||
|
||||
class SmsReceiver : BroadcastReceiver() {
|
||||
@@ -37,7 +37,7 @@ class SmsReceiver : BroadcastReceiver() {
|
||||
val subId = intent.extras?.getInt("subscription", -1) ?: -1
|
||||
|
||||
val pendingResult = goAsync()
|
||||
receiveMessage.execute(ReceiveSms.Params(subId, messages), { pendingResult.finish() })
|
||||
receiveMessage.execute(ReceiveSms.Params(subId, messages)) { pendingResult.finish() }
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -16,16 +16,16 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package receiver
|
||||
package com.moez.QKSMS.receiver
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.telephony.SmsManager
|
||||
import com.moez.QKSMS.interactor.MarkFailed
|
||||
import com.moez.QKSMS.interactor.MarkSent
|
||||
import dagger.android.AndroidInjection
|
||||
import interactor.MarkFailed
|
||||
import interactor.MarkSent
|
||||
import javax.inject.Inject
|
||||
|
||||
class SmsSentReceiver : BroadcastReceiver() {
|
||||
+4
-4
@@ -16,20 +16,20 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package repository
|
||||
package com.moez.QKSMS.repository
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.provider.BaseColumns
|
||||
import android.provider.ContactsContract
|
||||
import com.moez.QKSMS.extensions.asFlowable
|
||||
import com.moez.QKSMS.extensions.mapNotNull
|
||||
import com.moez.QKSMS.model.Contact
|
||||
import io.reactivex.Flowable
|
||||
import io.reactivex.Single
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import io.realm.Realm
|
||||
import model.Contact
|
||||
import util.extensions.asFlowable
|
||||
import util.extensions.mapNotNull
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
+16
-17
@@ -1,24 +1,24 @@
|
||||
package repository
|
||||
package com.moez.QKSMS.repository
|
||||
|
||||
import android.content.ContentUris
|
||||
import android.content.Context
|
||||
import android.provider.Telephony
|
||||
import android.telephony.PhoneNumberUtils
|
||||
import compat.TelephonyCompat
|
||||
import filter.ConversationFilter
|
||||
import com.moez.QKSMS.compat.TelephonyCompat
|
||||
import com.moez.QKSMS.extensions.anyOf
|
||||
import com.moez.QKSMS.extensions.map
|
||||
import com.moez.QKSMS.filter.ConversationFilter
|
||||
import com.moez.QKSMS.mapper.CursorToConversation
|
||||
import com.moez.QKSMS.mapper.CursorToRecipient
|
||||
import com.moez.QKSMS.model.Contact
|
||||
import com.moez.QKSMS.model.Conversation
|
||||
import com.moez.QKSMS.model.Message
|
||||
import com.moez.QKSMS.model.SearchResult
|
||||
import com.moez.QKSMS.util.tryOrNull
|
||||
import io.realm.Case
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmResults
|
||||
import io.realm.Sort
|
||||
import mapper.CursorToConversation
|
||||
import mapper.CursorToRecipient
|
||||
import model.Contact
|
||||
import model.Conversation
|
||||
import model.Message
|
||||
import model.SearchResult
|
||||
import util.extensions.anyOf
|
||||
import util.extensions.map
|
||||
import util.tryOrNull
|
||||
import javax.inject.Inject
|
||||
|
||||
class ConversationRepositoryImpl @Inject constructor(
|
||||
@@ -256,11 +256,10 @@ class ConversationRepositoryImpl @Inject constructor(
|
||||
* conversation unless it contains at least 1 message
|
||||
*/
|
||||
private fun getConversationFromCp(threadId: Long): Conversation? {
|
||||
return cursorToConversation.getConversationCursor(threadId)
|
||||
?.takeIf { cursor -> cursor.moveToFirst() }
|
||||
?.use { cursor ->
|
||||
val conversation = cursorToConversation.map(cursor)
|
||||
|
||||
return cursorToConversation.getConversationsCursor()
|
||||
?.map(cursorToConversation::map)
|
||||
?.firstOrNull { it.id == threadId }
|
||||
?.let { conversation ->
|
||||
val realm = Realm.getDefaultInstance()
|
||||
val contacts = realm.copyFromRealm(realm.where(Contact::class.java).findAll())
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package repository
|
||||
package com.moez.QKSMS.repository
|
||||
|
||||
import android.content.ContentResolver
|
||||
import android.content.ContentUris
|
||||
@@ -10,8 +10,8 @@ import android.graphics.Matrix
|
||||
import android.net.Uri
|
||||
import android.provider.MediaStore
|
||||
import android.provider.MediaStore.Images
|
||||
import android.support.media.ExifInterface
|
||||
import util.tryOrNull
|
||||
import androidx.exifinterface.media.ExifInterface
|
||||
import com.moez.QKSMS.util.tryOrNull
|
||||
import javax.inject.Inject
|
||||
|
||||
class ImageRepostoryImpl @Inject constructor(private val context: Context) : ImageRepository {
|
||||
+21
-31
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package repository
|
||||
package com.moez.QKSMS.repository
|
||||
|
||||
import android.app.AlarmManager
|
||||
import android.app.PendingIntent
|
||||
@@ -27,37 +27,29 @@ import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.os.Build
|
||||
import android.provider.Telephony
|
||||
import android.telephony.PhoneNumberUtils
|
||||
import android.telephony.SmsManager
|
||||
import androidx.core.content.contentValuesOf
|
||||
import com.google.android.mms.ContentType
|
||||
import com.klinker.android.send_message.BroadcastUtils
|
||||
import com.klinker.android.send_message.Settings
|
||||
import com.klinker.android.send_message.StripAccents
|
||||
import com.klinker.android.send_message.Transaction
|
||||
import compat.TelephonyCompat
|
||||
import filter.ConversationFilter
|
||||
import com.moez.QKSMS.compat.TelephonyCompat
|
||||
import com.moez.QKSMS.extensions.anyOf
|
||||
import com.moez.QKSMS.extensions.insertOrUpdate
|
||||
import com.moez.QKSMS.extensions.map
|
||||
import com.moez.QKSMS.manager.KeyManager
|
||||
import com.moez.QKSMS.mapper.CursorToConversation
|
||||
import com.moez.QKSMS.model.Attachment
|
||||
import com.moez.QKSMS.model.Conversation
|
||||
import com.moez.QKSMS.model.Message
|
||||
import com.moez.QKSMS.model.MmsPart
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
import io.realm.Case
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmList
|
||||
import io.realm.RealmResults
|
||||
import io.realm.Sort
|
||||
import manager.KeyManager
|
||||
import mapper.CursorToConversation
|
||||
import mapper.CursorToRecipient
|
||||
import model.Attachment
|
||||
import model.Contact
|
||||
import model.Conversation
|
||||
import model.Message
|
||||
import model.MmsPart
|
||||
import model.Recipient
|
||||
import model.SearchResult
|
||||
import timber.log.Timber
|
||||
import util.Preferences
|
||||
import util.extensions.anyOf
|
||||
import util.extensions.forEach
|
||||
import util.extensions.insertOrUpdate
|
||||
import util.extensions.map
|
||||
import util.tryOrNull
|
||||
import java.io.ByteArrayOutputStream
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
@@ -66,7 +58,6 @@ import javax.inject.Singleton
|
||||
class MessageRepositoryImpl @Inject constructor(
|
||||
private val context: Context,
|
||||
private val messageIds: KeyManager,
|
||||
private val conversationRepo: ConversationRepository,
|
||||
private val imageRepository: ImageRepository,
|
||||
private val prefs: Preferences) : MessageRepository {
|
||||
|
||||
@@ -379,13 +370,12 @@ class MessageRepositoryImpl @Inject constructor(
|
||||
override fun insertReceivedSms(subId: Int, address: String, body: String, sentTime: Long): Message {
|
||||
|
||||
// Insert the message to the native content provider
|
||||
val values = ContentValues().apply {
|
||||
put(Telephony.Sms.ADDRESS, address)
|
||||
put(Telephony.Sms.BODY, body)
|
||||
put(Telephony.Sms.DATE_SENT, sentTime)
|
||||
put(Telephony.Sms.SUBSCRIPTION_ID, subId)
|
||||
}
|
||||
val uri = context.contentResolver.insert(Telephony.Sms.Inbox.CONTENT_URI, values)
|
||||
val uri = contentValuesOf(
|
||||
Pair(Telephony.Sms.ADDRESS, address),
|
||||
Pair(Telephony.Sms.BODY, body),
|
||||
Pair(Telephony.Sms.DATE_SENT, sentTime),
|
||||
Pair(Telephony.Sms.SUBSCRIPTION_ID, subId))
|
||||
.let { values -> context.contentResolver.insert(Telephony.Sms.Inbox.CONTENT_URI, values) }
|
||||
|
||||
// Insert the message to Realm
|
||||
return Message().apply {
|
||||
@@ -396,8 +386,8 @@ class MessageRepositoryImpl @Inject constructor(
|
||||
this.subId = subId
|
||||
|
||||
id = messageIds.newId()
|
||||
threadId = conversationRepo.getOrCreateConversation(address)?.id ?: 0L
|
||||
contentId = uri.lastPathSegment.toLong()
|
||||
threadId = TelephonyCompat.getOrCreateThreadId(context, address)
|
||||
contentId = uri?.lastPathSegment?.toLong() ?: 0L
|
||||
boxId = Telephony.Sms.MESSAGE_TYPE_INBOX
|
||||
type = "sms"
|
||||
insertOrUpdate()
|
||||
+15
-15
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package repository
|
||||
package com.moez.QKSMS.repository
|
||||
|
||||
import android.content.ContentResolver
|
||||
import android.content.ContentUris
|
||||
@@ -24,23 +24,23 @@ import android.net.Uri
|
||||
import android.provider.Telephony
|
||||
import android.telephony.PhoneNumberUtils
|
||||
import com.f2prateek.rx.preferences2.RxSharedPreferences
|
||||
import com.moez.QKSMS.extensions.insertOrUpdate
|
||||
import com.moez.QKSMS.extensions.map
|
||||
import com.moez.QKSMS.manager.KeyManager
|
||||
import com.moez.QKSMS.mapper.CursorToContact
|
||||
import com.moez.QKSMS.mapper.CursorToConversation
|
||||
import com.moez.QKSMS.mapper.CursorToMessage
|
||||
import com.moez.QKSMS.mapper.CursorToRecipient
|
||||
import com.moez.QKSMS.model.Contact
|
||||
import com.moez.QKSMS.model.Conversation
|
||||
import com.moez.QKSMS.model.Message
|
||||
import com.moez.QKSMS.model.MmsPart
|
||||
import com.moez.QKSMS.model.Recipient
|
||||
import com.moez.QKSMS.model.SyncLog
|
||||
import com.moez.QKSMS.util.tryOrNull
|
||||
import io.reactivex.subjects.BehaviorSubject
|
||||
import io.reactivex.subjects.Subject
|
||||
import io.realm.Realm
|
||||
import manager.KeyManager
|
||||
import mapper.CursorToContact
|
||||
import mapper.CursorToConversation
|
||||
import mapper.CursorToMessage
|
||||
import mapper.CursorToRecipient
|
||||
import model.Contact
|
||||
import model.Conversation
|
||||
import model.Message
|
||||
import model.MmsPart
|
||||
import model.Recipient
|
||||
import model.SyncLog
|
||||
import util.extensions.insertOrUpdate
|
||||
import util.extensions.map
|
||||
import util.tryOrNull
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
+3
-3
@@ -16,15 +16,15 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package service
|
||||
package com.moez.QKSMS.service
|
||||
|
||||
import android.app.IntentService
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.telephony.TelephonyManager
|
||||
import com.moez.QKSMS.interactor.SendMessage
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import dagger.android.AndroidInjection
|
||||
import interactor.SendMessage
|
||||
import repository.ConversationRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class HeadlessSmsSendService : IntentService("HeadlessSmsSendService") {
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package util
|
||||
package com.moez.QKSMS.util
|
||||
|
||||
import compat.SubscriptionInfoCompat
|
||||
import compat.SubscriptionManagerCompat
|
||||
import com.moez.QKSMS.compat.SubscriptionInfoCompat
|
||||
import com.moez.QKSMS.compat.SubscriptionManagerCompat
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.Observer
|
||||
import io.reactivex.disposables.Disposable
|
||||
+2
-2
@@ -16,13 +16,13 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package util
|
||||
package com.moez.QKSMS.util
|
||||
|
||||
import android.app.AlarmManager
|
||||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import receiver.NightModeReceiver
|
||||
import com.moez.QKSMS.receiver.NightModeReceiver
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package util
|
||||
package com.moez.QKSMS.util
|
||||
|
||||
import android.os.Build
|
||||
import android.provider.Settings
|
||||
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package util
|
||||
package com.moez.QKSMS.util
|
||||
|
||||
fun <T> tryOrNull(body: () -> T?): T? {
|
||||
return try {
|
||||
+1
-2
@@ -16,9 +16,8 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package common.util
|
||||
package com.moez.QKSMS.manager
|
||||
|
||||
import manager.AnalyticsManager
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
+4
-5
@@ -16,15 +16,14 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package common.util
|
||||
package com.moez.QKSMS.manager
|
||||
|
||||
import android.content.Context
|
||||
import com.amplitude.api.Amplitude
|
||||
import com.amplitude.api.AmplitudeClient
|
||||
import com.amplitude.api.Identify
|
||||
import com.mixpanel.android.mpmetrics.MixpanelAPI
|
||||
import com.moez.QKSMS.BuildConfig
|
||||
import manager.AnalyticsManager
|
||||
import com.moez.QKSMS.data.BuildConfig
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import timber.log.Timber
|
||||
@@ -48,9 +47,9 @@ class AnalyticsManagerImpl @Inject constructor(context: Context) : AnalyticsMana
|
||||
|
||||
amplitude.logEvent(event, propertiesJson)
|
||||
|
||||
synchronized(mixpanel, {
|
||||
synchronized(mixpanel) {
|
||||
mixpanel.track(event, propertiesJson)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
override fun setUserProperty(key: String, value: Any) {
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package util.extensions
|
||||
package com.moez.QKSMS.extensions
|
||||
|
||||
import io.reactivex.Flowable
|
||||
import io.reactivex.Observable
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class CancelDelayedMessage @Inject constructor(private val messageRepo: MessageRepository) : Interactor<Long>() {
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.SyncRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.SyncRepository
|
||||
import timber.log.Timber
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.ConversationRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class DeleteConversations @Inject constructor(
|
||||
+3
-3
@@ -16,11 +16,11 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.ConversationRepository
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class DeleteMessages @Inject constructor(
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import io.reactivex.Flowable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class MarkAllSeen @Inject constructor(private val messageRepo: MessageRepository) : Interactor<Unit>() {
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.ConversationRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class MarkArchived @Inject constructor(private val conversationRepo: ConversationRepository) : Interactor<List<Long>>() {
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.ConversationRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class MarkBlocked @Inject constructor(private val conversationRepo: ConversationRepository) : Interactor<List<Long>>() {
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class MarkDelivered @Inject constructor(private val messageRepo: MessageRepository) : Interactor<Long>() {
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class MarkDeliveryFailed @Inject constructor(
|
||||
+3
-3
@@ -16,11 +16,11 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.manager.NotificationManager
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import manager.NotificationManager
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class MarkFailed @Inject constructor(
|
||||
+4
-4
@@ -16,12 +16,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.manager.NotificationManager
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import manager.NotificationManager
|
||||
import repository.ConversationRepository
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class MarkRead @Inject constructor(
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class MarkSeen @Inject constructor(private val messageRepo: MessageRepository) : Interactor<Long>() {
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class MarkSent @Inject constructor(private val messageRepo: MessageRepository) : Interactor<Long>() {
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.ConversationRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class MarkUnarchived @Inject constructor(private val conversationRepo: ConversationRepository) : Interactor<List<Long>>() {
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.ConversationRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class MarkUnblocked @Inject constructor(private val conversationRepo: ConversationRepository) : Interactor<List<Long>>() {
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class MarkUnread @Inject constructor(
|
||||
+7
-7
@@ -16,16 +16,16 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import android.net.Uri
|
||||
import com.moez.QKSMS.extensions.mapNotNull
|
||||
import com.moez.QKSMS.manager.ExternalBlockingManager
|
||||
import com.moez.QKSMS.manager.NotificationManager
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import com.moez.QKSMS.repository.SyncRepository
|
||||
import io.reactivex.Flowable
|
||||
import manager.ExternalBlockingManager
|
||||
import manager.NotificationManager
|
||||
import repository.ConversationRepository
|
||||
import repository.MessageRepository
|
||||
import repository.SyncRepository
|
||||
import util.extensions.mapNotNull
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
|
||||
+6
-6
@@ -16,15 +16,15 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import android.telephony.SmsMessage
|
||||
import com.moez.QKSMS.extensions.mapNotNull
|
||||
import com.moez.QKSMS.manager.ExternalBlockingManager
|
||||
import com.moez.QKSMS.manager.NotificationManager
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import manager.ExternalBlockingManager
|
||||
import manager.NotificationManager
|
||||
import repository.ConversationRepository
|
||||
import repository.MessageRepository
|
||||
import util.extensions.mapNotNull
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
|
||||
+3
-3
@@ -16,11 +16,11 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.model.Message
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import model.Message
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class RetrySending @Inject constructor(private val messageRepo: MessageRepository) : Interactor<Message>() {
|
||||
+3
-3
@@ -16,11 +16,11 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.ImageRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.ImageRepository
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class SaveImage @Inject constructor(
|
||||
+4
-4
@@ -16,12 +16,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.model.Attachment
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import model.Attachment
|
||||
import repository.ConversationRepository
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class SendMessage @Inject constructor(
|
||||
+8
-7
@@ -16,25 +16,26 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import android.net.Uri
|
||||
import com.moez.QKSMS.extensions.mapNotNull
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.SyncRepository
|
||||
import io.reactivex.Flowable
|
||||
import model.Message
|
||||
import repository.ConversationRepository
|
||||
import repository.SyncRepository
|
||||
import util.extensions.mapNotNull
|
||||
import javax.inject.Inject
|
||||
|
||||
class SyncMessage @Inject constructor(
|
||||
private val conversationRepo: ConversationRepository,
|
||||
private val syncManager: SyncRepository
|
||||
private val syncManager: SyncRepository,
|
||||
private val updateBadge: UpdateBadge
|
||||
) : Interactor<Uri>() {
|
||||
|
||||
override fun buildObservable(params: Uri): Flowable<Message> {
|
||||
override fun buildObservable(params: Uri): Flowable<*> {
|
||||
return Flowable.just(params)
|
||||
.mapNotNull { uri -> syncManager.syncMessage(uri) }
|
||||
.doOnNext { message -> conversationRepo.updateConversations(message.threadId) }
|
||||
.flatMap { updateBadge.buildObservable(Unit) } // Update the badge
|
||||
}
|
||||
|
||||
}
|
||||
+6
-4
@@ -16,24 +16,26 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.repository.SyncRepository
|
||||
import io.reactivex.Flowable
|
||||
import repository.SyncRepository
|
||||
import timber.log.Timber
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
|
||||
class SyncMessages @Inject constructor(
|
||||
private val syncManager: SyncRepository
|
||||
private val syncManager: SyncRepository,
|
||||
private val updateBadge: UpdateBadge
|
||||
) : Interactor<Unit>() {
|
||||
|
||||
override fun buildObservable(params: Unit): Flowable<Long> {
|
||||
override fun buildObservable(params: Unit): Flowable<*> {
|
||||
return Flowable.just(System.currentTimeMillis())
|
||||
.doOnNext { syncManager.syncMessages() }
|
||||
.map { startTime -> System.currentTimeMillis() - startTime }
|
||||
.map { elapsed -> TimeUnit.MILLISECONDS.toSeconds(elapsed) }
|
||||
.doOnNext { seconds -> Timber.v("Completed sync in $seconds seconds") }
|
||||
.flatMap { updateBadge.buildObservable(Unit) } // Update the badge
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -16,11 +16,11 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package interactor
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.manager.WidgetManager
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import manager.WidgetManager
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
class UpdateBadge @Inject constructor(
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package manager
|
||||
package com.moez.QKSMS.manager
|
||||
|
||||
interface AnalyticsManager {
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package manager
|
||||
package com.moez.QKSMS.manager
|
||||
|
||||
import io.reactivex.Single
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package manager
|
||||
package com.moez.QKSMS.manager
|
||||
|
||||
/**
|
||||
* Helper class for generating incrementing ids for messages
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package manager
|
||||
package com.moez.QKSMS.manager
|
||||
|
||||
interface NotificationManager {
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package manager
|
||||
package com.moez.QKSMS.manager
|
||||
|
||||
interface PermissionManager {
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package manager
|
||||
package com.moez.QKSMS.manager
|
||||
|
||||
import io.reactivex.Observable
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package manager
|
||||
package com.moez.QKSMS.manager
|
||||
|
||||
interface WidgetManager {
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package mapper
|
||||
package com.moez.QKSMS.mapper
|
||||
|
||||
import android.database.Cursor
|
||||
import model.Contact
|
||||
import com.moez.QKSMS.model.Contact
|
||||
|
||||
interface CursorToContact : Mapper<Cursor, Contact> {
|
||||
|
||||
+2
-4
@@ -16,15 +16,13 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package mapper
|
||||
package com.moez.QKSMS.mapper
|
||||
|
||||
import android.database.Cursor
|
||||
import model.Conversation
|
||||
import com.moez.QKSMS.model.Conversation
|
||||
|
||||
interface CursorToConversation : Mapper<Cursor, Conversation> {
|
||||
|
||||
fun getConversationsCursor(lastSync: Long = 0): Cursor?
|
||||
|
||||
fun getConversationCursor(threadId: Long): Cursor?
|
||||
|
||||
}
|
||||
+2
-2
@@ -16,11 +16,11 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package mapper
|
||||
package com.moez.QKSMS.mapper
|
||||
|
||||
import android.database.Cursor
|
||||
import android.provider.Telephony.*
|
||||
import model.Message
|
||||
import com.moez.QKSMS.model.Message
|
||||
import timber.log.Timber
|
||||
import java.util.*
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package mapper
|
||||
package com.moez.QKSMS.mapper
|
||||
|
||||
import android.database.Cursor
|
||||
import model.MmsPart
|
||||
import com.moez.QKSMS.model.MmsPart
|
||||
|
||||
interface CursorToPart : Mapper<Cursor, MmsPart> {
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package mapper
|
||||
package com.moez.QKSMS.mapper
|
||||
|
||||
import android.database.Cursor
|
||||
import model.Recipient
|
||||
import com.moez.QKSMS.model.Recipient
|
||||
|
||||
interface CursorToRecipient : Mapper<Cursor, Recipient> {
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package mapper
|
||||
package com.moez.QKSMS.mapper
|
||||
|
||||
interface Mapper<in From, out To> {
|
||||
|
||||
+2
-2
@@ -16,12 +16,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package model
|
||||
package com.moez.QKSMS.model
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.support.v13.view.inputmethod.InputContentInfoCompat
|
||||
import androidx.core.view.inputmethod.InputContentInfoCompat
|
||||
|
||||
data class Attachment(private val uri: Uri? = null, private val inputContent: InputContentInfoCompat? = null) {
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package model
|
||||
package com.moez.QKSMS.model
|
||||
|
||||
import io.realm.RealmList
|
||||
import io.realm.RealmObject
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package model
|
||||
package com.moez.QKSMS.model
|
||||
|
||||
import io.realm.RealmList
|
||||
import io.realm.RealmObject
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package model
|
||||
package com.moez.QKSMS.model
|
||||
|
||||
import android.content.ContentUris
|
||||
import android.net.Uri
|
||||
+2
-2
@@ -16,9 +16,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package model
|
||||
package com.moez.QKSMS.model
|
||||
|
||||
import androidx.net.toUri
|
||||
import androidx.core.net.toUri
|
||||
import io.realm.RealmObject
|
||||
import io.realm.RealmResults
|
||||
import io.realm.annotations.LinkingObjects
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package model
|
||||
package com.moez.QKSMS.model
|
||||
|
||||
import io.realm.RealmObject
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package model
|
||||
package com.moez.QKSMS.model
|
||||
|
||||
import android.telephony.PhoneNumberUtils
|
||||
import io.realm.RealmObject
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
package model
|
||||
package com.moez.QKSMS.model
|
||||
|
||||
data class SearchResult(val query: String, val conversation: Conversation, val messages: Int)
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package model
|
||||
package com.moez.QKSMS.model
|
||||
|
||||
import io.realm.RealmObject
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user