mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Fix merge issues
This commit is contained in:
parent
3bd7b95350
commit
6fc45f6180
6 changed files with 22 additions and 85 deletions
|
@ -162,7 +162,7 @@ abstract class BackupAPI<LOGIN_DATA>(defIndex: Int) : IBackupAPI<LOGIN_DATA>,
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val keysToUpdate = getKeysToUpdate(context.getBackup(), newData)
|
val keysToUpdate = getKeysToUpdate(getBackup(context), newData)
|
||||||
if (keysToUpdate.isEmpty()) {
|
if (keysToUpdate.isEmpty()) {
|
||||||
Log.d(LOG_KEY, "remote data is up to date, sync not needed")
|
Log.d(LOG_KEY, "remote data is up to date, sync not needed")
|
||||||
return
|
return
|
||||||
|
@ -267,7 +267,7 @@ abstract class BackupAPI<LOGIN_DATA>(defIndex: Int) : IBackupAPI<LOGIN_DATA>,
|
||||||
private fun shouldUploadBackup(): Boolean {
|
private fun shouldUploadBackup(): Boolean {
|
||||||
val ctx = AcraApplication.context ?: return false
|
val ctx = AcraApplication.context ?: return false
|
||||||
|
|
||||||
val newBackup = ctx.getBackup().toJson()
|
val newBackup = getBackup(ctx).toJson()
|
||||||
return compareJson(lastBackupJson ?: "", newBackup).failed
|
return compareJson(lastBackupJson ?: "", newBackup).failed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ abstract class BackupAPI<LOGIN_DATA>(defIndex: Int) : IBackupAPI<LOGIN_DATA>,
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val backupFile = context.getBackup().toJson()
|
val backupFile = getBackup(context).toJson()
|
||||||
lastBackupJson = backupFile
|
lastBackupJson = backupFile
|
||||||
Log.d(LOG_KEY, "${this.name}: uploadFile is now running")
|
Log.d(LOG_KEY, "${this.name}: uploadFile is now running")
|
||||||
uploadFile(context, backupFile, loginData)
|
uploadFile(context, backupFile, loginData)
|
||||||
|
|
|
@ -28,10 +28,6 @@ import com.lagradost.cloudstream3.APIHolder.apis
|
||||||
import com.lagradost.cloudstream3.APIHolder.filterProviderByPreferredMedia
|
import com.lagradost.cloudstream3.APIHolder.filterProviderByPreferredMedia
|
||||||
import com.lagradost.cloudstream3.APIHolder.getApiProviderLangSettings
|
import com.lagradost.cloudstream3.APIHolder.getApiProviderLangSettings
|
||||||
import com.lagradost.cloudstream3.CommonActivity.showToast
|
import com.lagradost.cloudstream3.CommonActivity.showToast
|
||||||
import com.lagradost.cloudstream3.MainActivity.Companion.afterBackupRestoreEvent
|
|
||||||
import com.lagradost.cloudstream3.MainActivity.Companion.afterPluginsLoadedEvent
|
|
||||||
import com.lagradost.cloudstream3.MainActivity.Companion.bookmarksUpdatedEvent
|
|
||||||
import com.lagradost.cloudstream3.MainActivity.Companion.mainPluginsLoadedEvent
|
|
||||||
import com.lagradost.cloudstream3.databinding.FragmentHomeBinding
|
import com.lagradost.cloudstream3.databinding.FragmentHomeBinding
|
||||||
import com.lagradost.cloudstream3.databinding.HomeEpisodesExpandedBinding
|
import com.lagradost.cloudstream3.databinding.HomeEpisodesExpandedBinding
|
||||||
import com.lagradost.cloudstream3.databinding.HomeSelectMainpageBinding
|
import com.lagradost.cloudstream3.databinding.HomeSelectMainpageBinding
|
||||||
|
@ -42,7 +38,6 @@ import com.lagradost.cloudstream3.mvvm.observe
|
||||||
import com.lagradost.cloudstream3.mvvm.observeNullable
|
import com.lagradost.cloudstream3.mvvm.observeNullable
|
||||||
import com.lagradost.cloudstream3.ui.APIRepository.Companion.noneApi
|
import com.lagradost.cloudstream3.ui.APIRepository.Companion.noneApi
|
||||||
import com.lagradost.cloudstream3.ui.APIRepository.Companion.randomApi
|
import com.lagradost.cloudstream3.ui.APIRepository.Companion.randomApi
|
||||||
import com.lagradost.cloudstream3.ui.WatchType
|
|
||||||
import com.lagradost.cloudstream3.ui.result.txt
|
import com.lagradost.cloudstream3.ui.result.txt
|
||||||
import com.lagradost.cloudstream3.ui.search.*
|
import com.lagradost.cloudstream3.ui.search.*
|
||||||
import com.lagradost.cloudstream3.ui.search.SearchHelper.handleSearchClickCallback
|
import com.lagradost.cloudstream3.ui.search.SearchHelper.handleSearchClickCallback
|
||||||
|
@ -55,7 +50,6 @@ import com.lagradost.cloudstream3.utils.AppUtils.ownShow
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.setDefaultFocus
|
import com.lagradost.cloudstream3.utils.AppUtils.setDefaultFocus
|
||||||
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
|
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper
|
import com.lagradost.cloudstream3.utils.DataStoreHelper
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.currentHomePage
|
|
||||||
import com.lagradost.cloudstream3.utils.Event
|
import com.lagradost.cloudstream3.utils.Event
|
||||||
import com.lagradost.cloudstream3.utils.SubtitleHelper.getFlagFromIso
|
import com.lagradost.cloudstream3.utils.SubtitleHelper.getFlagFromIso
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
||||||
|
@ -485,61 +479,6 @@ class HomeFragment : Fragment() {
|
||||||
fixGrid()
|
fixGrid()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun bookmarksUpdated(_data : Boolean) {
|
|
||||||
reloadStored()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
reloadStored()
|
|
||||||
bookmarksUpdatedEvent += ::bookmarksUpdated
|
|
||||||
afterPluginsLoadedEvent += ::afterPluginsLoaded
|
|
||||||
mainPluginsLoadedEvent += ::afterMainPluginsLoaded
|
|
||||||
afterBackupRestoreEvent += ::reloadStored
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStop() {
|
|
||||||
bookmarksUpdatedEvent -= ::bookmarksUpdated
|
|
||||||
afterPluginsLoadedEvent -= ::afterPluginsLoaded
|
|
||||||
mainPluginsLoadedEvent -= ::afterMainPluginsLoaded
|
|
||||||
afterBackupRestoreEvent -= ::reloadStored
|
|
||||||
super.onStop()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun reloadStored(unused: Unit = Unit) {
|
|
||||||
homeViewModel.reloadStored()
|
|
||||||
val list = EnumSet.noneOf(WatchType::class.java)
|
|
||||||
getKey<IntArray>(HOME_BOOKMARK_VALUE_LIST)?.map { WatchType.fromInternalId(it) }?.let {
|
|
||||||
list.addAll(it)
|
|
||||||
}
|
|
||||||
homeViewModel.loadStoredData(list)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun afterMainPluginsLoaded(unused: Boolean = false) {
|
|
||||||
loadHomePage(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun afterPluginsLoaded(forceReload: Boolean) {
|
|
||||||
loadHomePage(forceReload)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun loadHomePage(forceReload: Boolean) {
|
|
||||||
val apiName = currentHomePage
|
|
||||||
|
|
||||||
if (homeViewModel.apiName.value != apiName || apiName == null || forceReload) {
|
|
||||||
//println("Caught home: " + homeViewModel.apiName.value + " at " + apiName)
|
|
||||||
homeViewModel.loadAndCancel(apiName, forceReload)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun homeHandleSearch(callback: SearchClickCallback) {
|
|
||||||
if (callback.action == SEARCH_ACTION_FOCUSED) {
|
|
||||||
//focusCallback(callback.card)
|
|
||||||
} else {
|
|
||||||
handleSearchClickCallback(callback)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var currentApiName: String? = null
|
private var currentApiName: String? = null
|
||||||
private var toggleRandomButton = false
|
private var toggleRandomButton = false
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,8 @@ class LibraryFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the color for the search exit icon to the correct theme text color
|
// Set the color for the search exit icon to the correct theme text color
|
||||||
val searchExitIcon = binding?.mainSearch?.findViewById<ImageView>(androidx.appcompat.R.id.search_close_btn)
|
val searchExitIcon =
|
||||||
|
binding?.mainSearch?.findViewById<ImageView>(androidx.appcompat.R.id.search_close_btn)
|
||||||
val searchExitIconColor = TypedValue()
|
val searchExitIconColor = TypedValue()
|
||||||
|
|
||||||
activity?.theme?.resolveAttribute(android.R.attr.textColor, searchExitIconColor, true)
|
activity?.theme?.resolveAttribute(android.R.attr.textColor, searchExitIconColor, true)
|
||||||
|
@ -481,6 +482,7 @@ class LibraryFragment : Fragment() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||||
(binding?.viewpager?.adapter as? ViewpagerAdapter)?.rebind()
|
(binding?.viewpager?.adapter as? ViewpagerAdapter)?.rebind()
|
||||||
super.onConfigurationChanged(newConfig)
|
super.onConfigurationChanged(newConfig)
|
||||||
|
@ -499,6 +501,7 @@ class LibraryFragment : Fragment() {
|
||||||
private fun onNewSyncData(unused: Unit) {
|
private fun onNewSyncData(unused: Unit) {
|
||||||
Log.d(BackupAPI.LOG_KEY, "will reload pages")
|
Log.d(BackupAPI.LOG_KEY, "will reload pages")
|
||||||
libraryViewModel.reloadPages(true)
|
libraryViewModel.reloadPages(true)
|
||||||
|
}
|
||||||
|
|
||||||
private val sortChangeClickListener = View.OnClickListener { view ->
|
private val sortChangeClickListener = View.OnClickListener { view ->
|
||||||
val methods = libraryViewModel.sortingMethods.map {
|
val methods = libraryViewModel.sortingMethods.map {
|
||||||
|
@ -515,10 +518,10 @@ class LibraryFragment : Fragment() {
|
||||||
libraryViewModel.sort(method)
|
libraryViewModel.sort(method)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
class MenuSearchView(context: Context) : SearchView(context) {
|
class MenuSearchView(context: Context) : SearchView(context) {
|
||||||
override fun onActionViewCollapsed() {
|
override fun onActionViewCollapsed() {
|
||||||
super.onActionViewCollapsed()
|
super.onActionViewCollapsed()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -151,10 +151,8 @@ object BackupUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
private fun getBackup(context: Context?): BackupFile? {
|
fun getBackup(context: Context): BackupFile {
|
||||||
if (context == null) return null
|
val syncDataPrefs = context.getSyncPrefs().all.filter { it.key.isTransferable() }
|
||||||
|
|
||||||
val syncDataPrefs = getSyncPrefs().all.filter { it.key.isTransferable() }
|
|
||||||
val allData = context.getSharedPrefs().all.filter { it.key.isTransferable() }
|
val allData = context.getSharedPrefs().all.filter { it.key.isTransferable() }
|
||||||
val allSettings = context.getDefaultSharedPrefs().all.filter { it.key.isTransferable() }
|
val allSettings = context.getDefaultSharedPrefs().all.filter { it.key.isTransferable() }
|
||||||
|
|
||||||
|
@ -216,9 +214,15 @@ object BackupUtils {
|
||||||
|
|
||||||
// we must remove keys that are not present
|
// we must remove keys that are not present
|
||||||
if (!restoreKeys.isNullOrEmpty()) {
|
if (!restoreKeys.isNullOrEmpty()) {
|
||||||
Log.d(BackupAPI.LOG_KEY, "successfulRestore for src=[${restoreSource.name}]: ${restoreData.successfulRestore}")
|
Log.d(
|
||||||
|
BackupAPI.LOG_KEY,
|
||||||
|
"successfulRestore for src=[${restoreSource.name}]: ${restoreData.successfulRestore}"
|
||||||
|
)
|
||||||
val removedKeys = restoreData.wantToRestore - restoreData.successfulRestore
|
val removedKeys = restoreData.wantToRestore - restoreData.successfulRestore
|
||||||
Log.d(BackupAPI.LOG_KEY, "removed keys for src=[${restoreSource.name}]: $removedKeys")
|
Log.d(
|
||||||
|
BackupAPI.LOG_KEY,
|
||||||
|
"removed keys for src=[${restoreSource.name}]: $removedKeys"
|
||||||
|
)
|
||||||
|
|
||||||
removedKeys.forEach { removeKeyRaw(it, restoreSource) }
|
removedKeys.forEach { removeKeyRaw(it, restoreSource) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,6 @@ import android.util.Log
|
||||||
import com.lagradost.cloudstream3.syncproviders.AccountManager
|
import com.lagradost.cloudstream3.syncproviders.AccountManager
|
||||||
import com.lagradost.cloudstream3.syncproviders.BackupAPI
|
import com.lagradost.cloudstream3.syncproviders.BackupAPI
|
||||||
import com.lagradost.cloudstream3.syncproviders.BackupAPI.Companion.logHistoryChanged
|
import com.lagradost.cloudstream3.syncproviders.BackupAPI.Companion.logHistoryChanged
|
||||||
import com.lagradost.cloudstream3.ui.home.HOME_BOOKMARK_VALUE_LIST
|
|
||||||
import com.lagradost.cloudstream3.ui.player.PLAYBACK_SPEED_KEY
|
|
||||||
import com.lagradost.cloudstream3.ui.player.RESIZE_MODE_KEY
|
|
||||||
import com.lagradost.cloudstream3.utils.BackupUtils.nonTransferableKeys
|
import com.lagradost.cloudstream3.utils.BackupUtils.nonTransferableKeys
|
||||||
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
|
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
|
||||||
|
|
||||||
|
@ -27,9 +24,6 @@ class Scheduler<INPUT>(
|
||||||
*nonTransferableKeys.toTypedArray(),
|
*nonTransferableKeys.toTypedArray(),
|
||||||
VideoDownloadManager.KEY_DOWNLOAD_INFO,
|
VideoDownloadManager.KEY_DOWNLOAD_INFO,
|
||||||
DOWNLOAD_HEADER_CACHE,
|
DOWNLOAD_HEADER_CACHE,
|
||||||
PLAYBACK_SPEED_KEY,
|
|
||||||
HOME_BOOKMARK_VALUE_LIST,
|
|
||||||
RESIZE_MODE_KEY,
|
|
||||||
)
|
)
|
||||||
private val invalidUploadTriggerKeysRegex = listOf(
|
private val invalidUploadTriggerKeysRegex = listOf(
|
||||||
// These trigger automatically every time a show is opened, way too often.
|
// These trigger automatically every time a show is opened, way too often.
|
||||||
|
@ -100,6 +94,7 @@ class Scheduler<INPUT>(
|
||||||
|
|
||||||
var lastValue = all
|
var lastValue = all
|
||||||
registerOnSharedPreferenceChangeListener { sharedPreferences, storeKey ->
|
registerOnSharedPreferenceChangeListener { sharedPreferences, storeKey ->
|
||||||
|
if (storeKey == null) return@registerOnSharedPreferenceChangeListener
|
||||||
ioSafe {
|
ioSafe {
|
||||||
scheduler.work(
|
scheduler.work(
|
||||||
BackupAPI.PreferencesSchedulerData(
|
BackupAPI.PreferencesSchedulerData(
|
||||||
|
|
|
@ -696,8 +696,6 @@
|
||||||
<string name="qualities">Qualities</string>
|
<string name="qualities">Qualities</string>
|
||||||
<string name="profile_background_des">Profile background</string>
|
<string name="profile_background_des">Profile background</string>
|
||||||
<string name="unable_to_inflate">UI was unable to be created correctly, this is a MAJOR BUG and should be reported immediately %s</string>
|
<string name="unable_to_inflate">UI was unable to be created correctly, this is a MAJOR BUG and should be reported immediately %s</string>
|
||||||
<string name="tv_no_focus_tag" translatable="false">tv_no_focus_tag</string>
|
|
||||||
<string name="already_voted">You have already voted</string>
|
|
||||||
<string name="example_login_file_name_full">Sync file name (optional)</string>
|
<string name="example_login_file_name_full">Sync file name (optional)</string>
|
||||||
<string name="example_login_redirect_url_full">Oauth redirect url (optional)</string>
|
<string name="example_login_redirect_url_full">Oauth redirect url (optional)</string>
|
||||||
<string name="example_redirect_url" translatable="false">https://recloudstream.github.io/cloudstream-sync/google-drive</string>
|
<string name="example_redirect_url" translatable="false">https://recloudstream.github.io/cloudstream-sync/google-drive</string>
|
||||||
|
@ -732,8 +730,6 @@
|
||||||
|
|
||||||
|
|
||||||
<string name="tv_no_focus_tag" translatable="false">tv_no_focus_tag</string>
|
<string name="tv_no_focus_tag" translatable="false">tv_no_focus_tag</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="enter_pin">Enter PIN</string>
|
<string name="enter_pin">Enter PIN</string>
|
||||||
<string name="enter_current_pin">Enter Current PIN</string>
|
<string name="enter_current_pin">Enter Current PIN</string>
|
||||||
<string name="lock_profile">Lock Profile</string>
|
<string name="lock_profile">Lock Profile</string>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue