mirror of
https://github.com/ProtonMail/ios-mail.git
synced 2026-06-14 09:54:45 +00:00
Align with latest Rust SDK API
This commit is contained in:
@@ -290,9 +290,9 @@ extension MailboxModel {
|
||||
|
||||
// These disconnects will prevent unrequested scroller callbacks
|
||||
// for the previous state. Call them before the Mailbox constructor.
|
||||
messageScroller?.handle().disconnect()
|
||||
messageScroller?.watchHandle().disconnect()
|
||||
messageScroller?.terminate()
|
||||
conversationScroller?.handle().disconnect()
|
||||
conversationScroller?.watchHandle().disconnect()
|
||||
conversationScroller?.terminate()
|
||||
|
||||
paginatedDataSource.resetToInitialState()
|
||||
|
||||
@@ -160,7 +160,7 @@ extension DraftPresenter {
|
||||
undoScheduleSendProvider: UndoScheduleSendProvider = .mockInstance
|
||||
) -> DraftPresenter {
|
||||
.init(
|
||||
userSession: .init(noPointer: .init()),
|
||||
userSession: .init(noHandle: .init()),
|
||||
draftProvider: .dummy,
|
||||
undoSendProvider: undoSendProvider,
|
||||
undoScheduleSendProvider: undoScheduleSendProvider
|
||||
|
||||
@@ -28,6 +28,6 @@ extension DraftProvider {
|
||||
}
|
||||
|
||||
static var dummy: Self {
|
||||
.init(makeDraft: { _, _ in NewDraftResult.ok(.init(noPointer: .init())) })
|
||||
.init(makeDraft: { _, _ in NewDraftResult.ok(.init(noHandle: .init())) })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,6 @@ extension LabelAsActions {
|
||||
|
||||
extension Undo {
|
||||
static var dummy: Undo {
|
||||
Undo(noPointer: .init())
|
||||
Undo(noHandle: .init())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ enum LabelAsSheetPreviewProvider {
|
||||
static func testData() -> LabelAsSheetModel {
|
||||
.init(
|
||||
input: .init(sheetType: .labelAs, ids: [], mailboxItem: .message(isLastMessageInCurrentLocation: false)),
|
||||
mailbox: .init(noPointer: .init()),
|
||||
mailbox: .init(noHandle: .init()),
|
||||
availableLabelAsActions: .init(
|
||||
message: { _, _ in .ok(testLabels()) },
|
||||
conversation: { _, _ in .ok([]) }
|
||||
|
||||
@@ -19,6 +19,6 @@ import proton_app_uniffi
|
||||
|
||||
extension MailUserSession {
|
||||
static var dummy: MailUserSession {
|
||||
.init(noPointer: .init())
|
||||
.init(noHandle: .init())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ import proton_app_uniffi
|
||||
|
||||
extension Mailbox {
|
||||
static var dummy: Mailbox {
|
||||
.init(noPointer: .init())
|
||||
.init(noHandle: .init())
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -126,8 +126,8 @@ struct AppProtectionSelectionScreen: View {
|
||||
.init(type: .faceID, isSelected: true),
|
||||
]
|
||||
),
|
||||
appSettingsRepository: MailSession(noPointer: .init()),
|
||||
appProtectionConfigurator: MailSession(noPointer: .init())
|
||||
appSettingsRepository: MailSession(noHandle: .init()),
|
||||
appProtectionConfigurator: MailSession(noHandle: .init())
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ struct AppSettingsScreen: View {
|
||||
NavigationStack {
|
||||
AppSettingsScreen(
|
||||
state: .initial(isDiscreetAppIconEnabled: false),
|
||||
customSettings: CustomSettings(noPointer: .init())
|
||||
customSettings: CustomSettings(noHandle: .init())
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,5 +205,5 @@ struct ReportProblemScreen: View {
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ReportProblemScreen(reportProblemService: MailUserSession(noPointer: .init()))
|
||||
ReportProblemScreen(reportProblemService: MailUserSession(noHandle: .init()))
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ private extension SettingsPreference {
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
SettingsScreen(
|
||||
mailUserSession: MailUserSession(noPointer: .init()),
|
||||
mailUserSession: MailUserSession(noHandle: .init()),
|
||||
accountAuthCoordinator: .mock(),
|
||||
upsellCoordinator: .init(mailUserSession: .dummy, configuration: .mail)
|
||||
)
|
||||
|
||||
@@ -26,10 +26,11 @@ final class MailboxStub: Mailbox, @unchecked Sendable {
|
||||
|
||||
init(viewMode: ViewMode) {
|
||||
self._viewMode = viewMode
|
||||
super.init(noPointer: .init())
|
||||
super.init(noHandle: .init())
|
||||
}
|
||||
|
||||
required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
||||
fatalError("init(unsafeFromRawPointer:) has not been implemented")
|
||||
@available(*, unavailable)
|
||||
required init(unsafeFromHandle handle: UInt64) {
|
||||
fatalError("init(unsafeFromHandle:) has not been implemented")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,6 @@ final class SidebarSpy: SidebarProtocol, @unchecked Sendable {
|
||||
let mappedIndex: CallbackIndex = lastIndex == -1 ? .folder : .init(rawValue: lastIndex + 1)!
|
||||
spiedWatchers[mappedIndex] = callback
|
||||
|
||||
return .ok(WatchHandleDummy(noPointer: .init()))
|
||||
return .ok(WatchHandleDummy(noHandle: .init()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ import proton_app_uniffi
|
||||
|
||||
extension MailUserSession {
|
||||
static var dummy: MailUserSession {
|
||||
.init(noPointer: .init())
|
||||
.init(noHandle: .init())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ import proton_app_uniffi
|
||||
|
||||
extension Mailbox {
|
||||
static var dummy: Mailbox {
|
||||
.init(noPointer: .init())
|
||||
.init(noHandle: .init())
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import XCTest
|
||||
@MainActor
|
||||
class SettingsScreenSnapshotTests: BaseTestCase {
|
||||
func testSettingsScreenLayoutsCorrectOnIphoneX() {
|
||||
let store = AppAppearanceStore(mailSession: { MailSession(noPointer: .init()) })
|
||||
let store = AppAppearanceStore(mailSession: { MailSession(noHandle: .init()) })
|
||||
let mailUserSession = MailUserSessionSpy(id: "")
|
||||
mailUserSession.stubbedAccountDetails = .testData
|
||||
mailUserSession.stubbedUser = .testData
|
||||
|
||||
@@ -35,7 +35,7 @@ final class SceneDelegateTests: BaseTestCase {
|
||||
sut = .init()
|
||||
mailSessionSpy = .init()
|
||||
sut.appProtectionStore = .init(mailSession: { self.mailSessionSpy })
|
||||
sut.mailSessionFactory = { .init(noPointer: .init()) }
|
||||
sut.mailSessionFactory = { .init(noHandle: .init()) }
|
||||
sut.checkAutoLockSetting = { completion in completion(self.shouldAutoLockStub) }
|
||||
sut.transitionAnimation = { _, _, _, animation, completion in
|
||||
animation?()
|
||||
|
||||
@@ -33,7 +33,7 @@ final class DeviceTokenRegistrarTests {
|
||||
var lastCreatedHandle: RegisterDeviceTaskHandleSpy?
|
||||
|
||||
mailSession.stubbedRegisterDeviceTaskHandleFactory = {
|
||||
let newHandle = RegisterDeviceTaskHandleSpy(noPointer: .init())
|
||||
let newHandle = RegisterDeviceTaskHandleSpy(noHandle: .init())
|
||||
lastCreatedHandle = newHandle
|
||||
return newHandle
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ final class DraftPresenterTests: BaseTestCase, @unchecked Sendable {
|
||||
|
||||
@MainActor
|
||||
func testOpenDraftWithContact_ItCreatesEmptyDraftAddRecipientAndOpensDraft() async throws {
|
||||
let draftSpy = DraftSpy(noPointer: .init())
|
||||
let draftSpy = DraftSpy(noHandle: .init())
|
||||
sut = makeSUT(stubbedNewDraftResult: .ok(draftSpy))
|
||||
|
||||
var capturedDraftToPresent: [DraftToPresent] = []
|
||||
@@ -123,7 +123,7 @@ final class DraftPresenterTests: BaseTestCase, @unchecked Sendable {
|
||||
|
||||
@MainActor
|
||||
func testOpenDraftWithContactGroup_ItCreatesEmptyDraftAddGroupAndOpensDraft() async throws {
|
||||
let draftSpy = DraftSpy(noPointer: .init())
|
||||
let draftSpy = DraftSpy(noHandle: .init())
|
||||
sut = makeSUT(stubbedNewDraftResult: .ok(draftSpy))
|
||||
|
||||
var capturedDraftToPresent: [DraftToPresent] = []
|
||||
@@ -292,13 +292,13 @@ extension DraftPresenterTests {
|
||||
}
|
||||
|
||||
private extension Draft {
|
||||
static var dummyDraft: Draft { .init(noPointer: .init()) }
|
||||
static var dummyDraft: Draft { .init(noHandle: .init()) }
|
||||
}
|
||||
|
||||
private class DraftSpy: Draft, @unchecked Sendable {
|
||||
let toRecipientsCalls: ComposerRecipientListSpy = .init(noPointer: .init())
|
||||
let ccRecipientsCalls: ComposerRecipientListSpy = .init(noPointer: .init())
|
||||
let bccRecipientsCalls: ComposerRecipientListSpy = .init(noPointer: .init())
|
||||
let toRecipientsCalls: ComposerRecipientListSpy = .init(noHandle: .init())
|
||||
let ccRecipientsCalls: ComposerRecipientListSpy = .init(noHandle: .init())
|
||||
let bccRecipientsCalls: ComposerRecipientListSpy = .init(noHandle: .init())
|
||||
private(set) var setSubjectCalls: [String] = []
|
||||
private(set) var setBodyCalls: [String] = []
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ final class LabelAsSheetModelTests {
|
||||
private var invokedAvailableActionsWithConversationIDs: [ID] = []
|
||||
private var invokedDismissCount = 0
|
||||
private var stubbedLabelAsActions: [LabelAsAction] = []
|
||||
private var stubbedLabelAsOutput: LabelAsOutput = .init(inputLabelIsEmpty: false, undo: UndoSpy(noPointer: .init()))
|
||||
private var stubbedLabelAsOutput: LabelAsOutput = .init(inputLabelIsEmpty: false, undo: UndoSpy(noHandle: .init()))
|
||||
|
||||
private var toastStateStore = ToastStateStore(initialState: .initial)
|
||||
private var invokedLabelMessage: [LabelAsExecutedWithData] = []
|
||||
@@ -175,7 +175,7 @@ final class LabelAsSheetModelTests {
|
||||
private func sut(ids: [ID], type: MailboxItemType) -> LabelAsSheetModel {
|
||||
LabelAsSheetModel(
|
||||
input: .init(sheetType: .labelAs, ids: ids, mailboxItem: type.mailboxItem),
|
||||
mailbox: .init(noPointer: .init()),
|
||||
mailbox: .init(noHandle: .init()),
|
||||
availableLabelAsActions: .init(
|
||||
message: { _, ids in
|
||||
self.invokedAvailableActionsWithMessagesIDs = ids
|
||||
@@ -220,7 +220,7 @@ final class LabelAsSheetModelTests {
|
||||
itemType: MailboxItemType,
|
||||
spyToVerify: () -> [LabelAsExecutedWithData]
|
||||
) async throws {
|
||||
let undoSpy = UndoSpy(noPointer: .init())
|
||||
let undoSpy = UndoSpy(noHandle: .init())
|
||||
let selectedLabelID: ID = .init(value: 2)
|
||||
let partiallySelectedLabelID: ID = .init(value: 4)
|
||||
stubbedLabelAsActions = [
|
||||
@@ -257,7 +257,7 @@ final class LabelAsSheetModelTests {
|
||||
spyToVerify: () -> [LabelAsExecutedWithData],
|
||||
expectToastMessage: LocalizedStringResource
|
||||
) async throws {
|
||||
let undoSpy = UndoSpy(noPointer: .init())
|
||||
let undoSpy = UndoSpy(noHandle: .init())
|
||||
let selectedLabelID: ID = .init(value: 2)
|
||||
let partiallySelectedLabelID: ID = .init(value: 4)
|
||||
stubbedLabelAsActions = [
|
||||
|
||||
@@ -248,7 +248,7 @@ class ListActionsToolbarStoreTests {
|
||||
func action_WhenMoveToInboxIsTappedUndoIsAvailbleAndTapped_ItTriggersUndoAndDismissesToast() async throws {
|
||||
let ids: [ID] = [.init(value: 7), .init(value: 77)]
|
||||
let systemFolder = MovableSystemFolderAction.testInbox
|
||||
let undoSpy = UndoSpy(noPointer: .init())
|
||||
let undoSpy = UndoSpy(noHandle: .init())
|
||||
let viewMode = ViewMode.messages
|
||||
moveToActionsSpy.stubbedMoveMessagesToOkResult = undoSpy
|
||||
sut = makeSUT(viewMode: viewMode)
|
||||
|
||||
@@ -29,7 +29,7 @@ final class MoveToActionPerformerTests: BaseTestCase {
|
||||
super.setUp()
|
||||
|
||||
sut = .init(
|
||||
mailbox: .init(noPointer: .init()),
|
||||
mailbox: .init(noHandle: .init()),
|
||||
moveToActions: .init(
|
||||
moveMessagesTo: { [unowned self] _, _, _ in stubbedResult },
|
||||
moveConversationsTo: { [unowned self] _, _, _ in stubbedResult }
|
||||
|
||||
@@ -108,7 +108,7 @@ final class MoveToSheetStateStoreTests {
|
||||
|
||||
@Test
|
||||
func action_WhenInboxIsTappedUndoIsAvailableAndTapped_ItTriggersUndoAndDismissesToast() async throws {
|
||||
let undoSpy = UndoSpy(noPointer: .init())
|
||||
let undoSpy = UndoSpy(noHandle: .init())
|
||||
moveToActionsSpy.stubbedMoveMessagesToOkResult = undoSpy
|
||||
|
||||
let sut = sut(
|
||||
@@ -155,7 +155,7 @@ final class MoveToSheetStateStoreTests {
|
||||
.init(
|
||||
state: .initial,
|
||||
input: input,
|
||||
mailbox: .init(noPointer: .init()),
|
||||
mailbox: .init(noHandle: .init()),
|
||||
availableMoveToActions: .init(
|
||||
message: { _, ids in
|
||||
self.invokedAvailableActionsWithMessagesIDs = ids
|
||||
|
||||
+4
-3
@@ -566,11 +566,12 @@ private final class DecryptedMessageSpy: DecryptedMessage, @unchecked Sendable {
|
||||
|
||||
init(stubbedOptions: TransformOpts) {
|
||||
self.stubbedOptions = stubbedOptions
|
||||
super.init(noPointer: .init())
|
||||
super.init(noHandle: .init())
|
||||
}
|
||||
|
||||
required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
||||
fatalError("init(unsafeFromRawPointer:) has not been implemented")
|
||||
@available(*, unavailable)
|
||||
required init(unsafeFromHandle handle: UInt64) {
|
||||
fatalError("init(unsafeFromHandle:) has not been implemented")
|
||||
}
|
||||
|
||||
private(set) var bodyWithOptionsCalls: [TransformOpts] = []
|
||||
|
||||
+1
-1
@@ -333,7 +333,7 @@ final class MessageAddressActionViewStateStoreTests {
|
||||
senderUnblocker: .init(
|
||||
mailbox: .dummy,
|
||||
wrapper: .init(
|
||||
messageBody: { _, _ in .ok(.init(noPointer: .init())) },
|
||||
messageBody: { _, _ in .ok(.init(noHandle: .init())) },
|
||||
markMessageHam: { _, _ in .ok },
|
||||
unblockSender: { _, emailAddress in
|
||||
await self.unblockSpy.result(for: emailAddress)
|
||||
|
||||
+4
-3
@@ -235,11 +235,12 @@ class BackgroundExecutionHandleStub: BackgroundExecutionHandle, @unchecked Senda
|
||||
private(set) var abortCalls: [Bool] = []
|
||||
|
||||
init() {
|
||||
super.init(noPointer: .init())
|
||||
super.init(noHandle: .init())
|
||||
}
|
||||
|
||||
required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
||||
fatalError("init(unsafeFromRawPointer:) has not been implemented")
|
||||
@available(*, unavailable)
|
||||
required init(unsafeFromHandle handle: UInt64) {
|
||||
fatalError("init(unsafeFromHandle:) has not been implemented")
|
||||
}
|
||||
|
||||
// MARK: - BackgroundExecutionHandle
|
||||
|
||||
@@ -127,7 +127,7 @@ struct ComposerLoadingView: View {
|
||||
ComposerScreen(
|
||||
draft: .emptyMock,
|
||||
draftOrigin: .new,
|
||||
dependencies: .init(contactProvider: .mockInstance, userSession: .init(noPointer: .init())),
|
||||
dependencies: .init(contactProvider: .mockInstance, userSession: .init(noHandle: .init())),
|
||||
onDismiss: { _ in }
|
||||
)
|
||||
.environmentObject(toastStateStore)
|
||||
|
||||
@@ -307,6 +307,6 @@ final class MockAttachmentList: AttachmentListProtocol, @unchecked Sendable {
|
||||
}
|
||||
|
||||
func watcherStream() async -> AttachmentListWatcherStreamResult {
|
||||
.ok(DraftAttachmentListUpdateStream.init(noPointer: .init()))
|
||||
.ok(DraftAttachmentListUpdateStream.init(noHandle: .init()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ final class ComposerScreenSnapshotTests: BaseTestCase {
|
||||
let composerScreen = ComposerScreen(
|
||||
draft: .emptyMock,
|
||||
draftOrigin: .new,
|
||||
dependencies: .init(contactProvider: .mockInstance, userSession: .init(noPointer: .init())),
|
||||
dependencies: .init(contactProvider: .mockInstance, userSession: .init(noHandle: .init())),
|
||||
onDismiss: { _ in }
|
||||
)
|
||||
.environmentObject(toastStateStore)
|
||||
|
||||
@@ -141,7 +141,7 @@ private extension Array where Element == ContactSuggestion {
|
||||
|
||||
private extension MailUserSession {
|
||||
static func empty() -> MailUserSession {
|
||||
MailUserSession(noPointer: .init())
|
||||
MailUserSession(noHandle: .init())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,11 +150,12 @@ private class ContactSuggestionsStub: ContactSuggestions, @unchecked Sendable {
|
||||
|
||||
init(all: [ContactSuggestion]) {
|
||||
_all = all
|
||||
super.init(noPointer: .init())
|
||||
super.init(noHandle: .init())
|
||||
}
|
||||
|
||||
required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
||||
fatalError("init(unsafeFromRawPointer:) has not been implemented")
|
||||
@available(*, unavailable)
|
||||
required init(unsafeFromHandle handle: UInt64) {
|
||||
fatalError("init(unsafeFromHandle:) has not been implemented")
|
||||
}
|
||||
|
||||
override func all() -> [ContactSuggestion] {
|
||||
|
||||
@@ -137,7 +137,7 @@ public struct ContactsScreen: View {
|
||||
#Preview {
|
||||
ContactsScreen(
|
||||
apiConfig: .debugPreview,
|
||||
mailUserSession: .init(noPointer: .init()),
|
||||
mailUserSession: .init(noHandle: .init()),
|
||||
contactsProvider: .previewInstance(),
|
||||
contactsWatcher: .previewInstance(),
|
||||
draftPresenter: ContactsDraftPresenterDummy()
|
||||
|
||||
+1
-1
@@ -19,6 +19,6 @@ import proton_app_uniffi
|
||||
|
||||
extension ContactsWatcher {
|
||||
static func previewInstance() -> Self {
|
||||
.init(watch: { _, _ in .ok(.init(contactList: [], handle: .init(noPointer: .init()))) })
|
||||
.init(watch: { _, _ in .ok(.init(contactList: [], handle: .init(noHandle: .init()))) })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ import proton_app_uniffi
|
||||
|
||||
extension MailUserSession {
|
||||
static func testInstance() -> MailUserSession {
|
||||
.init(noPointer: .init())
|
||||
.init(noHandle: .init())
|
||||
}
|
||||
}
|
||||
|
||||
+5
-4
@@ -39,7 +39,7 @@ final class ContactSuggestionsRepositoryTests {
|
||||
let result = ContactSuggestionsStub(all: self.stubbedAllContacts)
|
||||
return .ok(result)
|
||||
}),
|
||||
mailUserSession: MailUserSession(noPointer: .init())
|
||||
mailUserSession: MailUserSession(noHandle: .init())
|
||||
)
|
||||
}
|
||||
|
||||
@@ -349,11 +349,12 @@ private class ContactSuggestionsStub: ContactSuggestions, @unchecked Sendable {
|
||||
|
||||
init(all: [ContactSuggestion]) {
|
||||
_all = all
|
||||
super.init(noPointer: .init())
|
||||
super.init(noHandle: .init())
|
||||
}
|
||||
|
||||
required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
||||
fatalError("init(unsafeFromRawPointer:) has not been implemented")
|
||||
@available(*, unavailable)
|
||||
required init(unsafeFromHandle handle: UInt64) {
|
||||
fatalError("init(unsafeFromHandle:) has not been implemented")
|
||||
}
|
||||
|
||||
override func all() -> [ContactSuggestion] {
|
||||
|
||||
@@ -26,7 +26,7 @@ import proton_app_uniffi
|
||||
final class ContactViewFactoryTests {
|
||||
let sut = ContactViewFactory(
|
||||
apiConfig: .testData,
|
||||
mailUserSession: .init(noPointer: .init()),
|
||||
mailUserSession: .init(noHandle: .init()),
|
||||
draftPresenter: ContactsDraftPresenterDummy()
|
||||
)
|
||||
|
||||
|
||||
@@ -627,7 +627,7 @@ final class ContactsStateStoreTests {
|
||||
},
|
||||
contactsWatcher: .init(watch: { [unowned self] _, callback in
|
||||
watchContactsCallback = callback
|
||||
return WatchContactListResult.ok(.init(contactList: [], handle: .init(noPointer: .init())))
|
||||
return WatchContactListResult.ok(.init(contactList: [], handle: .init(noHandle: .init())))
|
||||
})
|
||||
),
|
||||
makeContactsLiveQuery: { [unowned self] in
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import proton_app_uniffi
|
||||
|
||||
final class GroupedContactsRepositoryTests {
|
||||
private lazy var sut: GroupedContactsRepository = .init(
|
||||
mailUserSession: MailUserSession(noPointer: .init()),
|
||||
mailUserSession: MailUserSession(noHandle: .init()),
|
||||
contactsProvider: .init(allContacts: { _ in .ok(self.stubbedContacts) })
|
||||
)
|
||||
private var stubbedContacts: [GroupedContacts] = []
|
||||
|
||||
@@ -654,6 +654,16 @@ public extension MailSessionNewSignupFlowResult {
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension MailSessionRecordMeasurementPreloginResult {
|
||||
func get() throws(ProtonError) {
|
||||
switch self {
|
||||
case .ok:
|
||||
break
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension MailSessionRemainingPinAttemptsResult {
|
||||
func get() throws(UserSessionError) -> UInt32? {
|
||||
switch self {
|
||||
@@ -1014,6 +1024,16 @@ public extension MailUserSessionPostPaymentsTokensResult {
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension MailUserSessionRecordMeasurementResult {
|
||||
func get() throws(UserSessionError) {
|
||||
switch self {
|
||||
case .ok:
|
||||
break
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension MailUserSessionSessionIdResult {
|
||||
func get() throws(ProtonError) -> String {
|
||||
switch self {
|
||||
@@ -1314,6 +1334,96 @@ public extension NewMailboxResult {
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension PasswordFlowChangeMboxPassResult {
|
||||
func get() throws(PasswordError) -> SimplePasswordState {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension PasswordFlowChangePassResult {
|
||||
func get() throws(PasswordError) -> SimplePasswordState {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension PasswordFlowFidoDetailsResult {
|
||||
func get() throws(PasswordError) -> Fido2ResponseFfi? {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension PasswordFlowHasFidoResult {
|
||||
func get() throws(PasswordError) -> Bool {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension PasswordFlowHasMbpResult {
|
||||
func get() throws(PasswordError) -> Bool {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension PasswordFlowHasTotpResult {
|
||||
func get() throws(PasswordError) -> Bool {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension PasswordFlowStepBackResult {
|
||||
func get() throws(PasswordError) -> SimplePasswordState {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension PasswordFlowSubmitFidoResult {
|
||||
func get() throws(PasswordError) -> SimplePasswordState {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension PasswordFlowSubmitTotpResult {
|
||||
func get() throws(PasswordError) -> SimplePasswordState {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension ResolveSystemLabelByIdResult {
|
||||
func get() throws(ProtonError) -> SystemLabel? {
|
||||
switch self {
|
||||
@@ -1444,6 +1554,116 @@ public extension SearchScrollerTotalResult {
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension SignupFlowAvailableCountriesResult {
|
||||
func get() throws(SignupError) -> Countries {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension SignupFlowAvailableDomainsResult {
|
||||
func get() throws(SignupError) -> [String] {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension SignupFlowCompleteResult {
|
||||
func get() throws(SignupError) -> UserAddrId {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension SignupFlowCreateResult {
|
||||
func get() throws(SignupError) -> SimpleSignupState {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension SignupFlowSkipRecoveryResult {
|
||||
func get() throws(SignupError) -> SimpleSignupState {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension SignupFlowStepBackResult {
|
||||
func get() throws(SignupError) -> SimpleSignupState {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension SignupFlowSubmitExternalUsernameResult {
|
||||
func get() throws(SignupError) -> SimpleSignupState {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension SignupFlowSubmitInternalUsernameResult {
|
||||
func get() throws(SignupError) -> SimpleSignupState {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension SignupFlowSubmitPasswordResult {
|
||||
func get() throws(SignupError) -> SimpleSignupState {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension SignupFlowSubmitRecoveryEmailResult {
|
||||
func get() throws(SignupError) -> SimpleSignupState {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension SignupFlowSubmitRecoveryPhoneResult {
|
||||
func get() throws(SignupError) -> SimpleSignupState {
|
||||
switch self {
|
||||
case .ok(let value):
|
||||
value
|
||||
case .error(let error):
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
public extension UpdateNextMessageOnMoveResult {
|
||||
func get() throws(UserSessionError) {
|
||||
switch self {
|
||||
|
||||
@@ -44,7 +44,7 @@ final class TelemetryReporterTests {
|
||||
}
|
||||
|
||||
init() {
|
||||
sut = .init(mailUserSession: .init(noPointer: .init()), telemetryActions: telemetryActions)
|
||||
sut = .init(mailUserSession: .init(noHandle: .init()), telemetryActions: telemetryActions)
|
||||
sut.prepare(entryPoint: entryPoint)
|
||||
}
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@ import proton_app_uniffi
|
||||
@MainActor
|
||||
final class RSVPStateStoreTests {
|
||||
private let pasteboard = UIPasteboard.testInstance
|
||||
private let serviceSpy = RsvpEventServiceSpy(noPointer: .init())
|
||||
private let serviceSpy = RsvpEventServiceSpy(noHandle: .init())
|
||||
private let openURLSpy = EnvironmentURLOpenerSpy()
|
||||
private var serviceProviderSpy = RsvpEventServiceProviderSpy(noPointer: .init())
|
||||
private var serviceProviderSpy = RsvpEventServiceProviderSpy(noHandle: .init())
|
||||
private let toastStateStore = ToastStateStore(initialState: .initial)
|
||||
private let draftPresenterSpy = RecipientDraftPresenterSpy()
|
||||
private(set) lazy var sut = RSVPStateStore(
|
||||
|
||||
@@ -58,6 +58,15 @@ public final class MailSessionSpy: MailSessionProtocol {
|
||||
|
||||
// MARK: - MailSessionProtocol
|
||||
|
||||
public func recordMeasurementPrelogin(
|
||||
eventType: MeasurementEventType,
|
||||
asid: String,
|
||||
appPackageName: String,
|
||||
fields: [String: MeasurementValue?]
|
||||
) async -> MailSessionRecordMeasurementPreloginResult {
|
||||
fatalError()
|
||||
}
|
||||
|
||||
public func isFeatureEnabled(featureId: String) async -> Bool? {
|
||||
false
|
||||
}
|
||||
@@ -307,7 +316,7 @@ public final class MailSessionSpy: MailSessionProtocol {
|
||||
|
||||
public func watchSessionsAsync(callback: any AsyncLiveQueryCallback) async -> MailSessionWatchSessionsAsyncResult {
|
||||
watchSessionsAsyncCallback = callback
|
||||
return .ok(.init(sessions: storedSessions, handle: WatchHandleDummy(noPointer: .init())))
|
||||
return .ok(.init(sessions: storedSessions, handle: WatchHandleDummy(noHandle: .init())))
|
||||
}
|
||||
|
||||
public func isFeatureEnabled(featureId: String) async -> MailSessionIsFeatureEnabledResult {
|
||||
|
||||
@@ -30,12 +30,12 @@ public final class MailUserSessionSpy: MailUserSession, @unchecked Sendable {
|
||||
public init(id: String) {
|
||||
self.id = id
|
||||
|
||||
super.init(noPointer: .init())
|
||||
super.init(noHandle: .init())
|
||||
}
|
||||
|
||||
@available(*, unavailable)
|
||||
required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
||||
fatalError("init(unsafeFromRawPointer:) has not been implemented")
|
||||
required init(unsafeFromHandle handle: UInt64) {
|
||||
fatalError("init(unsafeFromHandle:) has not been implemented")
|
||||
}
|
||||
|
||||
public override func accountDetails() async -> MailUserSessionAccountDetailsResult {
|
||||
@@ -87,6 +87,6 @@ public final class MailUserSessionSpy: MailUserSession, @unchecked Sendable {
|
||||
public override func watchUserSettings(callback: any AsyncLiveQueryCallback) -> MailUserSessionWatchUserSettingsResult {
|
||||
watchUserSettingsCallback.append(callback)
|
||||
|
||||
return .ok(.init(noPointer: .init()))
|
||||
return .ok(.init(noHandle: .init()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,11 +19,12 @@ import proton_app_uniffi
|
||||
|
||||
final class PasswordFlowStub: PasswordFlow, @unchecked Sendable {
|
||||
init() {
|
||||
super.init(noPointer: .init())
|
||||
super.init(noHandle: .init())
|
||||
}
|
||||
|
||||
required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
||||
fatalError("init(unsafeFromRawPointer:) has not been implemented")
|
||||
@available(*, unavailable)
|
||||
required init(unsafeFromHandle handle: UInt64) {
|
||||
fatalError("init(unsafeFromHandle:) has not been implemented")
|
||||
}
|
||||
|
||||
override func hasMbp() -> PasswordFlowHasMbpResult {
|
||||
|
||||
@@ -27,12 +27,12 @@ public final class StoredSessionStub: StoredSession, @unchecked Sendable {
|
||||
userIdValue = userId
|
||||
stateValue = state
|
||||
|
||||
super.init(noPointer: .init())
|
||||
super.init(noHandle: .init())
|
||||
}
|
||||
|
||||
@available(*, unavailable)
|
||||
required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
||||
fatalError("init(unsafeFromRawPointer:) has not been implemented")
|
||||
required init(unsafeFromHandle handle: UInt64) {
|
||||
fatalError("init(unsafeFromHandle:) has not been implemented")
|
||||
}
|
||||
|
||||
public override func sessionId() -> String {
|
||||
|
||||
Reference in New Issue
Block a user