mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-06 02:54:49 +08:00
feat: edit dyn
feat: set pub setting feat: set reply interaction Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import 'package:PiliPlus/http/dynamics.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/http/reply.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/pages/common/dyn/common_dyn_controller.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class DynamicDetailController extends CommonDynController {
|
||||
@@ -45,4 +47,33 @@ class DynamicDetailController extends CommonDynController {
|
||||
replyType = commentType;
|
||||
queryData();
|
||||
}
|
||||
|
||||
Future<LoadingState> onSetPubSetting(bool isPrivate, Object dynId) async {
|
||||
final res = await DynamicsHttp.dynPrivatePubSetting(
|
||||
dynId: dynId,
|
||||
action: isPrivate ? 'public_pub' : 'private_pub',
|
||||
);
|
||||
if (res.isSuccess) {
|
||||
dynItem.modules.moduleAuthor?.badgeText = isPrivate ? null : '仅自己可见';
|
||||
SmartDialog.showToast('设置成功');
|
||||
} else {
|
||||
res.toast();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Future<void> onSetReplySubject(int action) async {
|
||||
final res = await ReplyHttp.replySubjectModify(
|
||||
oid: oid,
|
||||
type: replyType,
|
||||
action: action,
|
||||
);
|
||||
if (res.isSuccess) {
|
||||
await Future.delayed(const Duration(milliseconds: 500), () {
|
||||
if (!isClosed) {
|
||||
onReload();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user