From b2f0975ad1f51bbe5891fa12f30c8fd9d50275c8 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Thu, 14 Sep 2023 12:16:01 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20-=20=EB=B0=B0=EB=84=88=20=EA=B4=91=EA=B3=A0=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Podfile | 2 + Podfile.lock | 62 ++++- .../Resources/Debug/SodaLive-dev-Info.plist | 243 ++++++++++++++++-- SodaLive/Resources/Info.plist | 201 +++++++++++++++ .../Sources/Advertisement/BannerAdView.swift | 33 +++ SodaLive/Sources/App/AppDelegate.swift | 2 + .../Content/Detail/ContentDetailView.swift | 98 +++---- SodaLive/Sources/Debug/Utils/Constants.swift | 1 + SodaLive/Sources/Utils/Constants.swift | 1 + 9 files changed, 577 insertions(+), 66 deletions(-) create mode 100644 SodaLive/Sources/Advertisement/BannerAdView.swift diff --git a/Podfile b/Podfile index 920b610..4f9c32b 100644 --- a/Podfile +++ b/Podfile @@ -7,6 +7,7 @@ target 'SodaLive' do # Pods for SodaLive pod 'BootpayUI', '4.3.0' + pod 'Google-Mobile-Ads-SDK' pod 'ObjectBox' end @@ -17,6 +18,7 @@ target 'SodaLive-dev' do # Pods for SodaLive-dev pod 'BootpayUI', '4.3.0' + pod 'Google-Mobile-Ads-SDK' pod 'ObjectBox' end diff --git a/Podfile.lock b/Podfile.lock index 1f90cbc..faf6ef6 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -13,15 +13,63 @@ PODS: - SnapKit - SwiftyJSON - CryptoSwift (1.7.1) + - Google-Mobile-Ads-SDK (10.9.0): + - GoogleAppMeasurement (< 11.0, >= 7.0) + - GoogleUserMessagingPlatform (>= 1.1) + - GoogleAppMeasurement (10.13.0): + - GoogleAppMeasurement/AdIdSupport (= 10.13.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleAppMeasurement/AdIdSupport (10.13.0): + - GoogleAppMeasurement/WithoutAdIdSupport (= 10.13.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleAppMeasurement/WithoutAdIdSupport (10.13.0): + - GoogleUtilities/AppDelegateSwizzler (~> 7.11) + - GoogleUtilities/MethodSwizzler (~> 7.11) + - GoogleUtilities/Network (~> 7.11) + - "GoogleUtilities/NSData+zlib (~> 7.11)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleUserMessagingPlatform (2.1.0) + - GoogleUtilities/AppDelegateSwizzler (7.11.5): + - GoogleUtilities/Environment + - GoogleUtilities/Logger + - GoogleUtilities/Network + - GoogleUtilities/Environment (7.11.5): + - PromisesObjC (< 3.0, >= 1.2) + - GoogleUtilities/Logger (7.11.5): + - GoogleUtilities/Environment + - GoogleUtilities/MethodSwizzler (7.11.5): + - GoogleUtilities/Logger + - GoogleUtilities/Network (7.11.5): + - GoogleUtilities/Logger + - "GoogleUtilities/NSData+zlib" + - GoogleUtilities/Reachability + - "GoogleUtilities/NSData+zlib (7.11.5)" + - GoogleUtilities/Reachability (7.11.5): + - GoogleUtilities/Logger - JGProgressHUD (2.2) + - nanopb (2.30909.0): + - nanopb/decode (= 2.30909.0) + - nanopb/encode (= 2.30909.0) + - nanopb/decode (2.30909.0) + - nanopb/encode (2.30909.0) - ObjectBox (1.8.1) - ObjectMapper (4.2.0) + - PromisesObjC (2.3.1) - SCLAlertView (0.8) - SnapKit (5.6.0) - SwiftyJSON (5.0.1) DEPENDENCIES: - BootpayUI (= 4.3.0) + - Google-Mobile-Ads-SDK - ObjectBox SPEC REPOS: @@ -30,9 +78,15 @@ SPEC REPOS: - Bootpay - BootpayUI - CryptoSwift + - Google-Mobile-Ads-SDK + - GoogleAppMeasurement + - GoogleUserMessagingPlatform + - GoogleUtilities - JGProgressHUD + - nanopb - ObjectBox - ObjectMapper + - PromisesObjC - SCLAlertView - SnapKit - SwiftyJSON @@ -42,13 +96,19 @@ SPEC CHECKSUMS: Bootpay: d753088334a16ce99094142beb66a6610a15d84b BootpayUI: 54dcbe59a23e0d91b07a8add8115e1a6deace0f0 CryptoSwift: d3d18dc357932f7e6d580689e065cf1f176007c1 + Google-Mobile-Ads-SDK: e81e8b009a182dc8dd14951782efdbb30a5e4510 + GoogleAppMeasurement: 3ae505b44174bcc0775f5c86cecc5826259fbb1e + GoogleUserMessagingPlatform: dce302b8f1b84d6e945812ee7a15c3f65a102cbf + GoogleUtilities: 13e2c67ede716b8741c7989e26893d151b2b2084 JGProgressHUD: d83d7a981b85d11205e19ff8ad5bb9c40571c847 + nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431 ObjectBox: a7900d5335218cd437cbc080b7ccc38a5211f7b4 ObjectMapper: 1eb41f610210777375fa806bf161dc39fb832b81 + PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4 SCLAlertView: 6a77bb2edfc65e04dbe57725546cb4107a506b85 SnapKit: e01d52ebb8ddbc333eefe2132acf85c8227d9c25 SwiftyJSON: 2f33a42c6fbc52764d96f13368585094bfd8aa5e -PODFILE CHECKSUM: cdff30c96e85662f4de75ddd8d54358311c1e629 +PODFILE CHECKSUM: d876c87c55385f76f576689bed2e2309653253c9 COCOAPODS: 1.12.1 diff --git a/SodaLive/Resources/Debug/SodaLive-dev-Info.plist b/SodaLive/Resources/Debug/SodaLive-dev-Info.plist index 252891c..89a964a 100644 --- a/SodaLive/Resources/Debug/SodaLive-dev-Info.plist +++ b/SodaLive/Resources/Debug/SodaLive-dev-Info.plist @@ -1,25 +1,226 @@ - - FirebaseAppDelegateProxyEnabled - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - UIAppFonts - - gmarket_sans_bold.otf - gmarket_sans_medium.otf - gmarket_sans_light.otf - - UIBackgroundModes - - audio - fetch - remote-notification - - + + FirebaseAppDelegateProxyEnabled + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + UIAppFonts + + gmarket_sans_bold.otf + gmarket_sans_medium.otf + gmarket_sans_light.otf + + UIBackgroundModes + + audio + fetch + remote-notification + + GADApplicationIdentifier + ca-app-pub-1299501215847962~3447556960 + SKAdNetworkItems + + + SKAdNetworkIdentifier + cstr6suwn9.skadnetwork + + + SKAdNetworkIdentifier + 4fzdc2evr5.skadnetwork + + + SKAdNetworkIdentifier + 4pfyvq9l8r.skadnetwork + + + SKAdNetworkIdentifier + 2fnua5tdw4.skadnetwork + + + SKAdNetworkIdentifier + ydx93a7ass.skadnetwork + + + SKAdNetworkIdentifier + 5a6flpkh64.skadnetwork + + + SKAdNetworkIdentifier + p78axxw29g.skadnetwork + + + SKAdNetworkIdentifier + v72qych5uu.skadnetwork + + + SKAdNetworkIdentifier + ludvb6z3bs.skadnetwork + + + SKAdNetworkIdentifier + cp8zw746q7.skadnetwork + + + SKAdNetworkIdentifier + 3sh42y64q3.skadnetwork + + + SKAdNetworkIdentifier + c6k4g5qg8m.skadnetwork + + + SKAdNetworkIdentifier + s39g8k73mm.skadnetwork + + + SKAdNetworkIdentifier + 3qy4746246.skadnetwork + + + SKAdNetworkIdentifier + f38h382jlk.skadnetwork + + + SKAdNetworkIdentifier + hs6bdukanm.skadnetwork + + + SKAdNetworkIdentifier + v4nxqhlyqp.skadnetwork + + + SKAdNetworkIdentifier + wzmmz9fp6w.skadnetwork + + + SKAdNetworkIdentifier + yclnxrl5pm.skadnetwork + + + SKAdNetworkIdentifier + t38b2kh725.skadnetwork + + + SKAdNetworkIdentifier + 7ug5zh24hu.skadnetwork + + + SKAdNetworkIdentifier + gta9lk7p23.skadnetwork + + + SKAdNetworkIdentifier + vutu7akeur.skadnetwork + + + SKAdNetworkIdentifier + y5ghdn5j9k.skadnetwork + + + SKAdNetworkIdentifier + n6fk4nfna4.skadnetwork + + + SKAdNetworkIdentifier + v9wttpbfk9.skadnetwork + + + SKAdNetworkIdentifier + n38lu8286q.skadnetwork + + + SKAdNetworkIdentifier + 47vhws6wlr.skadnetwork + + + SKAdNetworkIdentifier + kbd757ywx3.skadnetwork + + + SKAdNetworkIdentifier + 9t245vhmpl.skadnetwork + + + SKAdNetworkIdentifier + eh6m2bh4zr.skadnetwork + + + SKAdNetworkIdentifier + a2p9lx4jpn.skadnetwork + + + SKAdNetworkIdentifier + 22mmun2rn5.skadnetwork + + + SKAdNetworkIdentifier + 4468km3ulz.skadnetwork + + + SKAdNetworkIdentifier + 2u9pt9hc89.skadnetwork + + + SKAdNetworkIdentifier + 8s468mfl3y.skadnetwork + + + SKAdNetworkIdentifier + klf5c3l5u5.skadnetwork + + + SKAdNetworkIdentifier + ppxm28t8ap.skadnetwork + + + SKAdNetworkIdentifier + ecpz2srf59.skadnetwork + + + SKAdNetworkIdentifier + uw77j35x4d.skadnetwork + + + SKAdNetworkIdentifier + pwa73g5rt2.skadnetwork + + + SKAdNetworkIdentifier + mlmmfzh3r3.skadnetwork + + + SKAdNetworkIdentifier + 578prtvx9j.skadnetwork + + + SKAdNetworkIdentifier + 4dzt52r2t5.skadnetwork + + + SKAdNetworkIdentifier + e5fvkxwrpn.skadnetwork + + + SKAdNetworkIdentifier + 8c4e2ghe7u.skadnetwork + + + SKAdNetworkIdentifier + zq492l623r.skadnetwork + + + SKAdNetworkIdentifier + 3rd42ekr43.skadnetwork + + + SKAdNetworkIdentifier + 3qcr597p9d.skadnetwork + + + diff --git a/SodaLive/Resources/Info.plist b/SodaLive/Resources/Info.plist index 252891c..7b912bf 100644 --- a/SodaLive/Resources/Info.plist +++ b/SodaLive/Resources/Info.plist @@ -21,5 +21,206 @@ fetch remote-notification + GADApplicationIdentifier + ca-app-pub-1299501215847962~8852459715 + SKAdNetworkItems + + + SKAdNetworkIdentifier + cstr6suwn9.skadnetwork + + + SKAdNetworkIdentifier + 4fzdc2evr5.skadnetwork + + + SKAdNetworkIdentifier + 4pfyvq9l8r.skadnetwork + + + SKAdNetworkIdentifier + 2fnua5tdw4.skadnetwork + + + SKAdNetworkIdentifier + ydx93a7ass.skadnetwork + + + SKAdNetworkIdentifier + 5a6flpkh64.skadnetwork + + + SKAdNetworkIdentifier + p78axxw29g.skadnetwork + + + SKAdNetworkIdentifier + v72qych5uu.skadnetwork + + + SKAdNetworkIdentifier + ludvb6z3bs.skadnetwork + + + SKAdNetworkIdentifier + cp8zw746q7.skadnetwork + + + SKAdNetworkIdentifier + 3sh42y64q3.skadnetwork + + + SKAdNetworkIdentifier + c6k4g5qg8m.skadnetwork + + + SKAdNetworkIdentifier + s39g8k73mm.skadnetwork + + + SKAdNetworkIdentifier + 3qy4746246.skadnetwork + + + SKAdNetworkIdentifier + f38h382jlk.skadnetwork + + + SKAdNetworkIdentifier + hs6bdukanm.skadnetwork + + + SKAdNetworkIdentifier + v4nxqhlyqp.skadnetwork + + + SKAdNetworkIdentifier + wzmmz9fp6w.skadnetwork + + + SKAdNetworkIdentifier + yclnxrl5pm.skadnetwork + + + SKAdNetworkIdentifier + t38b2kh725.skadnetwork + + + SKAdNetworkIdentifier + 7ug5zh24hu.skadnetwork + + + SKAdNetworkIdentifier + gta9lk7p23.skadnetwork + + + SKAdNetworkIdentifier + vutu7akeur.skadnetwork + + + SKAdNetworkIdentifier + y5ghdn5j9k.skadnetwork + + + SKAdNetworkIdentifier + n6fk4nfna4.skadnetwork + + + SKAdNetworkIdentifier + v9wttpbfk9.skadnetwork + + + SKAdNetworkIdentifier + n38lu8286q.skadnetwork + + + SKAdNetworkIdentifier + 47vhws6wlr.skadnetwork + + + SKAdNetworkIdentifier + kbd757ywx3.skadnetwork + + + SKAdNetworkIdentifier + 9t245vhmpl.skadnetwork + + + SKAdNetworkIdentifier + eh6m2bh4zr.skadnetwork + + + SKAdNetworkIdentifier + a2p9lx4jpn.skadnetwork + + + SKAdNetworkIdentifier + 22mmun2rn5.skadnetwork + + + SKAdNetworkIdentifier + 4468km3ulz.skadnetwork + + + SKAdNetworkIdentifier + 2u9pt9hc89.skadnetwork + + + SKAdNetworkIdentifier + 8s468mfl3y.skadnetwork + + + SKAdNetworkIdentifier + klf5c3l5u5.skadnetwork + + + SKAdNetworkIdentifier + ppxm28t8ap.skadnetwork + + + SKAdNetworkIdentifier + ecpz2srf59.skadnetwork + + + SKAdNetworkIdentifier + uw77j35x4d.skadnetwork + + + SKAdNetworkIdentifier + pwa73g5rt2.skadnetwork + + + SKAdNetworkIdentifier + mlmmfzh3r3.skadnetwork + + + SKAdNetworkIdentifier + 578prtvx9j.skadnetwork + + + SKAdNetworkIdentifier + 4dzt52r2t5.skadnetwork + + + SKAdNetworkIdentifier + e5fvkxwrpn.skadnetwork + + + SKAdNetworkIdentifier + 8c4e2ghe7u.skadnetwork + + + SKAdNetworkIdentifier + zq492l623r.skadnetwork + + + SKAdNetworkIdentifier + 3rd42ekr43.skadnetwork + + + SKAdNetworkIdentifier + 3qcr597p9d.skadnetwork + + diff --git a/SodaLive/Sources/Advertisement/BannerAdView.swift b/SodaLive/Sources/Advertisement/BannerAdView.swift new file mode 100644 index 0000000..9c8e625 --- /dev/null +++ b/SodaLive/Sources/Advertisement/BannerAdView.swift @@ -0,0 +1,33 @@ +// +// BannerAdView.swift +// SodaLive +// +// Created by klaus on 2023/09/14. +// + +import SwiftUI +import UIKit + +import GoogleMobileAds + +struct BannerAdView: UIViewControllerRepresentable { + + let adUnitId: String + + func makeUIViewController(context: Context) -> some UIViewController { + let viewController = UIViewController() + + let bannerSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(UIScreen.main.bounds.width) + let banner = GADBannerView(adSize: bannerSize) + banner.rootViewController = viewController + viewController.view.addSubview(banner) + viewController.view.frame = CGRect(origin: .zero, size: bannerSize.size) + + banner.adUnitID = adUnitId + banner.load(GADRequest()) + + return viewController + } + + func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) {} +} diff --git a/SodaLive/Sources/App/AppDelegate.swift b/SodaLive/Sources/App/AppDelegate.swift index ef267e2..4a0ffb6 100644 --- a/SodaLive/Sources/App/AppDelegate.swift +++ b/SodaLive/Sources/App/AppDelegate.swift @@ -9,6 +9,7 @@ import UIKit import FirebaseCore import FirebaseMessaging +import GoogleMobileAds class AppDelegate: UIResponder, UIApplicationDelegate { @@ -16,6 +17,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { FirebaseApp.configure() + GADMobileAds.sharedInstance().start() Messaging.messaging().delegate = self diff --git a/SodaLive/Sources/Content/Detail/ContentDetailView.swift b/SodaLive/Sources/Content/Detail/ContentDetailView.swift index 4f594b8..aaf9b8d 100644 --- a/SodaLive/Sources/Content/Detail/ContentDetailView.swift +++ b/SodaLive/Sources/Content/Detail/ContentDetailView.swift @@ -7,6 +7,7 @@ import SwiftUI import Kingfisher +import GoogleMobileAds import RefreshableScrollView struct ContentDetailView: View { @@ -66,56 +67,65 @@ struct ContentDetailView: View { viewModel.getAudioContentDetail() }) { VStack(spacing: 0) { - LazyVStack(spacing: 0) { - ContentDetailPlayView( - audioContent: audioContent, - isShowPreviewAlert: $viewModel.isShowPreviewAlert - ) - - ContentDetailInfoView( - isExpandDescription: $viewModel.isExpandDescription, - isShowPreviewAlert: $viewModel.isShowPreviewAlert, - audioContent: audioContent, - onClickLike: { viewModel.likeContent() }, - onClickShare: { - viewModel.shareAudioContent( - contentImage: audioContent.coverImageUrl, - contentTitle: "\(audioContent.title) - \(audioContent.creator.nickname)" - ) - }, - onClickDonation: { viewModel.isShowDonationPopup = true } - ) - - if audioContent.price > 0 && - !audioContent.existOrdered && - audioContent.orderType == nil && - audioContent.creator.creatorId != UserDefaults.int(forKey: .userId) { - ContentDetailPurchaseButton(price: audioContent.price) - .contentShape(Rectangle()) - .onTapGesture { isShowOrderView = true } - } - - if audioContent.isCommentAvailable { - ContentDetailCommentView( - commentCount: audioContent.commentCount, - commentList: audioContent.commentList, - registerComment: { comment in - self.viewModel.registerComment(comment: comment) - } + ContentDetailPlayView( + audioContent: audioContent, + isShowPreviewAlert: $viewModel.isShowPreviewAlert + ) + + if audioContent.price <= 0 || (audioContent.price > 0 && !audioContent.existOrdered) { + BannerAdView(adUnitId: FREE_CONTENT_BANNER_AD_UNIT_ID) + .frame( + width: screenSize().width, + height: GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(screenSize().width).size.height ) - .padding(10.3) - .background(Color.white.opacity(0.1)) - .cornerRadius(5.3) .padding(.top, 13.3) + } + + ContentDetailInfoView( + isExpandDescription: $viewModel.isExpandDescription, + isShowPreviewAlert: $viewModel.isShowPreviewAlert, + audioContent: audioContent, + onClickLike: { viewModel.likeContent() }, + onClickShare: { + viewModel.shareAudioContent( + contentImage: audioContent.coverImageUrl, + contentTitle: "\(audioContent.title) - \(audioContent.creator.nickname)" + ) + }, + onClickDonation: { viewModel.isShowDonationPopup = true } + ) + .padding(.horizontal, 13.3) + + if audioContent.price > 0 && + !audioContent.existOrdered && + audioContent.orderType == nil && + audioContent.creator.creatorId != UserDefaults.int(forKey: .userId) { + ContentDetailPurchaseButton(price: audioContent.price) .contentShape(Rectangle()) - .onTapGesture { - if audioContent.commentCount > 0 { - isShowCommentListView = true - } + .padding(.horizontal, 13.3) + .onTapGesture { isShowOrderView = true } + } + + if audioContent.isCommentAvailable { + ContentDetailCommentView( + commentCount: audioContent.commentCount, + commentList: audioContent.commentList, + registerComment: { comment in + self.viewModel.registerComment(comment: comment) + } + ) + .padding(10.3) + .background(Color.white.opacity(0.1)) + .cornerRadius(5.3) + .padding(.top, 13.3) + .contentShape(Rectangle()) + .padding(.horizontal, 13.3) + .onTapGesture { + if audioContent.commentCount > 0 { + isShowCommentListView = true } } } - .padding(.horizontal, 13.3) Rectangle() .foregroundColor(Color(hex: "232323")) diff --git a/SodaLive/Sources/Debug/Utils/Constants.swift b/SodaLive/Sources/Debug/Utils/Constants.swift index d2b3d9d..9912daa 100644 --- a/SodaLive/Sources/Debug/Utils/Constants.swift +++ b/SodaLive/Sources/Debug/Utils/Constants.swift @@ -14,3 +14,4 @@ let AGORA_APP_ID = "b96574e191a9430fa54c605528aa3ef7" let AGORA_APP_CERTIFICATE = "ae18ade3afcf4086bd4397726eb0654c" let BOOTPAY_APP_ID = "6242a7772701800023f68b2f" +let FREE_CONTENT_BANNER_AD_UNIT_ID = "ca-app-pub-3940256099942544/2934735716" diff --git a/SodaLive/Sources/Utils/Constants.swift b/SodaLive/Sources/Utils/Constants.swift index 7f8949c..8ff0b16 100644 --- a/SodaLive/Sources/Utils/Constants.swift +++ b/SodaLive/Sources/Utils/Constants.swift @@ -14,3 +14,4 @@ let AGORA_APP_ID = "e34e40046e9847baba3adfe2b8ffb4f6" let AGORA_APP_CERTIFICATE = "15cadeea4ba94ff7b091c9a10f4bf4a6" let BOOTPAY_APP_ID = "64c35be1d25985001dc50c88" +let FREE_CONTENT_BANNER_AD_UNIT_ID = "ca-app-pub-1299501215847962/7126167277"