Skip to content
Open
Show file tree
Hide file tree
Changes from all 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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import BitwardenKit
import BitwardenResources

// MARK: - SessionTimeoutValue

/// An enumeration of session timeout values to choose from.
/// BWA does not use the custom value.
///
extension SessionTimeoutValue: @retroactive CaseIterable, Menuable {
extension SessionTimeoutValue: @retroactive CaseIterable {
/// All of the cases to show in the menu.
public static let allCases: [Self] = [
.immediately,
Expand All @@ -19,30 +18,4 @@ extension SessionTimeoutValue: @retroactive CaseIterable, Menuable {
.onAppRestart,
.never,
]

/// The localized string representation of a `SessionTimeoutValue`.
public var localizedName: String {
switch self {
case .immediately:
Localizations.immediately
case .oneMinute:
Localizations.xMinutes(1)
case .fiveMinutes:
Localizations.xMinutes(5)
case .fifteenMinutes:
Localizations.xMinutes(15)
case .thirtyMinutes:
Localizations.xMinutes(30)
case .oneHour:
Localizations.oneHour
case .fourHours:
Localizations.fourHours
case .onAppRestart:
Localizations.onRestart
case .never:
Localizations.never
case .custom:
Localizations.custom
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ final class SessionTimeoutValueTests: BitwardenTestCase {
XCTAssertEqual(SessionTimeoutValue.fiveMinutes.localizedName, Localizations.xMinutes(5))
XCTAssertEqual(SessionTimeoutValue.fifteenMinutes.localizedName, Localizations.xMinutes(15))
XCTAssertEqual(SessionTimeoutValue.thirtyMinutes.localizedName, Localizations.xMinutes(30))
XCTAssertEqual(SessionTimeoutValue.oneHour.localizedName, Localizations.oneHour)
XCTAssertEqual(SessionTimeoutValue.fourHours.localizedName, Localizations.fourHours)
XCTAssertEqual(SessionTimeoutValue.oneHour.localizedName, Localizations.xHours(1))
XCTAssertEqual(SessionTimeoutValue.fourHours.localizedName, Localizations.xHours(4))
XCTAssertEqual(SessionTimeoutValue.onAppRestart.localizedName, Localizations.onRestart)
XCTAssertEqual(SessionTimeoutValue.never.localizedName, Localizations.never)
XCTAssertEqual(SessionTimeoutValue.custom(123).localizedName, Localizations.custom)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@testable import AuthenticatorShared
import BitwardenKit

class MockPasteboardService: PasteboardService {
var clearClipboardValue: ClearClipboardValue = .never
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ enum TotpPeriodOptions: Int, Menuable, CaseIterable {
var localizedName: String {
switch self {
case .thirty:
Localizations.thirtySeconds
Localizations.xSeconds(30)
case .sixty:
Localizations.sixtySeconds
Localizations.xSeconds(60)
case .ninety:
Localizations.ninetySeconds
Localizations.xSeconds(90)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import BitwardenKit
import BitwardenResources
import Foundation

// MARK: - ClearClipboardValue

/// The time after which the clipboard should be cleared.
///
enum ClearClipboardValue: Int, Menuable {
public enum ClearClipboardValue: Int, Menuable {
/// Do not clear the clipboard.
case never = -1

Expand All @@ -29,7 +28,7 @@ enum ClearClipboardValue: Int, Menuable {
case fiveMinutes = 300

/// All of the cases to show in the menu, in order.
static let allCases: [Self] = [
public static let allCases: [Self] = [
.never,
.tenSeconds,
.twentySeconds,
Expand All @@ -40,16 +39,16 @@ enum ClearClipboardValue: Int, Menuable {
]

/// The name of the value to display in the menu.
var localizedName: String {
public var localizedName: String {
switch self {
case .never:
Localizations.never
case .tenSeconds:
Localizations.tenSeconds
Localizations.xSeconds(10)
case .twentySeconds:
Localizations.twentySeconds
Localizations.xSeconds(20)
case .thirtySeconds:
Localizations.thirtySeconds
Localizations.xSeconds(30)
case .oneMinute:
Localizations.xMinutes(1)
case .twoMinutes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import XCTest

import BitwardenKit
import BitwardenResources
@testable import BitwardenShared
import XCTest

class ClearClipboardValueTests: BitwardenTestCase {
// MARK: Tests

/// `localizedName` returns the correct values.
func test_localizedName() {
XCTAssertEqual(ClearClipboardValue.never.localizedName, Localizations.never)
XCTAssertEqual(ClearClipboardValue.tenSeconds.localizedName, Localizations.tenSeconds)
XCTAssertEqual(ClearClipboardValue.twentySeconds.localizedName, Localizations.twentySeconds)
XCTAssertEqual(ClearClipboardValue.thirtySeconds.localizedName, Localizations.thirtySeconds)
XCTAssertEqual(ClearClipboardValue.tenSeconds.localizedName, Localizations.xSeconds(10))
XCTAssertEqual(ClearClipboardValue.twentySeconds.localizedName, Localizations.xSeconds(20))
XCTAssertEqual(ClearClipboardValue.thirtySeconds.localizedName, Localizations.xSeconds(30))
XCTAssertEqual(ClearClipboardValue.oneMinute.localizedName, Localizations.xMinutes(1))
XCTAssertEqual(ClearClipboardValue.twoMinutes.localizedName, Localizations.xMinutes(2))
XCTAssertEqual(ClearClipboardValue.fiveMinutes.localizedName, Localizations.xMinutes(5))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import BitwardenResources

// MARK: - SessionTimeoutValue

/// An enumeration of session timeout values to choose from.
///
public enum SessionTimeoutValue: Codable, RawRepresentable, Equatable, Hashable, Sendable {
public enum SessionTimeoutValue: Codable, RawRepresentable, Equatable, Hashable, Menuable, Sendable {
/// Time out immediately.
case immediately

Expand Down Expand Up @@ -38,6 +40,32 @@ public enum SessionTimeoutValue: Codable, RawRepresentable, Equatable, Hashable,
rawValue * 60
}

/// The localized string representation of a `SessionTimeoutValue`.
public var localizedName: String {
switch self {
case .immediately:
Localizations.immediately
case .oneMinute:
Localizations.xMinutes(1)
case .fiveMinutes:
Localizations.xMinutes(5)
case .fifteenMinutes:
Localizations.xMinutes(15)
case .thirtyMinutes:
Localizations.xMinutes(30)
case .oneHour:
Localizations.xHours(1)
case .fourHours:
Localizations.xHours(4)
case .onAppRestart:
Localizations.onRestart
case .never:
Localizations.never
case .custom:
Localizations.custom
}
}

/// The session timeout value in minutes.
public var rawValue: Int {
switch self {
Expand Down
14 changes: 0 additions & 14 deletions BitwardenResources/Localizations/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@
"LastSync" = "Last sync:";
"Length" = "Length";
"Lock" = "Lock";
"OneHour" = "1 hour";
"FourHours" = "4 hours";
"Immediately" = "Immediately";
"VaultTimeout" = "Vault timeout";
"VaultTimeoutAction" = "Vault timeout action";
Expand Down Expand Up @@ -439,9 +437,6 @@
"VaultLockedIdentity" = "Your vault is locked. Verify your identity to continue.";
"Dark" = "Dark";
"Light" = "Light";
"TenSeconds" = "10 seconds";
"ThirtySeconds" = "30 seconds";
"TwentySeconds" = "20 seconds";
"ClearClipboard" = "Clear clipboard";
"ClearClipboardDescription" = "Automatically clear copied values from your clipboard.";
"DefaultUriMatchDetection" = "Default URI match detection";
Expand Down Expand Up @@ -584,11 +579,6 @@
"SendDeleted" = "Send deleted";
"SendUpdated" = "Send saved";
"NewSendCreated" = "Send created";
"OneDay" = "1 day";
"TwoDays" = "2 days";
"ThreeDays" = "3 days";
"SevenDays" = "7 days";
"ThirtyDays" = "30 days";
"Custom" = "Custom";
"ShareOnSave" = "Share this Send upon save";
"SendDisabledWarning" = "Due to an enterprise policy, you are only able to delete an existing Send.";
Expand Down Expand Up @@ -841,7 +831,6 @@
"OneHourAndXMinute" = "One hour and %1$@ minutes";
"XHoursAndOneMinute" = "%1$@ hours and one minute";
"XHoursAndYMinutes" = "%1$@ hours and %2$@ minutes";
"XHours" = "%1$@ hours";
"PasskeyManagementExplanationLong" = "Use Bitwarden to save new passkeys and log in with passkeys stored in your vault.";
"AutofillServicesExplanationLong" = "The Android Autofill Framework is used to assist in filling login information into other apps on your device.";
"UseInlineAutofillExplanationLong" = "Use inline autofill if your selected keyboard supports it. Otherwise, use the default overlay.";
Expand Down Expand Up @@ -1147,7 +1136,6 @@
"LoggingDuration" = "Logging duration";
"LogsWillBeAutomaticallyDeletedAfter30DaysDescriptionLong" = "Logs will be automatically deleted after 30 days. Bitwarden is only able to access your log data when you share it.";
"ForDetailsOnWhatIsAndIsntLoggedVisitTheBitwardenHelpCenter" = "For details on what is and isnโ€™t logged, visit the **[Bitwarden help center](%1$@)**.";
"OneWeek" = "1 week";
"ShowMore" = "Show more";
"ShowLess" = "Show less";
"ItemNameX" = "Item name, %1$@";
Expand Down Expand Up @@ -1242,7 +1230,6 @@
"LearnMoreLink" = "[Learn more](%1$@)";
"LocalCodes" = "Local codes";
"NeedHelpVisitOurHelpCenterForGuidance" = "Need help? Visit our Help Center for guidance.";
"NinetySeconds" = "90 seconds";
"NoAskMe" = "No, ask me";
"NoCodes" = "You donโ€™t have any codes to display";
"None" = "None";
Expand All @@ -1260,7 +1247,6 @@
"SetSaveLocallyAsYourDefaultSaveOption" = "Set โ€œSave locallyโ€ as your default save option?";
"SetSaveToBitwardenAsYourDefaultSaveOption" = "Set โ€œSave to Bitwardenโ€ as your default save option?";
"SignInUsingUniqueCodes" = "Sign in using unique codes";
"SixtySeconds" = "60 seconds";
"Skip" = "Skip";
"Steam" = "Steam";
"StoreAllOfYourLoginsAndSyncVerificationCodesDirectlyWithTheAuthenticatorApp" = "Store all of your logins and sync verification codes directly with the Authenticator app.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,41 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- A number of days, used in menu selections. For example, the number of days to keep a send before deletion. -->
<key>XDays</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@days@</string>
<key>days</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>%d day</string>
<key>other</key>
<string>%d days</string>
</dict>
</dict>
<!-- A number of hours, used in menu selections. For example, how long to log events in the flight recorder. -->
<key>XHours</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@hours@</string>
<key>hours</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>%d hour</string>
<key>other</key>
<string>%d hours</string>
</dict>
</dict>
<!-- A number of minutes, used in menu selections. For example, the amount of time to keep the vault unlocked after being unlocked. -->
<key>XMinutes</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
Expand All @@ -18,5 +53,39 @@
<string>%d minutes</string>
</dict>
</dict>
<!-- A number of seconds, used in menu selection. For example, how long to keep copied fields in the clipboard before clearing. -->
<key>XSeconds</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@seconds@</string>
<key>seconds</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>%d second</string>
<key>other</key>
<string>%d seconds</string>
</dict>
</dict>
<!-- A number of weeks, used in menu selection. For example, how long to log events in the flight recorder. -->
<key>XWeeks</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@weeks@</string>
<key>weeks</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>%d week</string>
<key>other</key>
<string>%d weeks</string>
</dict>
</dict>
</dict>
</plist>
Loading