mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-02 00:58:19 +08:00
add publish throttle
Closes #2152 Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -37,6 +37,8 @@ abstract class CommonPublishPageState<T extends CommonPublishPage>
|
||||
late final RxBool readOnly = false.obs;
|
||||
late final RxBool enablePublish = false.obs;
|
||||
|
||||
bool isPublishing = false;
|
||||
|
||||
bool hasPub = false;
|
||||
void initPubState();
|
||||
|
||||
@@ -208,10 +210,16 @@ abstract class CommonPublishPageState<T extends CommonPublishPage>
|
||||
|
||||
void onSubmitted(String value) {
|
||||
if (enablePublish.value) {
|
||||
onPublish();
|
||||
onPublishThrottle();
|
||||
}
|
||||
}
|
||||
|
||||
void onPublishThrottle() {
|
||||
if (isPublishing) return;
|
||||
isPublishing = true;
|
||||
onPublish().whenComplete(() => isPublishing = false);
|
||||
}
|
||||
|
||||
Future<void> onPublish();
|
||||
|
||||
Future<void> onCustomPublish({List? pictures});
|
||||
|
||||
Reference in New Issue
Block a user