diff --git a/.gitignore b/.gitignore index 1c78e77..9f0bec0 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ GoogleService-Info.plist ### Sensitive Data ### DevelopmentEndpoint.swift ProductionEndpoint.swift +DevelopmentAdsService.swift +ProductionAdsService.swift ### Projects ### *.xcodeproj diff --git a/.package.resolved b/.package.resolved index f0a15ba..ea87a9a 100644 --- a/.package.resolved +++ b/.package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "34724f4ec037b9f40a821de88ecf11d541e22e538ad65946bfc2556846216f32", + "originHash" : "979c4fb83e47a264cb81aaa5fc13729f0ec12b28107f097b15efbd708794e5f4", "pins" : [ { "identity" : "abseil-cpp-binary", @@ -109,6 +109,15 @@ "version" : "1.22.5" } }, + { + "identity" : "lottie-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/airbnb/lottie-ios", + "state" : { + "revision" : "047aa81b77adcbf583a966dfef620d17650cc656", + "version" : "4.5.1" + } + }, { "identity" : "nanopb", "kind" : "remoteSourceControl", @@ -145,6 +154,24 @@ "version" : "1.5.0" } }, + { + "identity" : "swift-package-manager-google-mobile-ads", + "kind" : "remoteSourceControl", + "location" : "https://github.com/googleads/swift-package-manager-google-mobile-ads", + "state" : { + "revision" : "7778cc1ab037c10dbbe026959e51e616bd961be9", + "version" : "11.13.0" + } + }, + { + "identity" : "swift-package-manager-google-user-messaging-platform", + "kind" : "remoteSourceControl", + "location" : "https://github.com/googleads/swift-package-manager-google-user-messaging-platform.git", + "state" : { + "revision" : "708a282840c2171ee63bd93b87afa49fe507d70e", + "version" : "2.7.0" + } + }, { "identity" : "swift-protobuf", "kind" : "remoteSourceControl", diff --git a/ModularPlugin/ProjectDescriptionHelpers/ExternalPackages.swift b/ModularPlugin/ProjectDescriptionHelpers/ExternalPackages.swift index d7027b6..e290386 100644 --- a/ModularPlugin/ProjectDescriptionHelpers/ExternalPackages.swift +++ b/ModularPlugin/ProjectDescriptionHelpers/ExternalPackages.swift @@ -18,22 +18,34 @@ public struct ExternalPackages { return .package(product: "ConfettiSwiftUI", type: .runtime) } + public static var Lottie: TargetDependency { + return .package(product: "Lottie", type: .runtime) + } + public static var ToastUI: TargetDependency { return .package(product: "ToastUI", type: .runtime) } } - public struct Firebase { - public static var Core: TargetDependency { - return .package(product: "FirebaseCore", type: .runtime) - } + public struct Google { - public static var Analytics: TargetDependency { - return .package(product: "FirebaseAnalytics", type: .runtime) + public struct Firebase { + public static var Core: TargetDependency { + return .package(product: "FirebaseCore", type: .runtime) + } + + public static var Analytics: TargetDependency { + return .package(product: "FirebaseAnalytics", type: .runtime) + } + + public static var Crashlytics: TargetDependency { + return .package(product: "FirebaseCrashlytics", type: .runtime) + } } - public static var Crashlytics: TargetDependency { - return .package(product: "FirebaseCrashlytics", type: .runtime) + public static var MobileAds: TargetDependency { + return .package(product: "GoogleMobileAds", type: .runtime) } + } } diff --git a/ModularPlugin/ProjectDescriptionHelpers/Presentation.swift b/ModularPlugin/ProjectDescriptionHelpers/Presentation.swift index db1cbb1..6830a63 100644 --- a/ModularPlugin/ProjectDescriptionHelpers/Presentation.swift +++ b/ModularPlugin/ProjectDescriptionHelpers/Presentation.swift @@ -26,6 +26,7 @@ extension PresentationLayer { case UIExtensions case Resources case Toast + case MobileAds case Main case PlaceDetail case ReportSurcharge diff --git a/ModularPlugin/ProjectDescriptionHelpers/Shared.swift b/ModularPlugin/ProjectDescriptionHelpers/Shared.swift index 6f8ac20..eaf4ac4 100644 --- a/ModularPlugin/ProjectDescriptionHelpers/Shared.swift +++ b/ModularPlugin/ProjectDescriptionHelpers/Shared.swift @@ -26,6 +26,9 @@ extension Shared { case AppStatusServiceProtocol case ViewUpdateService case ViewUpdateServiceProtocol + case ProductionAdsService + case DevelopmentAdsService + case AdsServiceProtocol } } @@ -42,6 +45,8 @@ public extension Shared.Services { return "\(parent.path)/Shared/Services/AppStatus/\(name)" case .ViewUpdateService, .ViewUpdateServiceProtocol: return "\(parent.path)/Shared/Services/ViewUpdate/\(name)" + case .ProductionAdsService, .DevelopmentAdsService, .AdsServiceProtocol: + return "\(parent.path)/Shared/Services/Ads/\(name)" } } @@ -49,3 +54,23 @@ public extension Shared.Services { return Surcharges.Surcharges } } + +extension Shared { + public enum Google: Project { + case FirebaseSDKs + } +} + +public extension Shared.Google { + var name: String { + return String(describing: self) + } + + var path: String { + return "\(parent.path)/Shared/Google/\(name)" + } + + var parent: Workspace { + return Surcharges.Surcharges + } +} diff --git a/Surcharges/Applications/Project.swift b/Surcharges/Applications/Project.swift index 2c3c1d9..b3559c5 100644 --- a/Surcharges/Applications/Project.swift +++ b/Surcharges/Applications/Project.swift @@ -18,13 +18,16 @@ func getDependencies(_ config: Configuration) -> [TargetDependency] { PresentationLayer.UIs.ReportSurcharge, PresentationLayer.UIs.SurchargeStatusHelp, PresentationLayer.UIs.Toast, + Shared.Google.FirebaseSDKs, ] switch config { case .dev: projects.append(DataSource.DevelopmentEndpoint) + projects.append(Shared.Services.DevelopmentAdsService) case .prod: projects.append(DataSource.ProductionEndpoint) + projects.append(Shared.Services.ProductionAdsService) } return projects.map { @@ -41,9 +44,7 @@ let developmentDependencies: [TargetDependency] = getDependencies(.dev) // MARK: External Dependencies let externalDependencies: [TargetDependency] = [ - ExternalPackages.Firebase.Core, - ExternalPackages.Firebase.Analytics, - ExternalPackages.Firebase.Crashlytics, + ] // MARK: Target - Infomation @@ -54,7 +55,6 @@ let baseSetting = SettingsDictionary() .swiftVersion("6.0") .bitcodeEnabled(false) .marketingVersion(appVersion) - .otherLinkerFlags(["-ObjC"]) .automaticCodeSigning(devTeam: developmentTeam) let debugSetting = SettingsDictionary() @@ -62,8 +62,9 @@ let debugSetting = SettingsDictionary() let releaseSetting = SettingsDictionary() // MARK: Plist -let infoPlist: InfoPlist = .extendingDefault( - with: [ +func getInfoPlist(_ config: Configuration, appVersion: String) -> InfoPlist { + + var infoPlist: [String: Plist.Value] = [ "UILaunchScreen": [ "UIColorName": "", "UIImageName": "", @@ -73,9 +74,19 @@ let infoPlist: InfoPlist = .extendingDefault( "NSLocationWhenInUseUsageDescription": .string("Surcharges uses your location to provide nearest places to you."), "NSCameraUsageDescription": .string("Surcharges uses your camera to take your receipt."), "ITSAppUsesNonExemptEncryption": .boolean(false), - "UISupportedInterfaceOrientations": .array([.string("UIInterfaceOrientationPortrait")]) + "UISupportedInterfaceOrientations": .array([.string("UIInterfaceOrientationPortrait")]), ] -) + + switch config { + case .dev: + infoPlist.updateValue(.string("ca-app-pub-2719055739020811~8730306210"), forKey: "GADApplicationIdentifier") + case .prod: + infoPlist.updateValue(.string("ca-app-pub-2719055739020811~5366340920"), forKey: "GADApplicationIdentifier") + } + + return .extendingDefault(with: infoPlist) + +} // MARK: Target - Prod let surcharges = Target.target( @@ -84,7 +95,7 @@ let surcharges = Target.target( product: .app, bundleId: "nz.surcharges", deploymentTargets: .iOS("17.0"), - infoPlist: infoPlist, + infoPlist: getInfoPlist(.prod, appVersion: appVersion), sources: ["Sources/Commons/**", "Sources/Prod/**"], resources: .resources( [ @@ -112,7 +123,7 @@ let surchargesDev = Target.target( product: .app, bundleId: "nz.surcharges.development", deploymentTargets: .iOS("17.0"), - infoPlist: infoPlist, + infoPlist: getInfoPlist(.dev, appVersion: appVersion), sources: ["Sources/Commons/**", "Sources/Dev/**"], resources: .resources( [ diff --git a/Surcharges/Applications/Sources/Commons/AppDelegate.swift b/Surcharges/Applications/Sources/Commons/AppDelegate.swift index 887ee98..5506b18 100644 --- a/Surcharges/Applications/Sources/Commons/AppDelegate.swift +++ b/Surcharges/Applications/Sources/Commons/AppDelegate.swift @@ -7,7 +7,9 @@ // import UIKit + import FirebaseCore +import GoogleMobileAds final class AppDelegate: NSObject, UIApplicationDelegate { func application( @@ -15,6 +17,7 @@ final class AppDelegate: NSObject, UIApplicationDelegate { launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil ) -> Bool { FirebaseApp.configure() + GADMobileAds.sharedInstance().start(completionHandler: nil) return true } } diff --git a/Surcharges/Applications/Sources/Commons/SurchargeAppView.swift b/Surcharges/Applications/Sources/Commons/SurchargeAppView.swift index a64d591..11aff71 100644 --- a/Surcharges/Applications/Sources/Commons/SurchargeAppView.swift +++ b/Surcharges/Applications/Sources/Commons/SurchargeAppView.swift @@ -29,11 +29,12 @@ import Factories import AppStatusService import LocationService import ViewUpdateService +import AdsServiceProtocol // Endpoint import EndpointProtocol -public struct SurchargeAppView: View { +public struct SurchargeAppView: View { @StateObject private var _mainRouter = MainRouter() @StateObject private var _placeDetailRouter = PlaceDetailRouter() @@ -55,7 +56,7 @@ public struct SurchargeAppView: View { NavigationStack { - MainView( + MainView.ViewModel, MainRouter, AdsService>( viewModel: _mainFactory.resolve(appStatusService: _appStatusService), router: _mainRouter ) diff --git a/Surcharges/Applications/Sources/Dev/SurchargesApp.swift b/Surcharges/Applications/Sources/Dev/SurchargesApp.swift index 8ba69ff..4cc2f57 100644 --- a/Surcharges/Applications/Sources/Dev/SurchargesApp.swift +++ b/Surcharges/Applications/Sources/Dev/SurchargesApp.swift @@ -9,6 +9,7 @@ import SwiftUI import DevelopmentEndpoint +import DevelopmentAdsService @main struct SurchargesApp: App { @@ -20,7 +21,7 @@ struct SurchargesApp: App { var body: some Scene { WindowGroup { - SurchargeAppView() + SurchargeAppView() } } diff --git a/Surcharges/Applications/Sources/Prod/SurchargesApp.swift b/Surcharges/Applications/Sources/Prod/SurchargesApp.swift index 2b7d71a..89f7076 100644 --- a/Surcharges/Applications/Sources/Prod/SurchargesApp.swift +++ b/Surcharges/Applications/Sources/Prod/SurchargesApp.swift @@ -9,6 +9,7 @@ import SwiftUI import ProductionEndpoint +import ProductionAdsService @main struct SurchargesApp: App { @@ -20,7 +21,7 @@ struct SurchargesApp: App { var body: some Scene { WindowGroup { - SurchargeAppView() + SurchargeAppView() } } diff --git a/Surcharges/PresentationLayer/UIs/Main/Project.swift b/Surcharges/PresentationLayer/UIs/Main/Project.swift index dfd5936..e6d51cf 100644 --- a/Surcharges/PresentationLayer/UIs/Main/Project.swift +++ b/Surcharges/PresentationLayer/UIs/Main/Project.swift @@ -10,17 +10,20 @@ let target = surcharges.target( PresentationLayer.ViewModelProtocols, PresentationLayer.UIs.CommonUI, PresentationLayer.Routers.RouterProtocols, + PresentationLayer.UIs.MobileAds, + Shared.Services.AdsServiceProtocol, ], - externalPackages: + externalPackages: [ - ] + ] ) let demo = surcharges.demo( projects: [ Builder.Factories, DataSource.DevelopmentEndpoint, + Shared.Services.DevelopmentAdsService, PresentationLayer.Routers.MainRouter, PresentationLayer.UIs.Main, PresentationLayer.UIs.SurchargeStatusHelp, diff --git a/Surcharges/PresentationLayer/UIs/Main/Sources/MainView.swift b/Surcharges/PresentationLayer/UIs/Main/Sources/MainView.swift index 42638cd..05df6ad 100644 --- a/Surcharges/PresentationLayer/UIs/Main/Sources/MainView.swift +++ b/Surcharges/PresentationLayer/UIs/Main/Sources/MainView.swift @@ -11,14 +11,17 @@ import TipKit import Resources import CommonUI +import MobileAds import ViewModelProtocols import RouterProtocols +import AdsServiceProtocol -public struct MainView: View { +public struct MainView: View { @StateObject private var _viewModel: VM @StateObject private var _router: Router + @StateObject private var _adsService: AdsService = AdsService() private let _surchargeStatusTip = SurchargeStatusTip() private let _useLocationTip = UseLocationTip() @@ -71,6 +74,10 @@ public struct MainView: V if _viewModel.noResults { + if _adsService.isShowingAds { + ListAdsView(unitId: _adsService.listBannerUnitId) + } + NoResultView(searchedText: _viewModel.searchedText) .padding(.top, 40) .padding([.leading, .trailing], 20) @@ -79,6 +86,10 @@ public struct MainView: V if !_viewModel.mainModel.places.isEmpty { + if _adsService.isShowingAds { + ListAdsView(unitId: _adsService.listBannerUnitId) + } + Section { PlacesView( mainModel: $_viewModel.mainModel, @@ -93,8 +104,7 @@ public struct MainView: V ) } header: { - Text(R.string.localizable.searchFor(_viewModel.searchedText)) - .font(.title3) + Text("๐Ÿ”Ž\(R.string.localizable.searchFor(_viewModel.searchedText))") .blurBackground() } @@ -104,6 +114,10 @@ public struct MainView: V .padding(.top, 40) .padding([.leading, .trailing], 20) + FixedAdsView(isAdShowing: $_adsService.isShowingAds, unitId: _adsService.fixedBannerUnitId) + .padding(.top, 20) + .padding([.leading, .trailing], 20) + } } } diff --git a/Surcharges/PresentationLayer/UIs/Main/Sources/Welcome/WelcomeView.swift b/Surcharges/PresentationLayer/UIs/Main/Sources/Welcome/WelcomeView.swift index d2ffa43..151680a 100644 --- a/Surcharges/PresentationLayer/UIs/Main/Sources/Welcome/WelcomeView.swift +++ b/Surcharges/PresentationLayer/UIs/Main/Sources/Welcome/WelcomeView.swift @@ -11,8 +11,9 @@ import SwiftUI import Resources struct WelcomeView: View { - var body: some View { - Text(R.string.localizable.welcomeToSurchargeApp()) + VStack { + Text("\(R.string.localizable.welcomeToSurchargeApp())๐Ÿ™Œ") + } } } diff --git a/Surcharges/PresentationLayer/UIs/MobileAds/Project.swift b/Surcharges/PresentationLayer/UIs/MobileAds/Project.swift new file mode 100644 index 0000000..222069b --- /dev/null +++ b/Surcharges/PresentationLayer/UIs/MobileAds/Project.swift @@ -0,0 +1,25 @@ +import ProjectDescription +import ProjectDescriptionHelpers +import ModularPlugin + +let surcharges = Surcharges(project: PresentationLayer.UIs.MobileAds) + +let target = surcharges.target( + projects: + [ + PresentationLayer.UIs.UIExtensions, + PresentationLayer.UIs.Resources, + ], + externalPackages: + [ + ExternalPackages.PresentationLayer.Lottie, + ExternalPackages.Google.MobileAds, + .sdk(name: "JavaScriptCore", type: .framework), + ], + baseSettings: SettingsDictionary() + .swiftVersion("6.0") + .bitcodeEnabled(false) + .otherLinkerFlags(["-ObjC"]) +) + +let project = surcharges.project(targets: [target]) diff --git a/Surcharges/PresentationLayer/UIs/MobileAds/Sources/AdViewWrapper.swift b/Surcharges/PresentationLayer/UIs/MobileAds/Sources/AdViewWrapper.swift new file mode 100644 index 0000000..2ac2d63 --- /dev/null +++ b/Surcharges/PresentationLayer/UIs/MobileAds/Sources/AdViewWrapper.swift @@ -0,0 +1,57 @@ +// +// AdViewWrapper.swift +// MobileAds +// +// Created by Bonsung Koo on 31/01/2025. +// Copyright ยฉ 2025 Surcharges. All rights reserved. +// + +import UIKit +import SwiftUI + +import GoogleMobileAds + +struct AdViewWrapper: UIViewRepresentable { + private let _adSize: GADAdSize + private let _unitId: String + + init(_ adSize: GADAdSize, unitId: String) { + _adSize = adSize + _unitId = unitId + } + + func makeUIView(context: Context) -> UIView { + let view = UIView() + view.addSubview(context.coordinator.bannerView) + return view + } + + func updateUIView(_ uiView: UIView, context: Context) { + context.coordinator.bannerView.adSize = _adSize + } + + func makeCoordinator() -> BannerCoordinator { + return BannerCoordinator(self, unitId: _unitId) + } + + @MainActor + class BannerCoordinator: NSObject, GADBannerViewDelegate { + + private let _unitId: String + + private(set) lazy var bannerView: GADBannerView = { + let banner = GADBannerView(adSize: _parent._adSize) + banner.adUnitID = _unitId + banner.load(GADRequest()) + banner.delegate = self + return banner + }() + + private let _parent: AdViewWrapper + + init(_ parent: AdViewWrapper, unitId: String) { + _parent = parent + _unitId = unitId + } + } +} diff --git a/Surcharges/PresentationLayer/UIs/MobileAds/Sources/FixedAdsView.swift b/Surcharges/PresentationLayer/UIs/MobileAds/Sources/FixedAdsView.swift new file mode 100644 index 0000000..2241795 --- /dev/null +++ b/Surcharges/PresentationLayer/UIs/MobileAds/Sources/FixedAdsView.swift @@ -0,0 +1,105 @@ +// +// FixedAdsView.swift +// MobileAds +// +// Created by Bonsung Koo on 31/01/2025. +// Copyright ยฉ 2025 Surcharges. All rights reserved. +// + +import SwiftUI + +import Resources +import UIExtensions + +import Lottie +import GoogleMobileAds + +public struct FixedAdsView: View { + + enum AdShowingMoment { + case hide + case thanks + case show + } + + @State private var _adSize: GADAdSize = .init() + @State private var _adShowingMoment: AdShowingMoment = .hide + @Binding private var _isAdShowing: Bool + + private let _unitId: String + + public init(isAdShowing: Binding, unitId: String) { + __isAdShowing = isAdShowing + _unitId = unitId + + if _isAdShowing { + __adShowingMoment = .init(initialValue: .show) + } + } + + public var body: some View { + + VStack { + + switch _adShowingMoment { + + case .hide: + + VStack(spacing: 10) { + + LottieView { + return .dotLottieFile( + try await .named(R.file.adsLottie.filename, bundle: R.file.adsLottie.bundle) + ) + } + .playbackMode(.playing(.fromProgress(0, toProgress: 1, loopMode: .loop))) + .frame(maxWidth: 200, maxHeight: 200) + + Text(R.string.localizable.exposingAdsSuggestion()) + .font(.headline) + .multilineTextAlignment(.center) + + Button { + + _isAdShowing = true + + withAnimation { + _adShowingMoment = .thanks + } + + DispatchQueue.main.asyncAfter(deadline: .now() + 3) { + withAnimation { + _adShowingMoment = .show + } + } + + } label: { + Text(R.string.localizable.exposingAdsAcceptButtonTitle()) + } + .padding(.top, 20) + + } + .frame(maxWidth: .infinity, maxHeight: .infinity) + .padding() + + case .thanks: + + VStack { + Text("\(R.string.localizable.exposingAdsThanks())๐ŸŽ‰") + } + .frame(maxWidth: .infinity, maxHeight: .infinity) + + case .show: + + AdViewWrapper(_adSize, unitId: _unitId) + + } + } + .background(R.color.gray100.color) + .frame(minHeight: _adSize.size.width, maxHeight: _adSize.size.width) + .cornerRadius(20) + .readSize { size in + _adSize = GADAdSizeFromCGSize(.init(width: size.width, height: size.width)) + } + } +} diff --git a/Surcharges/PresentationLayer/UIs/MobileAds/Sources/ListAdsView.swift b/Surcharges/PresentationLayer/UIs/MobileAds/Sources/ListAdsView.swift new file mode 100644 index 0000000..59e03ae --- /dev/null +++ b/Surcharges/PresentationLayer/UIs/MobileAds/Sources/ListAdsView.swift @@ -0,0 +1,38 @@ +// +// ListAdsView.swift +// MobileAds +// +// Created by Bonsung Koo on 31/01/2025. +// Copyright ยฉ 2025 Surcharges. All rights reserved. +// + +import SwiftUI + +import Resources +import UIExtensions + +import Lottie +import GoogleMobileAds + +public struct ListAdsView: View { + + @State private var _adSize: GADAdSize = .init() + + private let _unitId: String + + public init(unitId: String) { + _unitId = unitId + } + + public var body: some View { + VStack { + AdViewWrapper(_adSize, unitId: _unitId) + .frame(height: _adSize.size.height) + } + .background(R.color.gray100.color) + .cornerRadius(20) + .readSize { size in + _adSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(size.width) + } + } +} diff --git a/Surcharges/PresentationLayer/UIs/Resources/Resources/Localise/en.lproj/Localizable.strings b/Surcharges/PresentationLayer/UIs/Resources/Resources/Localise/en.lproj/Localizable.strings index 2b3afc1..559a40b 100644 --- a/Surcharges/PresentationLayer/UIs/Resources/Resources/Localise/en.lproj/Localizable.strings +++ b/Surcharges/PresentationLayer/UIs/Resources/Resources/Localise/en.lproj/Localizable.strings @@ -65,3 +65,6 @@ "toastNoInternet"="Please check the Internet connection."; "toastNewVersion"="New version available. Please update."; "toastUnknown"="Oops๐Ÿซข Something went wrong. Please try again."; +"exposingAdsSuggestion"="If you are enjoy this app, and make it sustainable, is it okay to show you ads? It will show here and in the place list."; +"exposingAdsAcceptButtonTitle"="Yes. Show me ads!"; +"exposingAdsThanks"="Thank you for supporting us!"; diff --git a/Surcharges/PresentationLayer/UIs/Resources/Resources/Localise/ko.lproj/Localizable.strings b/Surcharges/PresentationLayer/UIs/Resources/Resources/Localise/ko.lproj/Localizable.strings index 96e18b7..42ef01d 100644 --- a/Surcharges/PresentationLayer/UIs/Resources/Resources/Localise/ko.lproj/Localizable.strings +++ b/Surcharges/PresentationLayer/UIs/Resources/Resources/Localise/ko.lproj/Localizable.strings @@ -12,7 +12,7 @@ "tipSurchargeStatusMessage"="ํ‘œ์‹œ๋˜๋Š” ๊ฒฐ์ œ์ˆ˜์ˆ˜๋ฃŒ ์ƒํƒœ๋ฅผ ์•Œ์•„๋ณด์„ธ์š”."; "tipUseLocationTitle"="ํ˜„์žฌ ์œ„์น˜๋ฅผ ์‚ฌ์šฉํ•ด ๋ณด์„ธ์š”."; "tipUseLocationMessage"="ํ˜„์žฌ ์œ„์น˜๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์ฃผ๋ณ€ ์ƒ์ ์„ ๊ฒ€์ƒ‰ํ•ด๋ณด์„ธ์š”."; -"welcomeToSurchargeApp"="Surcharge์— ์ž˜ ์˜ค์…จ์Šต๋‹ˆ๋‹ค!"; +"welcomeToSurchargeApp"="ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค!"; "searchFor"="\"%@\"์˜ ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ"; "alertUseLocationDeniedTitle"="์œ„์น˜ ์ •๋ณด ๊ถŒํ•œ์ด ๊ฑฐ๋ถ€ ๋จ."; "alertUseLocationDeniedMessage"="์œ„์น˜ ์ •๋ณด๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ๊ถŒํ•œ์„ ์ฃผ์„ธ์š”."; @@ -20,7 +20,7 @@ "close"="๋‹ซ๊ธฐ"; "searchBoxPlaceholder"="์–ด๋””๋กœ ๊ฐ€์‹œ๋‚˜์š”?"; "searchButtonTitle"="๊ฒ€์ƒ‰"; -"reportForUnknownButtonTitle"="๋‹น์‹ ์˜ ์ •๋ณด๋ฅผ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค."; +"reportForUnknownButtonTitle"="๊ณต์œ ํ•˜๊ณ  ์‹ถ์€ ์ •๋ณด๊ฐ€ ์žˆ๋‚˜์š”?"; "reportForConfirmedButtonTitle"="์‹ค์ œ ์ •๋ณด์™€ ๋‹ค๋ฅธ๊ฐ€์š”?"; "surchargeStatusUnknownMessage"="์•„์ง ๋ณด๊ณ ๋œ ๊ฒฐ์ œ์ˆ˜์ˆ˜๋ฃŒ ์ •๋ณด๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค."; "surchargeStatusUnknown"="์•Œ๋ ค์ง€์ง€ ์•Š์Œ"; @@ -65,3 +65,6 @@ "toastNoInternet"="์ธํ„ฐ๋„ท ์—ฐ๊ฒฐ์„ ํ™•์ธํ•ด ์ฃผ์„ธ์š”."; "toastNewVersion"="์ƒˆ๋กœ์šด ๋ฒ„์ „์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์—…๋ฐ์ดํŠธ ํ•ด์ฃผ์„ธ์š”."; "toastUnknown"="์ด๋Ÿฐ๐Ÿซข ๋ญ”๊ฐ€ ์ด์ƒํ•˜๊ตฐ์š”. ๋‹ค์‹œ ์‹œ๋„ํ•ด ์ฃผ์„ธ์š”."; +"exposingAdsSuggestion"="์ง€์† ๊ฐ€๋Šฅํ•œ ์„œ๋น„์Šค๋ฅผ ์œ„ํ•ด ๊ด‘๊ณ ๋ฅผ ํ—ˆ์šฉ ํ•ด์ฃผ์‹œ๊ฒ ์–ด์š”? ์ด๊ณณ๊ณผ ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ ๋ชฉ๋ก์— ๊ด‘๊ณ ๊ฐ€ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค."; +"exposingAdsAcceptButtonTitle"="๋ณด์—ฌ์ฃผ์„ธ์š”!"; +"exposingAdsThanks"="๋„์™€์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!"; diff --git a/Surcharges/PresentationLayer/UIs/Resources/Resources/LottieFiles/Ads/ads.lottie b/Surcharges/PresentationLayer/UIs/Resources/Resources/LottieFiles/Ads/ads.lottie new file mode 100644 index 0000000..fe49ea9 Binary files /dev/null and b/Surcharges/PresentationLayer/UIs/Resources/Resources/LottieFiles/Ads/ads.lottie differ diff --git a/Surcharges/Shared/Google/FirebaseSDKs/Project.swift b/Surcharges/Shared/Google/FirebaseSDKs/Project.swift new file mode 100644 index 0000000..70b229b --- /dev/null +++ b/Surcharges/Shared/Google/FirebaseSDKs/Project.swift @@ -0,0 +1,26 @@ +import ProjectDescription +import ProjectDescriptionHelpers +import ModularPlugin + +let surcharges = Surcharges(project: Shared.Google.FirebaseSDKs) + +let target = surcharges.target( + hasSources: false, + projects: + [ + + ], + externalPackages: + [ + ExternalPackages.Google.Firebase.Core, + ExternalPackages.Google.Firebase.Analytics, + ExternalPackages.Google.Firebase.Crashlytics, + + ], + baseSettings: SettingsDictionary() + .swiftVersion("6.0") + .bitcodeEnabled(false) + .otherLinkerFlags(["-ObjC"]) +) + +let project = surcharges.project(targets: [target]) diff --git a/Surcharges/Shared/Services/Ads/AdsServiceProtocol/Project.swift b/Surcharges/Shared/Services/Ads/AdsServiceProtocol/Project.swift new file mode 100644 index 0000000..5e20f49 --- /dev/null +++ b/Surcharges/Shared/Services/Ads/AdsServiceProtocol/Project.swift @@ -0,0 +1,14 @@ +import ProjectDescription +import ProjectDescriptionHelpers +import ModularPlugin + +let surcharges = Surcharges(project: Shared.Services.AdsServiceProtocol) + +let target = surcharges.target( + projects: + [ + + ] +) + +let project = surcharges.project(targets: [target]) diff --git a/Surcharges/Shared/Services/Ads/AdsServiceProtocol/Sources/AdsServiceProtocol.swift b/Surcharges/Shared/Services/Ads/AdsServiceProtocol/Sources/AdsServiceProtocol.swift new file mode 100644 index 0000000..a42a5c9 --- /dev/null +++ b/Surcharges/Shared/Services/Ads/AdsServiceProtocol/Sources/AdsServiceProtocol.swift @@ -0,0 +1,16 @@ +// +// AdsServiceProtocol.swift +// AdsServiceProtocol +// +// Created by Bonsung Koo on 31/01/2025. +// Copyright ยฉ 2025 Surcharges. All rights reserved. +// + +import Foundation + +public protocol AdsServiceProtocol: ObservableObject { + init() + var isShowingAds: Bool { get set } + var fixedBannerUnitId: String { get } + var listBannerUnitId: String { get } +} diff --git a/Surcharges/Shared/Services/Ads/DevelopmentAdsService/Project.swift b/Surcharges/Shared/Services/Ads/DevelopmentAdsService/Project.swift new file mode 100644 index 0000000..8e2f48b --- /dev/null +++ b/Surcharges/Shared/Services/Ads/DevelopmentAdsService/Project.swift @@ -0,0 +1,14 @@ +import ProjectDescription +import ProjectDescriptionHelpers +import ModularPlugin + +let surcharges = Surcharges(project: Shared.Services.DevelopmentAdsService) + +let target = surcharges.target( + projects: + [ + Shared.Services.AdsServiceProtocol + ] +) + +let project = surcharges.project(targets: [target]) diff --git a/Surcharges/Shared/Services/Ads/DevelopmentAdsService/Sources/.gitkeep b/Surcharges/Shared/Services/Ads/DevelopmentAdsService/Sources/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Surcharges/Shared/Services/Ads/ProductionAdsService/Project.swift b/Surcharges/Shared/Services/Ads/ProductionAdsService/Project.swift new file mode 100644 index 0000000..d461367 --- /dev/null +++ b/Surcharges/Shared/Services/Ads/ProductionAdsService/Project.swift @@ -0,0 +1,14 @@ +import ProjectDescription +import ProjectDescriptionHelpers +import ModularPlugin + +let surcharges = Surcharges(project: Shared.Services.ProductionAdsService) + +let target = surcharges.target( + projects: + [ + Shared.Services.AdsServiceProtocol + ] +) + +let project = surcharges.project(targets: [target]) diff --git a/Surcharges/Shared/Services/Ads/ProductionAdsService/Sources/.gitkeep b/Surcharges/Shared/Services/Ads/ProductionAdsService/Sources/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Tuist/ProjectDescriptionHelpers/Project/Packages.swift b/Tuist/ProjectDescriptionHelpers/Project/Packages.swift index e937bb5..6c35275 100644 --- a/Tuist/ProjectDescriptionHelpers/Project/Packages.swift +++ b/Tuist/ProjectDescriptionHelpers/Project/Packages.swift @@ -18,17 +18,27 @@ public struct Packages { return .remote(url: "https://github.com/quanshousio/ToastUI", requirement: .exact("4.0.0")) } + public static var Lottie: Package { + return .remote(url: "https://github.com/airbnb/lottie-ios", requirement: .exact("4.5.1")) + } + public static var Firebase: Package { return .remote(url: "https://github.com/firebase/firebase-ios-sdk", requirement: .exact("11.7.0")) } + public static var GoogleMobileAds: Package { + return .remote(url: "https://github.com/googleads/swift-package-manager-google-mobile-ads", requirement: .exact("11.13.0")) + } + public static var all: [Package] { return [ Alamofire, Shimmer, Confetti, ToastUI, + Lottie, Firebase, + GoogleMobileAds, ] } } diff --git a/Tuist/ProjectDescriptionHelpers/Project/Surcharges.swift b/Tuist/ProjectDescriptionHelpers/Project/Surcharges.swift index 1b90b96..7066a58 100644 --- a/Tuist/ProjectDescriptionHelpers/Project/Surcharges.swift +++ b/Tuist/ProjectDescriptionHelpers/Project/Surcharges.swift @@ -18,11 +18,24 @@ public final class Surcharges: @unchecked Sendable { } public func target( + hasSources: Bool = true, hasResources: Bool = false, projects: [ModularPlugin.Project], scripts: [TargetScript] = [], - externalPackages: [TargetDependency] = [] + externalPackages: [TargetDependency] = [], + baseSettings: SettingsDictionary? = nil ) -> Target { + + var _baseSettings: SettingsDictionary { + if let baseSettings = baseSettings { + return baseSettings + } else { + return SettingsDictionary() + .swiftVersion("6.0") + .bitcodeEnabled(false) + } + } + return .target( name: _project.name, destinations: [.iPhone], @@ -38,7 +51,7 @@ public final class Surcharges: @unchecked Sendable { "NSHumanReadableCopyright": .string("ยฉ2025 Bonsung Koo. All rights reserved.") ] ), - sources: ["Sources/**"], + sources: hasSources ? ["Sources/**"] : nil, resources: hasResources ? .resources(["Resources/**"], privacyManifest: .default) : nil, scripts: scripts, dependencies: projects @@ -49,9 +62,7 @@ public final class Surcharges: @unchecked Sendable { ) } + externalPackages, settings: Settings.settings( - base: SettingsDictionary() - .swiftVersion("6.0") - .bitcodeEnabled(false), + base: _baseSettings, debug: SettingsDictionary(), release: SettingsDictionary(), defaultSettings: .recommended diff --git a/ci_scripts/ci_post_clone.sh b/ci_scripts/ci_post_clone.sh index 889eb4c..9483ee6 100644 --- a/ci_scripts/ci_post_clone.sh +++ b/ci_scripts/ci_post_clone.sh @@ -18,6 +18,7 @@ then sh ./make_files/dev/make_endpoint.sh sh ./make_files/dev/make_firebase.sh + sh ./make_files/dev/make_adsService.sh cd .. @@ -42,6 +43,7 @@ else sh ./make_files/prod/make_endpoint.sh sh ./make_files/prod/make_firebase.sh + sh ./make_files/prod/make_adsService.sh cd .. diff --git a/ci_scripts/make_files/dev/make_adsService.sh b/ci_scripts/make_files/dev/make_adsService.sh new file mode 100644 index 0000000..823b7d2 --- /dev/null +++ b/ci_scripts/make_files/dev/make_adsService.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# make_adsService.sh +# +# +# Created by Bonsung Koo on 31/01/2025. +# + +FILE_PATH=$CI_PRIMARY_REPOSITORY_PATH/Surcharges/Shared/Services/Ads/DevelopmentAdsService/Sources/DevelopmentAdsService.swift + +echo "import Foundation" >> $FILE_PATH +echo "import AdsServiceProtocol" >> $FILE_PATH +echo "public final class DevelopmentAdsService: AdsServiceProtocol {" >> $FILE_PATH +echo "public init() { }" >> $FILE_PATH +echo "public var isShowingAds: Bool {" >> $FILE_PATH +echo "get {" >> $FILE_PATH +echo "return UserDefaults.standard.bool(forKey: \"isShowingAds\")" >> $FILE_PATH +echo "}" >> $FILE_PATH +echo "set {" >> $FILE_PATH +echo "UserDefaults.standard.set(newValue, forKey: \"isShowingAds\")" >> $FILE_PATH +echo "}" >> $FILE_PATH +echo "}" >> $FILE_PATH +echo "public var fixedBannerUnitId = \"$AD_FIXED_BANNER_UNIT_ID\"" >> $FILE_PATH +echo "public var listBannerUnitId = \"$AD_LIST_BANNER_UNIT_ID\"" >> $FILE_PATH +echo "}" >> $FILE_PATH \ No newline at end of file diff --git a/ci_scripts/make_files/dev/make_endpoint.sh b/ci_scripts/make_files/dev/make_endpoint.sh index 8519394..8f1b8c9 100644 --- a/ci_scripts/make_files/dev/make_endpoint.sh +++ b/ci_scripts/make_files/dev/make_endpoint.sh @@ -6,17 +6,19 @@ # Created by Bonsung Koo on 28/01/2025. # -echo "import Foundation" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/DevelopmentEndpoint/Sources/DevelopmentEndpoint.swift -echo "import EndpointProtocol" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/DevelopmentEndpoint/Sources/DevelopmentEndpoint.swift -echo "public struct DevelopmentEndpoint: EndpointProtocol {" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/DevelopmentEndpoint/Sources/DevelopmentEndpoint.swift -echo "public init() { }" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/DevelopmentEndpoint/Sources/DevelopmentEndpoint.swift -echo "public var baseURL: String {" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/DevelopmentEndpoint/Sources/DevelopmentEndpoint.swift -echo "return \"$BASE_URL\"" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/DevelopmentEndpoint/Sources/DevelopmentEndpoint.swift -echo "}" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/DevelopmentEndpoint/Sources/DevelopmentEndpoint.swift -echo "public var authorisationScheme: String {" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/DevelopmentEndpoint/Sources/DevelopmentEndpoint.swift -echo "return \"$AUTHORISATION_SCHEME\"" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/DevelopmentEndpoint/Sources/DevelopmentEndpoint.swift -echo "}" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/DevelopmentEndpoint/Sources/DevelopmentEndpoint.swift -echo "public var authorisationToken: String {" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/DevelopmentEndpoint/Sources/DevelopmentEndpoint.swift -echo "return \"$AUTHORISATION_TOKEN\"" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/DevelopmentEndpoint/Sources/DevelopmentEndpoint.swift -echo "}" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/DevelopmentEndpoint/Sources/DevelopmentEndpoint.swift -echo "}" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/DevelopmentEndpoint/Sources/DevelopmentEndpoint.swift \ No newline at end of file +FILE_PATH=$CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/DevelopmentEndpoint/Sources/DevelopmentEndpoint.swift + +echo "import Foundation" >> $FILE_PATH +echo "import EndpointProtocol" >> $FILE_PATH +echo "public struct DevelopmentEndpoint: EndpointProtocol {" >> $FILE_PATH +echo "public init() { }" >> $FILE_PATH +echo "public var baseURL: String {" >> $FILE_PATH +echo "return \"$BASE_URL\"" >> $FILE_PATH +echo "}" >> $FILE_PATH +echo "public var authorisationScheme: String {" >> $FILE_PATH +echo "return \"$AUTHORISATION_SCHEME\"" >> $FILE_PATH +echo "}" >> $FILE_PATH +echo "public var authorisationToken: String {" >> $FILE_PATH +echo "return \"$AUTHORISATION_TOKEN\"" >> $FILE_PATH +echo "}" >> $FILE_PATH +echo "}" >> $FILE_PATH \ No newline at end of file diff --git a/ci_scripts/make_files/dev/make_firebase.sh b/ci_scripts/make_files/dev/make_firebase.sh index dd18316..276bfd7 100644 --- a/ci_scripts/make_files/dev/make_firebase.sh +++ b/ci_scripts/make_files/dev/make_firebase.sh @@ -6,37 +6,39 @@ # Created by Bonsung Koo on 28/01/2025. # -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "CLIENT_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "$FIREBASE_CLIENT_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "REVERSED_CLIENT_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "$FIREBASE_REVERSED_CLIENT_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "API_KEY" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "$FIREBASE_API_KEY" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "GCM_SENDER_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "$FIREBASE_GCM_SENDER_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "PLIST_VERSION" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "1" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "BUNDLE_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "nz.surcharges.development" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "PROJECT_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "surcharges-dev" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "STORAGE_BUCKET" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "$FIREBASE_STORAGE_BUCKET" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "IS_ADS_ENABLED" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "IS_ANALYTICS_ENABLED" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "IS_APPINVITE_ENABLED" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "IS_GCM_ENABLED" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "IS_SIGNIN_ENABLED" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "GOOGLE_APP_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "$FIREBASE_GOOGLE_APP_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist \ No newline at end of file +FILE_PATH=$CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Dev/GoogleService-Info.plist + +echo "" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "CLIENT_ID" >> $FILE_PATH +echo "$FIREBASE_CLIENT_ID" >> $FILE_PATH +echo "REVERSED_CLIENT_ID" >> $FILE_PATH +echo "$FIREBASE_REVERSED_CLIENT_ID" >> $FILE_PATH +echo "API_KEY" >> $FILE_PATH +echo "$FIREBASE_API_KEY" >> $FILE_PATH +echo "GCM_SENDER_ID" >> $FILE_PATH +echo "$FIREBASE_GCM_SENDER_ID" >> $FILE_PATH +echo "PLIST_VERSION" >> $FILE_PATH +echo "1" >> $FILE_PATH +echo "BUNDLE_ID" >> $FILE_PATH +echo "nz.surcharges.development" >> $FILE_PATH +echo "PROJECT_ID" >> $FILE_PATH +echo "surcharges-dev" >> $FILE_PATH +echo "STORAGE_BUCKET" >> $FILE_PATH +echo "$FIREBASE_STORAGE_BUCKET" >> $FILE_PATH +echo "IS_ADS_ENABLED" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "IS_ANALYTICS_ENABLED" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "IS_APPINVITE_ENABLED" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "IS_GCM_ENABLED" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "IS_SIGNIN_ENABLED" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "GOOGLE_APP_ID" >> $FILE_PATH +echo "$FIREBASE_GOOGLE_APP_ID" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "" >> $FILE_PATH \ No newline at end of file diff --git a/ci_scripts/make_files/prod/make_adsService.sh b/ci_scripts/make_files/prod/make_adsService.sh new file mode 100644 index 0000000..f782805 --- /dev/null +++ b/ci_scripts/make_files/prod/make_adsService.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# make_adsService.sh +# +# +# Created by Bonsung Koo on 31/01/2025. +# + +FILE_PATH=$CI_PRIMARY_REPOSITORY_PATH/Surcharges/Shared/Services/Ads/ProductionAdsService/Sources/ProductionAdsService.swift + +echo "import Foundation" >> $FILE_PATH +echo "import AdsServiceProtocol" >> $FILE_PATH +echo "public final class ProductionAdsService: AdsServiceProtocol {" >> $FILE_PATH +echo "public init() { }" >> $FILE_PATH +echo "public var isShowingAds: Bool {" >> $FILE_PATH +echo "get {" >> $FILE_PATH +echo "return UserDefaults.standard.bool(forKey: \"isShowingAds\")" >> $FILE_PATH +echo "}" >> $FILE_PATH +echo "set {" >> $FILE_PATH +echo "UserDefaults.standard.set(newValue, forKey: \"isShowingAds\")" >> $FILE_PATH +echo "}" >> $FILE_PATH +echo "}" >> $FILE_PATH +echo "public var fixedBannerUnitId = \"$AD_FIXED_BANNER_UNIT_ID\"" >> $FILE_PATH +echo "public var listBannerUnitId = \"$AD_LIST_BANNER_UNIT_ID\"" >> $FILE_PATH +echo "}" >> $FILE_PATH \ No newline at end of file diff --git a/ci_scripts/make_files/prod/make_endpoint.sh b/ci_scripts/make_files/prod/make_endpoint.sh index 8a968be..138070c 100644 --- a/ci_scripts/make_files/prod/make_endpoint.sh +++ b/ci_scripts/make_files/prod/make_endpoint.sh @@ -6,17 +6,19 @@ # Created by Bonsung Koo on 28/01/2025. # -echo "import Foundation" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/ProductionEndpoint/Sources/ProductionEndpoint.swift -echo "import EndpointProtocol" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/ProductionEndpoint/Sources/ProductionEndpoint.swift -echo "public struct ProductionEndpoint: EndpointProtocol {" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/ProductionEndpoint/Sources/ProductionEndpoint.swift -echo "public init() { }" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/ProductionEndpoint/Sources/ProductionEndpoint.swift -echo "public var baseURL: String {" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/ProductionEndpoint/Sources/ProductionEndpoint.swift -echo "return \"$BASE_URL\"" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/ProductionEndpoint/Sources/ProductionEndpoint.swift -echo "}" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/ProductionEndpoint/Sources/ProductionEndpoint.swift -echo "public var authorisationScheme: String {" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/ProductionEndpoint/Sources/ProductionEndpoint.swift -echo "return \"$AUTHORISATION_SCHEME\"" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/ProductionEndpoint/Sources/ProductionEndpoint.swift -echo "}" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/ProductionEndpoint/Sources/ProductionEndpoint.swift -echo "public var authorisationToken: String {" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/ProductionEndpoint/Sources/ProductionEndpoint.swift -echo "return \"$AUTHORISATION_TOKEN\"" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/ProductionEndpoint/Sources/ProductionEndpoint.swift -echo "}" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/ProductionEndpoint/Sources/ProductionEndpoint.swift -echo "}" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/ProductionEndpoint/Sources/ProductionEndpoint.swift \ No newline at end of file +FILE_PATH=$CI_PRIMARY_REPOSITORY_PATH/Surcharges/DataSource/Endpoints/ProductionEndpoint/Sources/ProductionEndpoint.swift + +echo "import Foundation" >> $FILE_PATH +echo "import EndpointProtocol" >> $FILE_PATH +echo "public struct ProductionEndpoint: EndpointProtocol {" >> $FILE_PATH +echo "public init() { }" >> $FILE_PATH +echo "public var baseURL: String {" >> $FILE_PATH +echo "return \"$BASE_URL\"" >> $FILE_PATH +echo "}" >> $FILE_PATH +echo "public var authorisationScheme: String {" >> $FILE_PATH +echo "return \"$AUTHORISATION_SCHEME\"" >> $FILE_PATH +echo "}" >> $FILE_PATH +echo "public var authorisationToken: String {" >> $FILE_PATH +echo "return \"$AUTHORISATION_TOKEN\"" >> $FILE_PATH +echo "}" >> $FILE_PATH +echo "}" >> $FILE_PATH \ No newline at end of file diff --git a/ci_scripts/make_files/prod/make_firebase.sh b/ci_scripts/make_files/prod/make_firebase.sh index 465165e..e72a5b1 100644 --- a/ci_scripts/make_files/prod/make_firebase.sh +++ b/ci_scripts/make_files/prod/make_firebase.sh @@ -6,37 +6,39 @@ # Created by Bonsung Koo on 28/01/2025. # -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "CLIENT_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "$FIREBASE_CLIENT_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "REVERSED_CLIENT_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "$FIREBASE_REVERSED_CLIENT_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "API_KEY" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "$FIREBASE_API_KEY" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "GCM_SENDER_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "$FIREBASE_GCM_SENDER_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "PLIST_VERSION" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "1" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "BUNDLE_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "nz.surcharges" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "PROJECT_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "surcharges" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "STORAGE_BUCKET" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "$FIREBASE_STORAGE_BUCKET" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "IS_ADS_ENABLED" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "IS_ANALYTICS_ENABLED" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "IS_APPINVITE_ENABLED" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "IS_GCM_ENABLED" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "IS_SIGNIN_ENABLED" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "GOOGLE_APP_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "$FIREBASE_GOOGLE_APP_ID" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist -echo "" >> $CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist \ No newline at end of file +FILE_PATH=$CI_PRIMARY_REPOSITORY_PATH/Surcharges/Applications/Resources/Prod/GoogleService-Info.plist + +echo "" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "CLIENT_ID" >> $FILE_PATH +echo "$FIREBASE_CLIENT_ID" >> $FILE_PATH +echo "REVERSED_CLIENT_ID" >> $FILE_PATH +echo "$FIREBASE_REVERSED_CLIENT_ID" >> $FILE_PATH +echo "API_KEY" >> $FILE_PATH +echo "$FIREBASE_API_KEY" >> $FILE_PATH +echo "GCM_SENDER_ID" >> $FILE_PATH +echo "$FIREBASE_GCM_SENDER_ID" >> $FILE_PATH +echo "PLIST_VERSION" >> $FILE_PATH +echo "1" >> $FILE_PATH +echo "BUNDLE_ID" >> $FILE_PATH +echo "nz.surcharges" >> $FILE_PATH +echo "PROJECT_ID" >> $FILE_PATH +echo "surcharges" >> $FILE_PATH +echo "STORAGE_BUCKET" >> $FILE_PATH +echo "$FIREBASE_STORAGE_BUCKET" >> $FILE_PATH +echo "IS_ADS_ENABLED" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "IS_ANALYTICS_ENABLED" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "IS_APPINVITE_ENABLED" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "IS_GCM_ENABLED" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "IS_SIGNIN_ENABLED" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "GOOGLE_APP_ID" >> $FILE_PATH +echo "$FIREBASE_GOOGLE_APP_ID" >> $FILE_PATH +echo "" >> $FILE_PATH +echo "" >> $FILE_PATH \ No newline at end of file