opt: note

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-03-29 10:56:35 +08:00
parent eea5257da2
commit 6ea8ffea7a
6 changed files with 50 additions and 21 deletions

View File

@@ -53,7 +53,11 @@ class FavNoteController extends MultiSelectController {
List dataList = (loadingState.value as Success).response as List;
Set removeList = dataList.where((item) => item['checked'] == true).toSet();
final res = await VideoHttp.delNote(
noteIds: removeList.map((item) => item['note_id']).toList());
isPublish: isPublish,
noteIds: removeList
.map((item) => isPublish ? item['cvid'] : item['note_id'])
.toList(),
);
if (res['status']) {
List remainList = dataList.toSet().difference(removeList).toList();
loadingState.value = LoadingState.success(remainList);

View File

@@ -111,6 +111,7 @@ class _NoteListPageState extends CommonSlidePageState<NoteListPage> {
onPressed: () {
_key.currentState?.showBottomSheet(
(context) => WebviewPageNew(
uaType: 'android',
oid: widget.oid,
title: widget.title,
url:

View File

@@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:io';
import 'package:PiliPlus/http/init.dart';
import 'package:PiliPlus/http/video.dart';
import 'package:PiliPlus/utils/accounts/account.dart';
import 'package:PiliPlus/utils/app_scheme.dart';
import 'package:PiliPlus/utils/cache_manage.dart';
@@ -193,20 +192,33 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
_webViewController?.evaluateJavascript(source: """
Array.from(document.querySelectorAll('.ql-editor > p')).map(p => p.textContent).join('\\n');
""").then((value) {
try {
String? summary = (value as String?);
if (summary?.isNotEmpty == true) {
VideoHttp.addNote(
oid: widget.oid!,
title: widget.title!,
summary: summary!,
);
}
} catch (_) {}
// try {
// String? summary = (value as String?);
// if (summary?.isNotEmpty == true) {
// VideoHttp.addNote(
// oid: widget.oid!,
// title: widget.title!,
// summary: summary!,
// );
// }
// } catch (_) {}
Get.back();
});
},
);
_webViewController?.addJavaScriptHandler(
handlerName: 'infoBarClicked',
callback: (args) async {
WebUri? uri = await _webViewController?.getUrl();
if (uri != null) {
String? oid =
RegExp(r'oid=(\d+)').firstMatch(uri.toString())?.group(1);
if (oid != null) {
PiliScheme.videoPush(int.parse(oid), null);
}
}
},
);
},
onProgressChanged: (controller, progress) {
_progressStream.add(progress / 100);
@@ -223,6 +235,11 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
document.querySelector('.finish-btn').addEventListener('click', function() {
window.flutter_inappwebview.callHandler('finishButtonClicked');
});
""");
_webViewController?.evaluateJavascript(source: """
document.querySelector('.info-bar').addEventListener('click', function() {
window.flutter_inappwebview.callHandler('infoBarClicked');
});
""");
} else if (url.toString().startsWith('https://live.bilibili.com')) {
_webViewController?.evaluateJavascript(