Skip to content

Commit

Permalink
Etc: develop 내용 업데이트
Browse files Browse the repository at this point in the history
# Conflicts:
#	Projects/App/Project.swift
#	Projects/App/Sources/AppDelegate.swift
#	Projects/Features/MemeDetail/Sources/MemeDetailViewModel.swift
#	Projects/Features/Recommend/Project.swift
#	Projects/Features/Recommend/Sources/Presentation/RecommendViewModel.swift
#	Tuist/Package.resolved
#	Tuist/Package.swift
  • Loading branch information
hryeong66 committed Sep 3, 2024
2 parents 5e8ad55 + 807104f commit ad3d86d
Show file tree
Hide file tree
Showing 30 changed files with 578 additions and 127 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,6 @@ fastlane/test_output
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/
Tuist/.build
Tuist/.build

**/Secret.swift
10 changes: 10 additions & 0 deletions Projects/App/Develop-Farmeme.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:farmeme.onelink.me</string>
</array>
</dict>
</plist>
31 changes: 25 additions & 6 deletions Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ let project = Project.configure(
infoPlist: .extendingDefault(with: [
"CFBundleIconName": "AppIcon",
"CFBundleDevelopmentRegion": "ko_KR",
"CFBundleShortVersionString": "1.1.1",
"CFBundleVersion": "1",
"CFBundleShortVersionString": "1.1.2",
"CFBundleVersion": "2",
"UILaunchStoryboardName": "launch",
"UIUserInterfaceStyle": "Light" // 다크모드 방지
"NSUserTrackingUsageDescription": "이 앱은 사용자 맞춤형 광고 제공 및 분석을 위해 사용자 추적 정보를 수집합니다.",
"UIUserInterfaceStyle": "Light", // 다크모드 방지
"NSAppTransportSecurity": [
"NSAllowsArbitraryLoads": true
]
]),
sources: "Sources/**",
resources: "Resources/**",
Expand All @@ -33,20 +37,25 @@ let project = Project.configure(
.Feature.Search,
.Feature.MyPage,
.Feature.Setting,
.Feature.MemeDetail,
.ResourceKit,
.Core.DesignSystem,
.Core.PPACNetwork,
.Core.PPACUtil,
.Core.PPACAnalytics,
.ThirdParty.Lottie,
.ThirdParty.Dependency,
.ThirdParty.AppsFlyerLib,
],
settings: .settings(
base: [
"DEVELOPMENT_TEAM": "4NV4Z6BW27",
"CODE_SIGN_STYLE": "Manual",
"PROVISIONING_PROFILE_SPECIFIER": "match AppStore ppac.farmeme.App",
"CODE_SIGN_IDENTITY": "Apple Distribution: Chansoo Kim (4NV4Z6BW27)"
"CODE_SIGN_IDENTITY": "Apple Distribution: Chansoo Kim (4NV4Z6BW27)",
"ASSOCIATED_DOMAINS": [
"applinks:https://farmeme.onelink.me"
]
],
defaultSettings: .recommended(excluding: [])
)
Expand All @@ -56,7 +65,12 @@ let project = Project.configure(
product: .app,
bundleId: "ppac.farmeme.App",
infoPlist: .extendingDefault(with: [
"CFBundleIconName": "AppIcon",
"CFBundleDevelopmentRegion": "ko_KR",
"CFBundleShortVersionString": "1.1.1",
"CFBundleVersion": "1",
"UILaunchStoryboardName": "launch",
"NSUserTrackingUsageDescription": "이 앱은 사용자 맞춤형 광고 제공 및 분석을 위해 사용자 추적 정보를 수집합니다.",
"UIUserInterfaceStyle": "Light" // 다크모드 방지
]),
sources: "Sources/**",
Expand All @@ -67,19 +81,24 @@ let project = Project.configure(
.Feature.Search,
.Feature.MyPage,
.Feature.Setting,
.Feature.MemeDetail,
.ResourceKit,
.Core.DesignSystem,
.Core.PPACNetwork,
.Core.PPACUtil,
.Core.PPACAnalytics,
.ThirdParty.Dependency
.ThirdParty.Dependency,
.ThirdParty.AppsFlyerLib
],
settings: .settings(
base: [
"DEVELOPMENT_TEAM": "4NV4Z6BW27",
"CODE_SIGN_STYLE": "Manual",
"PROVISIONING_PROFILE_SPECIFIER": "match Development ppac.farmeme.App",
"CODE_SIGN_IDENTITY": "Apple Development: Chansoo Kim (T7MYKWLF92)"
"CODE_SIGN_IDENTITY": "Apple Development: Chansoo Kim (T7MYKWLF92)",
"ASSOCIATED_DOMAINS": [
"applinks:https://farmeme.onelink.me"
]
],
defaultSettings: .recommended(excluding: [])
)
Expand Down
10 changes: 10 additions & 0 deletions Projects/App/Release-Farmeme.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:farmeme.onelink.me</string>
</array>
</dict>
</plist>
196 changes: 192 additions & 4 deletions Projects/App/Sources/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,216 @@

import UIKit
import SwiftUI
import Combine

import Home
import PPACUtil
import PPACAnalytics

import AppsFlyerLib
import AppTrackingTransparency

@main
final class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var navigationController = UINavigationController()
var appRouter: Router?

var ConversionData: [AnyHashable: Any]? = nil
var deferred_deep_link_processed_flag:Bool = false
private let deeplinkMemeId = PassthroughSubject<String, Never>()

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {

PPACAnalytics.shared.congigureFirebaseApp()
self.window = UIWindow(frame: UIScreen.main.bounds)
let router = SplashRouter(navigationController)
let router = SplashRouter(navigationController, deeplinkMemeId: self.deeplinkMemeId)
self.navigationController.setNavigationBarHidden(true, animated: false)
self.appRouter = router
self.window?.rootViewController = navigationController
self.window?.makeKeyAndVisible()
router.start() // router의 시작 메소드 호출
configureAppsFlyer()
return true
}

private func configureAppsFlyer() {
// Set isDebug to true to see AppsFlyer debug logs
AppsFlyerLib.shared().isDebug = true

// Replace 'appsFlyerDevKey', `appleAppID` with your DevKey, Apple App ID
AppsFlyerLib.shared().appsFlyerDevKey = Secret.appsFlyerDevKey.rawValue
AppsFlyerLib.shared().appleAppID = Secret.appleAppID.rawValue

return true
AppsFlyerLib.shared().waitForATTUserAuthorization(timeoutInterval: 60)

AppsFlyerLib.shared().delegate = self
AppsFlyerLib.shared().deepLinkDelegate = self

//set the OneLink template id for share invite links
AppsFlyerLib.shared().appInviteOneLinkID = "RtpU"

// Subscribe to didBecomeActiveNotification if you use SceneDelegate or just call
// -[AppsFlyerLib start] from -[AppDelegate applicationDidBecomeActive:]
NotificationCenter.default.addObserver(self, selector: #selector(didBecomeActiveNotification),
// For Swift version < 4.2 replace name argument with the commented out code
name: UIApplication.didBecomeActiveNotification, //.UIApplicationDidBecomeActive for Swift < 4.2
object: nil)

}

@objc func didBecomeActiveNotification() {
AppsFlyerLib.shared().start()
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { (status) in
switch status {
case .denied:
print("AuthorizationSatus is denied")
case .notDetermined:
print("AuthorizationSatus is notDetermined")
case .restricted:
print("AuthorizationSatus is restricted")
case .authorized:
print("AuthorizationSatus is authorized")
@unknown default:
fatalError("Invalid authorization status")
}
}
}
}

// Open Universal Links

// For Swift version < 4.2 replace function signature with the commented out code
// func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool { // this line for Swift < 4.2
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
AppsFlyerLib.shared().continue(userActivity, restorationHandler: nil)
return true
}

