Skip to content

Commit 8bb7d69

Browse files
committed
Merge branch 'main' into cmcg/pm-19305-vault-timeout-policy
2 parents e404cb3 + 25b9cd7 commit 8bb7d69

File tree

64 files changed

+288
-869
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+288
-869
lines changed

.github/workflows/ci-bwa.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@ on:
4242
type: boolean
4343
default: true
4444
xcode-version:
45-
description: "Xcode Version Override - e.g. '15.2'"
46-
type: string
45+
description: "Xcode Version Override - e.g. '15.2'"
46+
type: string
4747

4848
permissions:
4949
contents: read
50-
id-token: write
5150

5251
jobs:
5352
version:
@@ -64,6 +63,8 @@ jobs:
6463
build-manual:
6564
name: Build Manual - ${{ inputs.build-mode }}
6665
needs: version
66+
permissions:
67+
id-token: write
6768
if: ${{ github.event_name == 'workflow_dispatch' && inputs.build-mode != 'CI' }}
6869
uses: bitwarden/ios/.github/workflows/_build-any.yml@main
6970
with:
@@ -79,6 +80,8 @@ jobs:
7980
build-public:
8081
name: Build CI
8182
needs: version
83+
permissions:
84+
id-token: write
8285
if: ${{ github.event_name == 'push' || inputs.build-mode == 'CI' }}
8386
uses: bitwarden/ios/.github/workflows/_build-any.yml@main
8487
strategy:

.github/workflows/ci-bwpm.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ on:
4545
type: boolean
4646
default: true
4747
xcode-version:
48-
description: "Xcode Version Override - e.g. '15.2'"
49-
type: string
48+
description: "Xcode Version Override - e.g. '15.2'"
49+
type: string
5050

5151
permissions:
5252
contents: read
53-
id-token: write
5453

5554
jobs:
5655
version:
@@ -67,6 +66,8 @@ jobs:
6766
build-manual:
6867
name: Build Manual - ${{ inputs.build-variant }} (${{ inputs.build-mode }})
6968
needs: version
69+
permissions:
70+
id-token: write
7071
if: ${{ github.event_name == 'workflow_dispatch' && inputs.build-mode != 'CI' }}
7172
uses: bitwarden/ios/.github/workflows/_build-any.yml@main
7273
with:
@@ -82,6 +83,8 @@ jobs:
8283
build-public:
8384
name: Build CI
8485
needs: version
86+
permissions:
87+
id-token: write
8588
if: ${{ github.event_name == 'push' || inputs.build-mode == 'CI' }}
8689
uses: bitwarden/ios/.github/workflows/_build-any.yml@main
8790
strategy:

AuthenticatorShared/Core/Platform/Models/Enum/LanguageOption.swift

Lines changed: 0 additions & 158 deletions
This file was deleted.

AuthenticatorShared/Core/Platform/Models/Enum/LanguageOptionTests.swift

Lines changed: 0 additions & 34 deletions
This file was deleted.

AuthenticatorShared/Core/Platform/Services/ErrorReporter/BitwardenError.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ enum BitwardenError {
1919

2020
/// An error occurred with data from the API.
2121
case dataError = 3000
22+
23+
/// A general-purpose error.
24+
case generalError = 4000
2225
}
2326

2427
// MARK: Errors
@@ -37,6 +40,25 @@ enum BitwardenError {
3740
)
3841
}
3942

43+
/// A general-purpose error.
44+
///
45+
/// - Parameters:
46+
/// - type: The type of error. This is used to group the errors in the Crashlytics dashboard.
47+
/// - message: A message describing the error that occurred.
48+
/// - error: An optional underlying error that caused the error.
49+
///
50+
static func generalError(type: String, message: String, error: Error? = nil) -> NSError {
51+
var userInfo: [String: Any] = ["ErrorMessage": message]
52+
if let error {
53+
userInfo[NSUnderlyingErrorKey] = error
54+
}
55+
return NSError(
56+
domain: "General Error: \(type)",
57+
code: Code.generalError.rawValue,
58+
userInfo: userInfo,
59+
)
60+
}
61+
4062
/// An error that occurred persisting the generator options.
4163
///
4264
/// - Parameter error: The underlying error that caused the logout error.

