Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(desktop): use white native light backgrounds

Gener8ce4396394cc
diff --git a/scripts/ci/native-shell-theme-colors.test.ts b/scripts/ci/native-shell-theme-colors.test.ts
new file mode 100644
index 000000000..7466e594b
--- /dev/null
+++ b/scripts/ci/native-shell-theme-colors.test.ts
@@ -0,0 +1,71 @@
+import { readFileSync } from "node:fs"
+import { resolve } from "node:path"
+import { describe, expect, it } from "vitest"
+
+const repositoryRoot = resolve(import.meta.dirname, "../..")
+const desktopRoot = resolve(repositoryRoot, "src/desktop/src-tauri")
+
+const macosRuntime = readFileSync(resolve(desktopRoot, "src/commands.rs"), "utf8")
+const iosRuntime = readFileSync(resolve(desktopRoot, "gen/apple/Sources/alook-desktop/main.mm"), "utf8")
+const iosSplash = JSON.parse(
+ readFileSync(
+ resolve(desktopRoot, "gen/apple/Assets.xcassets/SplashBackground.colorset/Contents.json"),
+ "utf8",
+ ),
+) as {
+ colors: Array<{
+ appearances?: Array<{ appearance: string; value: string }>
+ color: { components: Record<string, string> }
+ }>
+}
+const androidRuntime = readFileSync(
+ resolve(desktopRoot, "gen/android/app/src/main/java/ai/alook/desktop/MainActivity.kt"),
+ "utf8",
+)
+const androidLightSplash = readFileSync(
+ resolve(desktopRoot, "gen/android/app/src/main/res/values/themes.xml"),
+ "utf8",
+)
+const androidDarkSplash = readFileSync(
+ resolve(desktopRoot, "gen/android/app/src/main/res/values-night/themes.xml"),
+ "utf8",
+)
+
+describe("native shell theme color contract", () => {
+ it("uses white light chrome and preserves dark chrome on macOS", () => {
+ expect(macosRuntime).toContain("(0.063f64, 0.051f64, 0.039f64)")
+ expect(macosRuntime).toContain("(1.0f64, 1.0f64, 1.0f64)")
+ expect(macosRuntime).toContain("setBackgroundColor: color")
+ })
+
+ it("uses white light chrome and preserves dark chrome at iOS launch and runtime", () => {
+ expect(iosRuntime).toContain("colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0")
+ expect(iosRuntime).toContain("colorWithRed:0.063 green:0.051 blue:0.039 alpha:1.0")
+
+ const light = iosSplash.colors.find((entry) => !entry.appearances)
+ const dark = iosSplash.colors.find((entry) =>
+ entry.appearances?.some(({ appearance, value }) => appearance === "luminosity" && value === "dark"),
+ )
+ expect(light?.color.components).toMatchObject({ red: "1.000", green: "1.000", blue: "1.000" })
+ expect(dark?.color.components).toMatchObject({ red: "0.063", green: "0.051", blue: "0.039" })
+ })
+
+ it("uses white light chrome and preserves dark chrome at Android launch and runtime", () => {
+ expect(androidRuntime).toContain('const val COLOR_LIGHT = "#FFFFFF"')
+ expect(androidRuntime).toContain('const val COLOR_DARK = "#100D0A"')
+ expect(androidLightSplash).toContain("<item name=\"windowSplashScreenBackground\">#FFFFFF</item>")
+ expect(androidDarkSplash).toContain("<item name=\"windowSplashScreenBackground\">#100D0A</item>")
+ })
+
+ it("retains runtime theme bridges and removes the legacy light color from native owners", () => {
+ expect(iosRuntime).toContain("new MutationObserver(sync)")
+ expect(iosRuntime).toContain('addScriptMessageHandler:handler name:@"alookTheme"')
+ expect(androidRuntime).toContain("WebViewCompat.addDocumentStartJavaScript")
+ expect(androidRuntime).toContain('webView.addJavascriptInterface(ThemeBridge(this), "AlookNative")')
+
+ const nativeOwners = [macosRuntime, iosRuntime, JSON.stringify(iosSplash), androidRuntime, androidLightSplash]
+ for (const source of nativeOwners) {
+ expect(source).not.toMatch(/#ECE8DE|0\.929[^\n]+0\.910[^\n]+0\.871/)
+ }
+ })
+})
diff --git a/src/desktop/src-tauri/gen/android/app/src/main/java/ai/alook/desktop/MainActivity.kt b/src/desktop/src-tauri/gen/android/app/src/main/java/ai/alook/desktop/MainActivity.kt
index 0d35b0d3d..c5641632e 100644
--- a/src/desktop/src-tauri/gen/android/app/src/main/java/ai/alook/desktop/MainActivity.kt
+++ b/src/desktop/src-tauri/gen/android/app/src/main/java/ai/alook/desktop/MainActivity.kt
@@ -19,7 +19,7 @@ class MainActivity : TauriActivity() {
private var isReady = false
companion object {
- const val COLOR_LIGHT = "#ECE8DE"
+ const val COLOR_LIGHT = "#FFFFFF"
const val COLOR_DARK = "#100D0A"
const val THEME_OBSERVER_SCRIPT = """
diff --git a/src/desktop/src-tauri/gen/android/app/src/main/res/values/themes.xml b/src/desktop/src-tauri/gen/android/app/src/main/res/values/themes.xml
index 931a4cc89..3ec0c30a7 100644
--- a/src/desktop/src-tauri/gen/android/app/src/main/res/values/themes.xml
+++ b/src/desktop/src-tauri/gen/android/app/src/main/res/values/themes.xml
@@ -4,7 +4,7 @@
</style>
<!-- Splash screen theme -->
<style name="Theme.alook_desktop.Splash" parent="Theme.SplashScreen">
- <item name="windowSplashScreenBackground">#ECE8DE</item>
+ <item name="windowSplashScreenBackground">#FFFFFF</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
<item name="windowSplashScreenAnimationDuration">300</item>
<item name="postSplashScreenTheme">@style/Theme.alook_desktop</item>
diff --git a/src/desktop/src-tauri/gen/apple/Assets.xcassets/SplashBackground.colorset/Contents.json b/src/desktop/src-tauri/gen/apple/Assets.xcassets/SplashBackground.colorset/Contents.json
index 82c9b8b75..4cdb038c7 100644
--- a/src/desktop/src-tauri/gen/apple/Assets.xcassets/SplashBackground.colorset/Contents.json
+++ b/src/desktop/src-tauri/gen/apple/Assets.xcassets/SplashBackground.colorset/Contents.json
@@ -4,9 +4,9 @@
"color": {
"color-space": "srgb",
"components": {
- "red": "0.929",
- "green": "0.910",
- "blue": "0.871",
+ "red": "1.000",
+ "green": "1.000",
+ "blue": "1.000",
"alpha": "1.000"
}
},
diff --git a/src/desktop/src-tauri/gen/apple/Sources/alook-desktop/main.mm b/src/desktop/src-tauri/gen/apple/Sources/alook-desktop/main.mm
index d1c6c794f..08f09e1af 100644
--- a/src/desktop/src-tauri/gen/apple/Sources/alook-desktop/main.mm
+++ b/src/desktop/src-tauri/gen/apple/Sources/alook-desktop/main.mm
@@ -4,7 +4,7 @@
#import <objc/runtime.h>
static UIColor *alookLightColor(void) {
- return [UIColor colorWithRed:0.929 green:0.910 blue:0.871 alpha:1.0];
+ return [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];
}
static UIColor *alookDarkColor(void) {
diff --git a/src/desktop/src-tauri/src/commands.rs b/src/desktop/src-tauri/src/commands.rs
index 763d87e8f..a393c7279 100644
--- a/src/desktop/src-tauri/src/commands.rs
+++ b/src/desktop/src-tauri/src/commands.rs
@@ -541,7 +541,7 @@ pub fn set_window_theme(window: tauri::WebviewWindow, dark: bool) {
let (r, g, b) = if dark {
(0.063f64, 0.051f64, 0.039f64)
} else {
- (0.929f64, 0.910f64, 0.871f64)
+ (1.0f64, 1.0f64, 1.0f64)
};
let color: *mut AnyObject = msg_send![
objc2::class!(NSColor),
diff --git a/src/web/src/test/e2e-ui/39-mobile-message-interactions.spec.ts b/src/web/src/test/e2e-ui/39-mobile-message-interactions.spec.ts
index cdff6bc52..423756350 100644
--- a/src/web/src/test/e2e-ui/39-mobile-message-interactions.spec.ts
+++ b/src/web/src/test/e2e-ui/39-mobile-message-interactions.spec.ts
@@ -328,7 +328,7 @@ test("mobile reply, avatar mention, and typing rail keep exact backend and WS id
const bobInfo = await memberInfo("alice", serverId, userId("bob"))
const aliceInfo = await memberInfo("alice", serverId, userId("alice"))
- const alice = await asUser("alice")
+ const alice = await asUser("alice", { hasTouch: true })
const bob = await asUser("bob")
await installInputCapability(alice.page, false)
await alice.page.setViewportSize({ width: 390, height: 844 })
@@ -609,7 +609,7 @@ test("mobile reply, avatar mention, and typing rail keep exact backend and WS id
await bobEditable.pressSequentially(" selection")
await expect(alice.page.getByTestId(tid.typingIndicator)).toBeVisible({ timeout: 4_000 })
const finalChannelMessage = alice.page.getByTestId(tid.message(typingWsReadyId))
- await finalChannelMessage.getByText(`typing ws ready ${stamp}`, { exact: true }).click()
+ await finalChannelMessage.getByText(`typing ws ready ${stamp}`, { exact: true }).tap()
await alice.page.getByRole("menuitem", { name: "Share as Image" }).click()
await expect(alice.page.getByTestId(tid.messageSelectionToolbar)).toBeVisible()
await expect(alice.page.locator("[data-selection-typing-fit]"))