Skip to content

Commit

Permalink
Add username to bookmarkGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
TaYaKi71751 committed Dec 23, 2023
1 parent a8efb69 commit 906c441
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/pages/settings/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
import 'package:flutter_windowmanager/flutter_windowmanager.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:html/parser.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:mdi/mdi.dart';
import 'package:path_provider/path_provider.dart';
Expand All @@ -26,6 +27,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:sqflite/sqflite.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:violet/component/eh/eh_bookmark.dart';
import 'package:violet/component/eh/eh_headers.dart';
import 'package:violet/component/hitomi/hitomi.dart';
import 'package:violet/component/hitomi/indexs.dart';
import 'package:violet/database/database.dart';
Expand Down Expand Up @@ -2057,11 +2059,19 @@ class _SettingsPageState extends State<SettingsPage>
.replaceAll('\$1', count.toString()));
if (qqq) {
var bookmark = await Bookmark.getInstance();
var forum_members_html = await EHSession.requestString(
'https://forums.e-hentai.org/index.php?act=Members'
);
var username = (
parse(forum_members_html)
.querySelector('[href*="showuser="]')
!.text.replaceAll('\n', '').replaceAll('\r', '').trim()
);
for (int i = 0; i < EHBookmark.bookmarkInfo!.length; i++) {
if (EHBookmark.bookmarkInfo![i].isEmpty) continue;
await bookmark.createGroup('Favorite $i', '', Colors.black);
await bookmark.createGroup('[${username}] Favorite $i', '', Colors.black);
var group = (await bookmark.getGroup())
.where((element) => element.name() == 'Favorite $i')
.where((element) => element.name() == '[${username}] Favorite $i')
.last
.id();
for (int j = 0; j < EHBookmark.bookmarkInfo![i].length; j++) {
Expand Down

0 comments on commit 906c441

Please sign in to comment.