mirror of
https://github.com/immich-app/immich.git
synced 2026-06-27 17:03:22 -07:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 39fe991451 | |||
| cbe34d7931 | |||
| 06c8d5a183 |
@@ -23,6 +23,6 @@ class ImmichApp : Application() {
|
|||||||
// as the previous start might have been killed without unlocking.
|
// as the previous start might have been killed without unlocking.
|
||||||
if (BackgroundEngineLock.connectEngines > 0) return@postDelayed
|
if (BackgroundEngineLock.connectEngines > 0) return@postDelayed
|
||||||
BackgroundWorkerApiImpl.enqueueBackgroundWorker(this)
|
BackgroundWorkerApiImpl.enqueueBackgroundWorker(this)
|
||||||
}, 5000)
|
}, 15000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-4
@@ -15,6 +15,7 @@ import androidx.work.ListenableWorker
|
|||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import app.alextran.immich.MainActivity
|
import app.alextran.immich.MainActivity
|
||||||
import app.alextran.immich.R
|
import app.alextran.immich.R
|
||||||
|
import com.google.common.util.concurrent.Futures
|
||||||
import com.google.common.util.concurrent.ListenableFuture
|
import com.google.common.util.concurrent.ListenableFuture
|
||||||
import com.google.common.util.concurrent.SettableFuture
|
import com.google.common.util.concurrent.SettableFuture
|
||||||
import io.flutter.FlutterInjector
|
import io.flutter.FlutterInjector
|
||||||
@@ -61,6 +62,11 @@ class BackgroundWorker(context: Context, params: WorkerParameters) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun startWork(): ListenableFuture<Result> {
|
override fun startWork(): ListenableFuture<Result> {
|
||||||
|
if (BackgroundWorkerPreferences(ctx).isLocked() && BackgroundEngineLock.connectEngines > 0) {
|
||||||
|
Log.i(TAG, "Foreground engine active, skipping background worker")
|
||||||
|
return Futures.immediateFuture(Result.success())
|
||||||
|
}
|
||||||
|
|
||||||
Log.i(TAG, "Starting background upload worker")
|
Log.i(TAG, "Starting background upload worker")
|
||||||
|
|
||||||
if (!loader.initialized()) {
|
if (!loader.initialized()) {
|
||||||
@@ -77,6 +83,10 @@ class BackgroundWorker(context: Context, params: WorkerParameters) :
|
|||||||
showNotification(notificationConfig.first, notificationConfig.second)
|
showNotification(notificationConfig.first, notificationConfig.second)
|
||||||
|
|
||||||
loader.ensureInitializationCompleteAsync(ctx, null, Handler(Looper.getMainLooper())) {
|
loader.ensureInitializationCompleteAsync(ctx, null, Handler(Looper.getMainLooper())) {
|
||||||
|
if (isStopped || isComplete) {
|
||||||
|
return@ensureInitializationCompleteAsync
|
||||||
|
}
|
||||||
|
|
||||||
engine = FlutterEngine(ctx)
|
engine = FlutterEngine(ctx)
|
||||||
FlutterEngineCache.getInstance().put(BackgroundWorkerApiImpl.ENGINE_CACHE_KEY, engine!!)
|
FlutterEngineCache.getInstance().put(BackgroundWorkerApiImpl.ENGINE_CACHE_KEY, engine!!)
|
||||||
|
|
||||||
@@ -143,11 +153,17 @@ class BackgroundWorker(context: Context, params: WorkerParameters) :
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val api = flutterApi
|
||||||
|
if (api == null) {
|
||||||
|
Handler(Looper.getMainLooper()).postAtFrontOfQueue {
|
||||||
|
complete(Result.failure())
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
Handler(Looper.getMainLooper()).postAtFrontOfQueue {
|
Handler(Looper.getMainLooper()).postAtFrontOfQueue {
|
||||||
if (flutterApi != null) {
|
api.cancel {
|
||||||
flutterApi?.cancel {
|
complete(Result.failure())
|
||||||
complete(Result.failure())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
brokenAssetClass?: ClassValue;
|
brokenAssetClass?: ClassValue;
|
||||||
dimmed?: boolean;
|
dimmed?: boolean;
|
||||||
albumUsers?: UserResponseDto[];
|
albumUsers?: UserResponseDto[];
|
||||||
onClick?: (asset: TimelineAsset) => void;
|
onClick?: (asset: TimelineAsset, event?: MouseEvent) => void;
|
||||||
onPreview?: (asset: TimelineAsset) => void;
|
onPreview?: (asset: TimelineAsset) => void;
|
||||||
onSelect?: (asset: TimelineAsset) => void;
|
onSelect?: (asset: TimelineAsset) => void;
|
||||||
onMouseEvent?: (event: { isMouseOver: boolean; selectedGroupIndex: number }) => void;
|
onMouseEvent?: (event: { isMouseOver: boolean; selectedGroupIndex: number }) => void;
|
||||||
@@ -93,12 +93,12 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const callClickHandlers = () => {
|
const callClickHandlers = (e?: MouseEvent) => {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
onIconClickedHandler();
|
onIconClickedHandler(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
onClick?.($state.snapshot(asset));
|
onClick?.($state.snapshot(asset), e);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClick = (e: MouseEvent) => {
|
const handleClick = (e: MouseEvent) => {
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
|
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
callClickHandlers();
|
callClickHandlers(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onMouseEnter = () => {
|
const onMouseEnter = () => {
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
groupTitle: string,
|
groupTitle: string,
|
||||||
asset: TimelineAsset,
|
asset: TimelineAsset,
|
||||||
) => void,
|
) => void,
|
||||||
|
event?: MouseEvent,
|
||||||
) => void;
|
) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -685,9 +686,9 @@
|
|||||||
{asset}
|
{asset}
|
||||||
{albumUsers}
|
{albumUsers}
|
||||||
{groupIndex}
|
{groupIndex}
|
||||||
onClick={(asset) => {
|
onClick={(asset, event) => {
|
||||||
if (typeof onThumbnailClick === 'function') {
|
if (typeof onThumbnailClick === 'function') {
|
||||||
onThumbnailClick(asset, timelineManager, timelineDay, _onClick);
|
onThumbnailClick(asset, timelineManager, timelineDay, _onClick, event);
|
||||||
} else {
|
} else {
|
||||||
_onClick(timelineManager, timelineDay.getAssets(), timelineDay.groupTitle, asset);
|
_onClick(timelineManager, timelineDay.getAssets(), timelineDay.groupTitle, asset);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,7 +118,12 @@
|
|||||||
groupTitle: string,
|
groupTitle: string,
|
||||||
asset: TimelineAsset,
|
asset: TimelineAsset,
|
||||||
) => void,
|
) => void,
|
||||||
|
event?: MouseEvent,
|
||||||
) => {
|
) => {
|
||||||
|
if (event?.shiftKey) {
|
||||||
|
onClick(timelineManager, timelineDay.getAssets(), timelineDay.groupTitle, asset);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (hasGps(asset)) {
|
if (hasGps(asset)) {
|
||||||
locationUpdated = true;
|
locationUpdated = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const config = {
|
|||||||
preprocess: vitePreprocess(),
|
preprocess: vitePreprocess(),
|
||||||
kit: {
|
kit: {
|
||||||
version: {
|
version: {
|
||||||
name: process.env.IMMICH_BUILD || Date.now().toString(),
|
name: process.env.IMMICH_BUILD || process.env.npm_package_version || 'local',
|
||||||
},
|
},
|
||||||
paths: {
|
paths: {
|
||||||
relative: false,
|
relative: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user