|
1 | | -import { expandHomePath } from "@t3tools/provider-core/server/pathExpansion"; |
2 | | -import type { NativeAppIconReference } from "@t3tools/contracts"; |
| 1 | +import type { ToolActivityNativeAppReference } from "@t3tools/contracts"; |
3 | 2 | import * as Cache from "effect/Cache"; |
4 | 3 | import * as Cause from "effect/Cause"; |
5 | 4 | import * as Digest from "effect/crypto/Digest"; |
@@ -29,16 +28,16 @@ const RESOLUTION_CACHE_MAX_ENTRIES = 256; |
29 | 28 | export class NativeAppIconResolver extends Context.Service< |
30 | 29 | NativeAppIconResolver, |
31 | 30 | { |
32 | | - readonly resolve: (app: NativeAppIconReference) => Effect.Effect<string | null>; |
| 31 | + readonly resolve: (app: ToolActivityNativeAppReference) => Effect.Effect<string | null>; |
33 | 32 | } |
34 | 33 | >()("t3/assets/NativeAppIconResolver") {} |
35 | 34 |
|
36 | | -function appCacheKey(app: NativeAppIconReference): string { |
| 35 | +function appCacheKey(app: ToolActivityNativeAppReference): string { |
37 | 36 | return JSON.stringify(app); |
38 | 37 | } |
39 | 38 |
|
40 | | -function appFromCacheKey(key: string): NativeAppIconReference { |
41 | | - return JSON.parse(key) as NativeAppIconReference; |
| 39 | +function appFromCacheKey(key: string): ToolActivityNativeAppReference { |
| 40 | + return JSON.parse(key) as ToolActivityNativeAppReference; |
42 | 41 | } |
43 | 42 |
|
44 | 43 | const existingFile = Effect.fn("NativeAppIconResolver.existingFile")(function* (filePath: string) { |
@@ -92,13 +91,9 @@ function containsControlCharacter(value: string): boolean { |
92 | 91 | } |
93 | 92 |
|
94 | 93 | const resolveApplicationPath = Effect.fn("NativeAppIconResolver.resolveApplicationPath")(function* ( |
95 | | - app: NativeAppIconReference, |
| 94 | + app: ToolActivityNativeAppReference, |
96 | 95 | ) { |
97 | 96 | const path = yield* Path.Path; |
98 | | - if (app._tag === "app-path") { |
99 | | - const appPath = expandHomePath(app.path, yield* HostProcess.HomeDirectory); |
100 | | - return path.isAbsolute(appPath) && appPath.endsWith(".app") ? appPath : null; |
101 | | - } |
102 | 97 | const query = |
103 | 98 | app._tag === "app-id" |
104 | 99 | ? `kMDItemCFBundleIdentifier == '${app.appId}'` |
@@ -136,7 +131,7 @@ const resolveApplicationPath = Effect.fn("NativeAppIconResolver.resolveApplicati |
136 | 131 | }); |
137 | 132 |
|
138 | 133 | const resolveNativeAppIconUncached = Effect.fn("NativeAppIconResolver.resolveUncached")(function* ( |
139 | | - app: NativeAppIconReference, |
| 134 | + app: ToolActivityNativeAppReference, |
140 | 135 | ) { |
141 | 136 | const fileSystem = yield* FileSystem.FileSystem; |
142 | 137 | const path = yield* Path.Path; |
@@ -247,7 +242,7 @@ export const make = Effect.gen(function* () { |
247 | 242 | ); |
248 | 243 |
|
249 | 244 | const resolveAttempt = Effect.fn("NativeAppIconResolver.resolve")(function* ( |
250 | | - app: NativeAppIconReference, |
| 245 | + app: ToolActivityNativeAppReference, |
251 | 246 | ) { |
252 | 247 | if ( |
253 | 248 | hostPlatform !== "darwin" || |
|
0 commit comments