Skip to content

Commit

Permalink
Dart format
Browse files Browse the repository at this point in the history
  • Loading branch information
violet-dev committed Dec 30, 2023
1 parent f72e2eb commit bdce84b
Show file tree
Hide file tree
Showing 23 changed files with 153 additions and 114 deletions.
12 changes: 8 additions & 4 deletions lib/component/hentai_download_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,16 @@ class HentaiDonwloadManager {
uploadDate: target.getDateTime().toString(),
filenameWithoutExtension: intToString(i, pad: 3),
artist: target.artists() != null
? target.artists().split('|').firstWhere((artist) => artist != null && (artist as String).isNotEmpty)
? target.artists().split('|').firstWhere(
(artist) => artist != null && (artist as String).isNotEmpty)
: target.groups() != null
? target.groups().split('|').firstWhere((group) => group != null && (group as String).isNotEmpty)
? target.groups().split('|').firstWhere((group) =>
group != null && (group as String).isNotEmpty)
: null,
group:
target.groups() != null ? target.groups().split('|').firstWhere((group) => group != null && (group as String).isNotEmpty) : null,
group: target.groups() != null
? target.groups().split('|').firstWhere(
(group) => group != null && (group as String).isNotEmpty)
: null,
extension: page.contains('fullimg.php')
? 'jpg'
: path.extension(page.split('/').last).replaceAll('.', ''),
Expand Down
2 changes: 1 addition & 1 deletion lib/component/hitomi/hitomi_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class HitomiParser {
.map((e) => e.querySelector('a')!.text.trim())
.toList();
} catch (_) {
try{
try {
artists = doc
.querySelector('div.artist-list')!
.querySelectorAll('li')
Expand Down
1 change: 1 addition & 0 deletions lib/component/nhentai/nhentai_provider.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 1 addition & 1 deletion lib/database/user/bookmark.dart
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class Bookmark {
'DateTime': datetime.toString(),
'GroupId': group,
});
if(bookmarkSet == null){
if (bookmarkSet == null) {
bookmarkSet = HashSet<int>();
}
bookmarkSet!.add(int.parse(article));
Expand Down
3 changes: 2 additions & 1 deletion lib/firebase_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class DefaultFirebaseOptions {
projectId: 'real-violet-app',
databaseURL: 'https://real-violet-app.firebaseio.com',
storageBucket: 'real-violet-app.appspot.com',
iosClientId: '774645671791-kpjcq7n5g2ap84nco7j2iab603tkrf0m.apps.googleusercontent.com',
iosClientId:
'774645671791-kpjcq7n5g2ap84nco7j2iab603tkrf0m.apps.googleusercontent.com',
iosBundleId: 'xyz.project.violet',
);
}
1 change: 1 addition & 0 deletions lib/lock/lock_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions lib/model/gallery.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions lib/network/cookies.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

20 changes: 9 additions & 11 deletions lib/pages/community/user_status_card_dead.dart
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,15 @@ class _UserStatusCardState extends State<UserStatusCard>
? const SizedBox(
height: 48,
width: 48,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
SizedBox(
height: 30,
width: 30,
child: CircularProgressIndicator(
valueColor:
AlwaysStoppedAnimation<Color>(Colors.grey),
))
]))
child: Stack(alignment: Alignment.center, children: <Widget>[
SizedBox(
height: 30,
width: 30,
child: CircularProgressIndicator(
valueColor:
AlwaysStoppedAnimation<Color>(Colors.grey),
))
]))
: InkWell(
customBorder: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
Expand Down
67 changes: 39 additions & 28 deletions lib/pages/database_download/database_download_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,15 @@ class DataBaseDownloadPageState extends State<DataBaseDownloadPage> {
Future<void> downloadFileAndroid() async {
try {
await downloadFileAndroidWith('latest', true);
} catch(e){
} catch (e) {
await downloadFileAndroidWith('old', false);
}
}

Future<void> downloadFileIOS() async {
try {
await downloadFileIOSWith('latest', true);
} catch(e){
} catch (e) {
await downloadFileIOSWith('old', false);
}
}
Expand All @@ -112,17 +113,22 @@ class DataBaseDownloadPageState extends State<DataBaseDownloadPage> {
if (await File('${dir.path}/db.sql.7z').exists()) {
await File('${dir.path}/db.sql.7z').delete();
}
switch(target){
case 'latest': await SyncManager.checkSyncLatest(_throw); break;
case 'old': await SyncManager.checkSyncOld(_throw); break;
default: {
try {
await downloadFileAndroidWith('latest', true);
} catch(e){
await downloadFileAndroidWith('old', false);
switch (target) {
case 'latest':
await SyncManager.checkSyncLatest(_throw);
break;
case 'old':
await SyncManager.checkSyncOld(_throw);
break;
default:
{
try {
await downloadFileAndroidWith('latest', true);
} catch (e) {
await downloadFileAndroidWith('old', false);
}
return;
}
return;
}
}
Timer timer = Timer.periodic(
const Duration(seconds: 1),
Expand Down Expand Up @@ -191,13 +197,13 @@ class DataBaseDownloadPageState extends State<DataBaseDownloadPage> {
if (Settings.useOptimizeDatabase) {
try {
await deleteUnused();
} catch(e1,st1){
} catch (e1, st1) {
Logger.error('[deleteUnused] E: $e1\n'
'$st1');
}
try {
await indexing();
} catch(e1,st1){
} catch (e1, st1) {
Logger.error('[indexing] E: $e1\n'
'$st1');
}
Expand All @@ -216,7 +222,7 @@ class DataBaseDownloadPageState extends State<DataBaseDownloadPage> {
} catch (e, st) {
Logger.error('[DBDownload] E: $e\n'
'$st');
if(_throw) throw e;
if (_throw) throw e;
}

setState(() {
Expand All @@ -238,17 +244,22 @@ class DataBaseDownloadPageState extends State<DataBaseDownloadPage> {
if (await File('$dir/data.db').exists()) {
await File('$dir/data.db').delete();
}
switch(target){
case 'latest': await SyncManager.checkSyncLatest(_throw); break;
case 'old': await SyncManager.checkSyncOld(_throw); break;
default: {
try {
await downloadFileIOSWith('latest', true);
} catch(e){
await downloadFileIOSWith('old', false);
switch (target) {
case 'latest':
await SyncManager.checkSyncLatest(_throw);
break;
case 'old':
await SyncManager.checkSyncOld(_throw);
break;
default:
{
try {
await downloadFileIOSWith('latest', true);
} catch (e) {
await downloadFileIOSWith('old', false);
}
return;
}
return;
}
}

Timer timer = Timer.periodic(
Expand Down Expand Up @@ -296,13 +307,13 @@ class DataBaseDownloadPageState extends State<DataBaseDownloadPage> {

try {
if (Settings.useOptimizeDatabase) await deleteUnused();
} catch(e1,st1){
} catch (e1, st1) {
Logger.error('[deleteUnused] E: $e1\n'
'$st1');
}
try {
await indexing();
} catch(e1,st1){
} catch (e1, st1) {
Logger.error('[indexing] E: $e1\n'
'$st1');
}
Expand All @@ -320,7 +331,7 @@ class DataBaseDownloadPageState extends State<DataBaseDownloadPage> {
} catch (e, st) {
Logger.error('[DBDownload] E: $e\n'
'$st');
if(_throw) throw e;
if (_throw) throw e;
}

setState(() {
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/database_download/decompress.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class P7zip {

final tempDir = await getTemporaryDirectory();
final libraryFile = File('${tempDir.path}/lib7zr.so');
if(await libraryFile.exists()){
if (await libraryFile.exists()) {
await libraryFile.delete();
}
final createdFile = await libraryFile.create();
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/main/artist_collection/artist_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class ArtistListPage extends StatelessWidget {
final List<String> artists;
final bool isLast;

const ArtistListPage({super.key, required this.artists, required this.isLast});
const ArtistListPage(
{super.key, required this.artists, required this.isLast});

static final RegExp _chDot = RegExp('[cC]h\\.');

Expand Down
3 changes: 1 addition & 2 deletions lib/pages/main/info/lab/setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ class _LabSettingState extends State<LabSetting> {
child: ListTile(
leading: Icon(MdiIcons.flask, color: Settings.majorColor),
title: const Text('In Viewer Message Search'),
subtitle: const Text(
'Support message search on viewer mode.'),
subtitle: const Text('Support message search on viewer mode.'),
trailing: Switch(
value: Settings.inViewerMessageSearch,
onChanged: (newValue) async {
Expand Down
15 changes: 10 additions & 5 deletions lib/pages/settings/libviolet_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class LibvioletPage extends StatelessWidget {
title: const Text('openssl'),
trailing: const Icon(Icons.open_in_new),
onTap: () async {
final url = Uri.parse('https://github.com/sfackler/rust-openssl');
final url =
Uri.parse('https://github.com/sfackler/rust-openssl');
if (await canLaunchUrl(url)) {
await launchUrl(url);
}
Expand All @@ -76,7 +77,8 @@ class LibvioletPage extends StatelessWidget {
title: const Text('futures-rs'),
trailing: const Icon(Icons.open_in_new),
onTap: () async {
final url = Uri.parse('https://github.com/rust-lang/futures-rs');
final url =
Uri.parse('https://github.com/rust-lang/futures-rs');
if (await canLaunchUrl(url)) {
await launchUrl(url);
}
Expand All @@ -93,7 +95,8 @@ class LibvioletPage extends StatelessWidget {
title: const Text('hyper-native-tls'),
trailing: const Icon(Icons.open_in_new),
onTap: () async {
final url = Uri.parse('https://github.com/sfackler/hyper-native-tls');
final url =
Uri.parse('https://github.com/sfackler/hyper-native-tls');
if (await canLaunchUrl(url)) {
await launchUrl(url);
}
Expand Down Expand Up @@ -179,7 +182,8 @@ class LibvioletPage extends StatelessWidget {
title: const Text('concurrent-queue'),
trailing: const Icon(Icons.open_in_new),
onTap: () async {
final url = Uri.parse('https://github.com/stjepang/concurrent-queue');
final url =
Uri.parse('https://github.com/stjepang/concurrent-queue');
if (await canLaunchUrl(url)) {
await launchUrl(url);
}
Expand All @@ -196,7 +200,8 @@ class LibvioletPage extends StatelessWidget {
title: const Text('lazy-static'),
trailing: const Icon(Icons.open_in_new),
onTap: () async {
final url = Uri.parse('https://github.com/rust-lang-nursery/lazy-static.rs');
final url = Uri.parse(
'https://github.com/rust-lang-nursery/lazy-static.rs');
if (await canLaunchUrl(url)) {
await launchUrl(url);
}
Expand Down
3 changes: 1 addition & 2 deletions lib/pages/settings/login/ehentai_login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ class _LoginScreenState extends State<LoginScreen> {

if (cookies.containsKey('ipb_member_id') &&
cookies.containsKey('ipb_pass_hash') &&
(cookies.containsKey('sk') ||
cookies.containsKey('igneous'))) {
(cookies.containsKey('sk') || cookies.containsKey('igneous'))) {
// await sessionStore.setSession(cookieString);
// await _cookieManager.clearCookies();
Navigator.pop(context, cookieString);
Expand Down
Loading

0 comments on commit bdce84b

Please sign in to comment.