Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/swift 6 upgrade #197

Merged
merged 21 commits into from
Dec 12, 2024
1 change: 1 addition & 0 deletions PresentationLayer/Constants/Strings/StringConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation

enum StringConstants {
static let plusSign = "+"
static let wxm = "WXM"
Expand Down
2 changes: 1 addition & 1 deletion PresentationLayer/Constants/WeatherFields.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SwiftUI
import DomainLayer
import Toolkit

extension WeatherField: CustomStringConvertible {
extension WeatherField: @retroactive CustomStringConvertible {

static var stationListFields: [WeatherField] {
[.temperature, .wind, .humidity, .precipitation]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation
import DomainLayer
import Toolkit

extension CurrentWeather: Identifiable {
extension CurrentWeather: @retroactive Identifiable {
public var id: String {
timestamp ?? ""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ import Foundation
import DomainLayer
import Toolkit

@MainActor
extension NetworkErrorResponse {
struct UIInfo {
let title: String
let description: String?

#if MAIN_APP
@MainActor
func defaultFailObject(type: SuccessFailEnum,
failMode: FailView.Mode = .default,
retryAction: VoidCallback?) -> FailSuccessStateObject {
failMode: FailView.Mode = .default,
retryAction: VoidCallback?) -> FailSuccessStateObject {
let obj = FailSuccessStateObject(type: type,
failMode: failMode,
title: title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import DomainLayer
typealias StateFontAwesome = (icon: FontIcon, color: ColorEnum, font: FontAwesome)

extension UserDeviceFollowState {
static let defaultFAIcon: StateFontAwesome = (FontIcon.heart, ColorEnum.favoriteHeart, FontAwesome.FAPro)
nonisolated(unsafe) static let defaultFAIcon: StateFontAwesome = (FontIcon.heart, ColorEnum.favoriteHeart, FontAwesome.FAPro)

enum State {
case owned
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct FirmwareVersion: Codable {
let version: String
}

extension DeviceDetails: Identifiable { }
extension DeviceDetails: @retroactive Identifiable { }

extension DeviceDetails {

Expand Down Expand Up @@ -109,6 +109,7 @@ extension DeviceDetails {
}

// MARK: - Issues
@MainActor
extension DeviceDetails {
private static let firmwareUpdateInterval: TimeInterval = .hour

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import Foundation
import DomainLayer
import Toolkit

extension RewardAnnotation: Identifiable {
extension RewardAnnotation: @retroactive Identifiable {
public var id: Int {
hashValue
}
}

extension RewardAnnotation.Severity: Comparable {
extension RewardAnnotation.Severity: @retroactive Comparable {
public static func < (lhs: RewardAnnotation.Severity, rhs: RewardAnnotation.Severity) -> Bool {
lhs.sortOrder < rhs.sortOrder
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation
import DomainLayer
import MapboxMaps

extension ExplorerData: Equatable {
extension ExplorerData: @retroactive Equatable {
public static func == (lhs: ExplorerData, rhs: ExplorerData) -> Bool {
lhs.totalDevices == rhs.totalDevices &&
lhs.polygonPoints == rhs.polygonPoints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import DomainLayer

extension ExplorerLocationError: CustomStringConvertible {
extension ExplorerLocationError: @retroactive CustomStringConvertible {
public var description: String {
switch self {
case .locationNotFound:
Expand Down
3 changes: 3 additions & 0 deletions PresentationLayer/Extensions/DomainExtensions/Filters+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ protocol FilterPresentable: CustomStringConvertible where Self: CaseIterable {
var analyticsParameterValue: ParameterValue { get }
}

extension GroupBy: @retroactive CustomStringConvertible {}
extension GroupBy: FilterPresentable {
static var title: String {
LocalizableString.Filters.groupByTitle.localized
Expand Down Expand Up @@ -41,6 +42,7 @@ extension GroupBy: FilterPresentable {
}
}

extension SortBy: @retroactive CustomStringConvertible {}
extension SortBy: FilterPresentable {
static var title: String {
LocalizableString.Filters.sortByTitle.localized
Expand Down Expand Up @@ -69,6 +71,7 @@ extension SortBy: FilterPresentable {
}
}

extension Filter: @retroactive CustomStringConvertible {}
extension Filter: FilterPresentable {
static var title: String {
LocalizableString.Filters.filterTitle.localized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Foundation
import DomainLayer

@MainActor
extension NetworkDeviceRewardDetailsResponse {
var mainAnnotation: RewardAnnotation? {
if let annotation = annotations?.first(where: { $0.severity == .error }) {
Expand Down Expand Up @@ -35,6 +36,7 @@ extension NetworkDeviceRewardDetailsResponse {
}

extension Optional where Wrapped == [RewardSplit] {
@MainActor
func isUserStakeholder(followState: UserDeviceFollowState?) -> Bool {
guard let userWallet = MainScreenViewModel.shared.userInfo?.wallet?.address else {
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension NetworkDeviceRewardsResponse.RewardItem {
}
}

extension DeviceRewardsMode: CustomStringConvertible {
extension DeviceRewardsMode: @retroactive CustomStringConvertible {
public var description: String {
switch self {
case .week:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension NetworkDeviceRewardsSummaryResponse {
}
}

extension NetworkDeviceRewardsSummary: Identifiable {
extension NetworkDeviceRewardsSummary: @retroactive Identifiable {
public var id: Int {
hashValue
}
Expand Down Expand Up @@ -83,6 +83,7 @@ extension NetworkDeviceRewardsSummary: Identifiable {
}
}

@MainActor
extension RewardAnnotation {
var warningType: CardWarningType? {
guard let severity else {
Expand Down Expand Up @@ -128,6 +129,7 @@ extension RewardAnnotation {
}
}

@MainActor
func handleRewardAnnotationTap(with device: DeviceDetails, followState: UserDeviceFollowState?) {
guard let group else {
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import DomainLayer

extension BatteryState: CustomStringConvertible {
extension BatteryState: @retroactive CustomStringConvertible {
public var description: String {
switch self {
case .low:
Expand All @@ -19,6 +19,7 @@ extension BatteryState: CustomStringConvertible {
}
}

@MainActor
extension NetworkDevicesInfoResponse {
var isRewardSplitted: Bool {
guard let rewardSplit else {
Expand Down
1 change: 1 addition & 0 deletions PresentationLayer/Navigation/DeepLinkHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Toolkit
import UserNotifications
import CoreLocation

@MainActor
class DeepLinkHandler {
typealias QueryParamsCallBack = GenericCallback<[String: String]?>
static let httpsScheme = "https"
Expand Down
7 changes: 5 additions & 2 deletions PresentationLayer/Navigation/Router.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import Foundation
import SwiftUI
import Toolkit

@MainActor
enum Route: Hashable, Equatable {
static func == (lhs: Route, rhs: Route) -> Bool {
nonisolated static func == (lhs: Route, rhs: Route) -> Bool {
lhs.hashValue == rhs.hashValue
}

// swiftlint:disable function_body_length
func hash(into hasher: inout Hasher) {
nonisolated func hash(into hasher: inout Hasher) {
hasher.combine(stringRepresentation)

switch self {
Expand Down Expand Up @@ -73,6 +74,7 @@ enum Route: Hashable, Equatable {
}
// swiftlint:enable function_body_length

nonisolated
var stringRepresentation: String {
switch self {
case .stationDetails:
Expand Down Expand Up @@ -246,6 +248,7 @@ extension Route {
}
}

@MainActor
class Router: ObservableObject {

static let shared = Router()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ struct AccountConfirmationView: View {
.buttonStyle(WXMButtonStyle.filled())
.disabled(!viewModel.isConfirmButtonEnabled)
}
.WXMCardStyle()
.spinningLoader(show: $viewModel.isLoading)
.onAppear {
WXMAnalytics.shared.trackScreen(.passwordConfirm)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import DomainLayer
import Toolkit
import Combine

@MainActor
class AccountConfirmationViewModel: ObservableObject {
@Published var password: String = "" {
didSet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,13 @@ private extension CustomPicker {
}
}

@MainActor
private class CustomPickerManager {
private init() {}

var customPickerHostController: UIHostingController<AnyView>?

static let `default` = CustomPickerManager()
static let `default` = CustomPickerManager()

var pickerFieldFrame: CGRect = .zero
var containerBounds: CGRect = .zero
Expand Down
Loading
Loading