Skip to content

Commit 257a45f

Browse files
authored
Release 0.3.0
2 parents 9810ead + a26db9e commit 257a45f

36 files changed

Lines changed: 631 additions & 133 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ GoogleService-Info.plist
77
### Sensitive Data ###
88
DevelopmentEndpoint.swift
99
ProductionEndpoint.swift
10+
DevelopmentAdsService.swift
11+
ProductionAdsService.swift
1012

1113
### Projects ###
1214
*.xcodeproj

.package.resolved

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"originHash" : "34724f4ec037b9f40a821de88ecf11d541e22e538ad65946bfc2556846216f32",
2+
"originHash" : "979c4fb83e47a264cb81aaa5fc13729f0ec12b28107f097b15efbd708794e5f4",
33
"pins" : [
44
{
55
"identity" : "abseil-cpp-binary",
@@ -109,6 +109,15 @@
109109
"version" : "1.22.5"
110110
}
111111
},
112+
{
113+
"identity" : "lottie-ios",
114+
"kind" : "remoteSourceControl",
115+
"location" : "https://github.com/airbnb/lottie-ios",
116+
"state" : {
117+
"revision" : "047aa81b77adcbf583a966dfef620d17650cc656",
118+
"version" : "4.5.1"
119+
}
120+
},
112121
{
113122
"identity" : "nanopb",
114123
"kind" : "remoteSourceControl",
@@ -145,6 +154,24 @@
145154
"version" : "1.5.0"
146155
}
147156
},
157+
{
158+
"identity" : "swift-package-manager-google-mobile-ads",
159+
"kind" : "remoteSourceControl",
160+
"location" : "https://github.com/googleads/swift-package-manager-google-mobile-ads",
161+
"state" : {
162+
"revision" : "7778cc1ab037c10dbbe026959e51e616bd961be9",
163+
"version" : "11.13.0"
164+
}
165+
},
166+
{
167+
"identity" : "swift-package-manager-google-user-messaging-platform",
168+
"kind" : "remoteSourceControl",
169+
"location" : "https://github.com/googleads/swift-package-manager-google-user-messaging-platform.git",
170+
"state" : {
171+
"revision" : "708a282840c2171ee63bd93b87afa49fe507d70e",
172+
"version" : "2.7.0"
173+
}
174+
},
148175
{
149176
"identity" : "swift-protobuf",
150177
"kind" : "remoteSourceControl",

ModularPlugin/ProjectDescriptionHelpers/ExternalPackages.swift

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,34 @@ public struct ExternalPackages {
1818
return .package(product: "ConfettiSwiftUI", type: .runtime)
1919
}
2020

21+
public static var Lottie: TargetDependency {
22+
return .package(product: "Lottie", type: .runtime)
23+
}
24+
2125
public static var ToastUI: TargetDependency {
2226
return .package(product: "ToastUI", type: .runtime)
2327
}
2428
}
2529

