测试安卓修改app名称

This commit is contained in:
rang 2025-12-05 17:59:13 +08:00
parent 6b1edcb475
commit 6ceeb99d20
19 changed files with 1218 additions and 822 deletions

View file

@ -0,0 +1,56 @@
import 'package:audio_service/audio_service.dart';
import 'package:audio_session/audio_session.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:just_audio_media_kit/just_audio_media_kit.dart';
import 'package:logging/logging.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:shelfsdk/audiobookshelf_api.dart';
import 'package:vaani/features/player/core/abs_audio_handler.dart' as core;
import 'package:vaani/features/player/core/abs_audio_player.dart' as core;
part 'abs_provider.g.dart';
final _logger = Logger('AbsPlayerProvider');
@Riverpod(keepAlive: true)
Future<core.AbsAudioHandler> absAudioHandler(Ref ref) async {
// for playing audio on windows, linux
JustAudioMediaKit.ensureInitialized();
// for configuring how this app will interact with other audio apps
final session = await AudioSession.instance;
await session.configure(const AudioSessionConfiguration.speech());
final player = ref.read(absAudioPlayerProvider);
final audioService = await AudioService.init(
builder: () => core.AbsAudioHandler(player),
config: const AudioServiceConfig(
androidNotificationChannelId: 'dr.blank.vaani.channel.audio',
androidNotificationChannelName: 'ABSPlayback',
androidNotificationChannelDescription:
'Needed to control audio from lock screen',
androidNotificationOngoing: false,
androidStopForegroundOnPause: false,
androidNotificationIcon: 'drawable/ic_stat_logo',
preloadArtwork: true,
// fastForwardInterval: Duration(seconds: 20),
// rewindInterval: Duration(seconds: 20),
),
);
return audioService;
}
@Riverpod(keepAlive: true)
class AbsAudioPlayer extends _$AbsAudioPlayer {
@override
core.AbsAudioPlayer build() {
final player = core.AbsAudioPlayer();
ref.onDispose(player.dispose);
_logger.finer('created simple player');
return player;
}
}

View file

@ -0,0 +1,43 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'abs_provider.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
String _$absAudioHandlerHash() => r'f4ef20cc3e244d5d37354ef38a1e0fdbd89412f4';
/// See also [absAudioHandler].
@ProviderFor(absAudioHandler)
final absAudioHandlerProvider = FutureProvider<core.AbsAudioHandler>.internal(
absAudioHandler,
name: r'absAudioHandlerProvider',
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$absAudioHandlerHash,
dependencies: null,
allTransitiveDependencies: null,
);
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
typedef AbsAudioHandlerRef = FutureProviderRef<core.AbsAudioHandler>;
String _$absAudioPlayerHash() => r'68a56d45a9f165d257c23f81d9bf7d0930425464';
/// See also [AbsAudioPlayer].
@ProviderFor(AbsAudioPlayer)
final absAudioPlayerProvider =
NotifierProvider<AbsAudioPlayer, core.AbsAudioPlayer>.internal(
AbsAudioPlayer.new,
name: r'absAudioPlayerProvider',
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$absAudioPlayerHash,
dependencies: null,
allTransitiveDependencies: null,
);
typedef _$AbsAudioPlayer = Notifier<core.AbsAudioPlayer>;
// ignore_for_file: type=lint
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

View file

@ -99,6 +99,7 @@ List<core.BookChapter> currentChapters(Ref ref) {
}
final index = book.chapters.indexOf(currentChapter);
final total = book.chapters.length;
return book.chapters
.sublist(index - 3, (total - 3) <= (index + 17) ? total : index + 17);
final start = index - 3 >= 0 ? index - 3 : 0;
final end = start + 20 <= total ? start + 20 : total;
return book.chapters.sublist(start, end);
}

View file

@ -6,7 +6,7 @@ part of 'currently_playing_provider.dart';
// RiverpodGenerator
// **************************************************************************
String _$currentChaptersHash() => r'a25733d8085a2ce7dbc16fa2bf14f00ab8e2a623';
String _$currentChaptersHash() => r'6574b3f4ee0af8006f233aaf76cc507d188c6305';
/// See also [currentChapters].
@ProviderFor(currentChapters)