Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Fix/15131 Quick actions are not reduced correctly in hibernation state #5169

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,60 @@ enum QuickAction: String {
application.shortcutItems = nil
return
}

var shortcutItems = [
UIApplicationShortcutItem(type: QuickAction.diaryNewEntry.rawValue, localizedTitle: AppStrings.QuickActions.contactDiaryNewEntry, localizedSubtitle: nil, icon: UIApplicationShortcutIcon(templateImageName: "book.closed")),
UIApplicationShortcutItem(type: QuickAction.showCertificates.rawValue, localizedTitle: AppStrings.QuickActions.showCertificates, localizedSubtitle: nil, icon: UIApplicationShortcutIcon(templateImageName: "Icons_Tabbar_Certificates"))
]

let status = AVCaptureDevice.authorizationStatus(for: .video)
if status == .authorized || status == .notDetermined {
// dont show camera related actions if no camera access is granted
shortcutItems.append(
contentsOf: [
UIApplicationShortcutItem(type: QuickAction.eventCheckin.rawValue, localizedTitle: AppStrings.QuickActions.eventCheckin, localizedSubtitle: nil, icon: UIApplicationShortcutIcon(templateImageName: "Icons_Tabbar_Checkin")),
UIApplicationShortcutItem(type: QuickAction.qrCodeScanner.rawValue, localizedTitle: AppStrings.QuickActions.qrCodeScanner, localizedSubtitle: nil, icon: UIApplicationShortcutIcon(templateImageName: "qrcode.viewfinder"))
]
)
var shortcutItems = [UIApplicationShortcutItem]()

if CWAHibernationProvider.shared.isHibernationState {
shortcutItems = [
UIApplicationShortcutItem(
type: QuickAction.diaryNewEntry.rawValue,
localizedTitle: AppStrings.QuickActions.contactDiaryNewEntry,
localizedSubtitle: nil,
icon: UIApplicationShortcutIcon(templateImageName: "book.closed")
),
UIApplicationShortcutItem(
type: QuickAction.showCertificates.rawValue,
localizedTitle: AppStrings.QuickActions.showCertificates,
localizedSubtitle: nil,
icon: UIApplicationShortcutIcon(templateImageName: "Icons_Tabbar_Certificates")
)
]
} else {
shortcutItems = [
UIApplicationShortcutItem(
type: QuickAction.diaryNewEntry.rawValue,
localizedTitle: AppStrings.QuickActions.contactDiaryNewEntry,
localizedSubtitle: nil,
icon: UIApplicationShortcutIcon(templateImageName: "book.closed")
),
UIApplicationShortcutItem(
type: QuickAction.showCertificates.rawValue,
localizedTitle: AppStrings.QuickActions.showCertificates,
localizedSubtitle: nil,
icon: UIApplicationShortcutIcon(templateImageName: "Icons_Tabbar_Certificates")
)
]

let status = AVCaptureDevice.authorizationStatus(for: .video)
if status == .authorized || status == .notDetermined {
// dont show camera related actions if no camera access is granted
shortcutItems.append(
contentsOf: [
UIApplicationShortcutItem(
type: QuickAction.eventCheckin.rawValue,
localizedTitle: AppStrings.QuickActions.eventCheckin,
localizedSubtitle: nil,
icon: UIApplicationShortcutIcon(templateImageName: "Icons_Tabbar_Checkin")
),
UIApplicationShortcutItem(
type: QuickAction.qrCodeScanner.rawValue,
localizedTitle: AppStrings.QuickActions.qrCodeScanner,
localizedSubtitle: nil,
icon: UIApplicationShortcutIcon(templateImageName: "qrcode.viewfinder")
)
]
)
}
}

application.shortcutItems = shortcutItems
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ final class HealthCertificateCoordinator {
private var validationCoordinator: HealthCertificateValidationCoordinator?

private var infoScreenShown: Bool {
get { store.healthCertificateInfoScreenShown }
get {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the usage of this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question!
The usage is, that the info screen has texts like "Add certificates" and that would be not a use case in hibernation, because we only show certificates. Thatswhy I change the getter for hibernation and skip the info screen at this point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that's a first (and maybe the only) move reg. corona-warn-app/cwa-documentation#950?

if CWAHibernationProvider.shared.isHibernationState {
return true
} else {
return store.healthCertificateInfoScreenShown
}
}
set { store.healthCertificateInfoScreenShown = newValue }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@ final class HealthCertificatesTabCoordinator {
private var printNavigationController: UINavigationController!

private var infoScreenShown: Bool {
get { store.healthCertificateInfoScreenShown }
get {
if CWAHibernationProvider.shared.isHibernationState {
return true
} else {
return store.healthCertificateInfoScreenShown
}
}
set { store.healthCertificateInfoScreenShown = newValue }
}

Expand Down