mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: insert dyn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
import 'package:PiliPlus/http/dynamics.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/http/msg.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/pages/common/common_publish_page.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/tab/controller.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/view.dart';
|
||||
import 'package:PiliPlus/pages/emote/controller.dart';
|
||||
import 'package:PiliPlus/pages/emote/view.dart';
|
||||
@@ -492,31 +488,10 @@ class _CreateDynPanelState extends CommonPublishPageState<CreateDynPanel> {
|
||||
if (result['status']) {
|
||||
Get.back();
|
||||
SmartDialog.showToast('发布成功');
|
||||
try {
|
||||
// insert
|
||||
dynamic id = result['data']['dyn_id'];
|
||||
if (id != null) {
|
||||
await Future.delayed(const Duration(milliseconds: 200));
|
||||
dynamic res = await DynamicsHttp.dynamicDetail(id: id);
|
||||
if (res['status']) {
|
||||
final ctr = Get.find<DynamicsTabController>(tag: 'all');
|
||||
List list = ctr.loadingState.value is Success
|
||||
? (ctr.loadingState.value as Success).response
|
||||
: <DynamicItemModel>[];
|
||||
list.insert(0, res['data']);
|
||||
ctr.loadingState.value = LoadingState.success(list);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('create dyn $e');
|
||||
}
|
||||
if (GStorage.enableCreateDynAntifraud) {
|
||||
try {
|
||||
Utils.checkCreatedDyn(result['data']['dyn_id'], editController.text);
|
||||
} catch (e) {
|
||||
SmartDialog.showToast(e.toString());
|
||||
}
|
||||
}
|
||||
Future.wait([
|
||||
Utils.insertCreatedDyn(result),
|
||||
Utils.checkCreatedDyn(result, editController.text)
|
||||
]);
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
debugPrint('failed to publish: ${result['msg']}');
|
||||
|
||||
@@ -386,13 +386,10 @@ class _RepostPanelState extends CommonPublishPageState<RepostPanel> {
|
||||
Get.back();
|
||||
SmartDialog.showToast('转发成功');
|
||||
widget.callback?.call();
|
||||
if (GStorage.enableCreateDynAntifraud) {
|
||||
try {
|
||||
Utils.checkCreatedDyn(result['data']['dyn_id'], editController.text);
|
||||
} catch (e) {
|
||||
SmartDialog.showToast(e.toString());
|
||||
}
|
||||
}
|
||||
Future.wait([
|
||||
Utils.insertCreatedDyn(result),
|
||||
Utils.checkCreatedDyn(result, editController.text)
|
||||
]);
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user