version updates
This commit is contained in:
parent
12e6f01d29
commit
b256cb9bf2
28 changed files with 302 additions and 234 deletions
|
|
@ -13,19 +13,23 @@
|
|||
<application
|
||||
android:name=".App"
|
||||
android:allowBackup="true"
|
||||
android:fullBackupContent="false"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:fullBackupContent="false"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.TikTokDownloader">
|
||||
<activity android:name=".ui.main.MainActivity">
|
||||
<activity
|
||||
android:name=".ui.main.MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".ui.service.DownloadIntentReceiverActivity"
|
||||
<activity
|
||||
android:name=".ui.service.DownloadIntentReceiverActivity"
|
||||
android:exported="true"
|
||||
android:theme="@style/NoDisplayTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
|
|
@ -35,6 +39,7 @@
|
|||
<data android:mimeType="message/*" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service android:name=".ui.service.QueueService" />
|
||||
</application>
|
||||
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ class SharedPreferencesManagerImpl private constructor(private val sharedPrefere
|
|||
override fun getValue(thisRef: SharedPreferencesManagerImpl, property: KProperty<*>): Flow<Set<String>> =
|
||||
callbackFlow {
|
||||
val listener = SharedPreferences.OnSharedPreferenceChangeListener { _, _ ->
|
||||
offer(thisRef.getValues())
|
||||
trySend(thisRef.getValues())
|
||||
}
|
||||
thisRef.sharedPreferences.registerOnSharedPreferenceChangeListener(listener)
|
||||
offer(thisRef.getValues())
|
||||
trySend(thisRef.getValues())
|
||||
|
||||
awaitClose {
|
||||
thisRef.sharedPreferences.unregisterOnSharedPreferenceChangeListener(listener)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ import org.fnives.tiktokdownloader.data.network.parsing.response.VideoResponse
|
|||
|
||||
class VideoResponseConverter : ParsingExceptionThrowingConverter<VideoResponse>() {
|
||||
|
||||
override fun convertSafely(value: ResponseBody): VideoResponse? =
|
||||
VideoResponse(value.contentType(), value.byteStream())
|
||||
override fun convertSafely(responseBody: ResponseBody): VideoResponse? =
|
||||
VideoResponse(responseBody.contentType(), responseBody.byteStream())
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package org.fnives.tiktokdownloader.data.usecase
|
||||
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.debounce
|
||||
|
|
@ -16,6 +16,7 @@ import org.fnives.tiktokdownloader.data.model.VideoInPending
|
|||
import org.fnives.tiktokdownloader.data.model.VideoInProgress
|
||||
import org.fnives.tiktokdownloader.data.model.VideoState
|
||||
|
||||
@OptIn(FlowPreview::class)
|
||||
class StateOfVideosObservableUseCase(
|
||||
videoInProgressLocalSource: VideoInProgressLocalSource,
|
||||
videoInPendingLocalSource: VideoInPendingLocalSource,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.fnives.tiktokdownloader.data.usecase
|
|||
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
|
|
@ -30,6 +31,7 @@ import org.fnives.tiktokdownloader.data.network.exceptions.CaptchaRequiredExcept
|
|||
import org.fnives.tiktokdownloader.data.network.exceptions.NetworkException
|
||||
import org.fnives.tiktokdownloader.data.network.exceptions.ParsingException
|
||||
|
||||
@OptIn(FlowPreview::class)
|
||||
class VideoDownloadingProcessorUseCase(
|
||||
private val tikTokDownloadRemoteSource: TikTokDownloadRemoteSource,
|
||||
private val videoInProgressLocalSource: VideoInProgressLocalSource,
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class ViewModelFactory(
|
|||
private val viewModelModule: ViewModelModule,
|
||||
) : AbstractSavedStateViewModelFactory(savedStateRegistryOwner, defaultArgs) {
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun <T : ViewModel?> create(key: String, modelClass: Class<T>, handle: SavedStateHandle): T {
|
||||
val viewModel = when (modelClass) {
|
||||
MainViewModel::class.java -> viewModelModule.mainViewModel(handle)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import android.os.Bundle
|
|||
import android.view.MenuItem
|
||||
import android.view.animation.AccelerateDecelerateInterpolator
|
||||
import android.view.animation.OvershootInterpolator
|
||||
import androidx.activity.viewModels
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
|
|
@ -43,28 +42,28 @@ class MainActivity : AppCompatActivity() {
|
|||
animateFabClicked(downloadFab)
|
||||
viewModel.onFetchDownloadClicked()
|
||||
}
|
||||
viewModel.refreshActionVisibility.observe(this, {
|
||||
viewModel.refreshActionVisibility.observe(this) {
|
||||
animateFabVisibility(downloadFab, it == true)
|
||||
})
|
||||
viewModel.errorMessage.observe(this, {
|
||||
}
|
||||
viewModel.errorMessage.observe(this) {
|
||||
val stringRes = it?.item?.stringRes ?: return@observe
|
||||
Snackbar.make(snackBarAnchor, stringRes, Snackbar.LENGTH_SHORT).show()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupBottomNavigationView(bottomNavigationView: BottomNavigationView, savedInstanceState: Bundle?) {
|
||||
bottomNavigationView.setOnNavigationItemSelectedListener(BottomNavigationView.OnNavigationItemSelectedListener { item ->
|
||||
bottomNavigationView.setOnItemSelectedListener { item ->
|
||||
val fragment = when (item.itemId) {
|
||||
R.id.help_menu_item -> HelpFragment.newInstance()
|
||||
R.id.queue_menu_item -> QueueFragment.newInstance()
|
||||
else -> return@OnNavigationItemSelectedListener false
|
||||
else -> return@setOnItemSelectedListener false
|
||||
}
|
||||
item.toScreen()?.let(viewModel::onScreenSelected)
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.fragment_holder, fragment)
|
||||
.commit()
|
||||
return@OnNavigationItemSelectedListener true
|
||||
})
|
||||
return@setOnItemSelectedListener true
|
||||
}
|
||||
if (savedInstanceState == null) {
|
||||
bottomNavigationView.selectedItemId = R.id.queue_menu_item
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class QueueService : Service() {
|
|||
.setSmallIcon(R.drawable.ic_download)
|
||||
.setContentIntent(buildMainPendingIntent(this))
|
||||
.setAutoCancel(true)
|
||||
.setNotificationSilent()
|
||||
.setSilent(true)
|
||||
.build()
|
||||
NotificationState.Finish -> {
|
||||
stopSelf()
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/default_padding"
|
||||
app:autoPlay="false"
|
||||
app:showFullScreenButton="false"
|
||||
app:enableAutomaticInitialization="true"
|
||||
app:handleNetworkEvents="true"
|
||||
app:videoId="NXv3JpmwA8Y" />
|
||||
|
|
@ -82,7 +81,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/default_padding"
|
||||
app:autoPlay="false"
|
||||
app:showFullScreenButton="false"
|
||||
app:enableAutomaticInitialization="true"
|
||||
app:handleNetworkEvents="true"
|
||||
app:videoId="jxaxffE8c4c" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue