mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: manual check dyn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -488,10 +488,11 @@ class _CreateDynPanelState extends CommonPublishPageState<CreateDynPanel> {
|
||||
if (result['status']) {
|
||||
Get.back();
|
||||
SmartDialog.showToast('发布成功');
|
||||
Future.wait([
|
||||
Utils.insertCreatedDyn(result),
|
||||
Utils.checkCreatedDyn(result, editController.text)
|
||||
]);
|
||||
Utils.insertCreatedDyn(result);
|
||||
Utils.checkCreatedDyn(
|
||||
id: result['data']?['dyn_id'],
|
||||
dynText: editController.text,
|
||||
);
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
debugPrint('failed to publish: ${result['msg']}');
|
||||
|
||||
@@ -386,10 +386,11 @@ class _RepostPanelState extends CommonPublishPageState<RepostPanel> {
|
||||
Get.back();
|
||||
SmartDialog.showToast('转发成功');
|
||||
widget.callback?.call();
|
||||
Future.wait([
|
||||
Utils.insertCreatedDyn(result),
|
||||
Utils.checkCreatedDyn(result, editController.text)
|
||||
]);
|
||||
Utils.insertCreatedDyn(result);
|
||||
Utils.checkCreatedDyn(
|
||||
id: result['data']?['dyn_id'],
|
||||
dynText: editController.text,
|
||||
);
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||
@@ -22,6 +21,7 @@ class AuthorPanel extends StatelessWidget {
|
||||
final Function? addBannedList;
|
||||
final String? source;
|
||||
final Function? onRemove;
|
||||
|
||||
const AuthorPanel({
|
||||
super.key,
|
||||
required this.item,
|
||||
@@ -310,6 +310,62 @@ class AuthorPanel extends StatelessWidget {
|
||||
},
|
||||
minLeadingWidth: 0,
|
||||
),
|
||||
if (item.modules.moduleAuthor.mid == Accounts.main.mid) ...[
|
||||
ListTile(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
Utils.checkCreatedDyn(id: item.idStr, isManual: true);
|
||||
},
|
||||
minLeadingWidth: 0,
|
||||
leading: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
const Icon(Icons.shield_outlined, size: 19),
|
||||
const Icon(Icons.published_with_changes_sharp, size: 12),
|
||||
],
|
||||
),
|
||||
title:
|
||||
Text('检查动态', style: Theme.of(context).textTheme.titleSmall!),
|
||||
),
|
||||
if (onRemove != null)
|
||||
ListTile(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('确定删除该动态?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: Get.back,
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
onRemove?.call(item.idStr);
|
||||
},
|
||||
child: const Text('确定'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
minLeadingWidth: 0,
|
||||
leading: Icon(Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.error, size: 19),
|
||||
title: Text('删除',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleSmall!
|
||||
.copyWith(color: Theme.of(context).colorScheme.error)),
|
||||
),
|
||||
],
|
||||
if (Accounts.main.isLogin)
|
||||
ListTile(
|
||||
title: Text(
|
||||
@@ -357,44 +413,6 @@ class AuthorPanel extends StatelessWidget {
|
||||
},
|
||||
minLeadingWidth: 0,
|
||||
),
|
||||
if (item.modules.moduleAuthor.mid == Accounts.main.mid &&
|
||||
onRemove != null)
|
||||
ListTile(
|
||||
onTap: () async {
|
||||
Get.back();
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('确定删除该动态?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: Get.back,
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
onRemove?.call(item.idStr);
|
||||
},
|
||||
child: const Text('确定'),
|
||||
),
|
||||
],
|
||||
));
|
||||
},
|
||||
minLeadingWidth: 0,
|
||||
leading: Icon(Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.error, size: 19),
|
||||
title: Text('删除',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleSmall!
|
||||
.copyWith(color: Theme.of(context).colorScheme.error)),
|
||||
),
|
||||
const Divider(thickness: 0.1, height: 1),
|
||||
ListTile(
|
||||
onTap: Get.back,
|
||||
|
||||
@@ -123,6 +123,11 @@ class AccountManager extends Interceptor {
|
||||
}
|
||||
return handler.next(options);
|
||||
} else {
|
||||
if (account is AnonymousAccount) {
|
||||
options.headers[HttpHeaders.cookieHeader] = '';
|
||||
handler.next(options);
|
||||
return;
|
||||
}
|
||||
account.cookieJar.loadForRequest(options.uri).then((cookies) {
|
||||
final previousCookies =
|
||||
options.headers[HttpHeaders.cookieHeader] as String?;
|
||||
|
||||
@@ -472,12 +472,13 @@ class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
static Future checkCreatedDyn(result, dynText) async {
|
||||
if (GStorage.enableCreateDynAntifraud) {
|
||||
static Future checkCreatedDyn({id, dynText, isManual}) async {
|
||||
if (isManual == true || GStorage.enableCreateDynAntifraud) {
|
||||
try {
|
||||
dynamic id = result['data']['dyn_id'];
|
||||
if (id != null) {
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
if (isManual != true) {
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
}
|
||||
dynamic res =
|
||||
await DynamicsHttp.dynamicDetail(id: id, clearCookie: true);
|
||||
showDialog(
|
||||
@@ -485,11 +486,13 @@ class Utils {
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('动态检查结果'),
|
||||
content: SelectableText(
|
||||
'${res['status'] ? '无账号状态下找到了你的动态,动态正常!' : '你的动态被shadow ban(仅自己可见)!'} \n\n动态内容: $dynText'),
|
||||
'${res['status'] ? '无账号状态下找到了你的动态,动态正常!' : '你的动态被shadow ban(仅自己可见)!'}${dynText != null ? ' \n\n动态内容: $dynText' : ''}'),
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (_) {}
|
||||
} catch (e) {
|
||||
debugPrint('check dyn error: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user