Skip to content

Commit

Permalink
Merge pull request #903 from Infomaniak/hide-lock-option-if-unavailable
Browse files Browse the repository at this point in the history
feat(SettingsView): Display lock settings if available
  • Loading branch information
adrien-coye committed Jul 28, 2023
2 parents 0e1cb62 + 2290999 commit 0766c9c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
30 changes: 15 additions & 15 deletions .package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/ProxymanApp/atlantis",
"state" : {
"revision" : "f6f7be1330bd4f847b6d52278acd88516eaac471",
"version" : "1.21.1"
"revision" : "cfa72085bce2600b28e47fdbbbfa2d5b96f0392b",
"version" : "1.22.0"
}
},
{
Expand All @@ -41,16 +41,16 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Infomaniak/ios-core",
"state" : {
"revision" : "703685e70f20e4cf802f98a918b157918dadb377"
"revision" : "4eaefd644f75d833d6b1009dd94a9d6d674ccb53"
}
},
{
"identity" : "ios-core-ui",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Infomaniak/ios-core-ui",
"state" : {
"revision" : "57104919b320d5b0d1bcb4d92a3e8117e98dabb6",
"version" : "2.5.0"
"revision" : "e9a466563a94d92cde8e8c3e48cf94879212de63",
"version" : "2.5.2"
}
},
{
Expand Down Expand Up @@ -139,8 +139,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/kean/Nuke",
"state" : {
"revision" : "c3864b8882bc69f5edfe5c70e18786c91d228b28",
"version" : "12.1.3"
"revision" : "989586f86b683680f7bd5765d6a5683edbea0c1b",
"version" : "12.1.4"
}
},
{
Expand All @@ -157,26 +157,26 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/realm/realm-core.git",
"state" : {
"revision" : "f1434caadda443b4ed2261b91ea4f43ab1ee2aa5",
"version" : "13.15.1"
"revision" : "f1e962cd447f8b69f8f7cf46a188b1c6246923c5",
"version" : "13.17.0"
}
},
{
"identity" : "realm-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/realm/realm-swift",
"state" : {
"revision" : "b287dc102036ff425bd8a88483f0a5596871f05e",
"version" : "10.41.0"
"revision" : "0155caac1a0830a9fbaaffe5866b909fad3a6fc4",
"version" : "10.41.1"
}
},
{
"identity" : "sentry-cocoa",
"kind" : "remoteSourceControl",
"location" : "https://github.com/getsentry/sentry-cocoa",
"state" : {
"revision" : "d277532e1c8af813981ba01f591b15bbdd735615",
"version" : "8.8.0"
"revision" : "259d8bc75aa4028416535d35840ff19fc7661292",
"version" : "8.9.3"
}
},
{
Expand Down Expand Up @@ -246,8 +246,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/siteline/SwiftUI-Introspect",
"state" : {
"revision" : "adb9e7a69fd75322dcdee0c20f2fb6640d6f0087",
"version" : "0.9.0"
"revision" : "ccb973cfff703cba53fb88197413485c060eb26b",
"version" : "0.10.0"
}
},
{
Expand Down
19 changes: 12 additions & 7 deletions Mail/Views/Settings/General/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@

import InfomaniakCore
import InfomaniakCoreUI
import InfomaniakDI
import MailCore
import MailResources
import SwiftUI

struct SettingsView: View {
@EnvironmentObject private var mailboxManager: MailboxManager

@LazyInjectService private var appLockHelper: AppLockHelper

@AppStorage(UserDefaults.shared.key(.threadDensity)) private var density = DefaultPreferences.threadDensity
@AppStorage(UserDefaults.shared.key(.theme)) private var theme = DefaultPreferences.theme
@AppStorage(UserDefaults.shared.key(.accentColor)) private var accentColor = DefaultPreferences.accentColor
Expand Down Expand Up @@ -52,13 +55,15 @@ struct SettingsView: View {
Text(MailResourcesStrings.Localizable.settingsSectionGeneral)
.textStyle(.bodySmallSecondary)

SettingsToggleCell(
title: MailResourcesStrings.Localizable.settingsAppLock,
userDefaults: \.isAppLockEnabled,
matomoCategory: .settingsGeneral,
matomoName: "lock"
)
.settingCellModifier()
if appLockHelper.isAvailable {
SettingsToggleCell(
title: MailResourcesStrings.Localizable.settingsAppLock,
userDefaults: \.isAppLockEnabled,
matomoCategory: .settingsGeneral,
matomoName: "lock"
)
.settingCellModifier()
}

SettingsSubMenuCell(title: MailResourcesStrings.Localizable.settingsMailboxGeneralNotifications) {
SettingsNotificationsView()
Expand Down
4 changes: 2 additions & 2 deletions Mail/Views/Settings/SettingsToggleCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import MailResources
import SwiftUI

struct SettingsToggleCell: View {
@LazyInjectService var appLockHelper: AppLockHelper
@LazyInjectService var matomo: MatomoUtils
@LazyInjectService private var appLockHelper: AppLockHelper
@LazyInjectService private var matomo: MatomoUtils

let title: String
let userDefaults: ReferenceWritableKeyPath<UserDefaults, Bool>
Expand Down
4 changes: 2 additions & 2 deletions Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ let project = Project(name: "Mail",
packages: [
.package(url: "https://github.com/Infomaniak/ios-login", .upToNextMajor(from: "4.0.0")),
.package(url: "https://github.com/Infomaniak/ios-dependency-injection", .upToNextMajor(from: "1.1.6")),
.package(url: "https://github.com/Infomaniak/ios-core", .revision("703685e70f20e4cf802f98a918b157918dadb377")),
.package(url: "https://github.com/Infomaniak/ios-core-ui", .upToNextMajor(from: "2.3.0")),
.package(url: "https://github.com/Infomaniak/ios-core", .revision("4eaefd644f75d833d6b1009dd94a9d6d674ccb53")),
.package(url: "https://github.com/Infomaniak/ios-core-ui", .upToNextMajor(from: "2.5.2")),
.package(url: "https://github.com/Infomaniak/ios-notifications", .upToNextMajor(from: "3.0.0")),
.package(url: "https://github.com/Infomaniak/ios-create-account", .upToNextMajor(from: "1.1.0")),
.package(url: "https://github.com/Infomaniak/ios-bug-tracker", .upToNextMajor(from: "2.0.0")),
Expand Down

0 comments on commit 0766c9c

Please sign in to comment.