Skip to content
16 changes: 8 additions & 8 deletions AppExample/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
840CD68E2AC0E39D00C6AAD0 /* ExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840CD68D2AC0E39D00C6AAD0 /* ExampleApp.swift */; };
840CD6902AC0E3A600C6AAD0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 840CD68F2AC0E3A600C6AAD0 /* Assets.xcassets */; };
840CD6932AC0E3A600C6AAD0 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 840CD6922AC0E3A600C6AAD0 /* Preview Assets.xcassets */; };
840CD6AF2AC0E44E00C6AAD0 /* Factory in Frameworks */ = {isa = PBXBuildFile; productRef = 840CD6AE2AC0E44E00C6AAD0 /* Factory */; };
840CD6B12AC0E6E200C6AAD0 /* Products.storekit in Resources */ = {isa = PBXBuildFile; fileRef = 840CD6B02AC0E6E200C6AAD0 /* Products.storekit */; };
84664C312BF9FD6400A24148 /* Example (watchOS) Watch App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 84664C302BF9FD6400A24148 /* Example (watchOS) Watch App.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
84664C362BF9FD6400A24148 /* Example__watchOS_App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84664C352BF9FD6400A24148 /* Example__watchOS_App.swift */; };
Expand All @@ -47,6 +46,7 @@
848479602BF9FFA4003FC3FC /* OversizeOnboardingKit in Frameworks */ = {isa = PBXBuildFile; productRef = 8484795F2BF9FFA4003FC3FC /* OversizeOnboardingKit */; };
848479622BF9FFA4003FC3FC /* OversizePhotoKit in Frameworks */ = {isa = PBXBuildFile; productRef = 848479612BF9FFA4003FC3FC /* OversizePhotoKit */; };
848479652BFA0E64003FC3FC /* TestView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848479642BFA0E64003FC3FC /* TestView.swift */; };
84A876512E129B0F00CC6DDA /* FactoryKit in Frameworks */ = {isa = PBXBuildFile; productRef = 84A876502E129B0F00CC6DDA /* FactoryKit */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -115,7 +115,7 @@
848479622BF9FFA4003FC3FC /* OversizePhotoKit in Frameworks */,
848479542BF9FFA4003FC3FC /* OversizeCalendarKit in Frameworks */,
8484795E2BF9FFA4003FC3FC /* OversizeNotificationKit in Frameworks */,
840CD6AF2AC0E44E00C6AAD0 /* Factory in Frameworks */,
84A876512E129B0F00CC6DDA /* FactoryKit in Frameworks */,
848479582BF9FFA4003FC3FC /* OversizeKit in Frameworks */,
8484795A2BF9FFA4003FC3FC /* OversizeLocationKit in Frameworks */,
8484795C2BF9FFA4003FC3FC /* OversizeNoticeKit in Frameworks */,
Expand Down Expand Up @@ -309,7 +309,6 @@
);
name = Example;
packageProductDependencies = (
840CD6AE2AC0E44E00C6AAD0 /* Factory */,
848479532BF9FFA4003FC3FC /* OversizeCalendarKit */,
848479552BF9FFA4003FC3FC /* OversizeContactsKit */,
848479572BF9FFA4003FC3FC /* OversizeKit */,
Expand All @@ -318,6 +317,7 @@
8484795D2BF9FFA4003FC3FC /* OversizeNotificationKit */,
8484795F2BF9FFA4003FC3FC /* OversizeOnboardingKit */,
848479612BF9FFA4003FC3FC /* OversizePhotoKit */,
84A876502E129B0F00CC6DDA /* FactoryKit */,
);
productName = Example;
productReference = 840CD6632AC0E39D00C6AAD0 /* Example.app */;
Expand Down Expand Up @@ -834,11 +834,6 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
840CD6AE2AC0E44E00C6AAD0 /* Factory */ = {
isa = XCSwiftPackageProductDependency;
package = 840CD6AD2AC0E44E00C6AAD0 /* XCRemoteSwiftPackageReference "Factory" */;
productName = Factory;
};
84664C462BF9FDC200A24148 /* Factory */ = {
isa = XCSwiftPackageProductDependency;
package = 840CD6AD2AC0E44E00C6AAD0 /* XCRemoteSwiftPackageReference "Factory" */;
Expand Down Expand Up @@ -908,6 +903,11 @@
isa = XCSwiftPackageProductDependency;
productName = OversizePhotoKit;
};
84A876502E129B0F00CC6DDA /* FactoryKit */ = {
isa = XCSwiftPackageProductDependency;
package = 840CD6AD2AC0E44E00C6AAD0 /* XCRemoteSwiftPackageReference "Factory" */;
productName = FactoryKit;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 840CD6592AC0E39D00C6AAD0 /* Project object */;
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion AppExample/Example/ExampleApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// ExampleApp.swift, created on 25.09.2023
//

import Factory
import FactoryKit
import OversizeKit
import OversizeServices
import OversizeUI
Expand Down
2 changes: 1 addition & 1 deletion AppExample/Example/Screens/Main/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// MainView.swift, created on 25.09.2023
//

import Factory
import FactoryKit
import OversizeKit
import OversizeLocalizable
import OversizeServices
Expand Down
2 changes: 1 addition & 1 deletion AppExample/Example/Screens/Onboarding/OnboardingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// OnboardingView.swift, created on 25.09.2023
//

import Factory
import FactoryKit
import OversizeServices
import OversizeUI
import SwiftUI
Expand Down
19 changes: 11 additions & 8 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
import Foundation
import PackageDescription

let remoteDependencies: [PackageDescription.Package.Dependency] = [
let commonDependencies: [PackageDescription.Package.Dependency] = [
.package(url: "https://github.com/lorenzofiamingo/swiftui-cached-async-image.git", .upToNextMajor(from: "2.1.1")),
.package(url: "https://github.com/hmlongco/Factory.git", .upToNextMajor(from: "2.1.3")),
.package(url: "https://github.com/hmlongco/Navigator.git", .upToNextMajor(from: "1.0.0")),
]

let remoteDependencies: [PackageDescription.Package.Dependency] = commonDependencies + [
.package(url: "https://github.com/oversizedev/OversizeUI.git", .upToNextMajor(from: "3.0.2")),
.package(url: "https://github.com/oversizedev/OversizeCore.git", .upToNextMajor(from: "1.3.0")),
.package(url: "https://github.com/oversizedev/OversizeServices.git", .upToNextMajor(from: "1.4.0")),
Expand All @@ -14,12 +20,10 @@ let remoteDependencies: [PackageDescription.Package.Dependency] = [
.package(url: "https://github.com/oversizedev/OversizeNetwork.git", .upToNextMajor(from: "1.0.0")),
.package(url: "https://github.com/oversizedev/OversizeModels.git", .upToNextMajor(from: "0.1.0")),
.package(url: "https://github.com/oversizedev/OversizeRouter.git", .upToNextMajor(from: "0.1.0")),
.package(url: "https://github.com/hmlongco/Factory.git", .upToNextMajor(from: "2.1.3")),
.package(url: "https://github.com/lorenzofiamingo/swiftui-cached-async-image.git", .upToNextMajor(from: "2.1.1")),
.package(url: "https://github.com/hmlongco/Navigator.git", .upToNextMajor(from: "1.0.0")),
.package(url: "https://github.com/oversizedev/OversizeNavigation.git", .upToNextMajor(from: "0.1.0")),
]

let localDependencies: [PackageDescription.Package.Dependency] = [
let localDependencies: [PackageDescription.Package.Dependency] = commonDependencies + [
.package(name: "OversizeUI", path: "../OversizeUI"),
.package(name: "OversizeServices", path: "../OversizeServices"),
.package(name: "OversizeLocalizable", path: "../OversizeLocalizable"),
Expand All @@ -29,9 +33,7 @@ let localDependencies: [PackageDescription.Package.Dependency] = [
.package(name: "OversizeNetwork", path: "../OversizeNetwork"),
.package(name: "OversizeModels", path: "../OversizeModels"),
.package(name: "OversizeRouter", path: "../OversizeRouter"),
.package(url: "https://github.com/lorenzofiamingo/swiftui-cached-async-image.git", .upToNextMajor(from: "2.1.1")),
.package(url: "https://github.com/hmlongco/Factory.git", .upToNextMajor(from: "2.1.3")),
.package(url: "https://github.com/hmlongco/Navigator.git", .upToNextMajor(from: "1.0.0")),
.package(name: "OversizeNavigation", path: "../OversizeNavigation"),
]

let dependencies: [PackageDescription.Package.Dependency] = remoteDependencies
Expand Down Expand Up @@ -73,6 +75,7 @@ let package = Package(
.product(name: "FactoryKit", package: "Factory"),
.product(name: "CachedAsyncImage", package: "swiftui-cached-async-image"),
.product(name: "NavigatorUI", package: "Navigator"),
.product(name: "OversizeNavigation", package: "OversizeNavigation"),
]
),
.target(
Expand Down
2 changes: 1 addition & 1 deletion Sources/OversizeKit/AdsKit/AdView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public struct AdView: View {
public var body: some View {
switch viewModel.state {
case .initial:
VStack {}
EmptyView()
.task {
if !isPremium {
await viewModel.fetchAd()
Expand Down
81 changes: 81 additions & 0 deletions Sources/OversizeKit/DebugKit/DebugInfoView/DebugInfoView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
//
// Copyright © 2023 Alexander Romanov
// DebugInfoView.swift
//

import OversizeCore
import OversizeLocalizable
import OversizeNavigation
import OversizeServices
import OversizeUI
import SwiftUI

public struct DebugInfoView: View {
@StateObject private var viewModel = DebugInfoViewModel()

public init() {}

public var body: some View {
NavigationLayoutView("Information") {
contentView
} background: {
Color.backgroundSecondary
}
.toolbarTitleDisplayMode(.inline)
}

var contentView: some View {
LeadingVStack {
SectionView("App State") {
Row(
"App Run Count",
subtitle: "\(viewModel.appStateService.appRunCount) runs"
)
Separator()
Row(
"First Run Date",
subtitle: viewModel.appStateService.firstRunDate.formatted(date: .abbreviated, time: .standard)
)
Separator()
Row("Last Run Date",
subtitle: viewModel.appStateService.lastRunDate.formatted(date: .abbreviated, time: .standard))
Separator()
Row(
"App last Run Version",
subtitle: viewModel.appStateService.lastRunVersion
)
}
.sectionContentCompactRowMargins()
.rowContentMargins(.init(horizontal: .medium, vertical: .xxxSmall))

SectionView("Review") {
Row(
"App launches for review",
subtitle: "Current: \(viewModel.appStateService.appRunCount), next request after \(viewModel.nextLaunchReviewCount) launches"
)
Separator()
Row(
"Events to show review request count",
subtitle: "Current: \(viewModel.eventCount), next request after \(viewModel.nextEventReviewCount) events",
action: viewModel.onTapAddEvent
)
Separator()
Row(
"App Review banner closed date",
subtitle: viewModel.reviewBannerClosedDate.formatted(date: .abbreviated, time: .standard)
)
Separator()
Row(
"App Review estimate date",
subtitle: viewModel.reviewEstimateDate.formatted(date: .abbreviated, time: .standard)
)
}
.sectionContentCompactRowMargins()
.rowContentMargins(.init(horizontal: .medium, vertical: .xxxSmall))
}
}
}

#Preview {
DebugInfoView()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// Copyright © 2022 Alexander Romanov
// DebugInfoViewModel.swift
//

import OversizeCore
import OversizeNetwork
import OversizeServices
import OversizeStoreService
import OversizeUI
import SwiftUI
#if canImport(LocalAuthentication)
import LocalAuthentication
#endif
import FactoryKit

@MainActor
public final class DebugInfoViewModel: ObservableObject {
@Injected(\.appStateService) var appStateService: AppStateService
@Injected(\.settingsService) var settingsService: SettingsServiceProtocol
@Injected(\.appStoreReviewService) var reviewService: AppStoreReviewService

@Published var eventCount: Int = 0
@Published var reviewBannerClosedDate: Date = .init()
@Published var reviewEstimateDate: Date = .init()
@Published var launchReviewCount: [Int] = []
@Published var eventReviewCount: [Int] = []

public init() {
Task {
await loadReviewData()
}
}

private func loadReviewData() async {
eventCount = await reviewService.appStoreReviewReceivedActionsCount
reviewBannerClosedDate = await reviewService.appReviewBannerClosedDate
reviewEstimateDate = await reviewService.appReviewEstimateDate
launchReviewCount = await reviewService.launchReviewCount
eventReviewCount = await reviewService.rewiewAfterEventCount
}

var nextEventReviewCount: Int {
eventReviewCount.first { $0 > eventCount } ?? eventReviewCount.last ?? 0
}

var nextLaunchReviewCount: Int {
let currentCount = appStateService.appRunCount
return launchReviewCount.first { $0 > currentCount } ?? launchReviewCount.last ?? 0
}

func onTapAddEvent() {
Task {
await reviewService.actionEvent()
}
}
}
47 changes: 47 additions & 0 deletions Sources/OversizeKit/DebugKit/DebugMenuView/DebugMenuView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// Copyright © 2023 Alexander Romanov
// DebugMenuView.swift
//

import OversizeCore
import OversizeLocalizable
import OversizeNavigation
import OversizeServices
import OversizeUI
import SwiftUI

public struct DebugMenuView: View {
@StateObject private var viewModel = DebugMenuViewModel()

public init() {}

public var body: some View {
NavigationLayoutView("Debug") {
contentView
} background: {
Color.backgroundSecondary
}
.toolbarTitleDisplayMode(.inline)
}

var contentView: some View {
LeadingVStack {
SectionView {
Row(
"Rest onboarding",
action: viewModel.onTapRestOnboarding
)

Row(
"Rest app run count",
action: viewModel.onTapRestAppRunCount
)
}
.sectionContentCompactRowMargins()
}
}
}

#Preview {
DebugMenuView()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// Copyright © 2022 Alexander Romanov
// DebugMenuViewModel.swift
//

import OversizeCore
import OversizeNetwork
import OversizeServices
import OversizeStoreService
import OversizeUI
import SwiftUI
#if canImport(LocalAuthentication)
import LocalAuthentication
#endif
import FactoryKit

@MainActor
public final class DebugMenuViewModel: ObservableObject {
@Injected(\.appStateService) var appStateService: AppStateService

public init() {}

func onTapRestOnboarding() {
appStateService.restOnbarding()
}

func onTapRestAppRunCount() {
appStateService.restAppRunCount()
}
}
Loading
Loading