// Open URI-scheme for iOS 9 and above
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
AppsFlyerLib.shared().handleOpen(url, options: options)
return true
}

// Report Push Notification attribution data for re-engagements
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
AppsFlyerLib.shared().handlePushNotification(userInfo)
}

// User logic
fileprivate func walkToSceneWithParams(memeId: String, deepLinkData: [String: Any]?) {
print("\(#function)")
// TODO: - MemeDetailRouter를 통해서 MemeDetail화면 호출. MainTabRouter의 start()함수가 호출된 이후에 호출되어야 함.
self.deeplinkMemeId.send(memeId)
}
}

extension AppDelegate: DeepLinkDelegate {

func didResolveDeepLink(_ result: DeepLinkResult) {
var memeId: String?
switch result.status {
case .notFound:
NSLog("[AFSDK] Deep link not found")
return
case .failure:
print("Error %@", result.error!)
return
case .found:
NSLog("[AFSDK] Deep link found")
}

guard let deepLinkObj:DeepLink = result.deepLink else {
NSLog("[AFSDK] Could not extract deep link object")
return
}

if deepLinkObj.clickEvent.keys.contains("deep_link_sub2") {
let ReferrerId:String = deepLinkObj.clickEvent["deep_link_sub2"] as! String
NSLog("[AFSDK] AppsFlyer: Referrer ID: \(ReferrerId)")
} else {
NSLog("[AFSDK] Could not extract referrerId")
}

let deepLinkStr:String = deepLinkObj.toString()
NSLog("[AFSDK] DeepLink data is: \(deepLinkStr)")

if( deepLinkObj.isDeferred == true) {
NSLog("[AFSDK] This is a deferred deep link")
if (deferred_deep_link_processed_flag == true) {
NSLog("Deferred deep link was already processed by GCD. This iteration can be skipped.")
deferred_deep_link_processed_flag = false
return
}
}
else {
NSLog("[AFSDK] This is a direct deep link")
}

memeId = deepLinkObj.deeplinkValue
print("memeId: ", memeId)

// This marks to GCD that UDL already processed this deep link.
// It is marked to both DL and DDL, but GCD is relevant only for DDL
deferred_deep_link_processed_flag = true

walkToSceneWithParams(memeId: memeId!, deepLinkData: deepLinkObj.clickEvent)
}
}

