* opt: sized

* fix: self send

* feat: ctrl enter to send

* opt: checked

* opt: download notifier

* opt: Future.syncValue

* mod: account

* mod: loading state

* opt: DebounceStreamMixin

* opt: report

* opt: enum map

* opt: file handler

* opt: dyn color

* opt: Uint8List subview

* opt: FileExt

* opt: computeLuminance

* opt: isNullOrEmpty

* opt: Get context

* update [skip ci]

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

* opt dynamicColor [skip ci]

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

* fixes [skip ci]

* update

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

* update

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

---------

Signed-off-by: My-Responsitories <107370289+My-Responsitories@users.noreply.github.com>
Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
My-Responsitories
2025-12-17 17:01:10 +08:00
committed by GitHub
parent 02e0d34127
commit ce5e85e64b
87 changed files with 707 additions and 646 deletions

View File

@@ -688,7 +688,8 @@ class Api {
// static const String videoTags = '/x/tag/archive/tags';
static const String videoTags = '/x/web-interface/view/detail/tag';
static const String reportMember = '/ajax/report/add';
static const String reportMember =
'${HttpString.spaceBaseUrl}/ajax/report/add';
static const String removeMsg = '/session_svr/v1/session_svr/remove_session';

View File

@@ -89,7 +89,7 @@ abstract final class DanmakuHttp {
}
}
static Future<Map<String, dynamic>> danmakuReport({
static Future<LoadingState<Null>> danmakuReport({
required int reason,
required int cid,
required int id,
@@ -115,7 +115,12 @@ abstract final class DanmakuHttp {
data: data,
options: Options(contentType: Headers.formUrlEncodedContentType),
);
return res.data as Map<String, dynamic>;
if (res.data['code'] == 0) {
return const Success(null);
} else {
return Error(res.data['message']);
}
/// res.data['data']['block']
/// {

View File

@@ -633,7 +633,7 @@ abstract final class LiveHttp {
}
}
static Future<Map<String, dynamic>> liveDmReport({
static Future<LoadingState<Null>> liveDmReport({
required int roomId,
required Object mid,
required String msg,
@@ -666,6 +666,10 @@ abstract final class LiveHttp {
data: data,
options: Options(contentType: Headers.formUrlEncodedContentType),
);
return res.data as Map<String, dynamic>;
if (res.data['code'] == 0) {
return const Success(null);
} else {
return Error(res.data['message']);
}
}
}

View File

@@ -3,7 +3,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
sealed class LoadingState<T> {
const LoadingState();
factory LoadingState.loading() = Loading;
factory LoadingState.loading() => const Loading._internal();
bool get isSuccess => this is Success<T>;
@@ -23,10 +23,6 @@ sealed class LoadingState<T> {
class Loading extends LoadingState<Never> {
const Loading._internal();
static const Loading _instance = Loading._internal();
factory Loading() => _instance;
@override
String toString() {
return 'ApiException: loading';
@@ -42,7 +38,7 @@ class Success<T> extends LoadingState<T> {
if (identical(this, other)) {
return true;
}
if (other is Success) {
if (other is Success<T>) {
return response == other.response;
}
return false;
@@ -63,13 +59,13 @@ class Error extends LoadingState<Never> {
return true;
}
if (other is Error) {
return errMsg == other.errMsg;
return errMsg == other.errMsg && code == other.code;
}
return false;
}
@override
int get hashCode => errMsg.hashCode;
int get hashCode => Object.hash(errMsg, code);
@override
String toString() {

View File

@@ -37,7 +37,7 @@ abstract final class MemberHttp {
int? reasonV2,
}) async {
var res = await Request().post(
HttpString.spaceBaseUrl + Api.reportMember,
Api.reportMember,
data: {
'mid': mid,
'reason': reason,

View File

@@ -10,7 +10,7 @@ import 'package:PiliPlus/utils/accounts.dart';
import 'package:PiliPlus/utils/accounts/account.dart';
import 'package:dio/dio.dart';
class ReplyHttp {
abstract final class ReplyHttp {
static final Options options = Options(
headers: {...Constants.baseHeaders, 'cookie': ''},
extra: {'account': const NoAccount()},
@@ -175,4 +175,35 @@ class ReplyHttp {
return Error(res.data['message']);
}
}
static Future<LoadingState<Null>> report({
required Object rpid,
required Object oid,
required int reasonType,
bool banUid = true,
String? reasonDesc,
}) async {
final res = await Request().post(
'/x/v2/reply/report',
data: {
'add_blacklist': banUid,
'csrf': Accounts.main.csrf,
'gaia_source': 'main_h5',
'oid': oid,
'platform': 'android',
'reason': reasonType,
'rpid': rpid,
'scene': 'main',
'type': 1,
if (reasonType == 0) 'content': reasonDesc!,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return const Success(null);
} else {
return Error(res.data['message']);
}
}
}

View File

@@ -221,7 +221,7 @@ class UserHttp {
// }
// 清空稍后再看 // clean_type: null->all, 1->invalid, 2->viewed
static Future toViewClear([int? cleanType]) async {
static Future<LoadingState<Null>> toViewClear([int? cleanType]) async {
var res = await Request().post(
Api.toViewClear,
data: {
@@ -231,9 +231,9 @@ class UserHttp {
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true, 'msg': '操作完成'};
return const Success(null);
} else {
return {'status': false, 'msg': res.data['message']};
return Error(res.data['message']);
}
}
@@ -383,9 +383,9 @@ class UserHttp {
}
}
static Future<Map> dynamicReport({
required dynamic mid,
required dynamic dynId,
static Future<LoadingState<Null>> dynamicReport({
required Object mid,
required Object dynId,
required int reasonType,
String? reasonDesc,
}) async {
@@ -402,7 +402,11 @@ class UserHttp {
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
return res.data as Map;
if (res.data['code'] == 0) {
return const Success(null);
} else {
return Error(res.data['message']);
}
}
static Future<LoadingState<SpaceSettingData>> spaceSetting() async {