26-
public struct Firebase {
27-
public static var Core: TargetDependency {
28-
return .package(product: "FirebaseCore", type: .runtime)
29-
}
30+
public struct Google {
3031

31-
public static var Analytics: TargetDependency {
32-
return .package(product: "FirebaseAnalytics", type: .runtime)
32+
public struct Firebase {
33+
public static var Core: TargetDependency {
34+
return .package(product: "FirebaseCore", type: .runtime)
35+
}
36+
37+
public static var Analytics: TargetDependency {
38+
return .package(product: "FirebaseAnalytics", type: .runtime)
39+
}
40+
41+
public static var Crashlytics: TargetDependency {
42+
return .package(product: "FirebaseCrashlytics", type: .runtime)
43+
}
3344
}
3445

35-
public static var Crashlytics: TargetDependency {
36-
return .package(product: "FirebaseCrashlytics", type: .runtime)
46+
public static var MobileAds: TargetDependency {
47+
return .package(product: "GoogleMobileAds", type: .runtime)
3748
}
49+
3850
}
3951
}

ModularPlugin/ProjectDescriptionHelpers/Presentation.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ extension PresentationLayer {
2626
case UIExtensions
2727
case Resources
2828
case Toast
29+
case MobileAds
2930
case Main
3031
case PlaceDetail
3132
case ReportSurcharge

ModularPlugin/ProjectDescriptionHelpers/Shared.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ extension Shared {
2626
case AppStatusServiceProtocol
2727
case ViewUpdateService
2828
case ViewUpdateServiceProtocol
29+
case ProductionAdsService
30+
case DevelopmentAdsService
31+
case AdsServiceProtocol
2932
}
3033
}
3134

@@ -42,10 +45,32 @@ public extension Shared.Services {
4245
return "\(parent.path)/Shared/Services/AppStatus/\(name)"
4346
case .ViewUpdateService, .ViewUpdateServiceProtocol:
4447
return "\(parent.path)/Shared/Services/ViewUpdate/\(name)"
48+
case .ProductionAdsService, .DevelopmentAdsService, .AdsServiceProtocol:
49+
return "\(parent.path)/Shared/Services/Ads/\(name)"
4550
}
4651
}
4752

4853
var parent: Workspace {
4954
return Surcharges.Surcharges
5055
}
5156
}
57+
58+
extension Shared {
59+
public enum Google: Project {
60+
case FirebaseSDKs
61+
}
62+
}
63+
64+
public extension Shared.Google {
65+
var name: String {
66+
return String(describing: self)
67+
}
68+
69+
var path: String {
70+
return "\(parent.path)/Shared/Google/\(name)"
71+
}
72+
73+
var parent: Workspace {
74+
return Surcharges.Surcharges
75+
}
76+
}

Surcharges/Applications/Project.swift

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ func getDependencies(_ config: Configuration) -> [TargetDependency] {
1818
PresentationLayer.UIs.ReportSurcharge,
1919
PresentationLayer.UIs.SurchargeStatusHelp,
2020
PresentationLayer.UIs.Toast,
21+
Shared.Google.FirebaseSDKs,
2122
]
2223

2324
switch config {
2425
case .dev:
2526
projects.append(DataSource.DevelopmentEndpoint)
27+
projects.append(Shared.Services.DevelopmentAdsService)
2628
case .prod:
2729
projects.append(DataSource.ProductionEndpoint)
30+
projects.append(Shared.Services.ProductionAdsService)
2831
}
2932

