Skip to content

Commit

Permalink
🔖 v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
iota9star committed Aug 19, 2023
1 parent 20113dc commit abbdac0
Show file tree
Hide file tree
Showing 75 changed files with 1,273 additions and 1,434 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

android {
compileSdkVersion 33
compileSdkVersion 34
defaultConfig {
applicationId "io.nichijou.flutter.mikan"
minSdkVersion 21
targetSdkVersion 33
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
Binary file removed assets/fonts/mono/JetBrainsMono-Bold-Italic.ttf
Binary file not shown.
Binary file removed assets/fonts/mono/JetBrainsMono-Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file removed assets/fonts/mono/JetBrainsMono-ExtraBold.ttf
Binary file not shown.
Binary file removed assets/fonts/mono/JetBrainsMono-Italic.ttf
Binary file not shown.
Binary file removed assets/fonts/mono/JetBrainsMono-Medium-Italic.ttf
Binary file not shown.
Binary file removed assets/fonts/mono/JetBrainsMono-Medium.ttf
Binary file not shown.
Binary file removed assets/fonts/mono/JetBrainsMono-Regular.ttf
Binary file not shown.
8 changes: 4 additions & 4 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -385,7 +385,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 5R742PP8VF;
DEVELOPMENT_TEAM = CHR83T9WY5;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = MikanProject;
Expand Down Expand Up @@ -518,7 +518,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 5R742PP8VF;
DEVELOPMENT_TEAM = CHR83T9WY5;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = MikanProject;
Expand All @@ -543,7 +543,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 5R742PP8VF;
DEVELOPMENT_TEAM = CHR83T9WY5;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = MikanProject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
8 changes: 4 additions & 4 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
Expand All @@ -24,6 +26,8 @@
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand All @@ -43,9 +47,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
12 changes: 8 additions & 4 deletions lib/firebase_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ class DefaultFirebaseOptions {
projectId: 'flutter-mikan',
databaseURL: 'https://flutter-mikan.firebaseio.com',
storageBucket: 'flutter-mikan.appspot.com',
androidClientId: '626809778849-j0s442pnv7vs989f9jsnricrqpnu4llq.apps.googleusercontent.com',
iosClientId: '626809778849-guglnjbelfb3scmjirffr0k09uh3kgkd.apps.googleusercontent.com',
androidClientId:
'626809778849-j0s442pnv7vs989f9jsnricrqpnu4llq.apps.googleusercontent.com',
iosClientId:
'626809778849-guglnjbelfb3scmjirffr0k09uh3kgkd.apps.googleusercontent.com',
iosBundleId: 'io.nichijou.flutter.mikan',
);

Expand All @@ -74,8 +76,10 @@ class DefaultFirebaseOptions {
projectId: 'flutter-mikan',
databaseURL: 'https://flutter-mikan.firebaseio.com',
storageBucket: 'flutter-mikan.appspot.com',
androidClientId: '626809778849-j0s442pnv7vs989f9jsnricrqpnu4llq.apps.googleusercontent.com',
iosClientId: '626809778849-ob4j2tt7qv9kis69servg1m464um9b9c.apps.googleusercontent.com',
androidClientId:
'626809778849-j0s442pnv7vs989f9jsnricrqpnu4llq.apps.googleusercontent.com',
iosClientId:
'626809778849-ob4j2tt7qv9kis69servg1m464um9b9c.apps.googleusercontent.com',
iosBundleId: 'io.nichijou.flutter.mikan.RunnerTests',
);
}
42 changes: 6 additions & 36 deletions lib/internal/extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import 'package:android_intent_plus/flag.dart';
import 'package:clipboard/clipboard.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:oktoast/oktoast.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:share_plus/share_plus.dart';
import 'package:url_launcher/url_launcher_string.dart';

import '../topvars.dart';

extension IterableExt<T> on Iterable<T>? {
bool get isNullOrEmpty => this == null || this!.isEmpty;

Expand Down Expand Up @@ -109,37 +107,9 @@ extension NullableStringExt on String? {
if (isNullOrBlank) {
return;
}
showToastWidget(
Material(
color: Colors.transparent,
child: Builder(
builder: (context) {
final theme = Theme.of(context);
return Stack(
alignment: AlignmentDirectional.center,
children: [
Container(
padding: edgeH16V8,
margin: edgeH24,
decoration: BoxDecoration(
color: theme.secondary,
borderRadius: borderRadius28,
),
child: Text(
this!.trim(),
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.bodyMedium?.copyWith(
color:
theme.secondary.isDark ? Colors.white : Colors.black,
),
),
),
],
);
},
),
),
SmartDialog.showToast(
this!,
alignment: const AlignmentDirectional(0.0, 0.72),
);
HapticFeedback.mediumImpact();
}
Expand All @@ -163,7 +133,7 @@ extension NullableStringExt on String? {
action: 'android.intent.action.VIEW',
flags: [
Flag.FLAG_ACTIVITY_NEW_TASK,
Flag.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
Flag.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED,
],
data: this,
).launch().catchError((e, s) async {
Expand All @@ -180,7 +150,7 @@ extension NullableStringExt on String? {
if (isNullOrBlank) {
return '内容为空,取消操作'.toast();
}
FlutterClipboard.copy(this!).then((_) => '成功复制到剪切板'.toast());
FlutterClipboard.copy(this!).then((_) => '已复制到剪切板'.toast());
}

void share() {
Expand Down
6 changes: 3 additions & 3 deletions lib/internal/http.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class MikanTransformer extends SyncTransformer {
@override
Future transformResponse(
RequestOptions options,
ResponseBody response,
ResponseBody responseBody,
) async {
final rep = await super.transformResponse(options, response);
final rep = await super.transformResponse(options, responseBody);
if (rep is String) {
final String? func = options.extra['$MikanFunc'];
if (func.isNotBlank) {
Expand Down Expand Up @@ -162,7 +162,7 @@ class Http {
}
} catch (e, s) {
e.$error(stackTrace: s);
if (e is DioError) {
if (e is DioException) {
if (e.response?.statusCode == 302 &&
options.method == _InnerMethod.form &&
(e.requestOptions.path == MikanUrls.login ||
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/http_cache_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class HttpCacheManager {
_tasks.remove(url);
throw value;
}),
completer.future
completer.future,
]);
}

Expand Down
2 changes: 2 additions & 0 deletions lib/internal/lifecycle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ abstract class LifecycleState<T extends StatefulWidget> extends State<T>
case AppLifecycleState.inactive:
case AppLifecycleState.paused:
case AppLifecycleState.detached:
case AppLifecycleState.hidden:
onPause();
}
}
Expand Down Expand Up @@ -137,6 +138,7 @@ abstract class LifecycleAppState<T extends StatefulWidget> extends State<T>
case AppLifecycleState.inactive:
case AppLifecycleState.paused:
case AppLifecycleState.detached:
case AppLifecycleState.hidden:
onPause();
}
}
Expand Down
11 changes: 5 additions & 6 deletions lib/internal/log.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ extension Log on Object? {
StackTrace? stackTrace,
int level = 1,
}) {
if(!kDebugMode){
if (!kDebugMode) {
return;
}
final track = tag ?? _trackStackTraceId(StackTrace.current, level);
Expand All @@ -67,7 +67,7 @@ extension Log on Object? {
StackTrace? stackTrace,
int level = 1,
}) {
if(!kDebugMode){
if (!kDebugMode) {
return;
}
final track = tag ?? _trackStackTraceId(StackTrace.current, level);
Expand All @@ -86,7 +86,7 @@ extension Log on Object? {
StackTrace? stackTrace,
int level = 1,
}) {
if(!kDebugMode){
if (!kDebugMode) {
return;
}
final track = tag ?? _trackStackTraceId(StackTrace.current, level);
Expand All @@ -106,7 +106,7 @@ extension Log on Object? {
StackTrace? stackTrace,
int level = 1,
}) {
if(!kDebugMode){
if (!kDebugMode) {
return;
}
final track = tag ?? _trackStackTraceId(StackTrace.current, level);
Expand Down Expand Up @@ -191,7 +191,6 @@ extension Log on Object? {
return '${now.hour.toString().padLeft(2, '0')}'
':${now.minute.toString().padLeft(2, '0')}'
':${now.second.toString().padLeft(2, '0')}'
'.${now.millisecond.toString().padLeft(3, '0')}'
;
'.${now.millisecond.toString().padLeft(3, '0')}';
}
}
35 changes: 35 additions & 0 deletions lib/internal/method.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';

import '../topvars.dart';

Future<T> wrapLoading<T>(
FutureOr<T> Function() block, {
String msg = '加载中...',
}) async {
try {
unawaited(
SmartDialog.showLoading(
backDismiss: false,
clickMaskDismiss: false,
maskColor: Theme.of(navKey.currentContext!)
.colorScheme
.background
.withOpacity(0.64),
msg: msg,
),
);
return await block();
} finally {
await SmartDialog.dismiss();
}
}

Future<void> hideKeyboard() {
return SystemChannels.textInput
.invokeMethod('TextInput.hide')
.catchError((_) {});
}
5 changes: 4 additions & 1 deletion lib/internal/repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ class Repo {
int bangumiId,
bool subscribe, {
int? subgroupId,
// 1: 简中,2: 繁中
int? language,
}) {
final Options options = Options(
final options = Options(
contentType: Headers.jsonContentType,
responseType: ResponseType.json,
);
Expand All @@ -115,6 +117,7 @@ class Repo {
data: <String, dynamic>{
'BangumiID': bangumiId,
'SubtitleGroupID': subgroupId,
if (language != null) 'Language': language,
},
options: options,
);
Expand Down
24 changes: 22 additions & 2 deletions lib/internal/resolver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,15 @@ class Resolver {
.querySelector('#login input[name=__RequestVerificationToken]')
?.attributes['value']
?.trim();
final rss = document
.querySelector('#an-episode-updates .mikan-rss')
?.attributes['href']
?.trim();
return User(
name: name,
avatar: avatar == null ? null : MikanUrls.baseUrl + avatar,
token: token,
rss: rss == null ? null : MikanUrls.baseUrl + rss,
);
}

Expand Down Expand Up @@ -603,8 +608,23 @@ class Resolver {
} else {
subgroupBangumi.name = temp!;
}
subgroupBangumi.subscribed =
element.querySelector('.subscribed')?.text.trim() == '已订阅';
final subele = element.querySelector('.subscribed')!;
subgroupBangumi.subscribed = !subele.attributes.containsKey('style');
subgroupBangumi.sublang = subele.text;
if (subgroupBangumi.subscribed) {
if (subgroupBangumi.sublang == '简中') {
subgroupBangumi.state = 1;
} else if (subgroupBangumi.sublang == '繁中') {
subgroupBangumi.state = 2;
} else {
subgroupBangumi.state = 0;
}
} else {
subgroupBangumi.state = -1;
}
final rss =
element.querySelector('.mikan-rss')?.attributes['href']?.trim();
subgroupBangumi.rss = rss == null ? null : MikanUrls.baseUrl + rss;
subgroups = [];
elements = element.querySelectorAll('ul > li > a');
if (elements.isSafeNotEmpty) {
Expand Down
Loading

0 comments on commit abbdac0

Please sign in to comment.