mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-06 04:37:59 +02:00
fix: improve share intent handling for YouTube Music links
- Check both path and message fields for shared URLs - Wait for extensions to initialize before handling shared URLs - Add retry logic (3 attempts) for extension URL handlers with empty data - Show error message if metadata fails to load after retries
This commit is contained in:
@@ -65,16 +65,22 @@ class ShareIntentService {
|
||||
|
||||
void _handleSharedMedia(List<SharedMediaFile> files, {bool isInitial = false}) {
|
||||
for (final file in files) {
|
||||
final textToCheck = file.path;
|
||||
// Check both path and message - apps may share URL in either field
|
||||
final textsToCheck = [
|
||||
file.path,
|
||||
if (file.message != null) file.message!,
|
||||
];
|
||||
|
||||
final url = _extractMusicUrl(textToCheck);
|
||||
if (url != null) {
|
||||
_log.i('Received music URL: $url (initial: $isInitial)');
|
||||
if (isInitial) {
|
||||
_pendingUrl = url;
|
||||
for (final textToCheck in textsToCheck) {
|
||||
final url = _extractMusicUrl(textToCheck);
|
||||
if (url != null) {
|
||||
_log.i('Received music URL: $url (initial: $isInitial)');
|
||||
if (isInitial) {
|
||||
_pendingUrl = url;
|
||||
}
|
||||
_sharedUrlController.add(url);
|
||||
return;
|
||||
}
|
||||
_sharedUrlController.add(url);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user