Compare commits

..

2 Commits

Author SHA1 Message Date
Santo Shakil 70c594dbeb fix(mobile): share the decode pool across flutter engines 2026-07-06 19:04:14 +06:00
Santo Shakil d734b354af fix(mobile): fix 10-bit heic and avif colors on android 2026-07-06 18:36:25 +06:00
36 changed files with 254 additions and 659 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
[
{
"label": "v3.0.1",
"url": "https://docs.v3.0.1.archive.immich.app"
"label": "v3.0.0",
"url": "https://docs.v3.0.0.archive.immich.app"
},
{
"label": "v2.7.5",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "immich-e2e",
"version": "3.0.1",
"version": "3.0.0",
"description": "",
"main": "index.js",
"type": "module",
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "immich-ml"
version = "3.0.1"
version = "3.0.0"
description = ""
authors = [{ name = "Hau Tran", email = "alex.tran1502@gmail.com" }]
requires-python = ">=3.11,<4.0"
+1 -1
View File
@@ -974,7 +974,7 @@ wheels = [
[[package]]
name = "immich-ml"
version = "3.0.1"
version = "3.0.0"
source = { editable = "." }
dependencies = [
{ name = "aiocache" },
@@ -107,3 +107,71 @@ Java_app_alextran_immich_NativeImage_rotate(
}
return (jlong) dst;
}
// Convert an RGBA_1010102 buffer to densely-packed RGBA_8888, matching Skia's
// Bitmap.copy(ARGB_8888) byte-for-byte so it's a drop-in for the intermediate 8888 bitmap.
// Each source pixel is a native (little-endian on every Android ABI) u32 with R in bits 0-9,
// G in 10-19, B in 20-29, A in 30-31 (standard RGB10_A2). Each 10-bit channel maps to 8-bit via
// round(v*255/1023) through a small L1-resident LUT; the 2-bit alpha maps a*85. Output is R,G,B,A
// bytes per pixel, i.e. Android ARGB_8888 memory == Dart PixelFormat.rgba8888.
static void convert_1010102(const uint8_t *src, int srcStride, uint32_t *dst, int w, int h) {
uint8_t scale[1024];
for (int v = 0; v < 1024; v++) {
scale[v] = (uint8_t) ((v * 255 + 511) / 1023);
}
static const uint8_t alpha[4] = {0, 85, 170, 255};
for (int y = 0; y < h; y++) {
const uint32_t *srcRow = (const uint32_t *) (src + (size_t) y * srcStride);
uint32_t *dstRow = dst + (size_t) y * w;
for (int x = 0; x < w; x++) {
uint32_t px = srcRow[x];
uint32_t r = scale[px & 0x3FF];
uint32_t g = scale[(px >> 10) & 0x3FF];
uint32_t b = scale[(px >> 20) & 0x3FF];
uint32_t a = alpha[(px >> 30) & 0x3];
dstRow[x] = r | (g << 8) | (b << 16) | (a << 24);
}
}
}
// Converts an RGBA_1010102 bitmap (what a 10-bit HEIC/AVIF decodes to on API 33+) into a freshly
// malloc'd RGBA_8888 buffer. Fills outInfo with {width, height, rowBytes} and returns the buffer
// address, or 0 (so the caller falls back to a Skia copy) if the bitmap isn't 1010102 or can't be
// locked. Same ownership contract as rotate: free the returned buffer via NativeBuffer.free.
JNIEXPORT jlong JNICALL
Java_app_alextran_immich_NativeImage_convert1010102(
JNIEnv *env, jclass clazz, jobject bitmap, jintArray outInfo) {
AndroidBitmapInfo info;
if (AndroidBitmap_getInfo(env, bitmap, &info) != ANDROID_BITMAP_RESULT_SUCCESS) {
return 0;
}
if (info.format != ANDROID_BITMAP_FORMAT_RGBA_1010102) {
return 0;
}
int w = (int) info.width;
int h = (int) info.height;
uint32_t *dst = (uint32_t *) malloc((size_t) w * h * 4);
if (dst == NULL) {
return 0;
}
void *srcPixels = NULL;
if (AndroidBitmap_lockPixels(env, bitmap, &srcPixels) != ANDROID_BITMAP_RESULT_SUCCESS) {
free(dst);
return 0;
}
convert_1010102((const uint8_t *) srcPixels, (int) info.stride, dst, w, h);
AndroidBitmap_unlockPixels(env, bitmap);
jint dims[3] = {w, h, w * 4};
(*env)->SetIntArrayRegion(env, outInfo, 0, 3, dims);
if ((*env)->ExceptionCheck(env)) {
free(dst);
return 0;
}
return (jlong) dst;
}
@@ -16,4 +16,14 @@ object NativeImage {
*/
@JvmStatic
external fun rotate(bitmap: Bitmap, orientation: Int, outInfo: IntArray): Long
/**
* Converts an RGBA_1010102 [bitmap] (what a 10-bit HEIC/AVIF decodes to on API 33+) to RGBA_8888,
* writing the result into a freshly malloc'd native buffer in one pass, with no intermediate
* ARGB_8888 bitmap. Returns the buffer address (free it with [NativeBuffer.free]) and fills
* [outInfo] with {width, height, rowBytes}. Returns 0 when the bitmap isn't RGBA_1010102 so the
* caller can fall back to a Skia copy.
*/
@JvmStatic
external fun convert1010102(bitmap: Bitmap, outInfo: IntArray): Long
}
@@ -46,22 +46,47 @@ inline fun ImageDecoder.Source.decodeBitmap(target: Size = Size(0, 0)): Bitmap {
}
fun Bitmap.toNativeBuffer(): Map<String, Long> {
val size = width * height * 4
// Dart reads the buffer as rgba8888, but 10-bit sources decode to RGBA_1010102, which garbles
// colors when copied verbatim. Convert those straight into the output buffer in native code -
// one pass, no intermediate ARGB_8888 bitmap.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && config == Bitmap.Config.RGBA_1010102) {
val info = IntArray(3)
val pointer = NativeImage.convert1010102(this, info)
if (pointer != 0L) {
recycle()
return mapOf(
"pointer" to pointer,
"width" to info[0].toLong(),
"height" to info[1].toLong(),
"rowBytes" to info[2].toLong()
)
}
// native convert declined (OOM/lock) -> fall through to the Skia copy path below.
}
// Other non-8888 configs (e.g. HDR F16) still need Skia's convert; 8-bit is copied as-is.
val bitmap = if (config != Bitmap.Config.ARGB_8888) {
val converted = copy(Bitmap.Config.ARGB_8888, false)
recycle()
converted ?: throw IOException("could not convert bitmap to ARGB_8888")
} else {
this
}
val size = bitmap.width * bitmap.height * 4
val pointer = NativeBuffer.allocate(size)
try {
val buffer = NativeBuffer.wrap(pointer, size)
copyPixelsToBuffer(buffer)
bitmap.copyPixelsToBuffer(buffer)
return mapOf(
"pointer" to pointer,
"width" to width.toLong(),
"height" to height.toLong(),
"rowBytes" to (width * 4).toLong()
"width" to bitmap.width.toLong(),
"height" to bitmap.height.toLong(),
"rowBytes" to (bitmap.width * 4).toLong()
)
} catch (e: Exception) {
} catch (e: Throwable) {
NativeBuffer.free(pointer)
throw e
} finally {
recycle()
bitmap.recycle()
}
}
@@ -1,6 +1,8 @@
package app.alextran.immich.images
import android.content.Context
import android.graphics.ImageDecoder
import android.os.Build
import android.os.CancellationSignal
import android.os.OperationCanceledException
import app.alextran.immich.INITIAL_BUFFER_SIZE
@@ -22,6 +24,7 @@ import java.io.File
import java.io.IOException
import java.nio.ByteBuffer
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.Executors
private const val MAX_PREALLOC_BYTES = 128 * 1024 * 1024
@@ -36,12 +39,16 @@ class RemoteImagesImpl(context: Context) : RemoteImageApi {
companion object {
val CANCELLED = Result.success<Map<String, Long>?>(null)
// Shared, process-lifetime pool: RemoteImagesImpl is re-created per FlutterEngine, so a
// per-instance pool would leak threads across engine restarts.
private val decodeExecutor = Executors.newFixedThreadPool(2)
}
override fun requestImage(
url: String,
requestId: Long,
@Suppress("UNUSED_PARAMETER") preferEncoded: Boolean, // always returns encoded; setting has no effect on Android
preferEncoded: Boolean,
callback: (Result<Map<String, Long>?>) -> Unit
) {
val signal = CancellationSignal()
@@ -51,12 +58,51 @@ class RemoteImagesImpl(context: Context) : RemoteImageApi {
url,
signal,
onSuccess = { buffer ->
requestMap.remove(requestId)
if (signal.isCanceled) {
NativeBuffer.free(buffer.pointer)
requestMap.remove(requestId)
buffer.free()
return@fetch callback(CANCELLED)
}
// Decode natively when the caller wants pixels: Flutter's fallback decoder copies
// 10-bit bitmaps (RGBA_1010102) as if they were rgba8888, garbling colors. Decode on a
// dedicated pool - the fetch callback threads are shared with video streaming. On any
// decode failure (including OOM on huge originals), hand Flutter the encoded bytes as
// before.
if (!preferEncoded && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
decodeExecutor.execute {
val res = if (signal.isCanceled) null else try {
val source = ImageDecoder.createSource(NativeBuffer.wrap(buffer.pointer, buffer.offset))
source.decodeBitmap().toNativeBuffer()
} catch (_: Throwable) {
null
}
requestMap.remove(requestId)
when {
// Deliver even if the request was cancelled meanwhile: re-checking here would orphan
// res's malloc, and Dart frees the buffer itself when it sees the cancel.
res != null -> {
buffer.free()
callback(Result.success(res))
}
signal.isCanceled -> {
buffer.free()
callback(CANCELLED)
}
else -> callback(
Result.success(
mapOf(
"pointer" to buffer.pointer,
"length" to buffer.offset.toLong()
)
)
)
}
}
return@fetch
}
requestMap.remove(requestId)
callback(
Result.success(
mapOf(
+4 -4
View File
@@ -22,8 +22,8 @@ platform :android do
task: 'bundle',
build_type: 'Release',
properties: {
"android.injected.version.code" => 3054,
"android.injected.version.name" => "3.0.1",
"android.injected.version.code" => 3053,
"android.injected.version.name" => "3.0.0",
}
)
upload_to_play_store(skip_upload_apk: true, skip_upload_images: true, skip_upload_screenshots: true, aab: '../build/app/outputs/bundle/release/app-release.aab', track: 'beta')
@@ -35,8 +35,8 @@ platform :android do
task: 'bundle',
build_type: 'Release',
properties: {
"android.injected.version.code" => 3054,
"android.injected.version.name" => "3.0.1",
"android.injected.version.code" => 3053,
"android.injected.version.name" => "3.0.0",
}
)
upload_to_play_store(skip_upload_apk: true, skip_upload_images: true, skip_upload_screenshots: true, aab: '../build/app/outputs/bundle/release/app-release.aab')
+1 -1
View File
@@ -78,7 +78,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.0.1</string>
<string>3.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
-2
View File
@@ -15,8 +15,6 @@ enum ActionSource { timeline, viewer }
enum ShareAssetType { original, preview }
enum ButtonPosition { bottomBar, kebabMenu }
enum CleanupStep { selectDate, scan, delete }
enum AssetKeepType { none, photosOnly, videosOnly }
@@ -25,7 +25,6 @@ enum SyncMigrationTask {
v20260128_CopyExifWidthHeightToAsset, // Asset table has incorrect width and height for video ratio calculations.
v20260128_ResetAssetV1, // Asset v2.5.0 has width and height information that were edited assets.
v20260597_ResetAssetV1AssetV2, // Assets didn't include the uploadedAt column.
v20260701_ResetAlbumsV1, // Album user migration dropped the owner. Sync fresh albums from the server to re-populate them.
}
class SyncStreamService {
@@ -104,12 +103,6 @@ class SyncStreamService {
}
Future<void> _runPreSyncTasks(List<String> migrations, SemVer semVer) async {
if (!migrations.contains(SyncMigrationTask.v20260701_ResetAlbumsV1.name)) {
_logger.info("Running pre-sync task: v20260701_ResetAlbumsV1");
await _syncApiRepository.deleteSyncAck([SyncEntityType.albumV1]);
migrations.add(SyncMigrationTask.v20260701_ResetAlbumsV1.name);
}
if (!migrations.contains(SyncMigrationTask.v20260128_ResetExifV1.name)) {
_logger.info("Running pre-sync task: v20260128_ResetExifV1");
await _syncApiRepository.deleteSyncAck([
@@ -12,7 +12,7 @@ class RemoteImageRequest extends ImageRequest {
}
final info = await remoteImageApi.requestImage(uri, requestId: requestId, preferEncoded: false);
// Android always returns encoded data, so we need to check for both shapes of the response.
// Android falls back to encoded data if native decoding fails, so check for both shapes of the response.
final frame = switch (info) {
{'pointer': int pointer, 'length': int length} => await _fromEncodedPlatformImage(pointer, length),
{'pointer': int pointer, 'width': int width, 'height': int height, 'rowBytes': int rowBytes} =>
@@ -15,10 +15,7 @@ import 'package:immich_mobile/providers/infrastructure/asset.provider.dart';
import 'package:immich_mobile/routing/router.dart';
class EditImageActionButton extends ConsumerWidget {
final bool iconOnly;
final bool menuItem;
const EditImageActionButton({super.key, this.iconOnly = false, this.menuItem = false});
const EditImageActionButton({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -57,8 +54,6 @@ class EditImageActionButton extends ConsumerWidget {
iconData: Icons.tune,
label: "edit".t(context: context),
onPressed: onPress,
iconOnly: iconOnly,
menuItem: menuItem,
);
}
}
@@ -1,36 +0,0 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
import 'package:immich_mobile/extensions/translate_extensions.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/base_action_button.widget.dart';
import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
import 'package:immich_mobile/providers/infrastructure/current_album.provider.dart';
import 'package:immich_mobile/routing/router.dart';
class OpenActivityActionButton extends ConsumerWidget {
const OpenActivityActionButton({super.key, this.iconOnly = false, this.menuItem = false});
final bool iconOnly;
final bool menuItem;
void _onTap(BuildContext context, WidgetRef ref) {
final album = ref.read(currentRemoteAlbumProvider);
final asset = ref.read(assetViewerProvider).currentAsset;
if (album == null || asset == null) {
return;
}
context.router.push(
DriftActivitiesRoute(album: album, assetId: asset is RemoteAsset ? asset.id : null, assetName: asset.name),
);
}
@override
Widget build(BuildContext context, WidgetRef ref) => BaseActionButton(
iconData: Icons.chat_outlined,
label: "activity".t(context: context),
onPressed: () => _onTap(context, ref),
iconOnly: iconOnly,
menuItem: menuItem,
);
}
@@ -2,18 +2,24 @@ import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/constants/enums.dart';
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
import 'package:immich_mobile/domain/models/setting.model.dart';
import 'package:immich_mobile/domain/services/timeline.service.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/add_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/delete_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/delete_local_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/delete_permanent_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/edit_image_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/restore_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/share_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/upload_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/asset_viewer/ocr_toggle_button.widget.dart';
import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
import 'package:immich_mobile/providers/infrastructure/current_album.provider.dart';
import 'package:immich_mobile/providers/infrastructure/readonly_mode.provider.dart';
import 'package:immich_mobile/providers/infrastructure/setting.provider.dart';
import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';
import 'package:immich_mobile/providers/routes.provider.dart';
import 'package:immich_mobile/providers/server_info.provider.dart';
import 'package:immich_mobile/providers/user.provider.dart';
import 'package:immich_mobile/utils/action_button.utils.dart';
import 'package:immich_mobile/utils/semver.dart';
import 'package:immich_mobile/widgets/asset_viewer/video_controls.dart';
class ViewerBottomBar extends ConsumerWidget {
@@ -31,31 +37,35 @@ class ViewerBottomBar extends ConsumerWidget {
final isOwner = asset is RemoteAsset && asset.ownerId == user?.id;
final showingDetails = ref.watch(assetViewerProvider.select((s) => s.showingDetails));
final isInLockedView = ref.watch(inLockedViewProvider);
final album = ref.watch(currentRemoteAlbumProvider);
final isArchived = asset is RemoteAsset && asset.visibility == AssetVisibility.archive;
final advancedTroubleshooting = ref.watch(settingsProvider.notifier).get(Setting.advancedTroubleshooting);
final timelineOrigin = ref.read(timelineServiceProvider).origin;
final isTrashEnabled = ref.watch(serverInfoProvider.select((state) => state.serverFeatures.trash));
final serverVersion = ref.watch(serverInfoProvider.select((state) => state.serverVersion));
final serverInfo = ref.watch(serverInfoProvider);
final isInTrash = ref.read(timelineServiceProvider).origin == TimelineOrigin.trash;
final originalTheme = context.themeData;
final buttonContext = ActionButtonContext(
asset: asset,
isOwner: isOwner,
isArchived: isArchived,
isTrashEnabled: isTrashEnabled,
isStacked: asset is RemoteAsset && asset.stackId != null,
isInLockedView: isInLockedView,
currentAlbum: album,
advancedTroubleshooting: advancedTroubleshooting,
source: ActionSource.viewer,
timelineOrigin: timelineOrigin,
originalTheme: originalTheme,
serverVersion: serverVersion,
);
final actions = <Widget>[
if (isInTrash && isOwner && asset.hasRemote)
const RestoreActionButton(source: ActionSource.viewer)
else
const ShareActionButton(source: ActionSource.viewer),
final actions = ActionButtonBuilder.buildViewerBottomBar(buttonContext, context);
if (!isInLockedView) ...[
if (!isInTrash) ...[
if (asset.isLocalOnly) const UploadActionButton(source: ActionSource.viewer),
// edit sync was added in 2.6.0
if (asset.isEditable && serverInfo.serverVersion >= const SemVer(major: 2, minor: 6, patch: 0))
const EditImageActionButton(),
if (asset.hasRemote) AddActionButton(originalTheme: originalTheme),
],
if (isOwner) ...[
if (asset.isLocalOnly)
const DeleteLocalActionButton(source: ActionSource.viewer)
else if (asset.isTrashed)
const DeletePermanentActionButton(source: ActionSource.viewer, useShortLabel: true)
else
const DeleteActionButton(source: ActionSource.viewer, showConfirmation: true),
],
],
];
return AnimatedSwitcher(
duration: Durations.short4,
@@ -31,7 +31,6 @@ class ViewerKebabMenu extends ConsumerWidget {
final isCasting = ref.watch(castProvider.select((c) => c.isCasting));
final timelineOrigin = ref.read(timelineServiceProvider).origin;
final isTrashEnable = ref.watch(serverInfoProvider.select((state) => state.serverFeatures.trash));
final serverVersion = ref.watch(serverInfoProvider.select((state) => state.serverVersion));
final isInLockedView = ref.watch(inLockedViewProvider);
final currentAlbum = ref.watch(currentRemoteAlbumProvider);
final isArchived = asset is RemoteAsset && asset.visibility == AssetVisibility.archive;
@@ -49,7 +48,6 @@ class ViewerKebabMenu extends ConsumerWidget {
source: ActionSource.viewer,
isCasting: isCasting,
timelineOrigin: timelineOrigin,
serverVersion: serverVersion,
);
final menuChildren = ActionButtonBuilder.buildViewerKebabMenu(actionContext, context);
@@ -14,6 +14,7 @@ import 'package:immich_mobile/providers/infrastructure/asset_viewer/asset.provid
import 'package:immich_mobile/providers/infrastructure/current_album.provider.dart';
import 'package:immich_mobile/providers/infrastructure/readonly_mode.provider.dart';
import 'package:immich_mobile/providers/routes.provider.dart';
import 'package:immich_mobile/routing/router.dart';
import 'package:immich_mobile/utils/timezone.dart';
import 'package:immich_ui/immich_ui.dart';
@@ -46,6 +47,20 @@ class ViewerTopAppBar extends ConsumerWidget implements PreferredSizeWidget {
final actions = <Widget>[
if (asset.isMotionPhoto) const MotionPhotoActionButton(iconOnly: true),
if (album != null && album.isActivityEnabled && album.isShared)
IconButton(
icon: const Icon(Icons.chat_outlined),
onPressed: () {
context.router.push(
DriftActivitiesRoute(
album: album,
assetId: asset is RemoteAsset ? asset.id : null,
assetName: asset.name,
),
);
},
),
ActionIconButtonWidget(action: FavoriteAction(assets: assetForAction)),
ViewerKebabMenu(originalTheme: originalTheme),
+17 -87
View File
@@ -9,7 +9,6 @@ import 'package:immich_mobile/domain/services/timeline.service.dart';
import 'package:immich_mobile/domain/utils/event_stream.dart';
import 'package:immich_mobile/presentation/actions/action.widget.dart';
import 'package:immich_mobile/presentation/actions/asset_debug.action.dart';
import 'package:immich_mobile/utils/semver.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/archive_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/base_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/cast_action_button.widget.dart';
@@ -17,11 +16,8 @@ import 'package:immich_mobile/presentation/widgets/action_buttons/delete_action_
import 'package:immich_mobile/presentation/widgets/action_buttons/delete_local_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/delete_permanent_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/download_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/add_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/edit_image_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/like_activity_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/move_to_lock_folder_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/open_activity_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/open_in_browser_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/remove_from_album_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/remove_from_lock_folder_action_button.widget.dart';
@@ -51,8 +47,6 @@ class ActionButtonContext {
final bool isCasting;
final TimelineOrigin timelineOrigin;
final int selectedCount;
final ThemeData? originalTheme;
final SemVer serverVersion;
const ActionButtonContext({
required this.asset,
@@ -67,17 +61,13 @@ class ActionButtonContext {
this.isCasting = false,
this.timelineOrigin = TimelineOrigin.main,
this.selectedCount = 1,
this.originalTheme,
this.serverVersion = const SemVer(major: 0, minor: 0, patch: 0),
});
}
enum ActionButtonType {
openInfo,
openActivity,
likeActivity,
share,
editImage,
shareLink,
cast,
setAlbumCover,
@@ -99,16 +89,8 @@ enum ActionButtonType {
deleteLocal,
deletePermanent,
delete,
addTo,
advancedInfo;
bool _isInActivityAlbum(ActionButtonContext context) {
return !context.isInLockedView &&
context.currentAlbum != null &&
context.currentAlbum!.isActivityEnabled &&
context.currentAlbum!.isShared;
}
bool shouldShow(ActionButtonContext context) {
return switch (this) {
ActionButtonType.advancedInfo => context.advancedTroubleshooting,
@@ -177,7 +159,11 @@ enum ActionButtonType {
!context.isInLockedView && //
context.isStacked,
ActionButtonType.openInBrowser => context.asset.hasRemote && !context.isInLockedView,
ActionButtonType.likeActivity => _isInActivityAlbum(context),
ActionButtonType.likeActivity =>
!context.isInLockedView &&
context.currentAlbum != null &&
context.currentAlbum!.isActivityEnabled &&
context.currentAlbum!.isShared,
ActionButtonType.similarPhotos =>
!context.isInLockedView && //
context.asset is RemoteAsset,
@@ -195,25 +181,10 @@ enum ActionButtonType {
context.timelineOrigin != TimelineOrigin.localAlbum &&
context.isOwner,
ActionButtonType.cast => context.isCasting || context.asset.hasRemote,
ActionButtonType.editImage =>
!context.isInLockedView &&
context.asset.isEditable &&
context.serverVersion >= const SemVer(major: 2, minor: 6, patch: 0),
ActionButtonType.addTo =>
!context.isInLockedView && //
context.asset.hasRemote,
ActionButtonType.openActivity => _isInActivityAlbum(context),
ActionButtonType.slideshow => true,
};
}
bool showsAt(ButtonPosition position, ActionButtonContext context) => switch (this) {
ActionButtonType.openActivity || ActionButtonType.likeActivity =>
position != ButtonPosition.bottomBar || context.timelineOrigin != TimelineOrigin.trash,
ActionButtonType.editImage => position != ButtonPosition.bottomBar || context.currentAlbum?.isShared != true,
_ => true,
};
Widget buildButton(
ActionButtonContext context, [
BuildContext? buildContext,
@@ -246,14 +217,8 @@ enum ActionButtonType {
source: context.source,
iconOnly: iconOnly,
menuItem: menuItem,
useShortLabel: false,
),
ActionButtonType.delete => DeleteActionButton(
source: context.source,
iconOnly: iconOnly,
menuItem: menuItem,
showConfirmation: true,
),
ActionButtonType.delete => DeleteActionButton(source: context.source, iconOnly: iconOnly, menuItem: menuItem),
ActionButtonType.moveToLockFolder => MoveToLockFolderActionButton(
source: context.source,
iconOnly: iconOnly,
@@ -319,9 +284,6 @@ enum ActionButtonType {
},
),
ActionButtonType.cast => CastActionButton(iconOnly: iconOnly, menuItem: menuItem),
ActionButtonType.editImage => EditImageActionButton(iconOnly: iconOnly, menuItem: menuItem),
ActionButtonType.addTo => AddActionButton(originalTheme: context.originalTheme),
ActionButtonType.openActivity => OpenActivityActionButton(iconOnly: iconOnly, menuItem: menuItem),
};
}
@@ -353,62 +315,34 @@ enum ActionButtonType {
class ActionButtonBuilder {
static const List<ActionButtonType> _actionTypes = ActionButtonType.values;
static const List<ActionButtonType> defaultViewerKebabMenuOrder = _actionTypes;
static const List<ActionButtonType> _defaultViewerBottomBarOrder = [
static const Set<ActionButtonType> defaultViewerBottomBarButtons = {
ActionButtonType.share,
ActionButtonType.moveToLockFolder,
ActionButtonType.upload,
ActionButtonType.editImage,
ActionButtonType.addTo,
ActionButtonType.openActivity,
ActionButtonType.likeActivity,
ActionButtonType.removeFromLockFolder,
ActionButtonType.delete,
ActionButtonType.archive,
ActionButtonType.unarchive,
ActionButtonType.restoreTrash,
ActionButtonType.deletePermanent,
ActionButtonType.delete,
ActionButtonType.deleteLocal,
];
};
static List<Widget> build(ActionButtonContext context) {
return _actionTypes.where((type) => type.shouldShow(context)).map((type) => type.buildButton(context)).toList();
}
static List<ActionButtonType> getViewerBottomBarTypes(ActionButtonContext context) {
return _defaultViewerBottomBarOrder
.where((type) => type.shouldShow(context) && type.showsAt(ButtonPosition.bottomBar, context))
.take(4)
.toList();
}
static List<ActionButtonType> getViewerKebabMenuTypes(ActionButtonContext context) {
final inBottomBar = getViewerBottomBarTypes(context).toSet();
return defaultViewerKebabMenuOrder
.where(
(type) =>
!inBottomBar.contains(type) &&
type.shouldShow(context) &&
type.showsAt(ButtonPosition.kebabMenu, context),
)
.toList();
}
static List<Widget> buildViewerKebabMenu(ActionButtonContext context, BuildContext buildContext) {
return getViewerKebabMenuTypes(context).toKebabMenuWidgets(context, buildContext);
}
final visibleButtons = defaultViewerKebabMenuOrder
.where((type) => !defaultViewerBottomBarButtons.contains(type) && type.shouldShow(context))
.toList();
static List<Widget> buildViewerBottomBar(ActionButtonContext context, BuildContext buildContext) {
return getViewerBottomBarTypes(context).toBottomBarWidgets(context, buildContext);
}
}
extension ActionButtonTypeListExtension on List<ActionButtonType> {
List<Widget> toKebabMenuWidgets(ActionButtonContext context, BuildContext buildContext) {
if (isEmpty) {
if (visibleButtons.isEmpty) {
return [];
}
final List<Widget> result = [];
int? lastGroup;
for (final type in this) {
for (final type in visibleButtons) {
if (lastGroup != null && type.kebabMenuGroup != lastGroup) {
result.add(const Divider(height: 1));
}
@@ -418,8 +352,4 @@ extension ActionButtonTypeListExtension on List<ActionButtonType> {
return result;
}
List<Widget> toBottomBarWidgets(ActionButtonContext context, BuildContext buildContext) {
return map((type) => type.buildButton(context, buildContext, false, false)).toList();
}
}
+1 -1
View File
@@ -3,7 +3,7 @@ Immich API
This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 3.0.1
- API version: 3.0.0
- Generator version: 7.22.0
- Build package: org.openapitools.codegen.languages.DartClientCodegen
+1 -1
View File
@@ -2,7 +2,7 @@ name: immich_mobile
description: Immich - selfhosted backup media file on mobile phone
publish_to: 'none'
version: 3.0.1+3054
version: 3.0.0+3053
environment:
sdk: '>=3.12.0 <4.0.0'
@@ -5,7 +5,6 @@ import 'package:immich_mobile/domain/models/album/album.model.dart';
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
import 'package:immich_mobile/domain/services/timeline.service.dart';
import 'package:immich_mobile/utils/action_button.utils.dart';
import 'package:immich_mobile/utils/semver.dart';
LocalAsset createLocalAsset({
String? remoteId,
@@ -1239,438 +1238,4 @@ void main() {
expect(nonArchivedWidgets, isNotEmpty);
});
});
group('ActionButtonBuilder.getViewerBottomBarTypes', () {
test('should return correct button types for shared album with activity', () {
final remoteAsset = createRemoteAsset();
final album = createRemoteAlbum(isActivityEnabled: true, isShared: true);
final context = ActionButtonContext(
asset: remoteAsset,
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: album,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
);
const expectedTypes = [
ActionButtonType.share,
ActionButtonType.addTo,
ActionButtonType.openActivity,
ActionButtonType.likeActivity,
];
final bottomBarTypes = ActionButtonBuilder.getViewerBottomBarTypes(context);
final kebabTypes = ActionButtonBuilder.getViewerKebabMenuTypes(context);
expect(bottomBarTypes, expectedTypes);
expect(bottomBarTypes.any(kebabTypes.contains), isFalse);
});
test('should return correct button types for local only asset', () {
final localAsset = createLocalAsset();
final context = ActionButtonContext(
asset: localAsset,
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: null,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
serverVersion: const SemVer(major: 2, minor: 6, patch: 0),
);
const expectedTypes = [ActionButtonType.share, ActionButtonType.upload, ActionButtonType.deleteLocal];
final bottomBarTypes = ActionButtonBuilder.getViewerBottomBarTypes(context);
final kebabTypes = ActionButtonBuilder.getViewerKebabMenuTypes(context);
expect(bottomBarTypes, expectedTypes);
expect(bottomBarTypes.any(kebabTypes.contains), isFalse);
});
test('should return correct button types for locked view', () {
final remoteAsset = createRemoteAsset();
final context = ActionButtonContext(
asset: remoteAsset,
isOwner: true,
isArchived: false,
isTrashEnabled: false,
isInLockedView: true,
currentAlbum: null,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
);
const expectedTypes = [
ActionButtonType.share,
ActionButtonType.removeFromLockFolder,
ActionButtonType.deletePermanent,
];
final bottomBarTypes = ActionButtonBuilder.getViewerBottomBarTypes(context);
final kebabTypes = ActionButtonBuilder.getViewerKebabMenuTypes(context);
expect(bottomBarTypes, expectedTypes);
expect(bottomBarTypes.any(kebabTypes.contains), isFalse);
});
test('should return correct button types for remote only asset', () {
final remoteAsset = createRemoteAsset();
final context = ActionButtonContext(
asset: remoteAsset,
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: null,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
serverVersion: const SemVer(major: 2, minor: 6, patch: 0),
);
const expectedTypes = [
ActionButtonType.share,
ActionButtonType.editImage,
ActionButtonType.addTo,
ActionButtonType.delete,
];
final bottomBarTypes = ActionButtonBuilder.getViewerBottomBarTypes(context);
final kebabTypes = ActionButtonBuilder.getViewerKebabMenuTypes(context);
expect(bottomBarTypes, expectedTypes);
expect(bottomBarTypes.any(kebabTypes.contains), isFalse);
});
test('trashed asset (no album) keeps restore and permanent delete in bottom bar', () {
final remoteAsset = createRemoteAsset(deletedAt: DateTime.now());
final context = ActionButtonContext(
asset: remoteAsset,
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: null,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
timelineOrigin: TimelineOrigin.trash,
);
const expectedTypes = [
ActionButtonType.share,
ActionButtonType.addTo,
ActionButtonType.restoreTrash,
ActionButtonType.deletePermanent,
];
expect(ActionButtonBuilder.getViewerBottomBarTypes(context), expectedTypes);
});
test('trashed asset in shared activity album still surfaces restore and permanent delete', () {
final remoteAsset = createRemoteAsset(deletedAt: DateTime.now());
final album = createRemoteAlbum(isActivityEnabled: true, isShared: true);
final context = ActionButtonContext(
asset: remoteAsset,
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: album,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
timelineOrigin: TimelineOrigin.trash,
);
final bottomBarTypes = ActionButtonBuilder.getViewerBottomBarTypes(context);
expect(bottomBarTypes, contains(ActionButtonType.restoreTrash));
expect(bottomBarTypes, contains(ActionButtonType.deletePermanent));
expect(bottomBarTypes, isNot(contains(ActionButtonType.openActivity)));
expect(bottomBarTypes, isNot(contains(ActionButtonType.likeActivity)));
});
test('5th bottom-bar candidate overflows into the kebab', () {
final remoteAsset = createRemoteAsset();
final album = createRemoteAlbum(isActivityEnabled: true, isShared: true);
final context = ActionButtonContext(
asset: remoteAsset,
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: album,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
serverVersion: const SemVer(major: 2, minor: 6, patch: 0),
);
final bottomBarTypes = ActionButtonBuilder.getViewerBottomBarTypes(context);
final kebabTypes = ActionButtonBuilder.getViewerKebabMenuTypes(context);
expect(bottomBarTypes.length, 4);
expect(bottomBarTypes, isNot(contains(ActionButtonType.delete)));
expect(kebabTypes, contains(ActionButtonType.delete));
});
});
group('ActionButtonType.shouldShow editImage button', () {
final editableRemote = createRemoteAsset();
test('should show for editable remote asset on a recent server', () {
final context = ActionButtonContext(
asset: editableRemote,
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: null,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
serverVersion: const SemVer(major: 2, minor: 6, patch: 0),
);
expect(ActionButtonType.editImage.shouldShow(context), isTrue);
});
test('should not show when local-only (LocalAsset is not editable)', () {
final context = ActionButtonContext(
asset: createLocalAsset(),
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: null,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
serverVersion: const SemVer(major: 2, minor: 6, patch: 0),
);
expect(ActionButtonType.editImage.shouldShow(context), isFalse);
});
test('should not show when server version is below 2.6', () {
final context = ActionButtonContext(
asset: editableRemote,
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: null,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
serverVersion: const SemVer(major: 2, minor: 5, patch: 9),
);
expect(ActionButtonType.editImage.shouldShow(context), isFalse);
});
test('should not show in locked view', () {
final context = ActionButtonContext(
asset: editableRemote,
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: true,
currentAlbum: null,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
serverVersion: const SemVer(major: 2, minor: 6, patch: 0),
);
expect(ActionButtonType.editImage.shouldShow(context), isFalse);
});
});
group('ActionButtonType.shouldShow addTo button', () {
test('should show when not locked and asset has remote', () {
final context = ActionButtonContext(
asset: createRemoteAsset(),
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: null,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
);
expect(ActionButtonType.addTo.shouldShow(context), isTrue);
});
test('should not show in locked view', () {
final context = ActionButtonContext(
asset: createRemoteAsset(),
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: true,
currentAlbum: null,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
);
expect(ActionButtonType.addTo.shouldShow(context), isFalse);
});
test('should not show for local-only asset', () {
final context = ActionButtonContext(
asset: createLocalAsset(),
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: null,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
);
expect(ActionButtonType.addTo.shouldShow(context), isFalse);
});
});
group('ActionButtonType.shouldShow openActivity button', () {
final asset = createRemoteAsset();
test('should show in a shared activity-enabled album', () {
final context = ActionButtonContext(
asset: asset,
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: createRemoteAlbum(isActivityEnabled: true, isShared: true),
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
);
expect(ActionButtonType.openActivity.shouldShow(context), isTrue);
});
test('should not show when no album', () {
final context = ActionButtonContext(
asset: asset,
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: null,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
);
expect(ActionButtonType.openActivity.shouldShow(context), isFalse);
});
test('should not show when album not shared', () {
final context = ActionButtonContext(
asset: asset,
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: createRemoteAlbum(isActivityEnabled: true, isShared: false),
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
);
expect(ActionButtonType.openActivity.shouldShow(context), isFalse);
});
test('should not show when activity disabled', () {
final context = ActionButtonContext(
asset: asset,
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: createRemoteAlbum(isActivityEnabled: false, isShared: true),
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
);
expect(ActionButtonType.openActivity.shouldShow(context), isFalse);
});
test('should not show in locked view', () {
final context = ActionButtonContext(
asset: asset,
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: true,
currentAlbum: createRemoteAlbum(isActivityEnabled: true, isShared: true),
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
);
expect(ActionButtonType.openActivity.shouldShow(context), isFalse);
});
});
group('ActionButtonType.showsAt', () {
ActionButtonContext ctx({RemoteAlbum? album, TimelineOrigin origin = TimelineOrigin.main}) => ActionButtonContext(
asset: createRemoteAsset(),
isOwner: true,
isArchived: false,
isTrashEnabled: true,
isInLockedView: false,
currentAlbum: album,
advancedTroubleshooting: false,
isStacked: false,
source: ActionSource.viewer,
timelineOrigin: origin,
);
group('editImage', () {
test('hidden from bottom bar when album is shared', () {
final context = ctx(album: createRemoteAlbum(isShared: true));
expect(ActionButtonType.editImage.showsAt(ButtonPosition.bottomBar, context), isFalse);
});
test('shown in bottom bar when album is not shared', () {
final context = ctx(album: createRemoteAlbum(isShared: false));
expect(ActionButtonType.editImage.showsAt(ButtonPosition.bottomBar, context), isTrue);
});
test('shown in bottom bar when there is no album', () {
expect(ActionButtonType.editImage.showsAt(ButtonPosition.bottomBar, ctx()), isTrue);
});
});
group('openActivity / likeActivity', () {
test('hidden from bottom bar when viewing from trash', () {
final context = ctx(origin: TimelineOrigin.trash);
expect(ActionButtonType.openActivity.showsAt(ButtonPosition.bottomBar, context), isFalse);
expect(ActionButtonType.likeActivity.showsAt(ButtonPosition.bottomBar, context), isFalse);
});
test('shown in bottom bar outside trash', () {
expect(ActionButtonType.openActivity.showsAt(ButtonPosition.bottomBar, ctx()), isTrue);
expect(ActionButtonType.likeActivity.showsAt(ButtonPosition.bottomBar, ctx()), isTrue);
});
});
});
}
+1 -1
View File
@@ -16206,7 +16206,7 @@
"info": {
"title": "Immich",
"description": "Immich API",
"version": "3.0.1",
"version": "3.0.0",
"contact": {}
},
"tags": [
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "immich-monorepo",
"version": "3.0.1",
"version": "3.0.0",
"description": "Monorepo for Immich",
"type": "module",
"private": true,
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@immich/cli",
"version": "3.0.1",
"version": "3.0.0",
"description": "Command Line Interface (CLI) for Immich",
"repository": {
"type": "git",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@immich/sdk",
"version": "3.0.1",
"version": "3.0.0",
"description": "Auto-generated TypeScript SDK for the Immich API",
"repository": {
"type": "git",
+1 -1
View File
@@ -1,6 +1,6 @@
/**
* Immich
* 3.0.1
* 3.0.0
* DO NOT MODIFY - This file has been generated using oazapfts.
* See https://www.npmjs.com/package/oazapfts
*/
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "immich",
"version": "3.0.1",
"version": "3.0.0",
"description": "",
"author": "",
"private": true,
@@ -381,8 +381,6 @@ describe(TranscodingService.name, () => {
'50',
'-keyint_min',
'50',
'-ac',
'2',
'-copyts',
'-r',
'50130000/2012441',
-5
View File
@@ -200,11 +200,6 @@ export class BaseConfig implements VideoCodecSWConfig {
const options = ['-c:v', videoCodec, '-c:a', audioCodec, '-map', `0:${videoStream.index}`, '-map_metadata', '-1'];
if (audioStream) {
options.push('-map', `0:${audioStream.index}`);
// If there are more than 2 channels sometimes the channel config is broken when re-encoded
// TODO: Store the number of channels in the db and then set it during the transcoding: -channel_layout 5.1
if ([TranscodeTarget.All, TranscodeTarget.Audio].includes(target)) {
options.push('-ac', '2');
}
}
if (this.getBFrames() > -1) {
options.push('-bf', `${this.getBFrames()}`);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "immich-web",
"version": "3.0.1",
"version": "3.0.0",
"license": "GNU Affero General Public License version 3",
"type": "module",
"scripts": {
@@ -5,7 +5,6 @@
import { assetViewerManager } from '$lib/managers/asset-viewer-manager.svelte';
import { castManager } from '$lib/managers/cast-manager.svelte';
import { featureFlagsManager } from '$lib/managers/feature-flags-manager.svelte';
import { authManager } from '$lib/managers/auth-manager.svelte';
import { mediaCapabilitiesManager } from '$lib/managers/media-capabilities-manager.svelte';
import { autoPlayVideo, lang, loopVideo as loopVideoPreference } from '$lib/stores/preferences.store';
import { getAssetHlsSessionUrl, getAssetHlsUrl, getAssetMediaUrl, getAssetPlaybackUrl } from '$lib/utils';
@@ -151,15 +150,6 @@
},
},
useMediaCapabilities: false,
xhrSetup: (xhr: XMLHttpRequest, url: string) => {
const authenticatedUrl = new URL(url, globalThis.location.origin);
for (const [key, value] of Object.entries(authManager.params)) {
if (value) {
authenticatedUrl.searchParams.set(key, value as string);
}
}
xhr.open('GET', authenticatedUrl.toString());
},
};
const releaseSession = () => {
@@ -37,18 +37,18 @@
</div>
{#await valuePromise}
<div class="relative mx-auto font-mono text-2xl font-medium" aria-label="0">
<div class="relative mx-auto font-mono text-2xl font-medium">
<span class="shimmer-text text-gray-300 dark:text-gray-600">{zeros()}</span>
</div>
{:then data}
<div class="relative mx-auto font-mono text-2xl font-medium" aria-label="{data.value} {data.unit ?? ''}">
<div class="relative mx-auto font-mono text-2xl font-medium">
<span class="text-gray-300 dark:text-gray-600">{zeros(data)}</span><span>{data.value}</span>
{#if data.unit}
<code class="font-mono text-base font-normal">{data.unit}</code>
{/if}
</div>
{:catch _}
<div class="relative mx-auto font-mono text-2xl font-medium" aria-label="0">
<div class="relative mx-auto font-mono text-2xl font-medium">
<span class="text-gray-300 dark:text-gray-600">{zeros()}</span>
</div>
{/await}
@@ -101,9 +101,7 @@
{description}
</p>
{:else}
<div class="pb-2">
{@render descriptionSnippet?.()}
</div>
{@render descriptionSnippet?.()}
{/if}
{#if inputType !== SettingInputFieldType.PASSWORD}
@@ -25,7 +25,7 @@ export class GCastDestination implements ICastDestination {
private currentUrl: string | null = null;
async initialize(): Promise<boolean> {
if (!authManager.authenticated || !authManager.preferences.cast.gCastEnabled) {
if (!authManager.authenticated || authManager.preferences.cast.gCastEnabled) {
this.isAvailable = false;
return false;
}
@@ -34,7 +34,6 @@
import {
type AlbumResponseDto,
type AssetResponseDto,
AssetVisibility,
getPerson,
getTagById,
type MetadataSearchDto,
@@ -142,10 +141,8 @@
try {
const { albums, assets } =
('query' in searchDto || 'queryAssetId' in searchDto) && smartSearchEnabled
? await searchSmart({
smartSearchDto: { visibility: AssetVisibility.Timeline, ...searchDto, language: $lang },
})
: await searchAssets({ metadataSearchDto: { visibility: AssetVisibility.Timeline, ...searchDto } });
? await searchSmart({ smartSearchDto: { ...searchDto, language: $lang } })
: await searchAssets({ metadataSearchDto: searchDto });
searchResultAlbums.push(...albums.items);
searchResultAssets.push(...assets.items);