This fixes two bugs with the "New Message" shortcut: - It was available even when you weren't registered (e.g., when you just installed the app) - It was not translated, so users always saw "New Message" even if their phone wasn't in English
21 lines
680 B
Swift
21 lines
680 B
Swift
//
|
|
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
import XCTest
|
|
@testable import Signal
|
|
|
|
class AppDelegateTest: XCTestCase {
|
|
func testApplicationShortcutItems() throws {
|
|
func hasNewMessageShortcut(_ shortcuts: [UIApplicationShortcutItem]) -> Bool {
|
|
shortcuts.contains(where: { $0.type.contains("quickCompose") })
|
|
}
|
|
|
|
let unregistered = AppDelegate.applicationShortcutItems(isRegisteredAndReady: false)
|
|
XCTAssertFalse(hasNewMessageShortcut(unregistered))
|
|
|
|
let registered = AppDelegate.applicationShortcutItems(isRegisteredAndReady: true)
|
|
XCTAssertTrue(hasNewMessageShortcut(registered))
|
|
}
|
|
}
|