extension AppDelegate: AppsFlyerLibDelegate {

// Handle Organic/Non-organic installation
func onConversionDataSuccess(_ data: [AnyHashable: Any]) {
ConversionData = data
print("onConversionDataSuccess data:")
for (key, value) in data {
print(key, ":", value)
}
if let conversionData = data as NSDictionary? as! [String:Any]? {

if let status = conversionData["af_status"] as? String {
if (status == "Non-organic") {
if let sourceID = conversionData["media_source"],
let campaign = conversionData["campaign"] {
NSLog("[AFSDK] This is a Non-Organic install. Media source: \(sourceID) Campaign: \(campaign)")
}
} else {
NSLog("[AFSDK] This is an organic install.")
}

if let is_first_launch = conversionData["is_first_launch"] as? Bool,
is_first_launch {
NSLog("[AFSDK] First Launch")
if (deferred_deep_link_processed_flag == true) {
NSLog("Deferred deep link was already processed by UDL. The DDL processing in GCD can be skipped.")
deferred_deep_link_processed_flag = false
return
}

deferred_deep_link_processed_flag = true

var fruitNameStr:String

if conversionData.keys.contains("deep_link_value") {
fruitNameStr = conversionData["deep_link_value"] as! String
} else if conversionData.keys.contains("fruit_name") {
fruitNameStr = conversionData["fruit_name"] as! String
} else {
NSLog("Could not extract deep_link_value or fruit_name from deep link object using conversion data")
return
}

NSLog("This is a deferred deep link opened using conversion data")
walkToSceneWithParams(memeId: fruitNameStr, deepLinkData: conversionData)
} else {
NSLog("[AFSDK] Not First Launch")
}
}
}
}

func onConversionDataFail(_ error: Error) {
NSLog("[AFSDK] \(error)")
}
}
1 change: 1 addition & 0 deletions Projects/Core/DesignSystem/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ let project = Project(
.ResourceKit,
.ThirdParty.PopupView,
.ThirdParty.Kingfisher,
.ThirdParty.Lottie,
.Core.PPACModels
]
)
Expand Down
2 changes: 1 addition & 1 deletion Projects/Core/PPACNetwork/Sources/Requestable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ extension Requestable {
urlRequest.httpMethod = httpMethod.rawValue.uppercased()

var defaultHeaders = [
"x-device-id": UserInfo.shared.testDeviceId, // FIXME: testId가 필요없어지면 deviceId로 변경하기
"x-device-id": UserInfo.shared.deviceId,
"accept": "application/json",
"Content-Type": "application/json"
]
Expand Down
3 changes: 2 additions & 1 deletion Projects/Core/PPACUtil/Sources/Router.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ public extension Router {
}

func popView() {
self.navigationController.popViewController(animated: true)
self.navigationController.popViewController(animated: false)
}

func dismissView() {
navigationController.dismiss(animated: true)
}

@MainActor
func pushView<V: View>(_ view: V, animated: Bool = false) {
let viewController = UIHostingController(rootView: view)
navigationController.pushViewController(viewController, animated: animated)
Expand Down
Loading

0 comments on commit ad3d86d

Please sign in to comment.