3033
return projects.map {
@@ -41,9 +44,7 @@ let developmentDependencies: [TargetDependency] = getDependencies(.dev)
4144

4245
// MARK: External Dependencies
4346
let externalDependencies: [TargetDependency] = [
44-
ExternalPackages.Firebase.Core,
45-
ExternalPackages.Firebase.Analytics,
46-
ExternalPackages.Firebase.Crashlytics,
47+
4748
]
4849

4950
// MARK: Target - Infomation
@@ -54,16 +55,16 @@ let baseSetting = SettingsDictionary()
5455
.swiftVersion("6.0")
5556
.bitcodeEnabled(false)
5657
.marketingVersion(appVersion)
57-
.otherLinkerFlags(["-ObjC"])
5858
.automaticCodeSigning(devTeam: developmentTeam)
5959

6060
let debugSetting = SettingsDictionary()
6161

6262
let releaseSetting = SettingsDictionary()
6363

6464
// MARK: Plist
65-
let infoPlist: InfoPlist = .extendingDefault(
66-
with: [
65+
func getInfoPlist(_ config: Configuration, appVersion: String) -> InfoPlist {
66+
67+
var infoPlist: [String: Plist.Value] = [
6768
"UILaunchScreen": [
6869
"UIColorName": "",
6970
"UIImageName": "",
@@ -73,9 +74,19 @@ let infoPlist: InfoPlist = .extendingDefault(
7374
"NSLocationWhenInUseUsageDescription": .string("Surcharges uses your location to provide nearest places to you."),
7475
"NSCameraUsageDescription": .string("Surcharges uses your camera to take your receipt."),
7576
"ITSAppUsesNonExemptEncryption": .boolean(false),
76-
"UISupportedInterfaceOrientations": .array([.string("UIInterfaceOrientationPortrait")])
77+
"UISupportedInterfaceOrientations": .array([.string("UIInterfaceOrientationPortrait")]),
7778
]
78-
)
79+
80+
switch config {
81+
case .dev:
82+
infoPlist.updateValue(.string("ca-app-pub-2719055739020811~8730306210"), forKey: "GADApplicationIdentifier")
83+
case .prod:
84+
infoPlist.updateValue(.string("ca-app-pub-2719055739020811~5366340920"), forKey: "GADApplicationIdentifier")
85+
}
86+
87+
return .extendingDefault(with: infoPlist)
88+
89+
}
7990

8091
// MARK: Target - Prod
8192
let surcharges = Target.target(
@@ -84,7 +95,7 @@ let surcharges = Target.target(
8495
product: .app,
8596
bundleId: "nz.surcharges",
8697
deploymentTargets: .iOS("17.0"),
87-
infoPlist: infoPlist,
98+
infoPlist: getInfoPlist(.prod, appVersion: appVersion),
8899
sources: ["Sources/Commons/**", "Sources/Prod/**"],
89100
resources: .resources(
90101
[
@@ -112,7 +123,7 @@ let surchargesDev = Target.target(
112123
product: .app,
113124
bundleId: "nz.surcharges.development",
114125
deploymentTargets: .iOS("17.0"),
115-
infoPlist: infoPlist,
126+
infoPlist: getInfoPlist(.dev, appVersion: appVersion),
116127
sources: ["Sources/Commons/**", "Sources/Dev/**"],
117128
resources: .resources(
118129
[

Surcharges/Applications/Sources/Commons/AppDelegate.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@
77
//
88

99
import UIKit
10+
1011
import FirebaseCore
12+
import GoogleMobileAds
1113

1214
final class AppDelegate: NSObject, UIApplicationDelegate {
1315
func application(
1416
_ application: UIApplication, didFinishLaunchingWithOptions
1517
launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil
1618
) -> Bool {
1719
FirebaseApp.configure()
20+
GADMobileAds.sharedInstance().start(completionHandler: nil)
1821
return true
1922
}
2023
}

Surcharges/Applications/Sources/Commons/SurchargeAppView.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ import Factories
2929
import AppStatusService
3030
import LocationService
3131
import ViewUpdateService
32+
import AdsServiceProtocol
3233

3334
// Endpoint
3435
import EndpointProtocol
3536

36-
public struct SurchargeAppView<Endpoint: EndpointProtocol>: View {
37+
public struct SurchargeAppView<Endpoint: EndpointProtocol, AdsService: AdsServiceProtocol>: View {
3738

3839
@StateObject private var _mainRouter = MainRouter()
3940
@StateObject private var _placeDetailRouter = PlaceDetailRouter()
@@ -55,7 +56,7 @@ public struct SurchargeAppView<Endpoint: EndpointProtocol>: View {
5556

5657
NavigationStack {
5758

58-
MainView(
59+
MainView<MainFactory<Endpoint>.ViewModel, MainRouter, AdsService>(
5960
viewModel: _mainFactory.resolve(appStatusService: _appStatusService),
6061
router: _mainRouter
6162
)

Surcharges/Applications/Sources/Dev/SurchargesApp.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import SwiftUI
1010

1111
import DevelopmentEndpoint
12+
import DevelopmentAdsService
1213

1314
@main
1415
struct SurchargesApp: App {
@@ -20,7 +21,7 @@ struct SurchargesApp: App {
2021
var body: some Scene {
2122
WindowGroup {
2223

23-
SurchargeAppView<DevelopmentEndpoint>()
24+
SurchargeAppView<DevelopmentEndpoint, DevelopmentAdsService>()
2425

2526
}
2627
}

Surcharges/Applications/Sources/Prod/SurchargesApp.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import SwiftUI
1010

1111
import ProductionEndpoint
12+
import ProductionAdsService
1213

1314
@main
1415
struct SurchargesApp: App {
@@ -20,7 +21,7 @@ struct SurchargesApp: App {
2021
var body: some Scene {
2122
WindowGroup {
2223

23-
SurchargeAppView<ProductionEndpoint>()
24+
SurchargeAppView<ProductionEndpoint, ProductionAdsService>()
2425

2526
}
2627
}

0 commit comments

Comments
 (0)