mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-20 03:24:50 +00:00
Fix dedup in subscriptions feed, Download change directory no longer crashes, Allow uppercase letters in email for payment, Fix developer mode not enabling
This commit is contained in:
parent
f4370c1bfd
commit
2067561c09
8 changed files with 31 additions and 23 deletions
|
@ -52,17 +52,6 @@ class SettingsActivity : AppCompatActivity(), IWithResultLauncher {
|
|||
startActivity(Intent(this, DeveloperActivity::class.java));
|
||||
}
|
||||
|
||||
var devCounter = 0;
|
||||
_form.findField("code")?.assume<ReadOnlyTextField>()?.setOnClickListener {
|
||||
devCounter++;
|
||||
if(devCounter > 5) {
|
||||
devCounter = 0;
|
||||
SettingsDev.instance.developerMode = true;
|
||||
SettingsDev.instance.save();
|
||||
updateDevMode();
|
||||
UIDialogs.toast(this, "You are now in developer mode");
|
||||
}
|
||||
};
|
||||
_lastActivity = this;
|
||||
|
||||
reloadSettings();
|
||||
|
@ -72,6 +61,18 @@ class SettingsActivity : AppCompatActivity(), IWithResultLauncher {
|
|||
_loader.start();
|
||||
_form.fromObject(lifecycleScope, Settings.instance) {
|
||||
_loader.stop();
|
||||
|
||||
var devCounter = 0;
|
||||
_form.findField("code")?.assume<ReadOnlyTextField>()?.setOnClickListener {
|
||||
devCounter++;
|
||||
if(devCounter > 5) {
|
||||
devCounter = 0;
|
||||
SettingsDev.instance.developerMode = true;
|
||||
SettingsDev.instance.save();
|
||||
updateDevMode();
|
||||
UIDialogs.toast(this, "You are now in developer mode");
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ class DedupContentPager : IPager<IPlatformContent>, IAsyncPager<IPlatformContent
|
|||
_currentResults = dedupResults(_basePager.getResults());
|
||||
}
|
||||
|
||||
override fun hasMorePages(): Boolean = _basePager.hasMorePages();
|
||||
override fun hasMorePages(): Boolean =
|
||||
_basePager.hasMorePages();
|
||||
override fun nextPage() {
|
||||
_basePager.nextPage()
|
||||
_currentResults = dedupResults(_basePager.getResults());
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.stream.IntStream
|
|||
* A PlatformContent MultiPager that orders the results of a page based on the datetime of a content item
|
||||
*/
|
||||
class MultiChronoContentPager : MultiPager<IPlatformContent> {
|
||||
constructor(pagers : Array<IPager<IPlatformContent>>, allowFailure: Boolean = false) : super(pagers.map { it }.toList(), allowFailure) {}
|
||||
constructor(pagers : Array<IPager<IPlatformContent>>, allowFailure: Boolean = false, pageSize: Int = 9) : super(pagers.map { it }.toList(), allowFailure, pageSize) {}
|
||||
|
||||
@Synchronized
|
||||
override fun selectItemIndex(options: Array<SelectionOption<IPlatformContent>>): Int {
|
||||
|
|
|
@ -16,7 +16,7 @@ abstract class MultiPager<T> : IPager<T> {
|
|||
protected val _subSinglePagers : MutableList<SingleItemPager<T>>;
|
||||
protected val _failedPagers: ArrayList<IPager<T>> = arrayListOf();
|
||||
|
||||
private val _pageSize : Int = 9;
|
||||
private var _pageSize : Int = 9;
|
||||
|
||||
private var _didInitialize = false;
|
||||
|
||||
|
@ -27,7 +27,8 @@ abstract class MultiPager<T> : IPager<T> {
|
|||
|
||||
val totalPagers: Int get() = _pagers.size;
|
||||
|
||||
constructor(pagers : List<IPager<T>>, allowFailure: Boolean = false) {
|
||||
constructor(pagers : List<IPager<T>>, allowFailure: Boolean = false, pageSize: Int = 9) {
|
||||
this._pageSize = pageSize;
|
||||
this.allowFailure = allowFailure;
|
||||
_pagers = pagers.toMutableList();
|
||||
_subSinglePagers = _pagers.map { SingleItemPager(it) }.toMutableList();
|
||||
|
|
|
@ -91,7 +91,7 @@ class StateApp {
|
|||
onChanged?.invoke(getExternalGeneralDirectory(context));
|
||||
}
|
||||
else
|
||||
StateApp.instance.scopeOrNull?.launch(Dispatchers.Main) {
|
||||
scopeOrNull?.launch(Dispatchers.Main) {
|
||||
UIDialogs.toast("Failed to gain access to\n [${it?.lastPathSegment}]");
|
||||
};
|
||||
};
|
||||
|
@ -103,10 +103,14 @@ class StateApp {
|
|||
return null;
|
||||
}
|
||||
fun changeExternalDownloadDirectory(context: IWithResultLauncher, onChanged: ((DocumentFile?)->Unit)? = null) {
|
||||
|
||||
scopeOrNull?.launch(Dispatchers.Main) {
|
||||
UIDialogs.toast("External download directory not yet used by export (WIP)");
|
||||
};
|
||||
if(context is Context)
|
||||
requestDirectoryAccess(context, "Download Exports", "This directory is used to export downloads to for external usage.", null) {
|
||||
if(it != null)
|
||||
context.contentResolver.takePersistableUriPermission(it, Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION.or(Intent.FLAG_GRANT_WRITE_URI_PERMISSION.or(Intent.FLAG_GRANT_READ_URI_PERMISSION)));
|
||||
context.contentResolver.takePersistableUriPermission(it, Intent.FLAG_GRANT_WRITE_URI_PERMISSION.or(Intent.FLAG_GRANT_READ_URI_PERMISSION));
|
||||
if(it != null && isValidStorageUri(context, it)) {
|
||||
Logger.i(TAG, "Changed external download directory: ${it}");
|
||||
Settings.instance.storage.storage_general = it.toString();
|
||||
|
|
|
@ -219,13 +219,13 @@ class StateSubscriptions {
|
|||
}
|
||||
}
|
||||
|
||||
fun getSubscriptionsFeed(allowFailure: Boolean = false): MultiChronoContentPager {
|
||||
fun getSubscriptionsFeed(allowFailure: Boolean = false): IPager<IPlatformContent> {
|
||||
val result = getSubscriptionsFeedWithExceptions(allowFailure, true);
|
||||
if(result.second.any())
|
||||
throw result.second.first();
|
||||
return result.first;
|
||||
}
|
||||
fun getSubscriptionsFeedWithExceptions(allowFailure: Boolean = false, withCacheFallback: Boolean = false, cacheScope: CoroutineScope? = null, onProgress: ((Int, Int)->Unit)? = null, onNewCacheHit: ((Subscription, IPlatformContent)->Unit)? = null): Pair<MultiChronoContentPager, List<Throwable>> {
|
||||
fun getSubscriptionsFeedWithExceptions(allowFailure: Boolean = false, withCacheFallback: Boolean = false, cacheScope: CoroutineScope? = null, onProgress: ((Int, Int)->Unit)? = null, onNewCacheHit: ((Subscription, IPlatformContent)->Unit)? = null): Pair<IPager<IPlatformContent>, List<Throwable>> {
|
||||
val subsPager: Array<IPager<IPlatformContent>>;
|
||||
val exs: ArrayList<Throwable> = arrayListOf();
|
||||
|
||||
|
@ -343,9 +343,10 @@ class StateSubscriptions {
|
|||
throw exs.first();
|
||||
|
||||
Logger.i(TAG, "Subscription pager with ${subsPager.size} channels");
|
||||
val pager = MultiChronoContentPager(subsPager, allowFailure);
|
||||
val pager = MultiChronoContentPager(subsPager, allowFailure, 15);
|
||||
pager.initialize();
|
||||
return Pair(pager, exs);
|
||||
//return Pair(pager, exs);
|
||||
return Pair(DedupContentPager(pager), exs);
|
||||
}
|
||||
|
||||
//New Migration
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 1c34bb016378805ca24883ed55573dcd862309cf
|
||||
Subproject commit eba1bb5d2ccf438a2f025a204d2d443e4b76b144
|
|
@ -1 +1 @@
|
|||
Subproject commit 9e589c231187b02a9922f55a962add0a688d28cd
|
||||
Subproject commit 2c608e7eddb742a918b304e3c52888206275f642
|
Loading…
Add table
Reference in a new issue