Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] #408 - Amplitude 설치 #462

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Next Next commit
feat: amplitude - 푸시알림 받았을 때
  • Loading branch information
seungchan2 committed Dec 12, 2024
commit 335e8e00c41ba2beb839589e44376e15b9f15aa1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import Foundation

public enum AmplitudeEventType: String {
// 푸시 이벤트
case receivedPush = "received_push"
// 클릭 이벤트
case clickAlarm = "click_alarm"
case clickMyPage = "click_mypage"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ public final class NotificationHandler: NSObject, UNUserNotificationCenterDelega
public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async {
let userInfo = response.notification.request.content.userInfo
print("APNs 푸시 알림 페이로드: \(userInfo)")

guard let payload = NotificationPayload(dictionary: userInfo) else { return }

AmplitudeInstance.shared.track(eventType: .receivedPush, eventProperties: ["notificationId": payload.id,
"send_timeStamp": payload.sendAt,
"title": payload.title,
"contents": payload.content,
"admin_category": payload.category ?? "없음"])
guard payload.hasLink else {
self.deepLink.send(makeComponentsForEmptyLink(notificationId: payload.id))
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import Sentry
public struct NotificationPayload: Codable {
public let aps: APS
public let id: String
public let title: String
public let content: String
public let sendAt: String
public let category: String?
public let deepLink: String?
public let webLink: String?
Expand Down