mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-29 07:18:49 +02:00
refactor!: rename extension store bridge ABI to repo across all layers
Coordinated rename of the nine store-named bridge surfaces: Go exports (InitExtensionStoreJSON -> InitExtensionRepoJSON etc.), method-channel strings, the Kotlin and Swift handlers, and the Dart PlatformBridge methods. Channel strings verified 1:1 across Dart/Kotlin/Swift; gomobile bindings match the new export names. Android MediaStore APIs untouched. store_registry_url pref key kept for existing users. Local Android/iOS builds need the gobackend AAR/xcframework rebuilt; CI does this in the release workflow.
This commit is contained in:
@@ -1450,14 +1450,14 @@ class ExtensionNotifier extends Notifier<ExtensionState> {
|
||||
|
||||
if (ext == null) {
|
||||
final cacheDir = await getTemporaryDirectory();
|
||||
await PlatformBridge.initExtensionStore(cacheDir.path);
|
||||
await PlatformBridge.initExtensionRepo(cacheDir.path);
|
||||
|
||||
final tempRoot = await getTemporaryDirectory();
|
||||
final installDir = await Directory(
|
||||
'${tempRoot.path}/spotiflac_bootstrap_spotify_web',
|
||||
).create(recursive: true);
|
||||
|
||||
final downloadPath = await PlatformBridge.downloadStoreExtension(
|
||||
final downloadPath = await PlatformBridge.downloadRepoExtension(
|
||||
_spotifyWebExtensionId,
|
||||
installDir.path,
|
||||
);
|
||||
@@ -1804,7 +1804,7 @@ class ExtensionNotifier extends Notifier<ExtensionState> {
|
||||
|
||||
String registryUrl = '';
|
||||
try {
|
||||
registryUrl = await PlatformBridge.getStoreRegistryUrl();
|
||||
registryUrl = await PlatformBridge.getRepoRegistryUrl();
|
||||
} catch (_) {}
|
||||
|
||||
List<Map<String, dynamic>> installed;
|
||||
@@ -1877,9 +1877,9 @@ class ExtensionNotifier extends Notifier<ExtensionState> {
|
||||
destDir = await Directory(
|
||||
'${tmp.path}/spotiflac_restore_ext',
|
||||
).create(recursive: true);
|
||||
await PlatformBridge.initExtensionStore(destDir.path);
|
||||
await PlatformBridge.initExtensionRepo(destDir.path);
|
||||
if (registryUrl.isNotEmpty) {
|
||||
await PlatformBridge.setStoreRegistryUrl(registryUrl);
|
||||
await PlatformBridge.setRepoRegistryUrl(registryUrl);
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setString(_storeRegistryUrlPrefKey, registryUrl);
|
||||
}
|
||||
@@ -1910,7 +1910,7 @@ class ExtensionNotifier extends Notifier<ExtensionState> {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
final path = await PlatformBridge.downloadStoreExtension(
|
||||
final path = await PlatformBridge.downloadRepoExtension(
|
||||
id,
|
||||
destDir.path,
|
||||
);
|
||||
|
||||
@@ -239,10 +239,10 @@ class RepoNotifier extends Notifier<RepoState> {
|
||||
);
|
||||
|
||||
try {
|
||||
await PlatformBridge.initExtensionStore(cacheDir);
|
||||
await PlatformBridge.initExtensionRepo(cacheDir);
|
||||
|
||||
if (savedUrl.isNotEmpty) {
|
||||
await PlatformBridge.setStoreRegistryUrl(savedUrl);
|
||||
await PlatformBridge.setRepoRegistryUrl(savedUrl);
|
||||
await refresh();
|
||||
}
|
||||
|
||||
@@ -267,13 +267,13 @@ class RepoNotifier extends Notifier<RepoState> {
|
||||
|
||||
final previousUrl = state.registryUrl;
|
||||
try {
|
||||
await PlatformBridge.setStoreRegistryUrl(trimmed);
|
||||
await PlatformBridge.setRepoRegistryUrl(trimmed);
|
||||
|
||||
final resolvedUrl = await PlatformBridge.getStoreRegistryUrl();
|
||||
final resolvedUrl = await PlatformBridge.getRepoRegistryUrl();
|
||||
|
||||
// Validate the registry actually loads before persisting the URL, so a
|
||||
// broken link never survives an app restart (or a backup restore).
|
||||
final extensions = await PlatformBridge.getStoreExtensions(
|
||||
final extensions = await PlatformBridge.getRepoExtensions(
|
||||
forceRefresh: true,
|
||||
);
|
||||
|
||||
@@ -291,9 +291,9 @@ class RepoNotifier extends Notifier<RepoState> {
|
||||
_log.e('Failed to set registry URL: $e');
|
||||
try {
|
||||
if (previousUrl.isNotEmpty) {
|
||||
await PlatformBridge.setStoreRegistryUrl(previousUrl);
|
||||
await PlatformBridge.setRepoRegistryUrl(previousUrl);
|
||||
} else {
|
||||
await PlatformBridge.clearStoreRegistryUrl();
|
||||
await PlatformBridge.clearRepoRegistryUrl();
|
||||
}
|
||||
} catch (restoreError) {
|
||||
_log.w('Failed to restore previous registry URL: $restoreError');
|
||||
@@ -307,7 +307,7 @@ class RepoNotifier extends Notifier<RepoState> {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.remove(_registryUrlPrefKey);
|
||||
|
||||
await PlatformBridge.clearStoreRegistryUrl();
|
||||
await PlatformBridge.clearRepoRegistryUrl();
|
||||
|
||||
state = state.copyWith(
|
||||
registryUrl: '',
|
||||
@@ -328,7 +328,7 @@ class RepoNotifier extends Notifier<RepoState> {
|
||||
state = state.copyWith(isLoading: true, clearError: true);
|
||||
|
||||
try {
|
||||
final extensions = await PlatformBridge.getStoreExtensions(
|
||||
final extensions = await PlatformBridge.getRepoExtensions(
|
||||
forceRefresh: forceRefresh,
|
||||
);
|
||||
state = state.copyWith(
|
||||
@@ -381,7 +381,7 @@ class RepoNotifier extends Notifier<RepoState> {
|
||||
|
||||
try {
|
||||
_log.i('Downloading extension: $extensionId');
|
||||
final downloadPath = await PlatformBridge.downloadStoreExtension(
|
||||
final downloadPath = await PlatformBridge.downloadRepoExtension(
|
||||
extensionId,
|
||||
tempDir,
|
||||
);
|
||||
@@ -426,7 +426,7 @@ class RepoNotifier extends Notifier<RepoState> {
|
||||
|
||||
try {
|
||||
_log.i('Downloading update for: $extensionId');
|
||||
final downloadPath = await PlatformBridge.downloadStoreExtension(
|
||||
final downloadPath = await PlatformBridge.downloadRepoExtension(
|
||||
extensionId,
|
||||
tempDir,
|
||||
);
|
||||
|
||||
@@ -2103,71 +2103,71 @@ class PlatformBridge {
|
||||
return _decodeMapListResult(result, 'getPostProcessingProviders');
|
||||
}
|
||||
|
||||
static Future<void> initExtensionStore(String cacheDir) async {
|
||||
_log.d('initExtensionStore: $cacheDir');
|
||||
await _channel.invokeMethod('initExtensionStore', {'cache_dir': cacheDir});
|
||||
static Future<void> initExtensionRepo(String cacheDir) async {
|
||||
_log.d('initExtensionRepo: $cacheDir');
|
||||
await _channel.invokeMethod('initExtensionRepo', {'cache_dir': cacheDir});
|
||||
}
|
||||
|
||||
static Future<void> setStoreRegistryUrl(String registryUrl) async {
|
||||
_log.d('setStoreRegistryUrl: $registryUrl');
|
||||
await _channel.invokeMethod('setStoreRegistryUrl', {
|
||||
static Future<void> setRepoRegistryUrl(String registryUrl) async {
|
||||
_log.d('setRepoRegistryUrl: $registryUrl');
|
||||
await _channel.invokeMethod('setRepoRegistryUrl', {
|
||||
'registry_url': registryUrl,
|
||||
});
|
||||
}
|
||||
|
||||
static Future<String> getStoreRegistryUrl() async {
|
||||
_log.d('getStoreRegistryUrl');
|
||||
final result = await _channel.invokeMethod('getStoreRegistryUrl');
|
||||
static Future<String> getRepoRegistryUrl() async {
|
||||
_log.d('getRepoRegistryUrl');
|
||||
final result = await _channel.invokeMethod('getRepoRegistryUrl');
|
||||
return result as String? ?? '';
|
||||
}
|
||||
|
||||
static Future<void> clearStoreRegistryUrl() async {
|
||||
_log.d('clearStoreRegistryUrl');
|
||||
await _channel.invokeMethod('clearStoreRegistryUrl');
|
||||
static Future<void> clearRepoRegistryUrl() async {
|
||||
_log.d('clearRepoRegistryUrl');
|
||||
await _channel.invokeMethod('clearRepoRegistryUrl');
|
||||
}
|
||||
|
||||
static Future<List<Map<String, dynamic>>> getStoreExtensions({
|
||||
static Future<List<Map<String, dynamic>>> getRepoExtensions({
|
||||
bool forceRefresh = false,
|
||||
}) async {
|
||||
_log.d('getStoreExtensions (forceRefresh: $forceRefresh)');
|
||||
final result = await _channel.invokeMethod('getStoreExtensions', {
|
||||
_log.d('getRepoExtensions (forceRefresh: $forceRefresh)');
|
||||
final result = await _channel.invokeMethod('getRepoExtensions', {
|
||||
'force_refresh': forceRefresh,
|
||||
});
|
||||
return _decodeMapListResult(result, 'getStoreExtensions');
|
||||
return _decodeMapListResult(result, 'getRepoExtensions');
|
||||
}
|
||||
|
||||
static Future<List<Map<String, dynamic>>> searchStoreExtensions(
|
||||
static Future<List<Map<String, dynamic>>> searchRepoExtensions(
|
||||
String query, {
|
||||
String? category,
|
||||
}) async {
|
||||
_log.d('searchStoreExtensions: "$query" (category: $category)');
|
||||
final result = await _channel.invokeMethod('searchStoreExtensions', {
|
||||
_log.d('searchRepoExtensions: "$query" (category: $category)');
|
||||
final result = await _channel.invokeMethod('searchRepoExtensions', {
|
||||
'query': query,
|
||||
'category': category ?? '',
|
||||
});
|
||||
return _decodeMapListResult(result, 'searchStoreExtensions');
|
||||
return _decodeMapListResult(result, 'searchRepoExtensions');
|
||||
}
|
||||
|
||||
static Future<List<String>> getStoreCategories() async {
|
||||
final result = await _channel.invokeMethod('getStoreCategories');
|
||||
return _decodeStringListResult(result, 'getStoreCategories');
|
||||
static Future<List<String>> getRepoCategories() async {
|
||||
final result = await _channel.invokeMethod('getRepoCategories');
|
||||
return _decodeStringListResult(result, 'getRepoCategories');
|
||||
}
|
||||
|
||||
static Future<String> downloadStoreExtension(
|
||||
static Future<String> downloadRepoExtension(
|
||||
String extensionId,
|
||||
String destDir,
|
||||
) async {
|
||||
_log.i('downloadStoreExtension: $extensionId to $destDir');
|
||||
final result = await _channel.invokeMethod('downloadStoreExtension', {
|
||||
_log.i('downloadRepoExtension: $extensionId to $destDir');
|
||||
final result = await _channel.invokeMethod('downloadRepoExtension', {
|
||||
'extension_id': extensionId,
|
||||
'dest_dir': destDir,
|
||||
});
|
||||
return result as String;
|
||||
}
|
||||
|
||||
static Future<void> clearStoreCache() async {
|
||||
_log.d('clearStoreCache');
|
||||
await _channel.invokeMethod('clearStoreCache');
|
||||
static Future<void> clearRepoCache() async {
|
||||
_log.d('clearRepoCache');
|
||||
await _channel.invokeMethod('clearRepoCache');
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> parseCueSheet(
|
||||
|
||||
Reference in New Issue
Block a user