mirror of
https://github.com/gokadzev/Musify.git
synced 2025-05-17 22:46:05 +08:00
Revert "refactor: remove client feature"
This reverts commit cbe5739fa0e7fe3d49eb9cae7a8345cc865a4c8e.
This commit is contained in:
@ -70,6 +70,23 @@ Map activePlaylist = {
|
||||
'list': [],
|
||||
};
|
||||
|
||||
final clients = {
|
||||
'tv': YoutubeApiClient.tv,
|
||||
'androidVr': YoutubeApiClient.androidVr,
|
||||
'safari': YoutubeApiClient.safari,
|
||||
'ios': YoutubeApiClient.ios,
|
||||
'android': YoutubeApiClient.android,
|
||||
'androidMusic': YoutubeApiClient.androidMusic,
|
||||
'mediaConnect': YoutubeApiClient.mediaConnect,
|
||||
'web': YoutubeApiClient.mweb,
|
||||
};
|
||||
|
||||
List<YoutubeApiClient> userChosenClients = [
|
||||
YoutubeApiClient.tv,
|
||||
YoutubeApiClient.androidVr,
|
||||
YoutubeApiClient.safari,
|
||||
];
|
||||
|
||||
dynamic nextRecommendedSong;
|
||||
|
||||
final currentLikedSongsLength = ValueNotifier<int>(userLikedSongsList.length);
|
||||
@ -704,7 +721,10 @@ Future<AudioOnlyStreamInfo?> getSongManifest(String? songId) async {
|
||||
logger.log('getSongManifest: songId is null or empty', null, null);
|
||||
return null;
|
||||
}
|
||||
final manifest = await _yt.videos.streams.getManifest(songId);
|
||||
final manifest = await _yt.videos.streams.getManifest(
|
||||
songId,
|
||||
ytClients: userChosenClients,
|
||||
);
|
||||
final audioStream = manifest.audioOnly;
|
||||
if (audioStream.isEmpty) {
|
||||
logger.log('getSongManifest: no audio streams for $songId', null, null);
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "Clear recently played history?",
|
||||
"clearSearchHistory": "امسح سجل البحث",
|
||||
"clearSearchHistoryQuestion": "Clear search history?",
|
||||
"client": "Client",
|
||||
"confirm": "تأكيد",
|
||||
"confirmation": "تأكيد",
|
||||
"copyLogs": "نسخ السجلات",
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "Wiedergabeverlauf löschen?",
|
||||
"clearSearchHistory": "Suchverlauf löschen",
|
||||
"clearSearchHistoryQuestion": "Suchverlauf löschen?",
|
||||
"client": "Client",
|
||||
"confirm": "Bestätigen",
|
||||
"confirmation": "Bestätigung",
|
||||
"copyLogs": "Logs kopieren",
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "Καθαρισμός πρόσφατου ιστορικού αναπαραγωγής?",
|
||||
"clearSearchHistory": "Καθαρισμός ιστορικού αναζήτησης",
|
||||
"clearSearchHistoryQuestion": "Καθαρισμός ιστορικού αναζήτησης?",
|
||||
"client": "Client",
|
||||
"confirm": "Επιβεβαίωση",
|
||||
"confirmation": "Επιβεβαίωση",
|
||||
"copyLogs": "Αντιγραφή καταγραφών",
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "Are you sure you want to clear recently played history?",
|
||||
"clearSearchHistory": "Clear search history",
|
||||
"clearSearchHistoryQuestion": "Are you sure you want to clear search history?",
|
||||
"client": "Client",
|
||||
"confirm": "Confirm",
|
||||
"confirmation": "Confirmation",
|
||||
"copyLogs": "Copy logs",
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "¿Borrar el historial de reproducción reciente?",
|
||||
"clearSearchHistory": "Borrar historial de búsqueda",
|
||||
"clearSearchHistoryQuestion": "¿Borrar el historial de búsqueda?",
|
||||
"client": "Client",
|
||||
"confirm": "Confirmar",
|
||||
"confirmation": "Confirmación",
|
||||
"copyLogs": "Copiar registros",
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "Souhaitez-vous effacer l'historique de lecture ?",
|
||||
"clearSearchHistory": "Effacer l'historique de recherche",
|
||||
"clearSearchHistoryQuestion": "Souhaitez-vous effacer l'historique de recherche ?",
|
||||
"client": "Client",
|
||||
"confirm": "Confirmer",
|
||||
"confirmation": "Confirmation",
|
||||
"copyLogs": "Copier les logs",
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "क्या आप हाल ही में बजाए गए गानों का इतिहास साफ़ करना चाहते हैं?",
|
||||
"clearSearchHistory": "खोज इतिहास साफ़ करें",
|
||||
"clearSearchHistoryQuestion": "क्या आप खोज इतिहास साफ़ करना चाहते हैं?",
|
||||
"client": "क्लाइंट",
|
||||
"confirm": "पुष्टि करें",
|
||||
"confirmation": "पुष्टिकरण",
|
||||
"copyLogs": "लॉग्स कॉपी करें",
|
||||
@ -127,4 +128,4 @@
|
||||
"update": "Update",
|
||||
"userPlaylists": "उपयोगकर्ता की प्लेलिस्ट्स",
|
||||
"youtubePlaylistLinkOrId": "YouTube प्लेलिस्ट लिंक या ID"
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "Apakah Anda yakin ingin menghapus riwayat yang baru saja dimainkan?",
|
||||
"clearSearchHistory": "Hapus riwayat pencarian",
|
||||
"clearSearchHistoryQuestion": "Apakah Anda yakin ingin menghapus riwayat pencarian?",
|
||||
"client": "Klien",
|
||||
"confirm": "Terima",
|
||||
"confirmation": "Konfirmasi",
|
||||
"copyLogs": "Salin catatan",
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "Cancellare cronologia recenti?",
|
||||
"clearSearchHistory": "Cancella cronologia ricerche",
|
||||
"clearSearchHistoryQuestion": "Cancellare cronologia ricerche?",
|
||||
"client": "Client",
|
||||
"confirm": "Conferma",
|
||||
"confirmation": "Conferma",
|
||||
"copyLogs": "Copia log",
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "再生履歴を削除しますか?",
|
||||
"clearSearchHistory": "検索履歴を削除",
|
||||
"clearSearchHistoryQuestion": "検索履歴を削除しますか?",
|
||||
"client": "クライアント",
|
||||
"confirm": "確認",
|
||||
"confirmation": "確認",
|
||||
"copyLogs": "ログをコピー",
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "최근 재생 기록을 지울까요?",
|
||||
"clearSearchHistory": "검색 기록 지우기",
|
||||
"clearSearchHistoryQuestion": "검색 기록 지울까요?",
|
||||
"client": "클라이언트",
|
||||
"confirm": "확인",
|
||||
"confirmation": "확인",
|
||||
"copyLogs": "로그 복사",
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "Wyczyścić historię ostatnio odtworzonych utworów?",
|
||||
"clearSearchHistory": "Wyczyść historię wyszukiwania",
|
||||
"clearSearchHistoryQuestion": "Wyczyścić historię wyszukiwania?",
|
||||
"client": "Client",
|
||||
"confirm": "Potwierdź",
|
||||
"confirmation": "Potwierdzenie",
|
||||
"copyLogs": "Kopiuj logi",
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "Deseja limpar as reproduções recentes?",
|
||||
"clearSearchHistory": "Limpar buscas",
|
||||
"clearSearchHistoryQuestion": "Deseja limpar histórico de buscas?",
|
||||
"client": "Cliente",
|
||||
"confirm": "Confirmar",
|
||||
"confirmation": "Confirmação",
|
||||
"copyLogs": "Copiar logs",
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "Точно очистить недавние треки?",
|
||||
"clearSearchHistory": "Очистить историю поиска",
|
||||
"clearSearchHistoryQuestion": "Точно очистить историю поиска?",
|
||||
"client": "Клиент",
|
||||
"confirm": "Подтвердить",
|
||||
"confirmation": "Подтверждение",
|
||||
"copyLogs": "Скопировать логи",
|
||||
@ -127,4 +128,4 @@
|
||||
"update": "Update",
|
||||
"userPlaylists": "Ваши плейлисты",
|
||||
"youtubePlaylistLinkOrId": "ID плейлиста YouTube или ссылка на него "
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "Son çalınanları silmek istiyor musun?",
|
||||
"clearSearchHistory": "Arama Geçmişini Temizle",
|
||||
"clearSearchHistoryQuestion": "Arama geçmişini temizlemek istiyor musun?",
|
||||
"client": "İstemci",
|
||||
"confirm": "Onayla",
|
||||
"confirmation": "Doğrulama",
|
||||
"copyLogs": "Kayıtları Kopyala",
|
||||
@ -127,4 +128,4 @@
|
||||
"update": "Update",
|
||||
"userPlaylists": "Kullanıcı Listeleri",
|
||||
"youtubePlaylistLinkOrId": "YouTube listesi bağlantısı veya ID'si"
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "Clear recently played history?",
|
||||
"clearSearchHistory": "Очистити історію пошуку",
|
||||
"clearSearchHistoryQuestion": "Clear search history?",
|
||||
"client": "Client",
|
||||
"confirm": "Підтвердити",
|
||||
"confirmation": "Підтвердження",
|
||||
"copyLogs": "Копіювати журнали",
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "您確定要清除最近播放歷史嗎?",
|
||||
"clearSearchHistory": "清除搜索歷史",
|
||||
"clearSearchHistoryQuestion": "您確定要清除搜索歷史嗎?",
|
||||
"client": "客戶端",
|
||||
"confirm": "確認",
|
||||
"confirmation": "確認",
|
||||
"copyLogs": "複製日誌",
|
||||
|
@ -31,6 +31,7 @@
|
||||
"clearRecentlyPlayedQuestion": "您确定要清除最近播放历史吗?",
|
||||
"clearSearchHistory": "清除搜索历史",
|
||||
"clearSearchHistoryQuestion": "您确定要清除搜索历史吗?",
|
||||
"client": "客户端",
|
||||
"confirm": "确认",
|
||||
"confirmation": "确认",
|
||||
"copyLogs": "复制日志",
|
||||
|
@ -44,6 +44,7 @@ import 'package:musify/services/update_manager.dart';
|
||||
import 'package:musify/style/app_themes.dart';
|
||||
import 'package:musify/utilities/flutter_toast.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:youtube_explode_dart/youtube_explode_dart.dart';
|
||||
|
||||
late MusifyAudioHandler audioHandler;
|
||||
|
||||
@ -244,6 +245,18 @@ Future<void> initialisation() async {
|
||||
// Init router
|
||||
NavigationManager.instance;
|
||||
|
||||
// Init clients
|
||||
if (clientsSetting.value.isNotEmpty) {
|
||||
final chosenClients = <YoutubeApiClient>[];
|
||||
for (final client in clientsSetting.value) {
|
||||
final _client = clients[client];
|
||||
if (_client != null) {
|
||||
chosenClients.add(_client);
|
||||
}
|
||||
}
|
||||
userChosenClients = chosenClients;
|
||||
}
|
||||
|
||||
try {
|
||||
// Listen to incoming links while app is running
|
||||
appLinks.uriLinkStream.listen(
|
||||
|
@ -102,6 +102,13 @@ class SettingsPage extends StatelessWidget {
|
||||
inactivatedColor,
|
||||
),
|
||||
),
|
||||
CustomBar(
|
||||
context.l10n!.client,
|
||||
FluentIcons.device_meeting_room_24_filled,
|
||||
onTap:
|
||||
() =>
|
||||
_showClientPicker(context, activatedColor, inactivatedColor),
|
||||
),
|
||||
CustomBar(
|
||||
context.l10n!.language,
|
||||
FluentIcons.translate_24_filled,
|
||||
@ -422,6 +429,56 @@ class SettingsPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
void _showClientPicker(
|
||||
BuildContext context,
|
||||
Color activatedColor,
|
||||
Color inactivatedColor,
|
||||
) {
|
||||
final availableClients = clients.keys.toList();
|
||||
showCustomBottomSheet(
|
||||
context,
|
||||
StatefulBuilder(
|
||||
builder: (context, setState) {
|
||||
return ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
padding: commonListViewBottmomPadding,
|
||||
itemCount: availableClients.length,
|
||||
itemBuilder: (context, index) {
|
||||
final client = availableClients[index];
|
||||
final _clientInModel = clients[client];
|
||||
final isSelected = userChosenClients.contains(_clientInModel);
|
||||
final borderRadius = getItemBorderRadius(
|
||||
index,
|
||||
availableClients.length,
|
||||
);
|
||||
|
||||
return BottomSheetBar(
|
||||
client,
|
||||
() {
|
||||
setState(() {
|
||||
if (isSelected) {
|
||||
clientsSetting.value.remove(client);
|
||||
userChosenClients.remove(_clientInModel);
|
||||
} else {
|
||||
if (_clientInModel != null) {
|
||||
clientsSetting.value.add(client);
|
||||
userChosenClients.add(_clientInModel);
|
||||
}
|
||||
}
|
||||
});
|
||||
addOrUpdateData('settings', 'clients', clientsSetting.value);
|
||||
},
|
||||
isSelected ? activatedColor : inactivatedColor,
|
||||
borderRadius: borderRadius,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showLanguagePicker(
|
||||
BuildContext context,
|
||||
Color activatedColor,
|
||||
|
@ -62,6 +62,10 @@ final audioQualitySetting = ValueNotifier<String>(
|
||||
Hive.box('settings').get('audioQuality', defaultValue: 'high'),
|
||||
);
|
||||
|
||||
final clientsSetting = ValueNotifier<List>(
|
||||
Hive.box('settings').get('clients', defaultValue: []),
|
||||
);
|
||||
|
||||
Locale languageSetting = getLocaleFromLanguageCode(
|
||||
Hive.box('settings').get('language', defaultValue: 'English') as String,
|
||||
);
|
||||
|
Reference in New Issue
Block a user