parent
6c37cc770c
commit
40b24cd242
59 changed files with 200 additions and 197 deletions
|
@ -129,14 +129,14 @@ dependencies {
|
||||||
implementation "androidx.viewpager2:viewpager2:1.0.0"
|
implementation "androidx.viewpager2:viewpager2:1.0.0"
|
||||||
implementation "androidx.work:work-runtime:2.4.0"
|
implementation "androidx.work:work-runtime:2.4.0"
|
||||||
implementation "androidx.room:room-runtime:$roomVersion"
|
implementation "androidx.room:room-runtime:$roomVersion"
|
||||||
implementation "androidx.room:room-rxjava2:$roomVersion"
|
implementation "androidx.room:room-rxjava3:$roomVersion"
|
||||||
kapt "androidx.room:room-compiler:$roomVersion"
|
kapt "androidx.room:room-compiler:$roomVersion"
|
||||||
|
|
||||||
implementation "com.google.android.material:material:1.3.0"
|
implementation "com.google.android.material:material:1.3.0"
|
||||||
|
|
||||||
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
|
||||||
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
|
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
|
||||||
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
|
implementation "com.squareup.retrofit2:adapter-rxjava3:$retrofitVersion"
|
||||||
|
|
||||||
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
|
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
|
||||||
implementation "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
|
implementation "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
|
||||||
|
@ -146,12 +146,12 @@ dependencies {
|
||||||
implementation "com.github.bumptech.glide:glide:$glideVersion"
|
implementation "com.github.bumptech.glide:glide:$glideVersion"
|
||||||
implementation "com.github.bumptech.glide:okhttp3-integration:$glideVersion"
|
implementation "com.github.bumptech.glide:okhttp3-integration:$glideVersion"
|
||||||
|
|
||||||
implementation "io.reactivex.rxjava2:rxjava:2.2.20"
|
implementation "io.reactivex.rxjava3:rxjava:3.0.12"
|
||||||
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
|
implementation "io.reactivex.rxjava3:rxandroid:3.0.0"
|
||||||
implementation "io.reactivex.rxjava2:rxkotlin:2.4.0"
|
implementation "io.reactivex.rxjava3:rxkotlin:3.0.1"
|
||||||
|
|
||||||
implementation "com.uber.autodispose:autodispose-android-archcomponents:1.4.0"
|
implementation "com.uber.autodispose2:autodispose-androidx-lifecycle:2.0.0"
|
||||||
implementation "com.uber.autodispose:autodispose:1.4.0"
|
implementation "com.uber.autodispose2:autodispose:2.0.0"
|
||||||
|
|
||||||
implementation "com.google.dagger:dagger:$daggerVersion"
|
implementation "com.google.dagger:dagger:$daggerVersion"
|
||||||
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
|
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
|
||||||
|
|
|
@ -28,6 +28,8 @@ import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.DiffUtil
|
import androidx.recyclerview.widget.DiffUtil
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.ListAdapter
|
import androidx.recyclerview.widget.ListAdapter
|
||||||
|
import autodispose2.androidx.lifecycle.AndroidLifecycleScopeProvider.from
|
||||||
|
import autodispose2.autoDispose
|
||||||
import com.keylesspalace.tusky.databinding.FragmentAccountsInListBinding
|
import com.keylesspalace.tusky.databinding.FragmentAccountsInListBinding
|
||||||
import com.keylesspalace.tusky.databinding.ItemFollowRequestBinding
|
import com.keylesspalace.tusky.databinding.ItemFollowRequestBinding
|
||||||
import com.keylesspalace.tusky.di.Injectable
|
import com.keylesspalace.tusky.di.Injectable
|
||||||
|
@ -37,9 +39,7 @@ import com.keylesspalace.tusky.settings.PrefKeys
|
||||||
import com.keylesspalace.tusky.util.*
|
import com.keylesspalace.tusky.util.*
|
||||||
import com.keylesspalace.tusky.viewmodel.AccountsInListViewModel
|
import com.keylesspalace.tusky.viewmodel.AccountsInListViewModel
|
||||||
import com.keylesspalace.tusky.viewmodel.State
|
import com.keylesspalace.tusky.viewmodel.State
|
||||||
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import com.uber.autodispose.autoDispose
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,12 @@ import android.widget.LinearLayout
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.annotation.VisibleForTesting
|
import androidx.annotation.VisibleForTesting
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import autodispose2.androidx.lifecycle.AndroidLifecycleScopeProvider
|
||||||
|
import autodispose2.autoDispose
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.util.LinkHelper
|
import com.keylesspalace.tusky.util.LinkHelper
|
||||||
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import com.uber.autodispose.autoDispose
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
import java.net.URISyntaxException
|
import java.net.URISyntaxException
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -30,6 +30,8 @@ import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.recyclerview.widget.*
|
import androidx.recyclerview.widget.*
|
||||||
import androidx.recyclerview.widget.ListAdapter
|
import androidx.recyclerview.widget.ListAdapter
|
||||||
import at.connyduck.sparkbutton.helpers.Utils
|
import at.connyduck.sparkbutton.helpers.Utils
|
||||||
|
import autodispose2.androidx.lifecycle.AndroidLifecycleScopeProvider.from
|
||||||
|
import autodispose2.autoDispose
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.keylesspalace.tusky.databinding.ActivityListsBinding
|
import com.keylesspalace.tusky.databinding.ActivityListsBinding
|
||||||
import com.keylesspalace.tusky.di.Injectable
|
import com.keylesspalace.tusky.di.Injectable
|
||||||
|
@ -44,11 +46,9 @@ import com.mikepenz.iconics.IconicsDrawable
|
||||||
import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
|
import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
|
||||||
import com.mikepenz.iconics.utils.colorInt
|
import com.mikepenz.iconics.utils.colorInt
|
||||||
import com.mikepenz.iconics.utils.sizeDp
|
import com.mikepenz.iconics.utils.sizeDp
|
||||||
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from
|
|
||||||
import com.uber.autodispose.autoDispose
|
|
||||||
import dagger.android.DispatchingAndroidInjector
|
import dagger.android.DispatchingAndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,6 +37,7 @@ import androidx.emoji.text.EmojiCompat.InitCallback
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.viewpager2.widget.MarginPageTransformer
|
import androidx.viewpager2.widget.MarginPageTransformer
|
||||||
|
import autodispose2.androidx.lifecycle.autoDispose
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.RequestManager
|
import com.bumptech.glide.RequestManager
|
||||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||||
|
@ -81,11 +82,10 @@ import com.mikepenz.materialdrawer.model.*
|
||||||
import com.mikepenz.materialdrawer.model.interfaces.*
|
import com.mikepenz.materialdrawer.model.interfaces.*
|
||||||
import com.mikepenz.materialdrawer.util.*
|
import com.mikepenz.materialdrawer.util.*
|
||||||
import com.mikepenz.materialdrawer.widget.AccountHeaderView
|
import com.mikepenz.materialdrawer.widget.AccountHeaderView
|
||||||
import com.uber.autodispose.android.lifecycle.autoDispose
|
|
||||||
import dagger.android.DispatchingAndroidInjector
|
import dagger.android.DispatchingAndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInjector {
|
class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInjector {
|
||||||
|
|
|
@ -31,6 +31,8 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import androidx.transition.TransitionManager
|
import androidx.transition.TransitionManager
|
||||||
import at.connyduck.sparkbutton.helpers.Utils
|
import at.connyduck.sparkbutton.helpers.Utils
|
||||||
|
import autodispose2.androidx.lifecycle.AndroidLifecycleScopeProvider.from
|
||||||
|
import autodispose2.autoDispose
|
||||||
import com.google.android.material.transition.MaterialArcMotion
|
import com.google.android.material.transition.MaterialArcMotion
|
||||||
import com.google.android.material.transition.MaterialContainerTransform
|
import com.google.android.material.transition.MaterialContainerTransform
|
||||||
import com.keylesspalace.tusky.adapter.ItemInteractionListener
|
import com.keylesspalace.tusky.adapter.ItemInteractionListener
|
||||||
|
@ -44,11 +46,9 @@ import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.util.onTextChanged
|
import com.keylesspalace.tusky.util.onTextChanged
|
||||||
import com.keylesspalace.tusky.util.viewBinding
|
import com.keylesspalace.tusky.util.viewBinding
|
||||||
import com.keylesspalace.tusky.util.visible
|
import com.keylesspalace.tusky.util.visible
|
||||||
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import com.uber.autodispose.autoDispose
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
||||||
import io.reactivex.schedulers.Schedulers
|
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
|
@ -22,16 +22,16 @@ import android.util.Log
|
||||||
import androidx.emoji.text.EmojiCompat
|
import androidx.emoji.text.EmojiCompat
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.work.WorkManager
|
import androidx.work.WorkManager
|
||||||
|
import autodispose2.AutoDisposePlugins
|
||||||
import com.keylesspalace.tusky.components.notifications.NotificationWorkerFactory
|
import com.keylesspalace.tusky.components.notifications.NotificationWorkerFactory
|
||||||
import com.keylesspalace.tusky.di.AppInjector
|
import com.keylesspalace.tusky.di.AppInjector
|
||||||
import com.keylesspalace.tusky.settings.PrefKeys
|
import com.keylesspalace.tusky.settings.PrefKeys
|
||||||
import com.keylesspalace.tusky.util.EmojiCompatFont
|
import com.keylesspalace.tusky.util.EmojiCompatFont
|
||||||
import com.keylesspalace.tusky.util.LocaleManager
|
import com.keylesspalace.tusky.util.LocaleManager
|
||||||
import com.keylesspalace.tusky.util.ThemeUtils
|
import com.keylesspalace.tusky.util.ThemeUtils
|
||||||
import com.uber.autodispose.AutoDisposePlugins
|
|
||||||
import dagger.android.DispatchingAndroidInjector
|
import dagger.android.DispatchingAndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import io.reactivex.plugins.RxJavaPlugins
|
import io.reactivex.rxjava3.plugins.RxJavaPlugins
|
||||||
import org.conscrypt.Conscrypt
|
import org.conscrypt.Conscrypt
|
||||||
import java.security.Security
|
import java.security.Security
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -41,6 +41,8 @@ import androidx.fragment.app.FragmentActivity
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||||
import androidx.viewpager2.widget.ViewPager2
|
import androidx.viewpager2.widget.ViewPager2
|
||||||
|
import autodispose2.androidx.lifecycle.AndroidLifecycleScopeProvider
|
||||||
|
import autodispose2.autoDispose
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.request.FutureTarget
|
import com.bumptech.glide.request.FutureTarget
|
||||||
import com.keylesspalace.tusky.BuildConfig.APPLICATION_ID
|
import com.keylesspalace.tusky.BuildConfig.APPLICATION_ID
|
||||||
|
@ -52,11 +54,9 @@ import com.keylesspalace.tusky.pager.ImagePagerAdapter
|
||||||
import com.keylesspalace.tusky.util.getTemporaryMediaFilename
|
import com.keylesspalace.tusky.util.getTemporaryMediaFilename
|
||||||
import com.keylesspalace.tusky.util.viewBinding
|
import com.keylesspalace.tusky.util.viewBinding
|
||||||
import com.keylesspalace.tusky.viewdata.AttachmentViewData
|
import com.keylesspalace.tusky.viewdata.AttachmentViewData
|
||||||
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import com.uber.autodispose.autoDispose
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
||||||
import io.reactivex.schedulers.Schedulers
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileNotFoundException
|
import java.io.FileNotFoundException
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
|
|
|
@ -3,9 +3,9 @@ package com.keylesspalace.tusky.appstore
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.keylesspalace.tusky.db.AccountManager
|
import com.keylesspalace.tusky.db.AccountManager
|
||||||
import com.keylesspalace.tusky.db.AppDatabase
|
import com.keylesspalace.tusky.db.AppDatabase
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class CacheUpdater @Inject constructor(
|
class CacheUpdater @Inject constructor(
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.keylesspalace.tusky.appstore
|
package com.keylesspalace.tusky.appstore
|
||||||
|
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.subjects.PublishSubject
|
import io.reactivex.rxjava3.subjects.PublishSubject
|
||||||
|
|
||||||
interface Event
|
interface Event
|
||||||
interface Dispatchable : Event
|
interface Dispatchable : Event
|
||||||
|
|
|
@ -28,7 +28,7 @@ import com.keylesspalace.tusky.entity.Emoji
|
||||||
import com.keylesspalace.tusky.entity.Instance
|
import com.keylesspalace.tusky.entity.Instance
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.util.*
|
import com.keylesspalace.tusky.util.*
|
||||||
import io.reactivex.rxkotlin.Singles
|
import io.reactivex.rxjava3.core.Single
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class AnnouncementsViewModel @Inject constructor(
|
class AnnouncementsViewModel @Inject constructor(
|
||||||
|
@ -45,15 +45,14 @@ class AnnouncementsViewModel @Inject constructor(
|
||||||
val emojis: LiveData<List<Emoji>> = emojisMutable
|
val emojis: LiveData<List<Emoji>> = emojisMutable
|
||||||
|
|
||||||
init {
|
init {
|
||||||
Singles.zip(
|
Single.zip(mastodonApi.getCustomEmojis(),
|
||||||
mastodonApi.getCustomEmojis(),
|
|
||||||
appDatabase.instanceDao().loadMetadataForInstance(accountManager.activeAccount?.domain!!)
|
appDatabase.instanceDao().loadMetadataForInstance(accountManager.activeAccount?.domain!!)
|
||||||
.map<Either<InstanceEntity, Instance>> { Either.Left(it) }
|
.map<Either<InstanceEntity, Instance>> { Either.Left(it) }
|
||||||
.onErrorResumeNext(
|
.onErrorResumeNext {
|
||||||
mastodonApi.getInstance()
|
mastodonApi.getInstance()
|
||||||
.map { Either.Right(it) }
|
.map { Either.Right(it) }
|
||||||
)
|
},
|
||||||
) { emojis, either ->
|
{ emojis, either ->
|
||||||
either.asLeftOrNull()?.copy(emojiList = emojis)
|
either.asLeftOrNull()?.copy(emojiList = emojis)
|
||||||
?: InstanceEntity(
|
?: InstanceEntity(
|
||||||
accountManager.activeAccount?.domain!!,
|
accountManager.activeAccount?.domain!!,
|
||||||
|
@ -63,7 +62,7 @@ class AnnouncementsViewModel @Inject constructor(
|
||||||
either.asRight().pollLimits?.maxOptionChars,
|
either.asRight().pollLimits?.maxOptionChars,
|
||||||
either.asRight().version
|
either.asRight().version
|
||||||
)
|
)
|
||||||
}
|
})
|
||||||
.doOnSuccess {
|
.doOnSuccess {
|
||||||
appDatabase.instanceDao().insertOrReplace(it)
|
appDatabase.instanceDao().insertOrReplace(it)
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,9 @@ import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.service.ServiceClient
|
import com.keylesspalace.tusky.service.ServiceClient
|
||||||
import com.keylesspalace.tusky.service.TootToSend
|
import com.keylesspalace.tusky.service.TootToSend
|
||||||
import com.keylesspalace.tusky.util.*
|
import com.keylesspalace.tusky.util.*
|
||||||
import io.reactivex.Observable.just
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.rxkotlin.Singles
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ class ComposeViewModel @Inject constructor(
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
||||||
Singles.zip(api.getCustomEmojis(), api.getInstance()) { emojis, instance ->
|
Single.zip(api.getCustomEmojis(), api.getInstance(), { emojis, instance ->
|
||||||
InstanceEntity(
|
InstanceEntity(
|
||||||
instance = accountManager.activeAccount?.domain!!,
|
instance = accountManager.activeAccount?.domain!!,
|
||||||
emojiList = emojis,
|
emojiList = emojis,
|
||||||
|
@ -98,13 +98,13 @@ class ComposeViewModel @Inject constructor(
|
||||||
maxPollOptionLength = instance.pollLimits?.maxOptionChars,
|
maxPollOptionLength = instance.pollLimits?.maxOptionChars,
|
||||||
version = instance.version
|
version = instance.version
|
||||||
)
|
)
|
||||||
}
|
})
|
||||||
.doOnSuccess {
|
.doOnSuccess {
|
||||||
db.instanceDao().insertOrReplace(it)
|
db.instanceDao().insertOrReplace(it)
|
||||||
}
|
}
|
||||||
.onErrorResumeNext(
|
.onErrorResumeNext {
|
||||||
db.instanceDao().loadMetadataForInstance(accountManager.activeAccount?.domain!!)
|
db.instanceDao().loadMetadataForInstance(accountManager.activeAccount?.domain!!)
|
||||||
)
|
}
|
||||||
.subscribe({ instanceEntity ->
|
.subscribe({ instanceEntity ->
|
||||||
emoji.postValue(instanceEntity.emojiList)
|
emoji.postValue(instanceEntity.emojiList)
|
||||||
instance.postValue(instanceEntity)
|
instance.postValue(instanceEntity)
|
||||||
|
@ -257,7 +257,7 @@ class ComposeViewModel @Inject constructor(
|
||||||
val deletionObservable = if (isEditingScheduledToot) {
|
val deletionObservable = if (isEditingScheduledToot) {
|
||||||
api.deleteScheduledStatus(scheduledTootId.toString()).toObservable().map { }
|
api.deleteScheduledStatus(scheduledTootId.toString()).toObservable().map { }
|
||||||
} else {
|
} else {
|
||||||
just(Unit)
|
Observable.just(Unit)
|
||||||
}.toLiveData()
|
}.toLiveData()
|
||||||
|
|
||||||
val sendObservable = media
|
val sendObservable = media
|
||||||
|
|
|
@ -29,9 +29,9 @@ import com.keylesspalace.tusky.entity.Attachment
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.network.ProgressRequestBody
|
import com.keylesspalace.tusky.network.ProgressRequestBody
|
||||||
import com.keylesspalace.tusky.util.*
|
import com.keylesspalace.tusky.util.*
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
|
@ -11,8 +11,8 @@ import com.keylesspalace.tusky.entity.Conversation
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.util.Listing
|
import com.keylesspalace.tusky.util.Listing
|
||||||
import com.keylesspalace.tusky.util.NetworkState
|
import com.keylesspalace.tusky.util.NetworkState
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
|
@ -11,7 +11,7 @@ import com.keylesspalace.tusky.network.TimelineCases
|
||||||
import com.keylesspalace.tusky.util.Listing
|
import com.keylesspalace.tusky.util.Listing
|
||||||
import com.keylesspalace.tusky.util.NetworkState
|
import com.keylesspalace.tusky.util.NetworkState
|
||||||
import com.keylesspalace.tusky.util.RxAwareViewModel
|
import com.keylesspalace.tusky.util.RxAwareViewModel
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ConversationsViewModel @Inject constructor(
|
class ConversationsViewModel @Inject constructor(
|
||||||
|
|
|
@ -28,10 +28,10 @@ import com.keylesspalace.tusky.db.DraftEntity
|
||||||
import com.keylesspalace.tusky.entity.NewPoll
|
import com.keylesspalace.tusky.entity.NewPoll
|
||||||
import com.keylesspalace.tusky.entity.Status
|
import com.keylesspalace.tusky.entity.Status
|
||||||
import com.keylesspalace.tusky.util.IOUtils
|
import com.keylesspalace.tusky.util.IOUtils
|
||||||
import io.reactivex.Completable
|
import io.reactivex.rxjava3.core.Completable
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -124,7 +124,9 @@ class DraftHelper @Inject constructor(
|
||||||
fun deleteDraftAndAttachments(draftId: Int): Completable {
|
fun deleteDraftAndAttachments(draftId: Int): Completable {
|
||||||
return draftDao.find(draftId)
|
return draftDao.find(draftId)
|
||||||
.flatMapCompletable { draft ->
|
.flatMapCompletable { draft ->
|
||||||
deleteDraftAndAttachments(draft)
|
draft?.let {
|
||||||
|
deleteDraftAndAttachments(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@ import android.widget.Toast
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration
|
import androidx.recyclerview.widget.DividerItemDecoration
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import autodispose2.androidx.lifecycle.AndroidLifecycleScopeProvider.from
|
||||||
|
import autodispose2.autoDispose
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.keylesspalace.tusky.BaseActivity
|
import com.keylesspalace.tusky.BaseActivity
|
||||||
|
@ -34,8 +36,7 @@ import com.keylesspalace.tusky.db.DraftEntity
|
||||||
import com.keylesspalace.tusky.di.ViewModelFactory
|
import com.keylesspalace.tusky.di.ViewModelFactory
|
||||||
import com.keylesspalace.tusky.util.hide
|
import com.keylesspalace.tusky.util.hide
|
||||||
import com.keylesspalace.tusky.util.show
|
import com.keylesspalace.tusky.util.show
|
||||||
import com.uber.autodispose.android.lifecycle.autoDispose
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ class DraftsActivity : BaseActivity(), DraftActionListener {
|
||||||
bottomSheet.state = BottomSheetBehavior.STATE_COLLAPSED
|
bottomSheet.state = BottomSheetBehavior.STATE_COLLAPSED
|
||||||
viewModel.getToot(draft.inReplyToId)
|
viewModel.getToot(draft.inReplyToId)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.autoDispose(this)
|
.autoDispose(from(this))
|
||||||
.subscribe({ status ->
|
.subscribe({ status ->
|
||||||
val composeOptions = ComposeActivity.ComposeOptions(
|
val composeOptions = ComposeActivity.ComposeOptions(
|
||||||
draftId = draft.id,
|
draftId = draft.id,
|
||||||
|
|
|
@ -22,7 +22,7 @@ import com.keylesspalace.tusky.db.AppDatabase
|
||||||
import com.keylesspalace.tusky.db.DraftEntity
|
import com.keylesspalace.tusky.db.DraftEntity
|
||||||
import com.keylesspalace.tusky.entity.Status
|
import com.keylesspalace.tusky.entity.Status
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DraftsViewModel @Inject constructor(
|
class DraftsViewModel @Inject constructor(
|
||||||
|
|
|
@ -8,6 +8,8 @@ import androidx.lifecycle.Lifecycle
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration
|
import androidx.recyclerview.widget.DividerItemDecoration
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import autodispose2.androidx.lifecycle.AndroidLifecycleScopeProvider.from
|
||||||
|
import autodispose2.autoDispose
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.keylesspalace.tusky.R
|
import com.keylesspalace.tusky.R
|
||||||
import com.keylesspalace.tusky.components.instancemute.adapter.DomainMutesAdapter
|
import com.keylesspalace.tusky.components.instancemute.adapter.DomainMutesAdapter
|
||||||
|
@ -20,9 +22,7 @@ import com.keylesspalace.tusky.util.hide
|
||||||
import com.keylesspalace.tusky.util.show
|
import com.keylesspalace.tusky.util.show
|
||||||
import com.keylesspalace.tusky.util.viewBinding
|
import com.keylesspalace.tusky.util.viewBinding
|
||||||
import com.keylesspalace.tusky.view.EndlessOnScrollListener
|
import com.keylesspalace.tusky.view.EndlessOnScrollListener
|
||||||
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import com.uber.autodispose.autoDispose
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
|
@ -70,8 +70,8 @@ import java.util.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
|
|
||||||
import static com.keylesspalace.tusky.viewdata.PollViewDataKt.buildDescription;
|
import static com.keylesspalace.tusky.viewdata.PollViewDataKt.buildDescription;
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,8 @@ import com.keylesspalace.tusky.util.EmojiCompatFont.Companion.SYSTEM_DEFAULT
|
||||||
import com.keylesspalace.tusky.util.EmojiCompatFont.Companion.TWEMOJI
|
import com.keylesspalace.tusky.util.EmojiCompatFont.Companion.TWEMOJI
|
||||||
import com.keylesspalace.tusky.util.hide
|
import com.keylesspalace.tusky.util.hide
|
||||||
import com.keylesspalace.tusky.util.show
|
import com.keylesspalace.tusky.util.show
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@ import com.keylesspalace.tusky.entity.Relationship
|
||||||
import com.keylesspalace.tusky.entity.Status
|
import com.keylesspalace.tusky.entity.Status
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.util.*
|
import com.keylesspalace.tusky.util.*
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ReportViewModel @Inject constructor(
|
class ReportViewModel @Inject constructor(
|
||||||
|
|
|
@ -21,8 +21,8 @@ import androidx.paging.ItemKeyedDataSource
|
||||||
import com.keylesspalace.tusky.entity.Status
|
import com.keylesspalace.tusky.entity.Status
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.util.NetworkState
|
import com.keylesspalace.tusky.util.NetworkState
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.functions.BiFunction
|
import io.reactivex.rxjava3.functions.BiFunction
|
||||||
import java.util.concurrent.Executor
|
import java.util.concurrent.Executor
|
||||||
|
|
||||||
class StatusesDataSource(private val accountId: String,
|
class StatusesDataSource(private val accountId: String,
|
||||||
|
|
|
@ -19,7 +19,7 @@ import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.paging.DataSource
|
import androidx.paging.DataSource
|
||||||
import com.keylesspalace.tusky.entity.Status
|
import com.keylesspalace.tusky.entity.Status
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import java.util.concurrent.Executor
|
import java.util.concurrent.Executor
|
||||||
|
|
||||||
class StatusesDataSourceFactory(
|
class StatusesDataSourceFactory(
|
||||||
|
|
|
@ -21,7 +21,7 @@ import androidx.paging.toLiveData
|
||||||
import com.keylesspalace.tusky.entity.Status
|
import com.keylesspalace.tusky.entity.Status
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.util.BiListing
|
import com.keylesspalace.tusky.util.BiListing
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
|
@ -22,8 +22,8 @@ import androidx.paging.ItemKeyedDataSource
|
||||||
import com.keylesspalace.tusky.entity.ScheduledStatus
|
import com.keylesspalace.tusky.entity.ScheduledStatus
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.util.NetworkState
|
import com.keylesspalace.tusky.util.NetworkState
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxkotlin.addTo
|
import io.reactivex.rxjava3.kotlin.addTo
|
||||||
|
|
||||||
class ScheduledTootDataSourceFactory(
|
class ScheduledTootDataSourceFactory(
|
||||||
private val mastodonApi: MastodonApi,
|
private val mastodonApi: MastodonApi,
|
||||||
|
|
|
@ -23,7 +23,7 @@ import com.keylesspalace.tusky.appstore.StatusScheduledEvent
|
||||||
import com.keylesspalace.tusky.entity.ScheduledStatus
|
import com.keylesspalace.tusky.entity.ScheduledStatus
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.util.RxAwareViewModel
|
import com.keylesspalace.tusky.util.RxAwareViewModel
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ScheduledTootViewModel @Inject constructor(
|
class ScheduledTootViewModel @Inject constructor(
|
||||||
|
|
|
@ -13,8 +13,9 @@ import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.network.TimelineCases
|
import com.keylesspalace.tusky.network.TimelineCases
|
||||||
import com.keylesspalace.tusky.util.*
|
import com.keylesspalace.tusky.util.*
|
||||||
import com.keylesspalace.tusky.viewdata.StatusViewData
|
import com.keylesspalace.tusky.viewdata.StatusViewData
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.core.Single
|
||||||
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class SearchViewModel @Inject constructor(
|
class SearchViewModel @Inject constructor(
|
||||||
|
|
|
@ -21,8 +21,8 @@ import com.keylesspalace.tusky.components.search.SearchType
|
||||||
import com.keylesspalace.tusky.entity.SearchResult
|
import com.keylesspalace.tusky.entity.SearchResult
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.util.NetworkState
|
import com.keylesspalace.tusky.util.NetworkState
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxkotlin.addTo
|
import io.reactivex.rxjava3.kotlin.addTo
|
||||||
import java.util.concurrent.Executor
|
import java.util.concurrent.Executor
|
||||||
|
|
||||||
class SearchDataSource<T>(
|
class SearchDataSource<T>(
|
||||||
|
|
|
@ -20,7 +20,7 @@ import androidx.paging.DataSource
|
||||||
import com.keylesspalace.tusky.components.search.SearchType
|
import com.keylesspalace.tusky.components.search.SearchType
|
||||||
import com.keylesspalace.tusky.entity.SearchResult
|
import com.keylesspalace.tusky.entity.SearchResult
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import java.util.concurrent.Executor
|
import java.util.concurrent.Executor
|
||||||
|
|
||||||
class SearchDataSourceFactory<T>(
|
class SearchDataSourceFactory<T>(
|
||||||
|
|
|
@ -22,7 +22,7 @@ import com.keylesspalace.tusky.components.search.SearchType
|
||||||
import com.keylesspalace.tusky.entity.SearchResult
|
import com.keylesspalace.tusky.entity.SearchResult
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.util.Listing
|
import com.keylesspalace.tusky.util.Listing
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
|
|
||||||
class SearchRepository<T>(private val mastodonApi: MastodonApi) {
|
class SearchRepository<T>(private val mastodonApi: MastodonApi) {
|
||||||
|
|
|
@ -38,6 +38,8 @@ import androidx.paging.PagedListAdapter
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration
|
import androidx.recyclerview.widget.DividerItemDecoration
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import autodispose2.androidx.lifecycle.AndroidLifecycleScopeProvider.from
|
||||||
|
import autodispose2.autoDispose
|
||||||
import com.keylesspalace.tusky.BaseActivity
|
import com.keylesspalace.tusky.BaseActivity
|
||||||
import com.keylesspalace.tusky.MainActivity
|
import com.keylesspalace.tusky.MainActivity
|
||||||
import com.keylesspalace.tusky.R
|
import com.keylesspalace.tusky.R
|
||||||
|
@ -60,9 +62,7 @@ import com.keylesspalace.tusky.util.StatusDisplayOptions
|
||||||
import com.keylesspalace.tusky.view.showMuteAccountDialog
|
import com.keylesspalace.tusky.view.showMuteAccountDialog
|
||||||
import com.keylesspalace.tusky.viewdata.AttachmentViewData
|
import com.keylesspalace.tusky.viewdata.AttachmentViewData
|
||||||
import com.keylesspalace.tusky.viewdata.StatusViewData
|
import com.keylesspalace.tusky.viewdata.StatusViewData
|
||||||
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import com.uber.autodispose.autoDispose
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
||||||
|
|
||||||
class SearchStatusesFragment : SearchFragment<Pair<Status, StatusViewData.Concrete>>(), StatusActionListener {
|
class SearchStatusesFragment : SearchFragment<Pair<Status, StatusViewData.Concrete>>(), StatusActionListener {
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ package com.keylesspalace.tusky.db
|
||||||
import androidx.paging.DataSource
|
import androidx.paging.DataSource
|
||||||
import androidx.room.*
|
import androidx.room.*
|
||||||
import com.keylesspalace.tusky.components.conversation.ConversationEntity
|
import com.keylesspalace.tusky.components.conversation.ConversationEntity
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface ConversationsDao {
|
interface ConversationsDao {
|
||||||
|
|
|
@ -20,8 +20,8 @@ import androidx.room.Dao
|
||||||
import androidx.room.Insert
|
import androidx.room.Insert
|
||||||
import androidx.room.OnConflictStrategy
|
import androidx.room.OnConflictStrategy
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import io.reactivex.Completable
|
import io.reactivex.rxjava3.core.Completable
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface DraftDao {
|
interface DraftDao {
|
||||||
|
|
|
@ -19,7 +19,7 @@ import androidx.room.Dao
|
||||||
import androidx.room.Insert
|
import androidx.room.Insert
|
||||||
import androidx.room.OnConflictStrategy
|
import androidx.room.OnConflictStrategy
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface InstanceDao {
|
interface InstanceDao {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import androidx.room.OnConflictStrategy.IGNORE
|
||||||
import androidx.room.OnConflictStrategy.REPLACE
|
import androidx.room.OnConflictStrategy.REPLACE
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import androidx.room.Transaction
|
import androidx.room.Transaction
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
abstract class TimelineDao {
|
abstract class TimelineDao {
|
||||||
|
|
|
@ -34,7 +34,7 @@ import okhttp3.OkHttp
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.logging.HttpLoggingInterceptor
|
import okhttp3.logging.HttpLoggingInterceptor
|
||||||
import retrofit2.Retrofit
|
import retrofit2.Retrofit
|
||||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
|
import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory
|
||||||
import retrofit2.converter.gson.GsonConverterFactory
|
import retrofit2.converter.gson.GsonConverterFactory
|
||||||
import retrofit2.create
|
import retrofit2.create
|
||||||
import java.net.InetSocketAddress
|
import java.net.InetSocketAddress
|
||||||
|
@ -110,7 +110,7 @@ class NetworkModule {
|
||||||
return Retrofit.Builder().baseUrl("https://" + MastodonApi.PLACEHOLDER_DOMAIN)
|
return Retrofit.Builder().baseUrl("https://" + MastodonApi.PLACEHOLDER_DOMAIN)
|
||||||
.client(httpClient)
|
.client(httpClient)
|
||||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.createAsync())
|
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ import androidx.recyclerview.widget.DividerItemDecoration
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import androidx.recyclerview.widget.SimpleItemAnimator
|
import androidx.recyclerview.widget.SimpleItemAnimator
|
||||||
|
import autodispose2.androidx.lifecycle.AndroidLifecycleScopeProvider.from
|
||||||
|
import autodispose2.autoDispose
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.keylesspalace.tusky.AccountActivity
|
import com.keylesspalace.tusky.AccountActivity
|
||||||
import com.keylesspalace.tusky.AccountListActivity.Type
|
import com.keylesspalace.tusky.AccountListActivity.Type
|
||||||
|
@ -45,10 +47,8 @@ import com.keylesspalace.tusky.util.hide
|
||||||
import com.keylesspalace.tusky.util.show
|
import com.keylesspalace.tusky.util.show
|
||||||
import com.keylesspalace.tusky.util.viewBinding
|
import com.keylesspalace.tusky.util.viewBinding
|
||||||
import com.keylesspalace.tusky.view.EndlessOnScrollListener
|
import com.keylesspalace.tusky.view.EndlessOnScrollListener
|
||||||
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import com.uber.autodispose.autoDispose
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.Single
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
|
@ -27,6 +27,7 @@ import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import autodispose2.androidx.lifecycle.autoDispose
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.keylesspalace.tusky.R
|
import com.keylesspalace.tusky.R
|
||||||
import com.keylesspalace.tusky.ViewMediaActivity
|
import com.keylesspalace.tusky.ViewMediaActivity
|
||||||
|
@ -43,10 +44,9 @@ import com.keylesspalace.tusky.util.show
|
||||||
import com.keylesspalace.tusky.util.viewBinding
|
import com.keylesspalace.tusky.util.viewBinding
|
||||||
import com.keylesspalace.tusky.view.SquareImageView
|
import com.keylesspalace.tusky.view.SquareImageView
|
||||||
import com.keylesspalace.tusky.viewdata.AttachmentViewData
|
import com.keylesspalace.tusky.viewdata.AttachmentViewData
|
||||||
import com.uber.autodispose.android.lifecycle.autoDispose
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.SingleObserver
|
import io.reactivex.rxjava3.core.SingleObserver
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
import io.reactivex.disposables.Disposable
|
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
|
@ -99,18 +99,18 @@ import java.util.concurrent.TimeUnit;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import at.connyduck.sparkbutton.helpers.Utils;
|
import at.connyduck.sparkbutton.helpers.Utils;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.rxjava3.core.Single;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
import kotlin.Unit;
|
import kotlin.Unit;
|
||||||
import kotlin.collections.CollectionsKt;
|
import kotlin.collections.CollectionsKt;
|
||||||
import kotlin.jvm.functions.Function1;
|
import kotlin.jvm.functions.Function1;
|
||||||
|
|
||||||
|
import static autodispose2.AutoDispose.autoDisposable;
|
||||||
|
import static autodispose2.androidx.lifecycle.AndroidLifecycleScopeProvider.from;
|
||||||
import static com.keylesspalace.tusky.util.StringUtils.isLessThan;
|
import static com.keylesspalace.tusky.util.StringUtils.isLessThan;
|
||||||
import static com.uber.autodispose.AutoDispose.autoDisposable;
|
|
||||||
import static com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from;
|
|
||||||
|
|
||||||
public class NotificationsFragment extends SFragment implements
|
public class NotificationsFragment extends SFragment implements
|
||||||
SwipeRefreshLayout.OnRefreshListener,
|
SwipeRefreshLayout.OnRefreshListener,
|
||||||
|
@ -383,7 +383,7 @@ public class NotificationsFragment extends SFragment implements
|
||||||
|
|
||||||
eventHub.getEvents()
|
eventHub.getEvents()
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
.to(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
||||||
.subscribe(event -> {
|
.subscribe(event -> {
|
||||||
if (event instanceof FavoriteEvent) {
|
if (event instanceof FavoriteEvent) {
|
||||||
handleFavEvent((FavoriteEvent) event);
|
handleFavEvent((FavoriteEvent) event);
|
||||||
|
@ -425,7 +425,7 @@ public class NotificationsFragment extends SFragment implements
|
||||||
Objects.requireNonNull(status, "Reblog on notification without status");
|
Objects.requireNonNull(status, "Reblog on notification without status");
|
||||||
timelineCases.reblog(status, reblog)
|
timelineCases.reblog(status, reblog)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this)))
|
.to(autoDisposable(from(this)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(newStatus) -> setReblogForStatus(position, status, reblog),
|
(newStatus) -> setReblogForStatus(position, status, reblog),
|
||||||
(t) -> Log.d(getClass().getSimpleName(),
|
(t) -> Log.d(getClass().getSimpleName(),
|
||||||
|
@ -460,7 +460,7 @@ public class NotificationsFragment extends SFragment implements
|
||||||
|
|
||||||
timelineCases.favourite(status, favourite)
|
timelineCases.favourite(status, favourite)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this)))
|
.to(autoDisposable(from(this)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(newStatus) -> setFavouriteForStatus(position, status, favourite),
|
(newStatus) -> setFavouriteForStatus(position, status, favourite),
|
||||||
(t) -> Log.d(getClass().getSimpleName(),
|
(t) -> Log.d(getClass().getSimpleName(),
|
||||||
|
@ -495,7 +495,7 @@ public class NotificationsFragment extends SFragment implements
|
||||||
|
|
||||||
timelineCases.bookmark(status, bookmark)
|
timelineCases.bookmark(status, bookmark)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this)))
|
.to(autoDisposable(from(this)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(newStatus) -> setBookmarkForStatus(position, status, bookmark),
|
(newStatus) -> setBookmarkForStatus(position, status, bookmark),
|
||||||
(t) -> Log.d(getClass().getSimpleName(),
|
(t) -> Log.d(getClass().getSimpleName(),
|
||||||
|
@ -529,7 +529,7 @@ public class NotificationsFragment extends SFragment implements
|
||||||
|
|
||||||
timelineCases.voteInPoll(status, choices)
|
timelineCases.voteInPoll(status, choices)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this)))
|
.to(autoDisposable(from(this)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(newPoll) -> setVoteForPoll(position, newPoll),
|
(newPoll) -> setVoteForPoll(position, newPoll),
|
||||||
(t) -> Log.d(TAG,
|
(t) -> Log.d(TAG,
|
||||||
|
@ -687,7 +687,7 @@ public class NotificationsFragment extends SFragment implements
|
||||||
//Execute clear notifications request
|
//Execute clear notifications request
|
||||||
mastodonApi.clearNotifications()
|
mastodonApi.clearNotifications()
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
.to(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
response -> {
|
response -> {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
|
@ -832,7 +832,7 @@ public class NotificationsFragment extends SFragment implements
|
||||||
mastodonApi.authorizeFollowRequest(id) :
|
mastodonApi.authorizeFollowRequest(id) :
|
||||||
mastodonApi.rejectFollowRequest(id);
|
mastodonApi.rejectFollowRequest(id);
|
||||||
request.observeOn(AndroidSchedulers.mainThread())
|
request.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
.to(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(relationship) -> fullyRefreshWithProgressBar(true),
|
(relationship) -> fullyRefreshWithProgressBar(true),
|
||||||
(error) -> Log.e(TAG, String.format("Failed to %s account id %s", accept ? "accept" : "reject", id))
|
(error) -> Log.e(TAG, String.format("Failed to %s account id %s", accept ? "accept" : "reject", id))
|
||||||
|
@ -952,7 +952,7 @@ public class NotificationsFragment extends SFragment implements
|
||||||
|
|
||||||
Disposable notificationCall = mastodonApi.notifications(fromId, uptoId, LOAD_AT_ONCE, showNotificationsFilter ? notificationFilter : null)
|
Disposable notificationCall = mastodonApi.notifications(fromId, uptoId, LOAD_AT_ONCE, showNotificationsFilter ? notificationFilter : null)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
.to(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
response -> {
|
response -> {
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
|
@ -1284,7 +1284,7 @@ public class NotificationsFragment extends SFragment implements
|
||||||
if (!useAbsoluteTime) {
|
if (!useAbsoluteTime) {
|
||||||
Observable.interval(1, TimeUnit.MINUTES)
|
Observable.interval(1, TimeUnit.MINUTES)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this, Lifecycle.Event.ON_PAUSE)))
|
.to(autoDisposable(from(this, Lifecycle.Event.ON_PAUSE)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
interval -> updateAdapter()
|
interval -> updateAdapter()
|
||||||
);
|
);
|
||||||
|
|
|
@ -73,14 +73,14 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||||
import kotlin.Unit;
|
import kotlin.Unit;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
import static com.uber.autodispose.AutoDispose.autoDisposable;
|
import static autodispose2.AutoDispose.autoDisposable;
|
||||||
import static com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from;
|
import static autodispose2.androidx.lifecycle.AndroidLifecycleScopeProvider.from;
|
||||||
|
|
||||||
/* Note from Andrew on Jan. 22, 2017: This class is a design problem for me, so I left it with an
|
/* Note from Andrew on Jan. 22, 2017: This class is a design problem for me, so I left it with an
|
||||||
* awkward name. TimelineFragment and NotificationFragment have significant overlap but the nature
|
* awkward name. TimelineFragment and NotificationFragment have significant overlap but the nature
|
||||||
|
@ -323,7 +323,7 @@ public abstract class SFragment extends Fragment implements Injectable {
|
||||||
timelineCases.muteConversation(status, status.getMuted() == null || !status.getMuted())
|
timelineCases.muteConversation(status, status.getMuted() == null || !status.getMuted())
|
||||||
.onErrorReturnItem(status)
|
.onErrorReturnItem(status)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
.to(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
||||||
.subscribe();
|
.subscribe();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,7 @@ public abstract class SFragment extends Fragment implements Injectable {
|
||||||
.setPositiveButton(android.R.string.ok, (dialogInterface, i) -> {
|
.setPositiveButton(android.R.string.ok, (dialogInterface, i) -> {
|
||||||
timelineCases.delete(id)
|
timelineCases.delete(id)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
.to(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
deletedStatus -> {
|
deletedStatus -> {
|
||||||
},
|
},
|
||||||
|
@ -439,7 +439,7 @@ public abstract class SFragment extends Fragment implements Injectable {
|
||||||
.setPositiveButton(android.R.string.ok, (dialogInterface, i) -> {
|
.setPositiveButton(android.R.string.ok, (dialogInterface, i) -> {
|
||||||
timelineCases.delete(id)
|
timelineCases.delete(id)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
.to(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
||||||
.subscribe(deletedStatus -> {
|
.subscribe(deletedStatus -> {
|
||||||
removeItem(position);
|
removeItem(position);
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ import androidx.recyclerview.widget.RecyclerView
|
||||||
import androidx.recyclerview.widget.SimpleItemAnimator
|
import androidx.recyclerview.widget.SimpleItemAnimator
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener
|
||||||
import at.connyduck.sparkbutton.helpers.Utils
|
import at.connyduck.sparkbutton.helpers.Utils
|
||||||
|
import autodispose2.androidx.lifecycle.AndroidLifecycleScopeProvider.from
|
||||||
|
import autodispose2.autoDispose
|
||||||
import com.keylesspalace.tusky.AccountListActivity
|
import com.keylesspalace.tusky.AccountListActivity
|
||||||
import com.keylesspalace.tusky.AccountListActivity.Companion.newIntent
|
import com.keylesspalace.tusky.AccountListActivity.Companion.newIntent
|
||||||
import com.keylesspalace.tusky.BaseActivity
|
import com.keylesspalace.tusky.BaseActivity
|
||||||
|
@ -85,11 +87,9 @@ import com.keylesspalace.tusky.util.show
|
||||||
import com.keylesspalace.tusky.util.viewBinding
|
import com.keylesspalace.tusky.util.viewBinding
|
||||||
import com.keylesspalace.tusky.view.EndlessOnScrollListener
|
import com.keylesspalace.tusky.view.EndlessOnScrollListener
|
||||||
import com.keylesspalace.tusky.viewdata.StatusViewData
|
import com.keylesspalace.tusky.viewdata.StatusViewData
|
||||||
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import com.uber.autodispose.autoDispose
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.Single
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
|
@ -37,7 +37,7 @@ import com.keylesspalace.tusky.databinding.FragmentViewImageBinding
|
||||||
import com.keylesspalace.tusky.entity.Attachment
|
import com.keylesspalace.tusky.entity.Attachment
|
||||||
import com.keylesspalace.tusky.util.hide
|
import com.keylesspalace.tusky.util.hide
|
||||||
import com.keylesspalace.tusky.util.visible
|
import com.keylesspalace.tusky.util.visible
|
||||||
import io.reactivex.subjects.BehaviorSubject
|
import io.reactivex.rxjava3.subjects.BehaviorSubject
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
class ViewImageFragment : ViewMediaFragment() {
|
class ViewImageFragment : ViewMediaFragment() {
|
||||||
|
|
|
@ -73,10 +73,10 @@ import java.util.Locale;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||||
|
|
||||||
import static com.uber.autodispose.AutoDispose.autoDisposable;
|
import static autodispose2.AutoDispose.autoDisposable;
|
||||||
import static com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from;
|
import static autodispose2.androidx.lifecycle.AndroidLifecycleScopeProvider.from;
|
||||||
|
|
||||||
public final class ViewThreadFragment extends SFragment implements
|
public final class ViewThreadFragment extends SFragment implements
|
||||||
SwipeRefreshLayout.OnRefreshListener, StatusActionListener, Injectable {
|
SwipeRefreshLayout.OnRefreshListener, StatusActionListener, Injectable {
|
||||||
|
@ -182,7 +182,7 @@ public final class ViewThreadFragment extends SFragment implements
|
||||||
|
|
||||||
eventHub.getEvents()
|
eventHub.getEvents()
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
.to(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
||||||
.subscribe(event -> {
|
.subscribe(event -> {
|
||||||
if (event instanceof FavoriteEvent) {
|
if (event instanceof FavoriteEvent) {
|
||||||
handleFavEvent((FavoriteEvent) event);
|
handleFavEvent((FavoriteEvent) event);
|
||||||
|
@ -241,7 +241,7 @@ public final class ViewThreadFragment extends SFragment implements
|
||||||
|
|
||||||
timelineCases.reblog(statuses.get(position), reblog)
|
timelineCases.reblog(statuses.get(position), reblog)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this)))
|
.to(autoDisposable(from(this)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(newStatus) -> updateStatus(position, newStatus),
|
(newStatus) -> updateStatus(position, newStatus),
|
||||||
(t) -> Log.d(TAG,
|
(t) -> Log.d(TAG,
|
||||||
|
@ -255,7 +255,7 @@ public final class ViewThreadFragment extends SFragment implements
|
||||||
|
|
||||||
timelineCases.favourite(statuses.get(position), favourite)
|
timelineCases.favourite(statuses.get(position), favourite)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this)))
|
.to(autoDisposable(from(this)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(newStatus) -> updateStatus(position, newStatus),
|
(newStatus) -> updateStatus(position, newStatus),
|
||||||
(t) -> Log.d(TAG,
|
(t) -> Log.d(TAG,
|
||||||
|
@ -269,7 +269,7 @@ public final class ViewThreadFragment extends SFragment implements
|
||||||
|
|
||||||
timelineCases.bookmark(statuses.get(position), bookmark)
|
timelineCases.bookmark(statuses.get(position), bookmark)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this)))
|
.to(autoDisposable(from(this)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(newStatus) -> updateStatus(position, newStatus),
|
(newStatus) -> updateStatus(position, newStatus),
|
||||||
(t) -> Log.d(TAG,
|
(t) -> Log.d(TAG,
|
||||||
|
@ -416,7 +416,7 @@ public final class ViewThreadFragment extends SFragment implements
|
||||||
|
|
||||||
timelineCases.voteInPoll(status, choices)
|
timelineCases.voteInPoll(status, choices)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this)))
|
.to(autoDisposable(from(this)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(newPoll) -> setVoteForPoll(position, newPoll),
|
(newPoll) -> setVoteForPoll(position, newPoll),
|
||||||
(t) -> Log.d(TAG,
|
(t) -> Log.d(TAG,
|
||||||
|
@ -462,7 +462,7 @@ public final class ViewThreadFragment extends SFragment implements
|
||||||
private void sendStatusRequest(final String id) {
|
private void sendStatusRequest(final String id) {
|
||||||
mastodonApi.status(id)
|
mastodonApi.status(id)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
.to(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
status -> {
|
status -> {
|
||||||
int position = setStatus(status);
|
int position = setStatus(status);
|
||||||
|
@ -475,7 +475,7 @@ public final class ViewThreadFragment extends SFragment implements
|
||||||
private void sendThreadRequest(final String id) {
|
private void sendThreadRequest(final String id) {
|
||||||
mastodonApi.statusContext(id)
|
mastodonApi.statusContext(id)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.as(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
.to(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
context -> {
|
context -> {
|
||||||
swipeRefreshLayout.setRefreshing(false);
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
package com.keylesspalace.tusky.network
|
package com.keylesspalace.tusky.network
|
||||||
|
|
||||||
import com.keylesspalace.tusky.entity.*
|
import com.keylesspalace.tusky.entity.*
|
||||||
import io.reactivex.Completable
|
import io.reactivex.rxjava3.core.Completable
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import okhttp3.RequestBody
|
import okhttp3.RequestBody
|
||||||
import okhttp3.ResponseBody
|
import okhttp3.ResponseBody
|
||||||
|
|
|
@ -20,9 +20,9 @@ import com.keylesspalace.tusky.appstore.*
|
||||||
import com.keylesspalace.tusky.entity.DeletedStatus
|
import com.keylesspalace.tusky.entity.DeletedStatus
|
||||||
import com.keylesspalace.tusky.entity.Poll
|
import com.keylesspalace.tusky.entity.Poll
|
||||||
import com.keylesspalace.tusky.entity.Status
|
import com.keylesspalace.tusky.entity.Status
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxkotlin.addTo
|
import io.reactivex.rxjava3.kotlin.addTo
|
||||||
import java.lang.IllegalStateException
|
import java.lang.IllegalStateException
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,8 +14,8 @@ import com.keylesspalace.tusky.util.Either
|
||||||
import com.keylesspalace.tusky.util.dec
|
import com.keylesspalace.tusky.util.dec
|
||||||
import com.keylesspalace.tusky.util.inc
|
import com.keylesspalace.tusky.util.inc
|
||||||
import com.keylesspalace.tusky.util.trimTrailingWhitespace
|
import com.keylesspalace.tusky.util.trimTrailingWhitespace
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
|
@ -8,9 +8,9 @@ import androidx.annotation.StringRes
|
||||||
import androidx.annotation.VisibleForTesting
|
import androidx.annotation.VisibleForTesting
|
||||||
import com.keylesspalace.tusky.R
|
import com.keylesspalace.tusky.R
|
||||||
import de.c1710.filemojicompat.FileEmojiCompatConfig
|
import de.c1710.filemojicompat.FileEmojiCompatConfig
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.ObservableEmitter
|
import io.reactivex.rxjava3.core.ObservableEmitter
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
|
|
|
@ -16,9 +16,10 @@
|
||||||
package com.keylesspalace.tusky.util
|
package com.keylesspalace.tusky.util
|
||||||
|
|
||||||
import androidx.lifecycle.*
|
import androidx.lifecycle.*
|
||||||
import io.reactivex.BackpressureStrategy
|
import io.reactivex.rxjava3.core.BackpressureStrategy
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
|
|
||||||
|
|
||||||
inline fun <X, Y> LiveData<X>.map(crossinline mapFunction: (X) -> Y): LiveData<Y> =
|
inline fun <X, Y> LiveData<X>.map(crossinline mapFunction: (X) -> Y): LiveData<Y> =
|
||||||
Transformations.map(this) { input -> mapFunction(input) }
|
Transformations.map(this) { input -> mapFunction(input) }
|
||||||
|
|
|
@ -2,8 +2,8 @@ package com.keylesspalace.tusky.util
|
||||||
|
|
||||||
import androidx.annotation.CallSuper
|
import androidx.annotation.CallSuper
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
|
|
||||||
open class RxAwareViewModel : ViewModel() {
|
open class RxAwareViewModel : ViewModel() {
|
||||||
val disposables = CompositeDisposable()
|
val disposables = CompositeDisposable()
|
||||||
|
|
|
@ -31,8 +31,8 @@ import com.keylesspalace.tusky.MainActivity
|
||||||
import com.keylesspalace.tusky.R
|
import com.keylesspalace.tusky.R
|
||||||
import com.keylesspalace.tusky.components.notifications.NotificationHelper
|
import com.keylesspalace.tusky.components.notifications.NotificationHelper
|
||||||
import com.keylesspalace.tusky.db.AccountEntity
|
import com.keylesspalace.tusky.db.AccountEntity
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
|
|
||||||
fun updateShortcut(context: Context, account: AccountEntity) {
|
fun updateShortcut(context: Context, account: AccountEntity) {
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,13 @@
|
||||||
|
|
||||||
package com.keylesspalace.tusky.viewdata;
|
package com.keylesspalace.tusky.viewdata;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.keylesspalace.tusky.entity.Account;
|
import com.keylesspalace.tusky.entity.Account;
|
||||||
import com.keylesspalace.tusky.entity.Notification;
|
import com.keylesspalace.tusky.entity.Notification;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import io.reactivex.annotations.Nullable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by charlag on 12/07/2017.
|
* Created by charlag on 12/07/2017.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
@ -10,8 +10,8 @@ import com.keylesspalace.tusky.entity.IdentityProof
|
||||||
import com.keylesspalace.tusky.entity.Relationship
|
import com.keylesspalace.tusky.entity.Relationship
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.util.*
|
import com.keylesspalace.tusky.util.*
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
|
@ -24,8 +24,8 @@ import com.keylesspalace.tusky.util.Either.Left
|
||||||
import com.keylesspalace.tusky.util.Either.Right
|
import com.keylesspalace.tusky.util.Either.Right
|
||||||
import com.keylesspalace.tusky.util.RxAwareViewModel
|
import com.keylesspalace.tusky.util.RxAwareViewModel
|
||||||
import com.keylesspalace.tusky.util.withoutFirstWhich
|
import com.keylesspalace.tusky.util.withoutFirstWhich
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.subjects.BehaviorSubject
|
import io.reactivex.rxjava3.subjects.BehaviorSubject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
data class State(val accounts: Either<Throwable, List<Account>>, val searchResult: List<Account>?)
|
data class State(val accounts: Either<Throwable, List<Account>>, val searchResult: List<Account>?)
|
||||||
|
|
|
@ -31,10 +31,10 @@ import com.keylesspalace.tusky.entity.Instance
|
||||||
import com.keylesspalace.tusky.entity.StringField
|
import com.keylesspalace.tusky.entity.StringField
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.util.*
|
import com.keylesspalace.tusky.util.*
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxkotlin.addTo
|
import io.reactivex.rxjava3.kotlin.addTo
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
import okhttp3.RequestBody.Companion.asRequestBody
|
import okhttp3.RequestBody.Companion.asRequestBody
|
||||||
import okhttp3.RequestBody.Companion.toRequestBody
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
|
|
@ -21,14 +21,13 @@ import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.util.RxAwareViewModel
|
import com.keylesspalace.tusky.util.RxAwareViewModel
|
||||||
import com.keylesspalace.tusky.util.replacedFirstWhich
|
import com.keylesspalace.tusky.util.replacedFirstWhich
|
||||||
import com.keylesspalace.tusky.util.withoutFirstWhich
|
import com.keylesspalace.tusky.util.withoutFirstWhich
|
||||||
import io.reactivex.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.subjects.BehaviorSubject
|
import io.reactivex.rxjava3.subjects.BehaviorSubject
|
||||||
import io.reactivex.subjects.PublishSubject
|
import io.reactivex.rxjava3.subjects.PublishSubject
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.net.ConnectException
|
import java.net.ConnectException
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
||||||
internal class ListsViewModel @Inject constructor(private val api: MastodonApi) : RxAwareViewModel() {
|
internal class ListsViewModel @Inject constructor(private val api: MastodonApi) : RxAwareViewModel() {
|
||||||
enum class LoadingState {
|
enum class LoadingState {
|
||||||
INITIAL, LOADING, LOADED, ERROR_NETWORK, ERROR_OTHER
|
INITIAL, LOADING, LOADED, ERROR_NETWORK, ERROR_OTHER
|
||||||
|
|
|
@ -22,10 +22,10 @@ import com.keylesspalace.tusky.entity.Account
|
||||||
import com.keylesspalace.tusky.entity.SearchResult
|
import com.keylesspalace.tusky.entity.SearchResult
|
||||||
import com.keylesspalace.tusky.entity.Status
|
import com.keylesspalace.tusky.entity.Status
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.android.plugins.RxAndroidPlugins
|
||||||
import io.reactivex.android.plugins.RxAndroidPlugins
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.plugins.RxJavaPlugins
|
import io.reactivex.rxjava3.plugins.RxJavaPlugins
|
||||||
import io.reactivex.schedulers.TestScheduler
|
import io.reactivex.rxjava3.schedulers.TestScheduler
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
|
@ -32,8 +32,8 @@ import com.keylesspalace.tusky.entity.Instance
|
||||||
import com.keylesspalace.tusky.network.MastodonApi
|
import com.keylesspalace.tusky.network.MastodonApi
|
||||||
import com.keylesspalace.tusky.service.ServiceClient
|
import com.keylesspalace.tusky.service.ServiceClient
|
||||||
import com.nhaarman.mockitokotlin2.any
|
import com.nhaarman.mockitokotlin2.any
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.SingleObserver
|
import io.reactivex.rxjava3.core.SingleObserver
|
||||||
import org.junit.Assert.*
|
import org.junit.Assert.*
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
|
@ -16,10 +16,10 @@ import com.nhaarman.mockitokotlin2.isNull
|
||||||
import com.nhaarman.mockitokotlin2.verify
|
import com.nhaarman.mockitokotlin2.verify
|
||||||
import com.nhaarman.mockitokotlin2.verifyNoMoreInteractions
|
import com.nhaarman.mockitokotlin2.verifyNoMoreInteractions
|
||||||
import com.nhaarman.mockitokotlin2.whenever
|
import com.nhaarman.mockitokotlin2.whenever
|
||||||
import io.reactivex.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import io.reactivex.plugins.RxJavaPlugins
|
import io.reactivex.rxjava3.plugins.RxJavaPlugins
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
import io.reactivex.schedulers.TestScheduler
|
import io.reactivex.rxjava3.schedulers.TestScheduler
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
Loading…
Reference in a new issue