AuthenticatorShared/Core/Platform/Services/ServiceContainer.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public class ServiceContainer: Services {
4747
/// The service used by the application to encrypt and decrypt items
4848
let cryptographyService: CryptographyService
4949

50+
/// A helper for building an error report containing the details of an error that occurred.
51+
public let errorReportBuilder: ErrorReportBuilder
52+
5053
/// The service used by the application to report non-fatal errors.
5154
public let errorReporter: ErrorReporter
5255

@@ -93,6 +96,8 @@ public class ServiceContainer: Services {
9396
/// - clientService: The service used by the application to handle encryption and decryption tasks.
9497
/// - configService: The service to get locally-specified configuration.
9598
/// - cryptographyService: The service used by the application to encrypt and decrypt items
99+
/// - errorReportBuilder: A helper for building an error report containing the details of an
100+
/// error that occurred.
96101
/// - errorReporter: The service used by the application to report non-fatal errors.
97102
/// - exportItemsService: The service to export items.
98103
/// - importItemsService: The service to import items.
@@ -115,6 +120,7 @@ public class ServiceContainer: Services {
115120
clientService: ClientService,
116121
configService: ConfigService,
117122
cryptographyService: CryptographyService,
123+
errorReportBuilder: ErrorReportBuilder,
118124
errorReporter: ErrorReporter,
119125
exportItemsService: ExportItemsService,
120126
importItemsService: ImportItemsService,
@@ -136,6 +142,7 @@ public class ServiceContainer: Services {
136142
self.clientService = clientService
137143
self.configService = configService
138144
self.cryptographyService = cryptographyService
145+
self.errorReportBuilder = errorReportBuilder
139146
self.errorReporter = errorReporter
140147
self.exportItemsService = exportItemsService
141148
self.importItemsService = importItemsService
@@ -186,6 +193,11 @@ public class ServiceContainer: Services {
186193
environmentService: environmentService,
187194
)
188195

196+
let errorReportBuilder = DefaultErrorReportBuilder(
197+
activeAccountStateProvider: stateService,
198+
appInfoService: appInfoService,
199+
)
200+
189201
let timeProvider = CurrentTime()
190202
let totpExpirationManagerFactory = DefaultTOTPExpirationManagerFactory(timeProvider: timeProvider)
191203

@@ -305,6 +317,7 @@ public class ServiceContainer: Services {
305317
clientService: clientService,
306318
configService: configService,
307319
cryptographyService: cryptographyService,
320+
errorReportBuilder: errorReportBuilder,
308321
errorReporter: errorReporter,
309322
exportItemsService: exportItemsService,
310323
importItemsService: importItemsService,

AuthenticatorShared/Core/Platform/Services/Services.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ typealias Services = HasAppInfoService
1010
& HasCameraService
1111
& HasConfigService
1212
& HasCryptographyService
13+
& HasErrorReportBuilder
1314
& HasErrorReporter
1415
& HasExportItemsService
1516
& HasImportItemsService

AuthenticatorShared/Core/Platform/Services/TestHelpers/ServiceContainer+Mocks.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ extension ServiceContainer {
1717
clientService: ClientService = MockClientService(),
1818
configService: ConfigService = MockConfigService(),
1919
cryptographyService: CryptographyService = MockCryptographyService(),
20+
errorReportBuilder: ErrorReportBuilder = MockErrorReportBuilder(),
2021
errorReporter: ErrorReporter = MockErrorReporter(),
2122
exportItemsService: ExportItemsService = MockExportItemsService(),
2223
importItemsService: ImportItemsService = MockImportItemsService(),
@@ -39,6 +40,7 @@ extension ServiceContainer {
3940
clientService: clientService,
4041
configService: configService,
4142
cryptographyService: cryptographyService,
43+
errorReportBuilder: errorReportBuilder,
4244
errorReporter: errorReporter,
4345
exportItemsService: exportItemsService,
4446
importItemsService: importItemsService,

AuthenticatorShared/UI/Auth/AuthCoordinator.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ final class AuthCoordinator: NSObject, Coordinator, HasStackNavigator, HasRouter
2323
typealias Router = AnyRouter<AuthEvent, AuthRoute>
2424

2525
typealias Services = HasBiometricsRepository
26+
& HasErrorAlertServices.ErrorAlertServices
2627
& HasErrorReporter
2728

2829
// MARK: Properties
@@ -111,3 +112,9 @@ final class AuthCoordinator: NSObject, Coordinator, HasStackNavigator, HasRouter
111112
stackNavigator?.replace(view, animated: true)
112113
}
113114
}
115+
116+
// MARK: - HasErrorAlertServices
117+
118+
extension AuthCoordinator: HasErrorAlertServices {
119+
var errorAlertServices: ErrorAlertServices { services }
120+
}

0 commit comments

Comments
 (0)