diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 12d500de..aba64eb2 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -49,7 +49,7 @@ jobs: run: sed -i 's/applicationId "com.msob7y.namida"/applicationId "com.msob7y.namida.snapshot"/g' android/app/build.gradle - name: Build APKs - run: flutter build apk --target-platform android-arm,android-arm64 --release --split-per-abi -v + run: flutter build apk --target-platform android-arm64 --release -v # - name: Sign App Bundle # uses: r0adkll/sign-android-release@v1 diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro index 4f8d47b5..4f1268e8 100644 --- a/android/app/proguard-rules.pro +++ b/android/app/proguard-rules.pro @@ -31,3 +31,10 @@ -keep class com.namidaco.** { *; } -keep class org.jaudiotagger.** { *; } +-keep class io.flutter.app.** { *; } +-keep class io.flutter.plugin.** { *; } +-keep class io.flutter.util.** { *; } +-keep class io.flutter.view.** { *; } +-keep class io.flutter.** { *; } +-keep class io.flutter.plugins.** { *; } +-keep class androidx.lifecycle.DefaultLifecycleObserver \ No newline at end of file diff --git a/lib/base/audio_handler.dart b/lib/base/audio_handler.dart index 00d429eb..6d7358f5 100644 --- a/lib/base/audio_handler.dart +++ b/lib/base/audio_handler.dart @@ -459,6 +459,8 @@ class NamidaAudioVideoHandler extends BasicAudioHandler { await onItemPlayYoutubeID(item, finalItem, index, startPlaying, skipItem); }, ); + }, onRapidDetected: () { + if (isPlaying) pause(); }); MiniPlayerController.inst.reorderingQueueCompleterPlayer?.completeIfWasnt(); diff --git a/lib/base/pull_to_refresh.dart b/lib/base/pull_to_refresh.dart index fcea0880..42eb25e2 100644 --- a/lib/base/pull_to_refresh.dart +++ b/lib/base/pull_to_refresh.dart @@ -30,7 +30,7 @@ mixin PullToRefreshMixin on State implements Ticker final dy = event.delta.dy; if (_isDraggingVertically == null) { final canDragVertically = dy < 0 || (sc.hasClients && sc.position.pixels <= 0); - final horizontalAllowance = event.delta.dx < 0.1; + final horizontalAllowance = event.delta.dx.abs() < 0.1; _isDraggingVertically = canDragVertically && horizontalAllowance; } if (_isDraggingVertically == true) _onVerticalDragUpdate(dy); diff --git a/lib/class/func_execute_limiter.dart b/lib/class/func_execute_limiter.dart index 64ae9885..cd2ba626 100644 --- a/lib/class/func_execute_limiter.dart +++ b/lib/class/func_execute_limiter.dart @@ -19,8 +19,9 @@ class FunctionExecuteLimiter { Completer? _valueCompleter; - void execute(Function fn) { + void execute(Function fn, {void Function()? onRapidDetected}) { if (_isRapidlyCalling) { + if (onRapidDetected != null) onRapidDetected(); _latestColorUpdate = DateTime.now(); _isRapidlyCallingTimer?.cancel(); _isRapidlyCallingTimer = Timer(_executeAfter, () { @@ -32,8 +33,9 @@ class FunctionExecuteLimiter { } } - Future executeFuture(Future Function() fn) async { + Future executeFuture(Future Function() fn, {void Function()? onRapidDetected}) async { if (_isRapidlyCalling) { + if (onRapidDetected != null) onRapidDetected(); _latestColorUpdate = DateTime.now(); _isRapidlyCallingTimer?.cancel(); _valueCompleter?.completeIfWasnt(null); diff --git a/lib/controller/lyrics_controller.dart b/lib/controller/lyrics_controller.dart index f4898bec..7cf1a208 100644 --- a/lib/controller/lyrics_controller.dart +++ b/lib/controller/lyrics_controller.dart @@ -238,7 +238,7 @@ class Lyrics { return await _fetchLyricsGoogleIsolate.thready(possibleQueries); } - Future _fetchLyricsGoogleIsolate(List searches) async { + static Future _fetchLyricsGoogleIsolate(List searches) async { const url = "https://www.google.com/search?client=safari&rls=en&ie=UTF-8&oe=UTF-8&q="; const delimiter1 = '
'; const delimiter2 = '
'; @@ -261,7 +261,7 @@ class Lyrics { String lyrics = ''; for (final q in searches) { - lyrics = await requestQuery(q as String); + lyrics = await requestQuery(q); if (lyrics != '') break; } diff --git a/lib/controller/thumbnail_manager.dart b/lib/controller/thumbnail_manager.dart index 2e99a139..bad23215 100644 --- a/lib/controller/thumbnail_manager.dart +++ b/lib/controller/thumbnail_manager.dart @@ -257,9 +257,9 @@ class _YTThumbnailDownloadManager with PortsProvider { const bool deleteOldExtracted = true; - void updateLastAccessed(File file) { + void updateLastAccessed(File file) async { try { - file.setLastAccessed(DateTime.now()); + await file.setLastAccessed(DateTime.now()); } catch (_) {} } @@ -316,6 +316,7 @@ class _YTThumbnailDownloadManager with PortsProvider { await fileStream.flush(); await fileStream.close(); // closing file. } catch (_) {} + destinationFileTemp.delete().catchError((_) => File('')); } if (requester == null || requester.isClosed) { diff --git a/lib/main_page_wrapper.dart b/lib/main_page_wrapper.dart index 3e87509f..76d536d4 100644 --- a/lib/main_page_wrapper.dart +++ b/lib/main_page_wrapper.dart @@ -70,6 +70,7 @@ class _MainPageWrapperState extends State { borderRadius: 42.0.multipliedRadius, drawerChild: const NamidaDrawer(), maxPercentage: 0.465.withMaximum(324.0 / context.width), + initiallySwipeable: settings.swipeableDrawer.value, child: const MainScreenStack(), ); } diff --git a/lib/packages/lyrics_lrc_parsed_view.dart b/lib/packages/lyrics_lrc_parsed_view.dart index ffba97a8..cd30059c 100644 --- a/lib/packages/lyrics_lrc_parsed_view.dart +++ b/lib/packages/lyrics_lrc_parsed_view.dart @@ -59,9 +59,8 @@ class LyricsLRCParsedViewState extends State { String _currentLine = ''; static const int _lrcOpacityDurationMS = 500; - bool? _isScrollingVertically; - final bool _updateOpacityForEmptyLines = true; - late bool _isCurrentLineEmpty = _checkIfTextEmpty(lyrics.firstOrNull?.lyrics ?? ''); + late final bool _updateOpacityForEmptyLines = !widget.isFullScreenView; + late bool _isCurrentLineEmpty = _updateOpacityForEmptyLines ? _checkIfTextEmpty(lyrics.firstOrNull?.lyrics ?? '') : false; final _emptyTextRegex = RegExp(r'[^\s]'); bool _checkIfTextEmpty(String text) { @@ -155,6 +154,7 @@ class LyricsLRCParsedViewState extends State { if ((_canAnimateScroll || forceAnimate) && controller.isAttached) { if (newIndex < 0) newIndex = 0; + if (_currentIndex == newIndex) return; _currentIndex = newIndex; jump ? controller.jumpTo( @@ -320,19 +320,17 @@ class LyricsLRCParsedViewState extends State { fit: StackFit.expand, children: [ Listener( + onPointerDown: (event) { + if (_isCurrentLineEmpty) { + setState(() => _isCurrentLineEmpty = false); + } + }, onPointerMove: (event) { _scrollTimer?.cancel(); _scrollTimer = null; _canAnimateScroll = false; - _isScrollingVertically ??= event.delta.dy.abs() > 0.01; - if (_isScrollingVertically == true) { - if (_isCurrentLineEmpty) { - setState(() => _isCurrentLineEmpty = false); - } - } }, onPointerUp: (event) { - _isScrollingVertically = null; _scrollTimer = Timer(const Duration(seconds: 3), () { _canAnimateScroll = true; if (Player.inst.isPlaying) { @@ -358,12 +356,12 @@ class LyricsLRCParsedViewState extends State { controller: Lyrics.inst.textScrollController, child: Column( children: [ - const SizedBox(height: 48.0), + SizedBox(height: _paddingVertical), Text( text, style: normalTextStyle, ), - const SizedBox(height: 48.0), + SizedBox(height: _paddingVertical), ], ), ); diff --git a/lib/ui/pages/about_page.dart b/lib/ui/pages/about_page.dart index 8b065570..315d0b07 100644 --- a/lib/ui/pages/about_page.dart +++ b/lib/ui/pages/about_page.dart @@ -138,7 +138,7 @@ class AboutPage extends StatelessWidget { ), if (buildDateDiff != '') Text( - _getDateDifferenceText(), + buildDateDiff, style: context.textTheme.displaySmall, ), ], diff --git a/lib/ui/widgets/inner_drawer.dart b/lib/ui/widgets/inner_drawer.dart index 9bfb984e..2b8625b1 100644 --- a/lib/ui/widgets/inner_drawer.dart +++ b/lib/ui/widgets/inner_drawer.dart @@ -15,7 +15,7 @@ class NamidaInnerDrawer extends StatefulWidget { final Curve curve; final double borderRadius; final double maxPercentage; - final bool swipeable; + final bool initiallySwipeable; const NamidaInnerDrawer({ super.key, @@ -26,7 +26,7 @@ class NamidaInnerDrawer extends StatefulWidget { this.curve = Curves.fastEaseInToSlowEaseOut, this.borderRadius = 0, this.maxPercentage = 0.472, - this.swipeable = true, + required this.initiallySwipeable, }); @override @@ -59,7 +59,7 @@ class NamidaInnerDrawerState extends State with SingleTickerP super.dispose(); } - late bool _canSwipe = widget.swipeable; + late bool _canSwipe = widget.initiallySwipeable; bool _isOpened = false; double _distanceTraveled = 0; diff --git a/pubspec.yaml b/pubspec.yaml index 7d875f53..a30b841b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: namida description: A Beautiful and Feature-rich Music Player, With YouTube & Video Support Built in Flutter publish_to: "none" -version: 2.4.3-beta+240514201 +version: 2.4.4-beta+240514204 environment: sdk: ">=3.1.4 <4.0.0"