Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(ios): declare portrait-only mobile orientations (#1083)

Gener83e4e2114396
diff --git a/.github/workflows/mobile-release.yml b/.github/workflows/mobile-release.yml
index e71e56c69..3950b5248 100644
--- a/.github/workflows/mobile-release.yml
+++ b/.github/workflows/mobile-release.yml
@@ -178,6 +178,8 @@ jobs:
assert info["CFBundleIdentifier"] == "ai.alook.ios"
assert info["WKAppBoundDomains"] == ["localhost", "alook.ai"]
+ assert info["UISupportedInterfaceOrientations"] == ["UIInterfaceOrientationPortrait"]
+ assert info["UISupportedInterfaceOrientations~ipad"] == ["UIInterfaceOrientationPortrait"]
assert info["CFBundleURLTypes"] == [
{"CFBundleURLName": "ai.alook", "CFBundleURLSchemes": ["ai.alook"]}
]
diff --git a/scripts/ci/tauri-startup.test.ts b/scripts/ci/tauri-startup.test.ts
index 8d118b505..9858462d0 100644
--- a/scripts/ci/tauri-startup.test.ts
+++ b/scripts/ci/tauri-startup.test.ts
@@ -12,6 +12,51 @@ const base = JSON.parse(read("tauri.conf.json"))
const release = JSON.parse(read("tauri.ios.release.conf.json"))
const development = JSON.parse(read("tauri.dev.conf.json"))
+function verifyIosArtifact(orientationKey?: string, orientations?: string[]) {
+ const workflow = readFileSync(resolve(root, ".github/workflows/mobile-release.yml"), "utf8")
+ const validator = workflow.match(/^\s+python3 - "\$app_path\/Info\.plist" "\$entitlements_path" <<'PY'\n([\s\S]*?)^\s+PY$/m)
+ expect(validator).not.toBeNull()
+ const info: Record<string, unknown> = {
+ CFBundleIdentifier: "ai.alook.ios",
+ WKAppBoundDomains: ["localhost", "alook.ai"],
+ UISupportedInterfaceOrientations: ["UIInterfaceOrientationPortrait"],
+ "UISupportedInterfaceOrientations~ipad": ["UIInterfaceOrientationPortrait"],
+ CFBundleURLTypes: [{ CFBundleURLName: "ai.alook", CFBundleURLSchemes: ["ai.alook"] }],
+ }
+ if (orientationKey) {
+ if (orientations) info[orientationKey] = orientations
+ else delete info[orientationKey]
+ }
+ return spawnSync("python3", ["-c", `
+import json
+import pathlib
+import plistlib
+import sys
+import tempfile
+import textwrap
+
+validator = textwrap.dedent(sys.argv[1])
+fixture = json.load(sys.stdin)
+with tempfile.TemporaryDirectory(prefix="alook-ipa-metadata-") as directory:
+ paths = [pathlib.Path(directory) / (name + ".plist") for name in ["info", "entitlements"]]
+ for name, path in zip(["info", "entitlements"], paths):
+ path.write_bytes(plistlib.dumps(fixture[name]))
+ sys.argv = ["ipa-metadata"] + [str(path) for path in paths]
+ exec(compile(validator, "mobile-release-ipa-metadata", "exec"))
+`, validator![1]], {
+ encoding: "utf8",
+ input: JSON.stringify({
+ info,
+ entitlements: {
+ "application-identifier": "5RF24VHDQB.ai.alook.ios",
+ "com.apple.developer.team-identifier": "5RF24VHDQB",
+ "com.apple.developer.associated-domains": ["applinks:auth.alook.ai"],
+ "aps-environment": "production",
+ },
+ }),
+ })
+}
+
describe("Tauri startup release separation", () => {
it("retains the complete main window and bounds only the release overlay", () => {
expect(release.app.windows).toEqual(base.app.windows.map((window: object) => ({
@@ -51,6 +96,26 @@ describe("Tauri startup release separation", () => {
}
})
+ it("accepts the final IPA metadata with portrait-only phone and tablet declarations", () => {
+ const result = verifyIosArtifact()
+ expect(result.error).toBeUndefined()
+ expect(result.status, result.stderr).toBe(0)
+ })
+
+ const invalidOrientations: [string, string, string[] | undefined][] = [
+ ["phone landscape", "UISupportedInterfaceOrientations", ["UIInterfaceOrientationPortrait", "UIInterfaceOrientationLandscapeLeft"]],
+ ["tablet landscape", "UISupportedInterfaceOrientations~ipad", ["UIInterfaceOrientationPortrait", "UIInterfaceOrientationLandscapeRight"]],
+ ["tablet upside-down", "UISupportedInterfaceOrientations~ipad", ["UIInterfaceOrientationPortrait", "UIInterfaceOrientationPortraitUpsideDown"]],
+ ["missing phone", "UISupportedInterfaceOrientations", undefined],
+ ["missing tablet", "UISupportedInterfaceOrientations~ipad", undefined],
+ ]
+ it.each(invalidOrientations)("rejects final IPA metadata with %s declarations", (_name, key, orientations) => {
+ const result = verifyIosArtifact(key, orientations)
+ expect(result.error).toBeUndefined()
+ expect(result.status).toBe(1)
+ expect(result.stderr).toMatch(/AssertionError|KeyError/)
+ })
+
it("does not require a generated plist on a fresh development checkout", () => {
expect(prepareIosDevelopmentPlist(resolve(tauriRoot, "nonexistent-test.plist"))).toBe(false)
})
diff --git a/src/desktop/src-tauri/gen/apple/project.yml b/src/desktop/src-tauri/gen/apple/project.yml
index 96851cc8b..5d9a4c43a 100644
--- a/src/desktop/src-tauri/gen/apple/project.yml
+++ b/src/desktop/src-tauri/gen/apple/project.yml
@@ -47,13 +47,8 @@ targets:
UIRequiredDeviceCapabilities: [arm64, metal]
UISupportedInterfaceOrientations:
- UIInterfaceOrientationPortrait
- - UIInterfaceOrientationLandscapeLeft
- - UIInterfaceOrientationLandscapeRight
UISupportedInterfaceOrientations~ipad:
- UIInterfaceOrientationPortrait
- - UIInterfaceOrientationPortraitUpsideDown
- - UIInterfaceOrientationLandscapeLeft
- - UIInterfaceOrientationLandscapeRight
CFBundleShortVersionString: 0.1.60
CFBundleVersion: "1"
NSPhotoLibraryAddUsageDescription: Allow Alook to save shared message images to Photos.