Skip to content

Commit 9597435

Browse files
authored
🪴 로그 심기 (#335)
* Firebase SDK 업데이트 * Dev 스킴에 Firebase SDK 디버그 옵션 추가 * Automatic Screen Tracking 해제 * Analytics 관련 모델 정의 * pbxproj 업데이트 * Analytics 로깅 추가 * Apply SwiftFormat changes * Xcode 버전 16.1로 변경 --------- Co-authored-by: shp7724 <shp7724@users.noreply.github.com>
1 parent a36d8d5 commit 9597435

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+727
-100
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
matrix:
1717
# see https://github.com/actions/virtual-environments/blob/main/images/macos/macos-13-Readme.md for available versions
1818
xcode:
19-
- "16.2"
19+
- "16.1"
2020
macos: ["macos-15"]
2121
command: ["build", "test"]
2222
scheme: ["SNUTT"]

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
2424
GIT_PAT_READONLY: ${{ secrets.GIT_PAT_READONLY }}
2525
GIT_TAG_NAME: ${{ github.ref_name }}
26-
XCODE_VERSION: "16.2"
26+
XCODE_VERSION: "16.1"
2727

2828
runs-on: macos-15
2929

SNUTT-2022/SNUTT.xcodeproj/project.pbxproj

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@
135135
BE4B0EB628735005005FE164 /* MenuSheetViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE4B0EB528735005005FE164 /* MenuSheetViewModel.swift */; };
136136
BE4B0EBE2873BC84005FE164 /* FilterSheetViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE4B0EBD2873BC84005FE164 /* FilterSheetViewModel.swift */; };
137137
BE4CD86128F5A56200BA9BBC /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = BE4CD86028F5A56200BA9BBC /* FirebaseAnalytics */; };
138-
BE4CD86328F5A56200BA9BBC /* FirebaseAnalyticsSwift in Frameworks */ = {isa = PBXBuildFile; productRef = BE4CD86228F5A56200BA9BBC /* FirebaseAnalyticsSwift */; };
139138
BE4CD86528F5A56200BA9BBC /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = BE4CD86428F5A56200BA9BBC /* FirebaseCrashlytics */; };
140139
BE4CD86728F5A56200BA9BBC /* FirebaseMessaging in Frameworks */ = {isa = PBXBuildFile; productRef = BE4CD86628F5A56200BA9BBC /* FirebaseMessaging */; };
141140
BE682BB6287C40AF009EBCB7 /* BasicTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE682BB5287C40AF009EBCB7 /* BasicTheme.swift */; };
@@ -285,6 +284,12 @@
285284
CE9820502A0A0BB7001037F5 /* NetworkLogListScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE98204F2A0A0BB7001037F5 /* NetworkLogListScene.swift */; };
286285
CE9820522A0A0BE9001037F5 /* NetworkLogEntryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE9820512A0A0BE9001037F5 /* NetworkLogEntryView.swift */; };
287286
CE98750C29CC527F007F063A /* TimeRangeSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE4F2C6129BA45420007194E /* TimeRangeSlider.swift */; };
287+
CEA428992D71DF4400944DAB /* AnalyticsScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEA428982D71DF2B00944DAB /* AnalyticsScreen.swift */; };
288+
CEA4289E2D71E23A00944DAB /* AnalyticsEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEA4289D2D71E23200944DAB /* AnalyticsEvent.swift */; };
289+
CEA428A02D71E2DC00944DAB /* AnalyticsScreenModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEA4289F2D71E2D800944DAB /* AnalyticsScreenModifier.swift */; };
290+
CEA428A22D71E3A400944DAB /* SnakeCaseConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEA428A12D71E3A100944DAB /* SnakeCaseConvertible.swift */; };
291+
CEA428A42D71FE4D00944DAB /* Encodable+Dictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEA428A32D71FE4900944DAB /* Encodable+Dictionary.swift */; };
292+
CEA428A62D7208CB00944DAB /* AnalyticsLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEA428A52D7208C700944DAB /* AnalyticsLogger.swift */; };
288293
CEA7F1E62A6D096000299BAF /* LectureCellActionButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEA7F1E52A6D096000299BAF /* LectureCellActionButton.swift */; };
289294
CEB5A71E29DD9CD400E74C47 /* TimetableAccessoryRectangularView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEB5A71D29DD9CD400E74C47 /* TimetableAccessoryRectangularView.swift */; };
290295
CEB5A72029DDA8B200E74C47 /* TimetableAccessoryInlineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEB5A71F29DDA8B200E74C47 /* TimetableAccessoryInlineView.swift */; };
@@ -604,6 +609,12 @@
604609
CE98204A2A09FBDD001037F5 /* DebugState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugState.swift; sourceTree = "<group>"; };
605610
CE98204F2A0A0BB7001037F5 /* NetworkLogListScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkLogListScene.swift; sourceTree = "<group>"; };
606611
CE9820512A0A0BE9001037F5 /* NetworkLogEntryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkLogEntryView.swift; sourceTree = "<group>"; };
612+
CEA428982D71DF2B00944DAB /* AnalyticsScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsScreen.swift; sourceTree = "<group>"; };
613+
CEA4289D2D71E23200944DAB /* AnalyticsEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsEvent.swift; sourceTree = "<group>"; };
614+
CEA4289F2D71E2D800944DAB /* AnalyticsScreenModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsScreenModifier.swift; sourceTree = "<group>"; };
615+
CEA428A12D71E3A100944DAB /* SnakeCaseConvertible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnakeCaseConvertible.swift; sourceTree = "<group>"; };
616+
CEA428A32D71FE4900944DAB /* Encodable+Dictionary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Encodable+Dictionary.swift"; sourceTree = "<group>"; };
617+
CEA428A52D7208C700944DAB /* AnalyticsLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsLogger.swift; sourceTree = "<group>"; };
607618
CEA7F1E52A6D096000299BAF /* LectureCellActionButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LectureCellActionButton.swift; sourceTree = "<group>"; };
608619
CEB5A71D29DD9CD400E74C47 /* TimetableAccessoryRectangularView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimetableAccessoryRectangularView.swift; sourceTree = "<group>"; };
609620
CEB5A71F29DDA8B200E74C47 /* TimetableAccessoryInlineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimetableAccessoryInlineView.swift; sourceTree = "<group>"; };
@@ -659,7 +670,6 @@
659670
731C24522C4442590015877B /* KakaoSDKCommon in Frameworks */,
660671
BE4CD86728F5A56200BA9BBC /* FirebaseMessaging in Frameworks */,
661672
731C244E2C4442590015877B /* KakaoSDK in Frameworks */,
662-
BE4CD86328F5A56200BA9BBC /* FirebaseAnalyticsSwift in Frameworks */,
663673
CE85901C2C5E21D600ECFE9E /* KakaoSDKTemplate in Frameworks */,
664674
BE779B1828E3DD5B009960EB /* FacebookLogin in Frameworks */,
665675
CEF992F72BF3B8FC00F0FFA4 /* ReactNativeKit in Frameworks */,
@@ -900,6 +910,19 @@
900910
path = Lecture;
901911
sourceTree = "<group>";
902912
};
913+
CEA428952D71DE6600944DAB /* SharedUIAnalytics */ = {
914+
isa = PBXGroup;
915+
children = (
916+
CEA428982D71DF2B00944DAB /* AnalyticsScreen.swift */,
917+
CEA4289D2D71E23200944DAB /* AnalyticsEvent.swift */,
918+
CEA428A12D71E3A100944DAB /* SnakeCaseConvertible.swift */,
919+
CEA428A32D71FE4900944DAB /* Encodable+Dictionary.swift */,
920+
CEA4289F2D71E2D800944DAB /* AnalyticsScreenModifier.swift */,
921+
CEA428A52D7208C700944DAB /* AnalyticsLogger.swift */,
922+
);
923+
path = SharedUIAnalytics;
924+
sourceTree = "<group>";
925+
};
903926
CECDD36A2CC3E43400BB5E5B /* SyllabusWebView */ = {
904927
isa = PBXGroup;
905928
children = (
@@ -1128,6 +1151,7 @@
11281151
BEEBDFB9286B3A0C00DB5976 /* TabScene.swift */,
11291152
BE7E230027FF20EE004DC202 /* TimetableScene.swift */,
11301153
CE4777F62A6AE41C00E03253 /* VacancyScene.swift */,
1154+
CEA428952D71DE6600944DAB /* SharedUIAnalytics */,
11311155
CE3384BB2A893F1B00437CC5 /* FriendsScene.swift */,
11321156
BEDF507227F427FA00CDCC13 /* LectureListScene.swift */,
11331157
BEDF506E27EB744A00CDCC13 /* LectureDetailScene.swift */,
@@ -1276,7 +1300,6 @@
12761300
BEDE34D32879A59B00525014 /* Alamofire */,
12771301
BE779B1728E3DD5B009960EB /* FacebookLogin */,
12781302
BE4CD86028F5A56200BA9BBC /* FirebaseAnalytics */,
1279-
BE4CD86228F5A56200BA9BBC /* FirebaseAnalyticsSwift */,
12801303
BE4CD86428F5A56200BA9BBC /* FirebaseCrashlytics */,
12811304
BE4CD86628F5A56200BA9BBC /* FirebaseMessaging */,
12821305
CEF992F62BF3B8FC00F0FFA4 /* ReactNativeKit */,
@@ -1484,6 +1507,7 @@
14841507
BEE5CE10289E738900CF5ED3 /* MenuThemeSheet.swift in Sources */,
14851508
CE17DF892A7E9670000432B8 /* ConfigRepository.swift in Sources */,
14861509
738406F72B57134300007E62 /* ThemeService.swift in Sources */,
1510+
CEA428A22D71E3A400944DAB /* SnakeCaseConvertible.swift in Sources */,
14871511
BE9413C128C219AD00171060 /* STNotification.swift in Sources */,
14881512
B87B317328D81447005C170B /* UserDto.swift in Sources */,
14891513
BE060BD928DF4C1E00A2F1B9 /* OnboardScene.swift in Sources */,
@@ -1538,10 +1562,13 @@
15381562
BE682BEF288722A5009EBCB7 /* ErrorDto.swift in Sources */,
15391563
CE17DF8B2A7E96E1000432B8 /* ConfigDto.swift in Sources */,
15401564
BED04D3128EA8B0A00937E4C /* ChangePasswordView.swift in Sources */,
1565+
CEA428992D71DF4400944DAB /* AnalyticsScreen.swift in Sources */,
15411566
DC1E0ECF28772F13005632A3 /* NetworkUtils.swift in Sources */,
15421567
BE6D893528EFD68E000607A6 /* String+Localized.swift in Sources */,
15431568
BEB3B6A228CDB7A400E56062 /* LectureTimePicker.swift in Sources */,
1569+
CEA4289E2D71E23A00944DAB /* AnalyticsEvent.swift in Sources */,
15441570
CECDD3702CC3E4B400BB5E5B /* WebProgressView.swift in Sources */,
1571+
CEA428A62D7208CB00944DAB /* AnalyticsLogger.swift in Sources */,
15451572
BE77D0AC28B1384D0067A9D8 /* MenuSheetTopBar.swift in Sources */,
15461573
BEDF506F27EB744A00CDCC13 /* LectureDetailScene.swift in Sources */,
15471574
BE98A06F288AFC1600C2CE95 /* SNUTTWidget.intentdefinition in Sources */,
@@ -1601,6 +1628,7 @@
16011628
BEB3B6B328D4D4F500E56062 /* DetailButton.swift in Sources */,
16021629
738406FD2B57179100007E62 /* ThemeSettingViewModel.swift in Sources */,
16031630
BEDF506B27EB73EE00CDCC13 /* LectureListCell.swift in Sources */,
1631+
CEA428A02D71E2DC00944DAB /* AnalyticsScreenModifier.swift in Sources */,
16041632
B800A38B2B76132C008E8D84 /* SearchTimeMaskDto.swift in Sources */,
16051633
CEF630942BC690DF00D26999 /* FloatingButton.swift in Sources */,
16061634
B87DF6ED2914FAFB008BB95B /* PopupRouter.swift in Sources */,
@@ -1709,6 +1737,7 @@
17091737
BE9413B928C20A4000171060 /* AuthRouter.swift in Sources */,
17101738
BE682BDB28870872009EBCB7 /* LectureService.swift in Sources */,
17111739
BE7E230127FF20EE004DC202 /* TimetableScene.swift in Sources */,
1740+
CEA428A42D71FE4D00944DAB /* Encodable+Dictionary.swift in Sources */,
17121741
DCD41A7227E5CE1D00CF380E /* TimetableViewModel.swift in Sources */,
17131742
BE682BB6287C40AF009EBCB7 /* BasicTheme.swift in Sources */,
17141743
BE779B1C28E72622009960EB /* AnimatedTextField.swift in Sources */,
@@ -2406,7 +2435,7 @@
24062435
repositoryURL = "https://github.com/firebase/firebase-ios-sdk";
24072436
requirement = {
24082437
kind = upToNextMajorVersion;
2409-
minimumVersion = 10.22.0;
2438+
minimumVersion = 11.9.0;
24102439
};
24112440
};
24122441
BE779B1628E3DD5B009960EB /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */ = {
@@ -2479,11 +2508,6 @@
24792508
package = BE4CD85F28F5A56200BA9BBC /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
24802509
productName = FirebaseAnalytics;
24812510
};
2482-
BE4CD86228F5A56200BA9BBC /* FirebaseAnalyticsSwift */ = {
2483-
isa = XCSwiftPackageProductDependency;
2484-
package = BE4CD85F28F5A56200BA9BBC /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
2485-
productName = FirebaseAnalyticsSwift;
2486-
};
24872511
BE4CD86428F5A56200BA9BBC /* FirebaseCrashlytics */ = {
24882512
isa = XCSwiftPackageProductDependency;
24892513
package = BE4CD85F28F5A56200BA9BBC /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;

SNUTT-2022/SNUTT.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

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

SNUTT-2022/SNUTT.xcodeproj/xcshareddata/xcschemes/SNUTT.xcscheme

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@
7070
ReferencedContainer = "container:SNUTT.xcodeproj">
7171
</BuildableReference>
7272
</BuildableProductRunnable>
73+
<CommandLineArguments>
74+
<CommandLineArgument
75+
argument = "-FIRDebugEnabled"
76+
isEnabled = "YES">
77+
</CommandLineArgument>
78+
</CommandLineArguments>
7379
</LaunchAction>
7480
<ProfileAction
7581
buildConfiguration = "Debug"

SNUTT-2022/SNUTT/AppState/States/UserState.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Created by Jinsup Keum on 2022/06/25.
66
//
77

8+
import FirebaseAnalytics
89
import SwiftUI
910

1011
class UserState {
@@ -13,5 +14,9 @@ class UserState {
1314
@Published var socialProvider: SocialProvider?
1415

1516
/// Primary key of User. Required to logout. This is not `localId`.
16-
var userId: String?
17+
var userId: String? {
18+
didSet {
19+
Analytics.setUserID(userId)
20+
}
21+
}
1722
}

SNUTT-2022/SNUTT/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
<string>$(FACEBOOK_DISPLAY_NAME)</string>
5555
<key>FirebaseAppDelegateProxyEnabled</key>
5656
<false/>
57+
<key>FirebaseAutomaticScreenReportingEnabled</key>
58+
<false/>
5759
<key>GIDClientID</key>
5860
<string>$(GOOGLE_CLIENT_ID)</string>
5961
<key>ITSAppUsesNonExemptEncryption</key>

SNUTT-2022/SNUTT/Models/Lecture.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ struct Lecture: Identifiable {
3030
quota - freshmanQuota
3131
}
3232

33+
/// DB에 저장된 강의 고유 ID
34+
var referenceId: String {
35+
lectureId ?? id
36+
}
37+
3338
var createdAt: String
3439
var updatedAt: String
3540
var quota: Int

SNUTT-2022/SNUTT/Services/AuthService.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,36 +64,46 @@ struct AuthService: AuthServiceProtocol, UserAuthHandler {
6464
}
6565

6666
func loginWithLocalId(localId: String, localPassword: String) async throws {
67+
FirebaseAnalyticsLogger().logEvent(.login(.init(provider: .local)))
6768
let dto = try await authRepository.loginWithLocalId(localId: localId, localPassword: localPassword)
6869
saveAccessTokenFromLoginResponse(dto: dto)
6970
try await registerFCMToken()
7071
}
7172

7273
func registerWithLocalId(localId: String, localPassword: String, email: String) async throws {
73-
let dto = try await authRepository.registerWithLocalId(localId: localId, localPassword: localPassword, email: email)
74+
FirebaseAnalyticsLogger().logEvent(.signUp)
75+
let dto = try await authRepository.registerWithLocalId(
76+
localId: localId,
77+
localPassword: localPassword,
78+
email: email
79+
)
7480
saveAccessTokenFromLoginResponse(dto: dto)
7581
try await registerFCMToken()
7682
}
7783

7884
func loginWithApple(appleToken: String) async throws {
85+
FirebaseAnalyticsLogger().logEvent(.login(.init(provider: .apple)))
7986
let dto = try await authRepository.loginWithApple(appleToken: appleToken)
8087
saveAccessTokenFromLoginResponse(dto: dto)
8188
try await registerFCMToken()
8289
}
8390

8491
func loginWithFacebook(facebookToken: String) async throws {
92+
FirebaseAnalyticsLogger().logEvent(.login(.init(provider: .facebook)))
8593
let dto = try await authRepository.loginWithFacebook(facebookToken: facebookToken)
8694
saveAccessTokenFromLoginResponse(dto: dto)
8795
try await registerFCMToken()
8896
}
8997

9098
func loginWithGoogle(googleToken: String) async throws {
99+
FirebaseAnalyticsLogger().logEvent(.login(.init(provider: .google)))
91100
let dto = try await authRepository.loginWithGoogle(googleToken: googleToken)
92101
saveAccessTokenFromLoginResponse(dto: dto)
93102
try await registerFCMToken()
94103
}
95104

96105
func loginWithKakao(kakaoToken: String) async throws {
106+
FirebaseAnalyticsLogger().logEvent(.login(.init(provider: .kakao)))
97107
let dto = try await authRepository.loginWithKakao(kakaoToken: kakaoToken)
98108
saveAccessTokenFromLoginResponse(dto: dto)
99109
try await registerFCMToken()
@@ -120,6 +130,7 @@ struct AuthService: AuthServiceProtocol, UserAuthHandler {
120130
}
121131

122132
func logout() async throws {
133+
FirebaseAnalyticsLogger().logEvent(.logout)
123134
let fcmToken = userDefaultsRepository.get(String.self, key: .fcmToken, defaultValue: "")
124135
guard let userId = appState.user.userId else { throw STError(.NO_USER_TOKEN) }
125136
let _ = try? await authRepository.logout(userId: userId, fcmToken: fcmToken)

0 commit comments

Comments
 (0)