Skip to content

Commit

Permalink
Merge pull request #1337 from novasamatech/fix/fix-warnings
Browse files Browse the repository at this point in the history
Fix warnings
  • Loading branch information
svojsu authored Jan 16, 2025
2 parents 80ce4cb + 0cd9a1d commit ce2580d
Show file tree
Hide file tree
Showing 13 changed files with 187 additions and 134 deletions.
4 changes: 4 additions & 0 deletions novawallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,7 @@
2D5A61D02C0FAC5B006D58E3 /* IntegrateNetworksBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D5A61CF2C0FAC5B006D58E3 /* IntegrateNetworksBanner.swift */; };
2D5EBEB02D37D4090016AC4E /* WalletStorageCleanerFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D5EBEAF2D37D4090016AC4E /* WalletStorageCleanerFactory.swift */; };
2D5EBEB22D37DE440016AC4E /* DAppSettingsCleaner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D5EBEB12D37DE440016AC4E /* DAppSettingsCleaner.swift */; };
2D5EBEB42D38F0FD0016AC4E /* AssetListMeasurement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D5EBEB32D38F0FD0016AC4E /* AssetListMeasurement.swift */; };
2D5FC1A42C5220900013352B /* AccountVoteFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D5FC1A32C5220900013352B /* AccountVoteFactory.swift */; };
2D60C9BD2D1AA97C00027EC6 /* ModalCardPresentationConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D60C9BC2D1AA97C00027EC6 /* ModalCardPresentationConfiguration.swift */; };
2D60C9BF2D1AA9E500027EC6 /* ModalCardPresentationStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D60C9BE2D1AA9E500027EC6 /* ModalCardPresentationStyle.swift */; };
Expand Down Expand Up @@ -6599,6 +6600,7 @@
2D5A61CF2C0FAC5B006D58E3 /* IntegrateNetworksBanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntegrateNetworksBanner.swift; sourceTree = "<group>"; };
2D5EBEAF2D37D4090016AC4E /* WalletStorageCleanerFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletStorageCleanerFactory.swift; sourceTree = "<group>"; };
2D5EBEB12D37DE440016AC4E /* DAppSettingsCleaner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DAppSettingsCleaner.swift; sourceTree = "<group>"; };
2D5EBEB32D38F0FD0016AC4E /* AssetListMeasurement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetListMeasurement.swift; sourceTree = "<group>"; };
2D5FC1A32C5220900013352B /* AccountVoteFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountVoteFactory.swift; sourceTree = "<group>"; };
2D60C9BC2D1AA97C00027EC6 /* ModalCardPresentationConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalCardPresentationConfiguration.swift; sourceTree = "<group>"; };
2D60C9BE2D1AA9E500027EC6 /* ModalCardPresentationStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalCardPresentationStyle.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -13216,6 +13218,7 @@
isa = PBXGroup;
children = (
84AEEE6B27A92AEF005EBA77 /* AssetListFlowLayout.swift */,
2D5EBEB32D38F0FD0016AC4E /* AssetListMeasurement.swift */,
2D6F51A82CDD2C3100564C00 /* AssetListFlowLayout+Types.swift */,
2D6F51A62CDD035900564C00 /* AssetDecorationAttributesFactory.swift */,
2D008A602CC11E4600BFEE99 /* AssetListCustomLayoutAttributes.swift */,
Expand Down Expand Up @@ -28853,6 +28856,7 @@
7754BD582B50232C0099C13E /* ProxyDepositCalculator.swift in Sources */,
0CCDB2ED2B751E5B007BC5D6 /* HydraStableswapReservesService.swift in Sources */,
84DED40B266656D400A153BB /* KaruraBonusService.swift in Sources */,
2D5EBEB42D38F0FD0016AC4E /* AssetListMeasurement.swift in Sources */,
845B07EF2915951A005785D3 /* DemocracyVoteThreshold.swift in Sources */,
885551F78A5926D16D5AF0CB /* ControllerAccountPresenter.swift in Sources */,
8442002F28E9AEFB00C49C4A /* VoteWireframe.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ public struct ModalCardPresentationConfiguration {
public let dismissCancelSpeedFactor: CGFloat

public init(
contentAppearanceAnimator: BlockViewAnimatorProtocol = BlockViewAnimator(duration: 0.45, delay: 0.0, options: [.curveLinear]),
contentDissmisalAnimator: BlockViewAnimatorProtocol = BlockViewAnimator(duration: 0.35, delay: 0.0, options: [.curveLinear]),
contentAppearanceAnimator: BlockViewAnimatorProtocol = BlockViewAnimator(
duration: 0.45,
delay: 0.0,
options: [.curveLinear]
),
contentDissmisalAnimator: BlockViewAnimatorProtocol = BlockViewAnimator(
duration: 0.35,
delay: 0.0,
options: [.curveLinear]
),
style: ModalCardPresentationStyle = .defaultStyle,
extendUnderSafeArea: Bool = false,
dismissPercentThreshold: CGFloat = 0.35,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ private extension ModalCardPresentationController {
dy: topOffset
).origin

let presentedByModalCardController = presentingViewController.presentationController is ModalCardPresentationController
let presentationController = presentingViewController.presentationController
let presentedByModalCardController = presentationController is ModalCardPresentationController

let finalHeight: CGFloat = if presentedByModalCardController {
presentingViewController.view.bounds.height
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ extension ModalCardPresentationFactory: UIViewControllerTransitioningDelegate {
return presentation
}

public func interactionControllerForDismissal(using _: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
public func interactionControllerForDismissal(
using _: UIViewControllerAnimatedTransitioning
) -> UIViewControllerInteractiveTransitioning? {
presentation?.interactiveDismissal
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ private extension ModalCardPresentationTransformFactory {
func createLastPresenterTransform(for presentingViewController: UIViewController) -> CGAffineTransform {
guard let sourceView = presentingViewController.view else { return CGAffineTransform.identity }

let presenterIsModalCard = (presentingViewController.presentationController as? ModalCardPresentationController) != nil
let presentationController = presentingViewController.presentationController
let cardPresentationController = presentationController as? ModalCardPresentationController
let presenterIsModalCard = cardPresentationController != nil

let widthDelta: CGFloat = UIConstants.horizontalInset * 2
let scale = (sourceView.bounds.width - widthDelta) / sourceView.bounds.width
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
import UIKit

enum AssetListMeasurement {
static let accountHeight: CGFloat = 56.0
static let totalBalanceHeight: CGFloat = 200.0
static let totalBalanceWithLocksHeight: CGFloat = 200.0
static let settingsHeight: CGFloat = 56.0
static let nftsHeight = 56.0
static let bannerHeight = 102.0
static let assetHeight: CGFloat = 56.0
static let assetHeaderHeight: CGFloat = 45.0
static let emptyStateCellHeight: CGFloat = 230
static let decorationInset: CGFloat = 8.0
static let promotionInsets = UIEdgeInsets(top: 0, left: 0, bottom: 12, right: 0)
static let summaryInsets = UIEdgeInsets(top: 0, left: 0, bottom: 12, right: 0)
static let nftsInsets = UIEdgeInsets(top: 0, left: 0, bottom: 12, right: 0)
static let settingsInsets = UIEdgeInsets.zero
static let assetGroupInsets = UIEdgeInsets(top: 2.0, left: 0, bottom: 16.0, right: 0)

static let underneathViewHeight: CGFloat = 4
static let decorationContentInset: CGFloat = 4
}

class AssetListFlowLayout: UICollectionViewFlowLayout {
var animatingTransition: Bool = false

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import UIKit

enum AssetListMeasurement {
static let accountHeight: CGFloat = 56.0
static let totalBalanceHeight: CGFloat = 200.0
static let totalBalanceWithLocksHeight: CGFloat = 200.0
static let settingsHeight: CGFloat = 56.0
static let nftsHeight = 56.0
static let bannerHeight = 102.0
static let assetHeight: CGFloat = 56.0
static let assetHeaderHeight: CGFloat = 45.0
static let emptyStateCellHeight: CGFloat = 230
static let decorationInset: CGFloat = 8.0
static let promotionInsets = UIEdgeInsets(top: 0, left: 0, bottom: 12, right: 0)
static let summaryInsets = UIEdgeInsets(top: 0, left: 0, bottom: 12, right: 0)
static let nftsInsets = UIEdgeInsets(top: 0, left: 0, bottom: 12, right: 0)
static let settingsInsets = UIEdgeInsets.zero
static let assetGroupInsets = UIEdgeInsets(top: 2.0, left: 0, bottom: 16.0, right: 0)

static let underneathViewHeight: CGFloat = 4
static let decorationContentInset: CGFloat = 4
}
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ private extension DAppBrowserInteractor {
runningCallbackIn: .main
) { [weak self] result in
switch result {
case let .success(tab):
case .success:
self?.provideTabs()
case let .failure(error):
self?.presenter?.didReceive(error: error)
Expand Down
54 changes: 34 additions & 20 deletions novawallet/Modules/DApp/DAppBrowser/DAppBrowserViewFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,39 @@ struct DAppBrowserViewFactory {
let localizationManager = LocalizationManager.shared
let logger = Logger.shared

let interactor = createInteractor(
with: selectedTab,
wallet: wallet,
logger: logger
)

let presenter = DAppBrowserPresenter(
interactor: interactor,
wireframe: wireframe,
localizationManager: localizationManager,
logger: logger
)

let view = DAppBrowserViewController(
presenter: presenter,
localRouter: URLLocalRouter.createWithDeeplinks(),
webViewPool: WebViewPool.shared,
deviceOrientationManager: DeviceOrientationManager.shared,
localizationManager: localizationManager,
logger: logger
)

presenter.view = view
interactor.presenter = presenter

return view
}

private static func createInteractor(
with selectedTab: DAppBrowserTab,
wallet: MetaAccountModel,
logger: LoggerProtocol
) -> DAppBrowserInteractor {
let storageFacade = UserDataStorageFacade.shared
let accountRepositoryFactory = AccountRepositoryFactory(storageFacade: storageFacade)

Expand Down Expand Up @@ -74,25 +107,6 @@ struct DAppBrowserViewFactory {
logger: logger
)

let presenter = DAppBrowserPresenter(
interactor: interactor,
wireframe: wireframe,
localizationManager: localizationManager,
logger: logger
)

let view = DAppBrowserViewController(
presenter: presenter,
localRouter: URLLocalRouter.createWithDeeplinks(),
webViewPool: WebViewPool.shared,
deviceOrientationManager: DeviceOrientationManager.shared,
localizationManager: localizationManager,
logger: logger
)

presenter.view = view
interactor.presenter = presenter

return view
return interactor
}
}
62 changes: 37 additions & 25 deletions novawallet/Modules/DApp/DAppList/DAppListViewFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,42 @@ struct DAppListViewFactory {
walletNotificationService: WalletNotificationServiceProtocol,
proxySyncService: ProxySyncServiceProtocol
) -> DAppListViewProtocol? {
let interactor = createInteractor(
walletNotificationService: walletNotificationService,
proxySyncService: proxySyncService
)

let wireframe = DAppListWireframe(proxySyncService: proxySyncService)

let localizationManager = LocalizationManager.shared

let viewModelFactory = DAppListViewModelFactory(
dappCategoriesViewModelFactory: DAppCategoryViewModelFactory(),
dappIconViewModelFactory: DAppIconViewModelFactory()
)

let presenter = DAppListPresenter(
interactor: interactor,
wireframe: wireframe,
viewModelFactory: viewModelFactory,
localizationManager: localizationManager
)

let view = DAppListViewController(
presenter: presenter,
localizationManager: localizationManager
)

presenter.view = view
interactor.presenter = presenter

return view
}

private static func createInteractor(
walletNotificationService: WalletNotificationServiceProtocol,
proxySyncService _: ProxySyncServiceProtocol
) -> DAppListInteractor {
let appConfig = ApplicationConfig.shared
let dAppsUrl = appConfig.dAppsListURL
let dAppProvider: AnySingleValueProvider<DAppList> = JsonDataProviderFactory.shared.getJson(
Expand Down Expand Up @@ -41,30 +77,6 @@ struct DAppListViewFactory {
logger: logger
)

let wireframe = DAppListWireframe(proxySyncService: proxySyncService)

let localizationManager = LocalizationManager.shared

let viewModelFactory = DAppListViewModelFactory(
dappCategoriesViewModelFactory: DAppCategoryViewModelFactory(),
dappIconViewModelFactory: DAppIconViewModelFactory()
)

let presenter = DAppListPresenter(
interactor: interactor,
wireframe: wireframe,
viewModelFactory: viewModelFactory,
localizationManager: localizationManager
)

let view = DAppListViewController(
presenter: presenter,
localizationManager: localizationManager
)

presenter.view = view
interactor.presenter = presenter

return view
return interactor
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private extension DAppListViewModelFactory {
let details = if let knownDApp = knownDApps[model.identifier] {
knownDApp.categories.map {
categoriesDict[$0]?.name ?? $0
}.joined(separator: ", ") ?? knownDApp.identifier
}.joined(separator: ", ")
} else {
model.identifier
}
Expand Down
Loading

0 comments on commit ce2580d

Please sign in to comment.