mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-04 15:16:58 +02:00
Replace the Go backend with the Rust workspace and route Android/iOS through UniFFI bindings. Include the migrated extension runtime, network, providers, media metadata, downloads and library operations, with version 5.0.0+147. Remove Go sources, adapters, native build selection and CI dependencies. Build Rust unconditionally and lock the iOS Rust pod using a relative path. Retain legacy source and migration evidence in a local ignored archive. Validation: Android Kotlin compile and 53 native tests; Swift Rust-branch equivalence and syntax; CocoaPods install; workflow, shell, Ruby, plist and diff checks. Reuse the preceding 100 Rust tests, fmt/Clippy and five-ABI build checkpoint; no new APK or iOS application build for this cleanup. Known follow-up: URL/URLSearchParams globals are missing from the Rust JS runtime. A controlled extension replay confirms a URL-resolution regression; this commit does not fix that runtime gap.
65 lines
1.7 KiB
Rust
65 lines
1.7 KiB
Rust
use spotiflac_extensions::logging::{LogBuffer as CoreLogBuffer, LogClosed};
|
|
use std::sync::Arc;
|
|
|
|
#[derive(Debug, thiserror::Error, uniffi::Error)]
|
|
#[uniffi(flat_error)]
|
|
pub enum LogError {
|
|
#[error("log buffer closed")]
|
|
Closed,
|
|
}
|
|
|
|
impl From<LogClosed> for LogError {
|
|
fn from(_: LogClosed) -> Self {
|
|
Self::Closed
|
|
}
|
|
}
|
|
|
|
#[derive(uniffi::Object)]
|
|
pub struct LogBuffer {
|
|
pub(crate) inner: Arc<CoreLogBuffer>,
|
|
}
|
|
|
|
#[uniffi::export]
|
|
impl LogBuffer {
|
|
#[uniffi::constructor]
|
|
pub fn new() -> Self {
|
|
Self {
|
|
inner: Arc::new(CoreLogBuffer::default()),
|
|
}
|
|
}
|
|
|
|
pub fn set_enabled(&self, enabled: bool) -> Result<(), LogError> {
|
|
self.inner.set_enabled(enabled).map_err(Into::into)
|
|
}
|
|
pub fn is_enabled(&self) -> Result<bool, LogError> {
|
|
self.inner.is_enabled().map_err(Into::into)
|
|
}
|
|
pub fn add(&self, level: String, tag: String, message: String) -> Result<(), LogError> {
|
|
self.inner.add(&level, &tag, &message).map_err(Into::into)
|
|
}
|
|
pub fn backend(&self, message: String) -> Result<(), LogError> {
|
|
self.inner.backend(&message).map_err(Into::into)
|
|
}
|
|
pub fn all(&self) -> Result<String, LogError> {
|
|
self.inner.all().map_err(Into::into)
|
|
}
|
|
pub fn since(&self, index: i64) -> Result<String, LogError> {
|
|
self.inner.since(index).map_err(Into::into)
|
|
}
|
|
pub fn clear(&self) -> Result<(), LogError> {
|
|
self.inner.clear().map_err(Into::into)
|
|
}
|
|
pub fn count(&self) -> Result<u64, LogError> {
|
|
self.inner.count().map_err(Into::into)
|
|
}
|
|
pub fn shutdown(&self) {
|
|
self.inner.shutdown();
|
|
}
|
|
}
|
|
|
|
impl Default for LogBuffer {
|
|
fn default() -> Self {
|
|
Self::new()
|
|
}
|
|
}
|