Skip to content

Commit 2b24c80

Browse files
committed
[ITDS-73] refactor: #56 - GA 이벤트 호출방식 수정
- 각 화면당 불필요한 import FirebaseAnalytics 제거 - parameter 값 추후 논의 필요(예시: 어떤 공고를 선택했는지 공고 id 값 전달이 필요한 경우)
1 parent da34707 commit 2b24c80

File tree

7 files changed

+50
-50
lines changed

7 files changed

+50
-50
lines changed

Targets/DesignSystem/Sources/Component/PostList/JobCategoryView.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import RxSwift
1414
import RxCocoa
1515
import PinLayout
1616
import FlexLayout
17-
import FirebaseAnalytics
1817

1918
public final class JobCategoryView: UIView {
2019
private enum Metric {
@@ -121,10 +120,9 @@ public final class JobCategoryView: UIView {
121120
.map { (indexPath, dataList) in
122121
let category = ContestCategory.init(rawValue: dataList[indexPath.row]) ?? .all
123122
switch category {
124-
case .all: Analytics.logEvent(GA.전체칩, parameters: nil)
125-
case .design: Analytics.logEvent(GA.디자인칩, parameters: nil)
126-
// case .develop: Analytics.logEvent(GA.개발칩, parameters: nil)
127-
case .idea: Analytics.logEvent(GA.기획아이디어칩, parameters: nil)
123+
case .all: GA.logEvent(.전체칩)
124+
case .design: GA.logEvent(.디자인칩)
125+
case .idea: GA.logEvent(.기획아이디어칩)
128126
}
129127
return category
130128
}

Targets/DesignSystem/Sources/Component/PostList/OrderDropDownMenu.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import MozipCore
1212
import FlexLayout
1313
import RxCocoa
1414
import RxSwift
15-
import FirebaseAnalytics
1615

1716
public final class OrderDropDownMenu: UIView {
1817
// MARK: - Properties
@@ -50,15 +49,15 @@ public final class OrderDropDownMenu: UIView {
5049

5150
latestLabel.rxGesture.tap
5251
.map { _ in
53-
Analytics.logEvent(GA.최신순버튼, parameters: nil)
52+
GA.logEvent(.최신순버튼)
5453
return true
5554
}
5655
.bind(to: isLatestOrder)
5756
.disposed(by: disposeBag)
5857

5958
oldestLabel.rxGesture.tap
6059
.map { _ in
61-
Analytics.logEvent(GA.마감순버튼, parameters: nil)
60+
GA.logEvent(.마감순버튼)
6261
return false
6362
}
6463
.bind(to: isLatestOrder)

Targets/DesignSystem/Sources/Component/PostList/PostOrderControlView.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import RxSwift
1414
import RxCocoa
1515
import PinLayout
1616
import FlexLayout
17-
import FirebaseAnalytics
1817

1918
public final class PostOrderControlView: UIView {
2019

@@ -84,7 +83,7 @@ public final class PostOrderControlView: UIView {
8483
private func bind() {
8584
orderButton.rxGesture.tap
8685
.bind(with: self) { owner, _ in
87-
Analytics.logEvent(GA.정렬버튼, parameters: nil)
86+
GA.logEvent(.정렬버튼)
8887
let currentValue = owner.isOrderButtonTappedRelay.value
8988
owner.isOrderButtonTappedRelay.accept(!currentValue)
9089
}

Targets/MozipCore/Sources/GA.swift

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,42 @@
66
// Copyright © 2025 MOZIP. All rights reserved.
77
//
88

9-
import Foundation
9+
import FirebaseAnalytics
1010

1111
public struct GA {
12-
// 로그인 화면
13-
public static let 카카오버튼 = "kakao_login_button_selected"
14-
public static let 애플버튼 = "apple_login_button_selected"
1512

16-
// 홈 화면 - 네비게이션바 영역
17-
public static let 마이페이지버튼 = "profile_button_selected"
18-
public static let 검색버튼 = "search_button_selected"
13+
public static func logEvent(_ event: Event) {
14+
Analytics.logEvent(event.rawValue, parameters: nil)
15+
}
1916

20-
// 홈 화면 - 스크롤 영역
21-
public static let 배너이미지 = "banner_image_selected"
22-
public static let 공모전더보기버튼 = "contest_more_selected"
23-
public static let 해커톤더보기버튼 = "hackathon_more_selected"
24-
public static let IT동아리더보기버튼 = "it_club_more_selected"
25-
26-
// 공고 리스트 - 상단 카테고리 칩
27-
public static let 전체칩 = "contest_all_chip_selected"
28-
public static let 개발칩 = "contest_develop_chip_selected"
29-
public static let 디자인칩 = "contest_design_chip_selected"
30-
public static let 기획아이디어칩 = "contest_idea_chip_selected"
31-
32-
// 공고 리스트 - 정렬버튼
33-
public static let 정렬버튼 = "array_menu_selected"
34-
public static let 최신순버튼 = "latest_array_selected"
35-
public static let 마감순버튼 = "oldest_array_selected"
36-
37-
// 공고 상세
38-
public static let 지원하기버튼 = "apply_button_selected"
39-
public static let 공유버튼 = "share_button_selected"
17+
public enum Event: String {
18+
// 로그인 화면
19+
case 카카오버튼 = "kakao_login_button_selected"
20+
case 애플버튼 = "apple_login_button_selected"
21+
22+
// 홈 화면 - 네비게이션바 영역
23+
case 마이페이지버튼 = "profile_button_selected"
24+
case 검색버튼 = "search_button_selected"
25+
26+
// 홈 화면 - 스크롤 영역
27+
case 배너이미지 = "banner_image_selected"
28+
case 공모전더보기버튼 = "contest_more_selected"
29+
case 해커톤더보기버튼 = "hackathon_more_selected"
30+
case IT동아리더보기버튼 = "it_club_more_selected"
31+
32+
// 공고 리스트 - 상단 카테고리 칩
33+
case 전체칩 = "contest_all_chip_selected"
34+
case 개발칩 = "contest_develop_chip_selected"
35+
case 디자인칩 = "contest_design_chip_selected"
36+
case 기획아이디어칩 = "contest_idea_chip_selected"
37+
38+
// 공고 리스트 - 정렬버튼
39+
case 정렬버튼 = "array_menu_selected"
40+
case 최신순버튼 = "latest_array_selected"
41+
case 마감순버튼 = "oldest_array_selected"
42+
43+
// 공고 상세
44+
case 지원하기버튼 = "apply_button_selected"
45+
case 공유버튼 = "share_button_selected"
46+
}
4047
}

Targets/PresentationLayer/Sources/Home/View/HomeViewController.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import FlexLayout
1515
import PinLayout
1616
import ReactorKit
1717
import RxCocoa
18-
import FirebaseAnalytics
1918

2019
final class HomeViewController: BaseViewController<HomeReactor>, Coordinatable {
2120

@@ -196,23 +195,23 @@ private extension HomeViewController {
196195
navigationBar.myPageButtonTapObservable
197196
.asSignal(onErrorJustReturn: ())
198197
.emit(with: self) { owner, _ in
199-
Analytics.logEvent(GA.마이페이지버튼, parameters: nil)
198+
GA.logEvent(.마이페이지버튼)
200199
AppProperties.accessToken == .init() ? owner.coordinator?.pushLoginPage() : owner.coordinator?.pushMyPage()
201200
}
202201
.disposed(by: disposeBag)
203202

204203
navigationBar.searchButtonTapObservable
205204
.asSignal(onErrorJustReturn: ())
206205
.emit(with: self) { owner, _ in
207-
Analytics.logEvent(GA.검색버튼, parameters: nil)
206+
GA.logEvent(.검색버튼)
208207
owner.coordinator?.pushPostSearch()
209208
}
210209
.disposed(by: disposeBag)
211210

212211
bannerView.bannerTapObservable
213212
.asSignal(onErrorJustReturn: .stub())
214213
.emit(with: self) { owner, banner in
215-
Analytics.logEvent(GA.배너이미지, parameters: nil)
214+
GA.logEvent(.배너이미지)
216215
owner.coordinator?.pushPostDetail(id: banner.infoPostID)
217216
}
218217
.disposed(by: disposeBag)
@@ -223,9 +222,9 @@ private extension HomeViewController {
223222
let postHeaders = owner.reactor?.currentState.postHeaders ?? []
224223
let postKind = postHeaders[indexPath.section]
225224
switch postKind {
226-
case .공모전: Analytics.logEvent(GA.공모전더보기버튼, parameters: nil)
227-
case .해커톤: Analytics.logEvent(GA.해커톤더보기버튼, parameters: nil)
228-
case .동아리: Analytics.logEvent(GA.IT동아리더보기버튼, parameters: nil)
225+
case .공모전: GA.logEvent(.공모전더보기버튼)
226+
case .해커톤: GA.logEvent(.해커톤더보기버튼)
227+
case .동아리: GA.logEvent(.IT동아리더보기버튼)
229228
}
230229
owner.coordinator?.pushPostList(postKind: postKind)
231230
}

Targets/PresentationLayer/Sources/Login/Reactor/LoginReactor.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import MozipCore
1010
import DomainLayer
1111

1212
import ReactorKit
13-
import FirebaseAnalytics
1413

1514
final class LoginReactor: Reactor {
1615

@@ -53,15 +52,15 @@ final class LoginReactor: Reactor {
5352
private func didTapKakaoLoginButtonMutation() -> Observable<Mutation> {
5453
return loginUseCase.tryKakaoLogin()
5554
.do(onNext: { _ in
56-
Analytics.logEvent(GA.카카오버튼, parameters: nil)
55+
GA.logEvent(.카카오버튼)
5756
})
5857
.map { .setUserToken(userToken: $0) }
5958
}
6059

6160
private func didTapAppleLoginButtonMutation() -> Observable<Mutation> {
6261
return loginUseCase.tryAppleLogin()
6362
.do(onNext: { _ in
64-
Analytics.logEvent(GA.애플버튼, parameters: nil)
63+
GA.logEvent(.애플버튼)
6564
})
6665
.map { .setUserToken(userToken: $0) }
6766
}

Targets/PresentationLayer/Sources/PostDetail/View/PostDetailViewController.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import FlexLayout
1515
import PinLayout
1616
import ReactorKit
1717
import RxCocoa
18-
import FirebaseAnalytics
1918

2019
final class PostDetailViewController: BaseViewController<PostDetailReactor>, Coordinatable, Alertable {
2120

@@ -367,15 +366,15 @@ private extension PostDetailViewController {
367366
shareButton.rx.tap
368367
.asSignal()
369368
.emit(with: self, onNext: { owner, _ in
370-
Analytics.logEvent(GA.공유버튼, parameters: nil)
369+
GA.logEvent(.공유버튼)
371370
owner.showActivityController()
372371
})
373372
.disposed(by: disposeBag)
374373

375374
showMoreButton.tapObservable
376375
.asSignal(onErrorSignalWith: .empty())
377376
.emit(with: self, onNext: { owner, _ in
378-
Analytics.logEvent(GA.지원하기버튼, parameters: nil)
377+
GA.logEvent(.지원하기버튼)
379378
guard let reactor = owner.reactor else { return }
380379
owner.coordinator?.pushWebView(urlString: reactor.currentState.post.postUrlString)
381380
})

0 commit comments

Comments
 (0)