mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-08-03 14:50:49 +00:00
Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay
This commit is contained in:
commit
5769b39d78
2 changed files with 11 additions and 8 deletions
|
@ -556,7 +556,7 @@ class StateSync {
|
||||||
added.map { it.channel.name }.joinToString("\n"));
|
added.map { it.channel.name }.joinToString("\n"));
|
||||||
|
|
||||||
|
|
||||||
if(pack.subscriptions.isNotEmpty()) {
|
if(pack.subscriptionRemovals.isNotEmpty()) {
|
||||||
for (subRemoved in pack.subscriptionRemovals) {
|
for (subRemoved in pack.subscriptionRemovals) {
|
||||||
val removed = StateSubscriptions.instance.applySubscriptionRemovals(pack.subscriptionRemovals);
|
val removed = StateSubscriptions.instance.applySubscriptionRemovals(pack.subscriptionRemovals);
|
||||||
if(removed.size > 3) {
|
if(removed.size > 3) {
|
||||||
|
@ -653,12 +653,14 @@ class StateSync {
|
||||||
val subPackage = Serializer.json.decodeFromString<SyncSubscriptionsPackage>(json);
|
val subPackage = Serializer.json.decodeFromString<SyncSubscriptionsPackage>(json);
|
||||||
handleSyncSubscriptionPackage(session, subPackage);
|
handleSyncSubscriptionPackage(session, subPackage);
|
||||||
|
|
||||||
val newestSub = subPackage.subscriptions.maxOf { it.creationTime };
|
if(subPackage.subscriptions.size > 0) {
|
||||||
|
val newestSub = subPackage.subscriptions.maxOf { it.creationTime };
|
||||||
|
|
||||||
val sesData = getSyncSessionData(remotePublicKey);
|
val sesData = getSyncSessionData(remotePublicKey);
|
||||||
if(newestSub > sesData.lastSubscription) {
|
if (newestSub > sesData.lastSubscription) {
|
||||||
sesData.lastSubscription = newestSub;
|
sesData.lastSubscription = newestSub;
|
||||||
saveSyncSessionData(sesData);
|
saveSyncSessionData(sesData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,10 @@ class SubscriptionAdapter : RecyclerView.Adapter<SubscriptionViewHolder> {
|
||||||
_onDatasetChanged = onDatasetChanged;
|
_onDatasetChanged = onDatasetChanged;
|
||||||
|
|
||||||
StateSubscriptions.instance.onSubscriptionsChanged.subscribe { _, _ -> if(Looper.myLooper() != Looper.getMainLooper())
|
StateSubscriptions.instance.onSubscriptionsChanged.subscribe { _, _ -> if(Looper.myLooper() != Looper.getMainLooper())
|
||||||
StateApp.instance.scopeOrNull?.launch(Dispatchers.IO) { updateDataset() }
|
StateApp.instance.scopeOrNull?.launch(Dispatchers.Main) { updateDataset() }
|
||||||
else
|
else
|
||||||
updateDataset(); }
|
updateDataset();
|
||||||
|
}
|
||||||
updateDataset();
|
updateDataset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue