Skip to content

Commit d490c13

Browse files
committed
[#69] Firebase Analytics 및 Crashlytics 연동
1 parent b756ace commit d490c13

4 files changed

Lines changed: 165 additions & 4 deletions

File tree

Codive/Application/AppConfigurator.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,25 @@
88
import Foundation
99
import KakaoSDKCommon
1010
import Kingfisher
11+
import FirebaseCore
12+
import FirebaseCrashlytics
1113

1214
final class AppConfigurator {
1315

1416
static func configure() {
17+
configureFirebase()
1518
configureKakaoSDK()
1619
configureImageCache()
1720
}
1821

22+
private static func configureFirebase() {
23+
FirebaseApp.configure()
24+
25+
#if DEBUG
26+
Crashlytics.crashlytics().setCrashlyticsCollectionEnabled(false)
27+
#endif
28+
}
29+
1930
private static func configureImageCache() {
2031
let cache = ImageCache.default
2132
// 메모리 캐시 100MB 제한

Project.swift

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@
33
// MARK: - Projects
44

55
// SwiftLint 스크립트 정의
6+
let crashlyticsScript = TargetScript.post(
7+
script: """
8+
if [ "${CONFIGURATION}" = "Release" ]; then
9+
${BUILD_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run
10+
fi
11+
""",
12+
name: "Firebase Crashlytics dSYM Upload",
13+
inputPaths: [
14+
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}",
15+
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${PRODUCT_NAME}",
16+
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist",
17+
"$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/GoogleService-Info.plist",
18+
"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)"
19+
],
20+
basedOnDependencyAnalysis: false
21+
)
22+
623
let lintScript = TargetScript.pre(
724
script: """
825
if test -d "/opt/homebrew/bin/"; then
@@ -134,7 +151,7 @@ let project = Project(
134151
],
135152
resources: ["Codive/Resources/**"],
136153
entitlements: .file(path: "Codive/Codive.entitlements"),
137-
scripts: [lintScript],
154+
scripts: [lintScript, crashlyticsScript],
138155
dependencies: [
139156
// 카카오 SDK
140157
.external(name: "KakaoSDKCommon"),
@@ -147,7 +164,11 @@ let project = Project(
147164
// CodiveAPI
148165
.external(name: "CodiveAPI"),
149166
// 이미지 캐싱
150-
.external(name: "Kingfisher")
167+
.external(name: "Kingfisher"),
168+
169+
// Firebase
170+
.external(name: "FirebaseAnalytics"),
171+
.external(name: "FirebaseCrashlytics")
151172
],
152173
settings: .settings(
153174
base: [

Tuist/Package.resolved

Lines changed: 127 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tuist/Package.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import PackageDescription
1414
"KakaoSDKCommon": .framework,
1515
"Alamofire": .framework,
1616
"Kingfisher": .framework,
17+
"FirebaseAnalytics": .framework,
18+
"FirebaseCrashlytics": .framework,
1719
]
1820
)
1921
#endif
@@ -25,6 +27,7 @@ let package = Package(
2527
.package(url: "https://github.com/kakao/kakao-ios-sdk", from: "2.22.5"),
2628
.package(url: "https://github.com/Moya/Moya.git", from: "15.0.0"),
2729
.package(url: "https://github.com/Clokey-dev/CodiveAPI", branch: "main"),
28-
.package(url: "https://github.com/onevcat/Kingfisher.git", from: "8.0.0")
30+
.package(url: "https://github.com/onevcat/Kingfisher.git", from: "8.0.0"),
31+
.package(url: "https://github.com/firebase/firebase-ios-sdk.git", from: "11.0.0")
2932
]
3033
)

0 commit comments

Comments
 (0)