Skip to content

Commit

Permalink
Revert "Resolve UI module warnings"
Browse files Browse the repository at this point in the history
This reverts commit b3b9587.
  • Loading branch information
andrii-vysotskyi-cko committed Sep 25, 2024
1 parent 811d6dc commit 72159c4
Show file tree
Hide file tree
Showing 20 changed files with 6 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class BaseInteractor<State>: Interactor {
var didChange: (() -> Void)?
var willChange: ((State) -> Void)?

@MainActor
func start() {
// Does nothing
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// Created by Andrii Vysotskyi on 19.10.2023.
//

@MainActor
protocol Interactor<State>: AnyObject {

associatedtype State
Expand Down
12 changes: 0 additions & 12 deletions Sources/ProcessOutUI/Sources/Core/ViewModel/AnyViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ final class AnyViewModel<State>: ViewModel {
base.start()
}

func stop() {
base.stop()
}

var state: State {
get { base.state }
set { base.state = newValue }
Expand All @@ -54,10 +50,6 @@ private class ViewModelBox<T>: AnyViewModelBase<T.State> where T: ViewModel {
base.start()
}

override func stop() {
base.stop()
}

override var state: T.State {
get { base.state }
set { base.state = newValue }
Expand All @@ -72,10 +64,6 @@ private class AnyViewModelBase<State>: ViewModel {
fatalError("Not implemented")
}

func stop() {
fatalError("Not implemented")
}

var state: State {
get { fatalError("Not implemented") }
set { fatalError("Not implemented") }
Expand Down
4 changes: 0 additions & 4 deletions Sources/ProcessOutUI/Sources/Core/ViewModel/ViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import Combine

@MainActor
protocol ViewModel<State>: ObservableObject {

associatedtype State
Expand All @@ -17,7 +16,4 @@ protocol ViewModel<State>: ObservableObject {

/// Starts view model.
func start()

/// Stops view model.
func stop()
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import ProcessOut

@MainActor
protocol CardTokenizationInteractor: Interactor<CardTokenizationInteractorState> {

/// Delegate.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public struct POCardTokenizationView: View {
style.backgroundColor.ignoresSafeArea()
}
.onAppear(perform: viewModel.start)
.onDisappear(perform: viewModel.stop)
}

// MARK: - Private Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ final class DefaultCardTokenizationViewModel: ViewModel {
$state.performWithoutAnimation(interactor.start)
}

func stop() {
interactor.cancel()
}

// MARK: - Private Nested Types

private typealias InteractorState = CardTokenizationInteractorState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import ProcessOut

@MainActor
protocol CardUpdateInteractor: Interactor<CardUpdateInteractorState> {

/// Updates CVC value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public struct POCardUpdateView: View {
style.backgroundColor.ignoresSafeArea()
}
.onAppear(perform: viewModel.start)
.onDisappear(perform: viewModel.stop)
}

// MARK: - Private Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ final class AnyCardUpdateViewModel: CardUpdateViewModel {
base.start()
}

func stop() {
base.stop()
}

// MARK: - Private Properties

private var cancellable: AnyCancellable?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import Combine
@_spi(PO) import ProcessOutCoreUI

@MainActor
protocol CardUpdateViewModel: ObservableObject {

/// Screen title.
Expand All @@ -25,7 +24,4 @@ protocol CardUpdateViewModel: ObservableObject {

/// Starts view model.
func start()

/// Stops view model.
func stop()
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ final class DefaultCardUpdateViewModel: CardUpdateViewModel {
interactor.start()
}

func stop() {
interactor.cancel()
}

// MARK: - Private Nested Types

private typealias InteractorState = CardUpdateInteractorState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// Created by Andrii Vysotskyi on 05.03.2024.
//

@MainActor
protocol DynamicCheckoutInteractor: Interactor<DynamicCheckoutInteractorState> {

/// Configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

/// - NOTE: Your implementation should expect that instances created
/// by provider are going to be different every time you call a method.
@MainActor
protocol DynamicCheckoutInteractorChildProvider {

/// Creates and returns card tokenization interactor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public struct PODynamicCheckoutView: View {
}
.backport.geometryGroup()
.onAppear(perform: viewModel.start)
.onDisappear(perform: viewModel.stop)
.poConfirmationDialog(item: $viewModel.state.confirmationDialog)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ final class DefaultDynamicCheckoutViewModel: ViewModel {
$state.performWithoutAnimation(interactor.start)
}

func stop() {
interactor.cancel()
}

// MARK: - Private Nested Types

private enum ButtonId {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,7 @@ final class NativeAlternativePaymentDefaultInteractor:
guard let timeInterval = configuration.paymentConfirmation.showProgressIndicatorAfter else {
return
}
Task { [weak self] in
try? await Task.sleep(seconds: timeInterval)
Timer.scheduledTimer(withTimeInterval: timeInterval, repeats: false) { [weak self] _ in
guard let self, case .awaitingCapture(var awaitingCaptureState) = self.state else {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// Created by Andrii Vysotskyi on 29.02.2024.
//

@MainActor
protocol NativeAlternativePaymentInteractor: Interactor<NativeAlternativePaymentInteractorState> {

/// Configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public struct PONativeAlternativePaymentView: View {
.animation(.default, value: viewModel.state.isCaptured)
}
.onAppear(perform: viewModel.start)
.onDisappear(perform: viewModel.stop)
.poConfirmationDialog(item: $viewModel.state.confirmationDialog)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ final class DefaultNativeAlternativePaymentViewModel: ViewModel {
observeChanges(interactor: interactor)
}

deinit {
interactor.cancel()
}

// MARK: - NativeAlternativePaymentViewModel

@AnimatablePublished
Expand All @@ -27,10 +31,6 @@ final class DefaultNativeAlternativePaymentViewModel: ViewModel {
$state.performWithoutAnimation(interactor.start)
}

func stop() {
interactor.cancel()
}

// MARK: - Private Nested Types

private typealias InteractorState = NativeAlternativePaymentInteractorState
Expand Down

0 comments on commit 72159c4

Please sign in to comment.