mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-27 12:36:27 +08:00
feat: create dyn antifraud
Closes #278 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
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';
|
||||
import 'package:PiliPlus/pages/video/detail/reply_new/toolbar_icon_button.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -483,12 +488,36 @@ class _CreateDynPanelState extends CommonPublishPageState<CreateDynPanel> {
|
||||
replyOption: _replyOption,
|
||||
privatePub: _isPrivate ? 1 : null,
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
if (result['status']) {
|
||||
Get.back();
|
||||
SmartDialog.dismiss();
|
||||
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());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SmartDialog.dismiss();
|
||||
SmartDialog.showToast(result['msg']);
|
||||
debugPrint('failed to publish: ${result['msg']}');
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:PiliPlus/pages/emote/view.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/reply_new/toolbar_icon_button.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -385,6 +386,13 @@ 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());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
|
||||
@@ -1957,11 +1957,10 @@ List<SettingsModel> get extraSettings => [
|
||||
leading: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
const Icon(Icons.shield),
|
||||
const Icon(Icons.shield_outlined),
|
||||
Icon(
|
||||
Icons.reply,
|
||||
size: 16,
|
||||
color: Theme.of(Get.context!).colorScheme.surface,
|
||||
size: 14,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -1972,10 +1971,30 @@ List<SettingsModel> get extraSettings => [
|
||||
settingsType: SettingsType.sw1tch,
|
||||
title: '使用「哔哩发评反诈」检查评论',
|
||||
subtitle: '仅对Android生效',
|
||||
leading: Icon(FontAwesomeIcons.b),
|
||||
leading: Icon(
|
||||
FontAwesomeIcons.b,
|
||||
size: 22,
|
||||
),
|
||||
setKey: SettingBoxKey.biliSendCommAntifraud,
|
||||
defaultVal: false,
|
||||
),
|
||||
SettingsModel(
|
||||
settingsType: SettingsType.sw1tch,
|
||||
title: '发布/转发动态反诈',
|
||||
subtitle: '发布/转发动态后检查动态是否可见',
|
||||
leading: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
const Icon(Icons.shield_outlined),
|
||||
Icon(
|
||||
Icons.motion_photos_on,
|
||||
size: 12,
|
||||
),
|
||||
],
|
||||
),
|
||||
setKey: SettingBoxKey.enableCreateDynAntifraud,
|
||||
defaultVal: false,
|
||||
),
|
||||
SettingsModel(
|
||||
settingsType: SettingsType.sw1tch,
|
||||
title: '屏蔽带货动态',
|
||||
|
||||
Reference in New Issue
Block a user