mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: page observer
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -65,12 +65,19 @@ class _MainAppState extends State<MainApp>
|
||||
|
||||
@override
|
||||
void didPopNext() {
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
_mainController.checkUnreadDynamic();
|
||||
_checkDefaultSearch(true);
|
||||
_checkUnread(context.orientation == Orientation.portrait);
|
||||
super.didPopNext();
|
||||
}
|
||||
|
||||
@override
|
||||
void didPushNext() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
super.didPushNext();
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
if (state == AppLifecycleState.resumed) {
|
||||
|
||||
@@ -1003,7 +1003,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
case 1:
|
||||
final List<InlineSpan> spanChildren = <InlineSpan>[];
|
||||
final RegExp urlRegExp = RegExp(
|
||||
'${Constants.urlPattern}|av\\d+|bv\\S+\\b',
|
||||
'${Constants.urlPattern}|av\\d+|bv[a-z\\d]{10}',
|
||||
caseSensitive: false,
|
||||
);
|
||||
|
||||
@@ -1030,7 +1030,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
} catch (e) {
|
||||
spanChildren.add(TextSpan(text: matchStr));
|
||||
}
|
||||
} else if (RegExp(r'^bv\S+\b$', caseSensitive: false)
|
||||
} else if (RegExp(r'^bv[a-z\d]{10}$', caseSensitive: false)
|
||||
.hasMatch(matchStr)) {
|
||||
try {
|
||||
// validate
|
||||
|
||||
@@ -393,6 +393,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
return;
|
||||
}
|
||||
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
|
||||
ScreenBrightness().resetApplicationScreenBrightness();
|
||||
|
||||
videoDetailController.positionSubscription?.cancel();
|
||||
@@ -426,6 +428,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
return;
|
||||
}
|
||||
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
|
||||
if (videoDetailController.plPlayerController.playerStatus.status.value ==
|
||||
PlayerStatus.playing &&
|
||||
videoDetailController.playerStatus != PlayerStatus.playing) {
|
||||
|
||||
Reference in New Issue
Block a user