Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grayjay
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoStreaming
Grayjay
Commits
12b73bb2
Commit
12b73bb2
authored
1 year ago
by
Koen
Browse files
Options
Downloads
Patches
Plain Diff
Maximum import 75 subscriptions at once.
parent
c3ff897e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/ImportSubscriptionsFragment.kt
+15
-0
15 additions, 0 deletions
...fragment/mainactivity/main/ImportSubscriptionsFragment.kt
with
15 additions
and
0 deletions
app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/ImportSubscriptionsFragment.kt
+
15
−
0
View file @
12b73bb2
...
...
@@ -69,6 +69,8 @@ class ImportSubscriptionsFragment : MainFragment() {
private
var
_currentLoadIndex
=
0
;
private
var
_taskLoadChannel
:
TaskHandler
<
String
,
IPlatformChannel
>;
private
var
_counter
:
Int
=
0
;
private
var
_limitToastShown
=
false
;
constructor
(
fragment
:
ImportSubscriptionsFragment
,
inflater
:
LayoutInflater
)
:
super
(
inflater
.
context
)
{
_fragment
=
fragment
;
...
...
@@ -104,6 +106,7 @@ class ImportSubscriptionsFragment : MainFragment() {
setLoading
(
false
);
_taskLoadChannel
=
TaskHandler
<
String
,
IPlatformChannel
>({
_fragment
.
lifecycleScope
},
{
link
->
_counter
++;
val
channel
:
IPlatformChannel
=
StatePlatform
.
instance
.
getChannelLive
(
link
,
false
);
return
@TaskHandler
channel
;
}).
success
{
...
...
@@ -124,6 +127,8 @@ class ImportSubscriptionsFragment : MainFragment() {
}
fun
onShown
(
parameter
:
Any
?,
isBack
:
Boolean
)
{
_counter
=
0
;
_limitToastShown
=
false
;
updateSelected
();
val
itemsRemoved
=
_items
.
size
;
...
...
@@ -157,6 +162,15 @@ class ImportSubscriptionsFragment : MainFragment() {
private
fun
load
()
{
setLoading
(
true
);
if
(
_counter
>=
MAXIMUM_BATCH_SIZE
)
{
if
(!
_limitToastShown
)
{
_limitToastShown
=
true
;
UIDialogs
.
toast
(
context
,
"Stopped after $MAXIMUM_BATCH_SIZE to avoid rate limit, re-enter to import rest"
);
}
setLoading
(
false
);
return
;
}
_taskLoadChannel
.
run
(
_links
[
_currentLoadIndex
]);
}
...
...
@@ -196,6 +210,7 @@ class ImportSubscriptionsFragment : MainFragment() {
companion
object
{
val
TAG
=
"ImportSubscriptionsFragment"
;
private
const
val
MAXIMUM_BATCH_SIZE
=
75
;
fun
newInstance
()
=
ImportSubscriptionsFragment
().
apply
{}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment