Skip to content

Commit

Permalink
[Merge] #173 - Amplitude Setting 및 적용 완료
Browse files Browse the repository at this point in the history
Feat [#172] Amplitude Setting 및 적용 완료
  • Loading branch information
boogios authored Mar 27, 2024
2 parents a385542 + c150b49 commit f7c579b
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 3 deletions.
21 changes: 19 additions & 2 deletions DontBe-iOS/DontBe-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
3CF184D12B4EFF9900816D5F /* MyPageProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF184D02B4EFF9900816D5F /* MyPageProfileView.swift */; };
3CF4293A2B8F416F00A1524B /* MyPageMemberDeleteDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF429392B8F416F00A1524B /* MyPageMemberDeleteDTO.swift */; };
3CF4651B2B58398900997FCA /* PostTransparencyRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF4651A2B58398900997FCA /* PostTransparencyRequestDTO.swift */; };
3CFB30472BB305EE00A3F70A /* Amplitude in Frameworks */ = {isa = PBXBuildFile; productRef = 3CFB30462BB305EE00A3F70A /* Amplitude */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -326,6 +327,7 @@
files = (
2AAA845F2B494AC50098A824 /* SnapKit in Frameworks */,
2A8D70B12B4C4D8F009F4C6C /* KakaoSDK in Frameworks */,
3CFB30472BB305EE00A3F70A /* Amplitude in Frameworks */,
2FD9276A2B92245B0046193D /* Lottie in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -1185,6 +1187,7 @@
2AAA845E2B494AC50098A824 /* SnapKit */,
2A8D70B02B4C4D8F009F4C6C /* KakaoSDK */,
2FD927692B92245B0046193D /* Lottie */,
3CFB30462BB305EE00A3F70A /* Amplitude */,
);
productName = DontBe;
productReference = 3C6192E92B3A719A00220CEB /* DontBe-iOS.app */;
Expand Down Expand Up @@ -1218,6 +1221,7 @@
2AAA845D2B494AC50098A824 /* XCRemoteSwiftPackageReference "SnapKit" */,
2A8D70AF2B4C4D8F009F4C6C /* XCRemoteSwiftPackageReference "kakao-ios-sdk" */,
2FD927682B92245B0046193D /* XCRemoteSwiftPackageReference "lottie-spm" */,
3CFB30452BB305EE00A3F70A /* XCRemoteSwiftPackageReference "Amplitude-iOS" */,
);
productRefGroup = 3C6192EA2B3A719A00220CEB /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -1546,7 +1550,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.0;
MARKETING_VERSION = 1.0.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.SOPT33.DontBe-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -1583,7 +1587,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.0;
MARKETING_VERSION = 1.0.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.SOPT33.DontBe-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -1644,6 +1648,14 @@
minimumVersion = 4.4.1;
};
};
3CFB30452BB305EE00A3F70A /* XCRemoteSwiftPackageReference "Amplitude-iOS" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/amplitude/Amplitude-iOS";
requirement = {
branch = main;
kind = branch;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand All @@ -1662,6 +1674,11 @@
package = 2FD927682B92245B0046193D /* XCRemoteSwiftPackageReference "lottie-spm" */;
productName = Lottie;
};
3CFB30462BB305EE00A3F70A /* Amplitude */ = {
isa = XCSwiftPackageProductDependency;
package = 3CFB30452BB305EE00A3F70A /* XCRemoteSwiftPackageReference "Amplitude-iOS" */;
productName = Amplitude;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 3C6192E12B3A719A00220CEB /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@
"version" : "5.8.1"
}
},
{
"identity" : "amplitude-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/amplitude/Amplitude-iOS",
"state" : {
"branch" : "main",
"revision" : "d4a71f3e06b5108696ca7b33567d0fc539597d82"
}
},
{
"identity" : "analytics-connector-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/amplitude/analytics-connector-ios.git",
"state" : {
"revision" : "e2ca17ac735bcbc48b13062484541702ef45153d",
"version" : "1.0.3"
}
},
{
"identity" : "kakao-ios-sdk",
"kind" : "remoteSourceControl",
Expand Down
4 changes: 4 additions & 0 deletions DontBe-iOS/DontBe-iOS/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import AuthenticationServices
import UIKit

import Amplitude
import KakaoSDKCommon

@main
Expand All @@ -26,6 +27,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

KakaoSDK.initSDK(appKey: Config.nativeAppKey)

/// Amplitude 설정
Amplitude.instance().initializeApiKey(Config.amplitudeAppKey)

NotificationCenter.default.addObserver(forName: ASAuthorizationAppleIDProvider.credentialRevokedNotification, object: nil, queue: nil) { (Notification) in
// 앱 실행 중 강제로 연결 취소 시 로그인 페이지로 이동
if let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate {
Expand Down
2 changes: 2 additions & 0 deletions DontBe-iOS/DontBe-iOS/Global/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
</array>
<key>NATIVE_APP_KEY</key>
<string>$(NATIVE_APP_KEY)</string>
<key>AMPLITUDE_APP_KEY</key>
<string>$(AMPLITUDE_APP_KEY)</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
Expand Down
8 changes: 8 additions & 0 deletions DontBe-iOS/DontBe-iOS/Network/Foundation/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ enum Config {
enum Plist {
static let nativeAppKey = "NATIVE_APP_KEY"
static let baseURL = "BASE_URL"
static let amplitudeAppKey = "AMPLITUDE_APP_KEY"
}
}

Expand All @@ -37,4 +38,11 @@ extension Config {
}
return key
}()

static let amplitudeAppKey: String = {
guard let key = Config.infoDictionary[Keys.Plist.amplitudeAppKey] as? String else {
fatalError("AMPLITUDE_APP_KEY is not set in plist for this configuration")
}
return key
}()
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
// Created by yeonsu on 1/8/24.
//

import Combine
import Foundation

import Combine
import Amplitude

final class HomeViewModel: ViewModelType {

Expand Down Expand Up @@ -84,6 +85,8 @@ final class HomeViewModel: ViewModelType {
let statusCode = try await self.postLikeButtonAPI(contentId: value.1)?.status
if statusCode == 201 {
self.toggleLikeButton.send(value.0)

Amplitude.instance().logEvent("click_post_like")
}
}
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import Combine
import Foundation
import UIKit

import Amplitude

final class JoinProfileViewModel: ViewModelType {

private let cancelBag = CancelBag()
Expand Down Expand Up @@ -71,6 +73,8 @@ final class JoinProfileViewModel: ViewModelType {
profileImage: value.profile_image)

self.pushOrPopViewController.send(1)

Amplitude.instance().logEvent("click_account_join_done")
}
saveUserData(UserInfo(isSocialLogined: true,
isFirstUser: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import Combine
import Foundation

import Amplitude

final class MyPageAccountInfoViewModel: ViewModelType {
private let cancelBag = CancelBag()
private let networkProvider: NetworkServiceType
Expand Down Expand Up @@ -53,6 +55,8 @@ final class MyPageAccountInfoViewModel: ViewModelType {
if let accessToken = KeychainWrapper.loadToken(forKey: "accessToken") {
if let result = try await self.deleteMemberAPI(accessToken: accessToken, deletedReason: deletedReason) {
self.isSignOutResult.send(result.status)

Amplitude.instance().logEvent("click_account_delete_done")
}
}
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import Foundation
import Combine

import Amplitude

final class PostDetailViewModel: ViewModelType {

private let cancelBag = CancelBag()
Expand Down Expand Up @@ -65,6 +67,8 @@ final class PostDetailViewModel: ViewModelType {
if let data = postResult?.data {
self.isLikeButtonClicked = data.isLiked
self.getPostData.send(data)

Amplitude.instance().logEvent("click_post_view")
}
}
} catch {
Expand All @@ -87,6 +91,8 @@ final class PostDetailViewModel: ViewModelType {
let statusCode = try await self.postLikeButtonAPI(contentId: value.1)?.status
if statusCode == 201 {
self.toggleLikeButton.send(value.0)

Amplitude.instance().logEvent("click_post_like")
}
}
} catch {
Expand Down Expand Up @@ -135,6 +141,8 @@ final class PostDetailViewModel: ViewModelType {
let statusCode = try await self.postCommentLikeButtonAPI(commentId: value.1, alarmText: value.2)?.status
if statusCode == 201 {
self.toggleCommentLikeButton.send(value.0)

Amplitude.instance().logEvent("click_reply_like")
}
}
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import Foundation
import Combine

import Amplitude

final class WriteReplyViewModel: ViewModelType {

private let cancelBag = CancelBag()
Expand All @@ -33,6 +35,8 @@ final class WriteReplyViewModel: ViewModelType {
if let resultStatus = try await self.postWriteReplyContentAPI(accessToken: "\(accessToken)", commentText: value.0, contentId: value.1, notificationTriggerType: "comment") {
print(resultStatus.status)
self.popViewController.send(true)

Amplitude.instance().logEvent("click_reply_upload")
}
}
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import Combine
import Foundation

import Amplitude

final class WriteViewModel: ViewModelType {

private let cancelBag = CancelBag()
Expand All @@ -31,6 +33,8 @@ final class WriteViewModel: ViewModelType {
if let accessToken = KeychainWrapper.loadToken(forKey: "accessToken") {
if let resultStatus = try await self.postWriteContentAPI(accessToken: "\(accessToken)", contentText: "\(value)") {
self.popViewController.send(true)

Amplitude.instance().logEvent("click_post_upload")
}
}
} catch {
Expand Down

0 comments on commit f7c579b

Please sign in to comment.