refactor(flow): remove Live Activity and keep-alive mode picker

Keep voice sessions on silent low-profile PiP only, and fix custom polish style editor presentation via sheet(item:).
This commit is contained in:
Rocky
2026-08-07 11:32:31 +08:00
parent d237318bf3
commit 41b8db87b5
44 changed files with 276 additions and 1997 deletions
+25 -2
View File
@@ -64,7 +64,6 @@ final class SettingsCloudSyncTests: XCTestCase {
activePolishStyleId: SyncedField(value: "builtin.light", updatedAt: stampA, deviceID: deviceA),
llmThinkingEnabled: SyncedField(value: false, updatedAt: stampA, deviceID: deviceA),
flowSkipAppSwitch: SyncedField(value: true, updatedAt: stampA, deviceID: deviceA),
flowKeepAliveMode: SyncedField(value: .liveActivity, updatedAt: stampA, deviceID: deviceA),
flowInactivityDuration: SyncedField(value: .twelveHours, updatedAt: stampA, deviceID: deviceA)
)
let remote = SyncedAppSettingsV2(
@@ -87,7 +86,6 @@ final class SettingsCloudSyncTests: XCTestCase {
activePolishStyleId: SyncedField(value: "builtin.formal", updatedAt: stampB, deviceID: deviceB),
llmThinkingEnabled: SyncedField(value: true, updatedAt: stampB, deviceID: deviceB),
flowSkipAppSwitch: SyncedField(value: false, updatedAt: stampB, deviceID: deviceB),
flowKeepAliveMode: SyncedField(value: .pictureInPicture, updatedAt: stampB, deviceID: deviceB),
flowInactivityDuration: SyncedField(value: .threeHours, updatedAt: stampB, deviceID: deviceB)
)
@@ -100,6 +98,31 @@ final class SettingsCloudSyncTests: XCTestCase {
XCTAssertEqual(merged.polishIntensity.value, .heavy)
}
func testLegacyKeepAliveFieldDecodesButIsNotReencoded() throws {
let payload = SyncedAppSettingsV2.seeded(
from: AppGroupConfiguration.load(fromAvailable: defaults),
deviceID: deviceA,
updatedAt: Date(timeIntervalSince1970: 100)
)
let encoder = JSONEncoder()
var object = try XCTUnwrap(
JSONSerialization.jsonObject(with: encoder.encode(payload)) as? [String: Any]
)
object["flowKeepAliveMode"] = [
"value": "liveActivity",
"updatedAt": 0,
"deviceID": "legacy-device",
]
let legacyData = try JSONSerialization.data(withJSONObject: object)
let decoded = try JSONDecoder().decode(SyncedAppSettingsV2.self, from: legacyData)
let reencodedObject = try XCTUnwrap(
JSONSerialization.jsonObject(with: encoder.encode(decoded)) as? [String: Any]
)
XCTAssertNil(reencodedObject["flowKeepAliveMode"])
}
func testLegacyV1PullDoesNotClearKeychain() async throws {
try Keychain.setAPIKey("sk-local-openai", for: "openai", useICloudSync: false)
store.setSettingsICloudSyncEnabled(true)