Skip to content

Commit

Permalink
Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanov91 committed Apr 10, 2023
1 parent 278487a commit e62d4a8
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 88 deletions.
8 changes: 8 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ let productionDependencies: [PackageDescription.Package.Dependency] = { [
.package(url: "https://github.com/oversizedev/OversizeCore.git", branch: "main"),
.package(url: "https://github.com/oversizedev/OversizeComponents.git", branch: "main"),
.package(url: "https://github.com/oversizedev/OversizeResources.git", branch: "main"),
.package(url: "https://github.com/hmlongco/Factory.git", .upToNextMajor(from: "2.1.3"))
] }()

let developmentDependencies: [PackageDescription.Package.Dependency] = { [
Expand All @@ -19,6 +20,7 @@ let developmentDependencies: [PackageDescription.Package.Dependency] = { [
.package(name: "OversizeCore", path: "../OversizeCore"),
.package(name: "OversizeComponents", path: "../OversizeComponents"),
.package(name: "OversizeResources", path: "../OversizeResources"),
.package(url: "https://github.com/hmlongco/Factory.git", .upToNextMajor(from: "2.1.3"))
] }()

let package = Package(
Expand Down Expand Up @@ -52,6 +54,7 @@ let package = Package(
.product(name: "OversizeComponents", package: "OversizeComponents"),
.product(name: "OversizeLocalizable", package: "OversizeLocalizable"),
.product(name: "OversizeResources", package: "OversizeResources"),
.product(name: "Factory", package: "Factory")
]
),
.target(
Expand All @@ -71,6 +74,7 @@ let package = Package(
.product(name: "OversizeServices", package: "OversizeServices"),
.product(name: "OversizeCalendarService", package: "OversizeServices"),
.product(name: "OversizeLocationService", package: "OversizeServices"),
.product(name: "Factory", package: "Factory")
]
),
.target(
Expand All @@ -81,6 +85,7 @@ let package = Package(
.product(name: "OversizeServices", package: "OversizeServices"),
.product(name: "OversizeContactsService", package: "OversizeServices"),
.product(name: "OversizeCalendarService", package: "OversizeServices"),
.product(name: "Factory", package: "Factory")
]
),
.target(
Expand All @@ -89,6 +94,7 @@ let package = Package(
.product(name: "OversizeUI", package: "OversizeUI"),
.product(name: "OversizeServices", package: "OversizeServices"),
.product(name: "OversizeLocationService", package: "OversizeServices"),
.product(name: "Factory", package: "Factory")
]
),
.target(
Expand All @@ -99,6 +105,7 @@ let package = Package(
.product(name: "OversizeUI", package: "OversizeUI"),
.product(name: "OversizeServices", package: "OversizeServices"),
.product(name: "OversizeStoreService", package: "OversizeServices"),
.product(name: "Factory", package: "Factory")
]
),
.target(
Expand All @@ -114,6 +121,7 @@ let package = Package(
.product(name: "OversizeUI", package: "OversizeUI"),
.product(name: "OversizeServices", package: "OversizeServices"),
.product(name: "OversizeNotificationService", package: "OversizeServices"),
.product(name: "Factory", package: "Factory")
]
),
.target(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import OversizeCore
import OversizeLocationService
import OversizeServices
import SwiftUI
import Factory

public enum CreateEventType: Equatable {
case new(Date?, calendar: EKCalendar?)
Expand All @@ -17,8 +18,8 @@ public enum CreateEventType: Equatable {

@MainActor
public class CreateEventViewModel: ObservableObject {
@Injected(Container.calendarService) private var calendarService: CalendarService
@Injected(Container.locationService) private var locationService: LocationServiceProtocol
@Injected(\.calendarService) private var calendarService: CalendarService
@Injected(\.locationService) private var locationService: LocationServiceProtocol

@Published var state = CreateEventViewModelState.initial
@Published var sheet: CreateEventViewModel.Sheet? = nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import OversizeContactsService
import OversizeCore
import OversizeServices
import SwiftUI
import Factory

@MainActor
class AttendeesViewModel: ObservableObject {
@Injected(Container.contactsService) private var contactsService: ContactsService
@Injected(\.contactsService) private var contactsService: ContactsService
@Published var state = AttendeesViewModelState.initial
@Published var searchText: String = .init()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import OversizeContactsService
import OversizeCore
import OversizeServices
import SwiftUI
import Factory

@MainActor
public class ContactsListsViewModel: ObservableObject {
@Injected(Container.contactsService) private var contactsService: ContactsService
@Injected(\.contactsService) private var contactsService: ContactsService
@Published var state = ContactsPickerViewModelState.initial
@Published var searchText: String = .init()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import OversizeContactsService
import OversizeCore
import OversizeServices
import SwiftUI
import Factory

@MainActor
class EmailPickerViewModel: ObservableObject {
@Injected(Container.contactsService) private var contactsService: ContactsService
@Injected(\.contactsService) private var contactsService: ContactsService
@Published var state = ContactsPickerViewModelState.initial
@Published var searchText: String = .init()

Expand Down
11 changes: 6 additions & 5 deletions Sources/OversizeKit/LauncherKit/LauncherViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ import SwiftUI
#if canImport(LocalAuthentication)
import LocalAuthentication
#endif
import Factory

@MainActor
public final class LauncherViewModel: ObservableObject {
@Injected(Container.biometricService) var biometricService
@Injected(Container.appStateService) var appStateService: AppStateService
@Injected(Container.settingsService) var settingsService
@Injected(Container.appStoreReviewService) var reviewService: AppStoreReviewServiceProtocol
@Injected(Container.storeKitService) private var storeKitService: StoreKitService
@Injected(\.biometricService) var biometricService
@Injected(\.appStateService) var appStateService: AppStateService
@Injected(\.settingsService) var settingsService
@Injected(\.appStoreReviewService) var reviewService: AppStoreReviewServiceProtocol
@Injected(\.storeKitService) private var storeKitService: StoreKitService

@AppStorage("AppState.PremiumState") var isPremium: Bool = false
@AppStorage("AppState.SubscriptionsState") var subscriptionsState: RenewalState = .expired
Expand Down
4 changes: 2 additions & 2 deletions Sources/OversizeKit/LauncherKit/RateAppScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

import OversizeResources
import OversizeServices

import Factory
import OversizeUI
import SwiftUI

struct RateAppScreen: View {
@Injected(Container.appStoreReviewService) var reviewService
@Injected(\.appStoreReviewService) var reviewService
@Environment(\.dismiss) var dismiss

var body: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

import OversizeCore
import OversizeLocalizable

import OversizeServices

import OversizeUI
import SwiftUI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

import OversizeLocalizable
import OversizeServices

import OversizeUI
import SwiftUI
import Factory

// swiftlint:disable line_length
#if os(iOS)
public struct SecuritySettingsView: View {
@Injected(Container.biometricService) var biometricService
@Injected(\.biometricService) var biometricService
@Environment(\.verticalSizeClass) private var verticalSizeClass
@Environment(\.isPortrait) var isPortrait
@Environment(\.presentationMode) var presentationMode
Expand Down
1 change: 0 additions & 1 deletion Sources/OversizeKit/SettingsKit/Views/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import OversizeLocalizable
import OversizeResources
import OversizeServices

import OversizeUI
import SwiftUI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import OversizeCore
import OversizeLocalizable
import OversizeServices

import OversizeUI
import SwiftUI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import OversizeServices
import OversizeStoreService
import StoreKit
import SwiftUI
import Factory

@MainActor
class StoreViewModel: ObservableObject {
Expand All @@ -19,7 +20,7 @@ class StoreViewModel: ObservableObject {
case error(AppError)
}

@Injected(Container.storeKitService) var storeKitService: StoreKitService
@Injected(\.storeKitService) var storeKitService: StoreKitService
@Published var state = State.initial

public var updateListenerTask: Task<Void, Error>?
Expand Down
3 changes: 2 additions & 1 deletion Sources/OversizeKit/StoreKit/Views/StoreProductView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import OversizeStoreService
import OversizeUI
import StoreKit
import SwiftUI
import Factory

public struct StoreProductView: View {
public enum StoreProductViewType {
case row, collumn
}

@Injected(Container.storeKitService) private var store: StoreKitService
@Injected(\.storeKitService) private var store: StoreKitService
@State var isPurchased: Bool = false

@Binding var isSelected: Bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ struct SubscriptionPrivacyView: View {
HStack(spacing: .xxSmall) {
Button("Restore") {
Task {
// This call displays a system prompt that asks users to authenticate with their App Store credentials.
// Call this function only in response to an explicit user action, such as tapping a button.
try? await AppStore.sync()
}
}
Expand Down
7 changes: 4 additions & 3 deletions Sources/OversizeKit/SystemKit/SystemServices.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import OversizeServices
import OversizeStoreService
import OversizeUI
import SwiftUI
import Factory

public struct SystemServicesModifier: ViewModifier {
@Injected(Container.appStateService) var appState: AppStateService
@Injected(Container.settingsService) var settingsService: SettingsServiceProtocol
@Injected(Container.appStoreReviewService) var appStoreReviewService: AppStoreReviewServiceProtocol
@Injected(\.appStateService) var appState: AppStateService
@Injected(\.settingsService) var settingsService: SettingsServiceProtocol
@Injected(\.appStoreReviewService) var appStoreReviewService: AppStoreReviewServiceProtocol

@Environment(\.scenePhase) var scenePhase: ScenePhase
@Environment(\.theme) var theme: ThemeSettings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import MapKit
import OversizeLocationService
import OversizeServices
import SwiftUI
import Factory

@MainActor
class AddressPickerViewModel: NSObject, ObservableObject {
@Injected(Container.locationService) var locationService: LocationServiceProtocol
@Injected(\.locationService) var locationService: LocationServiceProtocol

@Published var locationResults: [MKLocalSearchCompletion] = .init()
@Published var searchTerm: String = .init()
Expand Down
3 changes: 2 additions & 1 deletion Sources/OversizeNoticeKit/NoticeListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import OversizeStoreService
import OversizeUI
import StoreKit
import SwiftUI
import Factory

public struct NoticeListView: View {
@Injected(Container.appStoreReviewService) var reviewService
@Injected(\.appStoreReviewService) var reviewService
@Environment(\.isPremium) var isPremium: Bool

@State private var isBannerClosed = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import OversizeCore
import OversizeNotificationService
import OversizeServices
import SwiftUI
import Factory

@MainActor
class LocalNotificationSetScreenViewModel: ObservableObject {
@Injected(Container.localNotificationService) var localNotificationService: LocalNotificationServiceProtocol
@Injected(\.localNotificationService) var localNotificationService: LocalNotificationServiceProtocol
@Published var state = State.initial

public let id: UUID
Expand Down
60 changes: 0 additions & 60 deletions Sources/OversizeNotificationKit/NotificationSetScreen.swift

This file was deleted.

0 comments on commit e62d4a8

Please sign in to comment.