Skip to content

Commit

Permalink
Update Kakaomap package (#322)
Browse files Browse the repository at this point in the history
* Update Kakaomap package

* Apply SwiftFormat changes

* Fix `Package.resolved`

---------

Co-authored-by: peng-u-0807 <[email protected]>
  • Loading branch information
peng-u-0807 and peng-u-0807 committed Dec 31, 2024
1 parent 77287ab commit 41480c3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 37 deletions.
18 changes: 9 additions & 9 deletions SNUTT-2022/SNUTT.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
B8A72A022A8F1ED000094FAA /* ChangeNicknameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8A72A012A8F1ED000094FAA /* ChangeNicknameView.swift */; };
B8AF8D3E28C72A880056DE62 /* ValidationUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8AF8D3D28C72A880056DE62 /* ValidationUtils.swift */; };
B8B22D1629311F6200AB88F3 /* EmptyLectureList.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8B22D1529311F6200AB88F3 /* EmptyLectureList.swift */; };
B8B7501D2B6274A5004F6272 /* KakaoMapsSDK_SPM in Frameworks */ = {isa = PBXBuildFile; productRef = B8B7501C2B6274A5004F6272 /* KakaoMapsSDK_SPM */; };
B8BC0C9028BE02D2007A1CA8 /* ReviewRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BC0C8F28BE02D2007A1CA8 /* ReviewRepository.swift */; };
B8C3F0192D23E29500DEB8C0 /* KakaoMapsSDK-SPM in Frameworks */ = {isa = PBXBuildFile; productRef = B8C3F0182D23E29500DEB8C0 /* KakaoMapsSDK-SPM */; };
B8C4F3352CA8F48E006B6BAD /* NoticeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8C4F3342CA8F48E006B6BAD /* NoticeView.swift */; };
B8E51E6628B5EC500065248E /* NetworkConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8E51E6528B5EC500065248E /* NetworkConfiguration.swift */; };
B8E51E6828B615140065248E /* WebErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8E51E6728B615140065248E /* WebErrorView.swift */; };
Expand Down Expand Up @@ -645,11 +645,11 @@
731C24522C4442590015877B /* KakaoSDKCommon in Frameworks */,
BE4CD86728F5A56200BA9BBC /* FirebaseMessaging in Frameworks */,
731C244E2C4442590015877B /* KakaoSDK in Frameworks */,
B8B7501D2B6274A5004F6272 /* KakaoMapsSDK_SPM in Frameworks */,
BE4CD86328F5A56200BA9BBC /* FirebaseAnalyticsSwift in Frameworks */,
CE85901C2C5E21D600ECFE9E /* KakaoSDKTemplate in Frameworks */,
BE779B1828E3DD5B009960EB /* FacebookLogin in Frameworks */,
CEF992F72BF3B8FC00F0FFA4 /* ReactNativeKit in Frameworks */,
B8C3F0192D23E29500DEB8C0 /* KakaoMapsSDK-SPM in Frameworks */,
736AF8512C2F279900ED9C1A /* GoogleSignInSwift in Frameworks */,
BE4CD86528F5A56200BA9BBC /* FirebaseCrashlytics in Frameworks */,
BEDE34D42879A59B00525014 /* Alamofire in Frameworks */,
Expand Down Expand Up @@ -1258,7 +1258,6 @@
BE4CD86228F5A56200BA9BBC /* FirebaseAnalyticsSwift */,
BE4CD86428F5A56200BA9BBC /* FirebaseCrashlytics */,
BE4CD86628F5A56200BA9BBC /* FirebaseMessaging */,
B8B7501C2B6274A5004F6272 /* KakaoMapsSDK_SPM */,
CEF992F62BF3B8FC00F0FFA4 /* ReactNativeKit */,
736AF84E2C2F279900ED9C1A /* GoogleSignIn */,
736AF8502C2F279900ED9C1A /* GoogleSignInSwift */,
Expand All @@ -1267,6 +1266,7 @@
731C24512C4442590015877B /* KakaoSDKCommon */,
CE8590172C5E1B5C00ECFE9E /* KakaoSDKShare */,
CE85901B2C5E21D600ECFE9E /* KakaoSDKTemplate */,
B8C3F0182D23E29500DEB8C0 /* KakaoMapsSDK-SPM */,
);
productName = SNUTT;
productReference = BE682BB22879E24D009EBCB7 /* SNUTT.app */;
Expand Down Expand Up @@ -1349,9 +1349,9 @@
BE779B1628E3DD5B009960EB /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */,
BE4CD85F28F5A56200BA9BBC /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
CE1F49AF2A8DB5A400B81E4E /* XCRemoteSwiftPackageReference "ios-rn-prebuilt" */,
B8B7501B2B6274A5004F6272 /* XCRemoteSwiftPackageReference "KakaoMapsSDK-SPM" */,
736AF84D2C2F279900ED9C1A /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */,
734A83172C2FD39600D6CB95 /* XCRemoteSwiftPackageReference "kakao-ios-sdk" */,
B8C3F0172D23E29500DEB8C0 /* XCRemoteSwiftPackageReference "KakaoMapsSDK-SPM" */,
);
productRefGroup = DC860F3C27E5C87D0068C94B;
projectDirPath = "";
Expand Down Expand Up @@ -2365,12 +2365,12 @@
minimumVersion = 7.1.0;
};
};
B8B7501B2B6274A5004F6272 /* XCRemoteSwiftPackageReference "KakaoMapsSDK-SPM" */ = {
B8C3F0172D23E29500DEB8C0 /* XCRemoteSwiftPackageReference "KakaoMapsSDK-SPM" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/kakao-mapsSDK/KakaoMapsSDK-SPM.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 2.6.3;
minimumVersion = 2.12.3;
};
};
BE4CD85F28F5A56200BA9BBC /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = {
Expand Down Expand Up @@ -2441,10 +2441,10 @@
package = 736AF84D2C2F279900ED9C1A /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */;
productName = GoogleSignInSwift;
};
B8B7501C2B6274A5004F6272 /* KakaoMapsSDK_SPM */ = {
B8C3F0182D23E29500DEB8C0 /* KakaoMapsSDK-SPM */ = {
isa = XCSwiftPackageProductDependency;
package = B8B7501B2B6274A5004F6272 /* XCRemoteSwiftPackageReference "KakaoMapsSDK-SPM" */;
productName = KakaoMapsSDK_SPM;
package = B8C3F0172D23E29500DEB8C0 /* XCRemoteSwiftPackageReference "KakaoMapsSDK-SPM" */;
productName = "KakaoMapsSDK-SPM";
};
BE4CD86028F5A56200BA9BBC /* FirebaseAnalytics */ = {
isa = XCSwiftPackageProductDependency;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "c5a43addf81097cbe1d3fca2033364f0e6e43186057dbcbd3e8d1955872a81fb",
"originHash" : "e3f78a64b4b7fece33ed06e67497191dc7168ae60bfe1531c7f381853782d0e8",
"pins" : [
{
"identity" : "abseil-cpp-binary",
Expand Down Expand Up @@ -132,8 +132,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/kakao-mapsSDK/KakaoMapsSDK-SPM.git",
"state" : {
"revision" : "d2b50b7ae9785f16287df49aa2d010c8e00cf6ee",
"version" : "2.6.3"
"revision" : "541ba0abe90325f041cd333c2d132f991b33fc9f",
"version" : "2.12.3"
}
},
{
Expand Down
50 changes: 26 additions & 24 deletions SNUTT-2022/SNUTT/Views/Components/KakaoMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,25 @@ struct KakaoMapView: UIViewRepresentable {
let colorScheme: ColorScheme
let buildings: [Location: String]

/// 뷰 생성과 함께 KMControllerDelegate를 구현한 Coordinator를 생성하고, 엔진을 생성 및 초기화한다.
func makeUIView(context: Self.Context) -> KMViewContainer {
let view = KMViewContainer()
view.sizeToFit()
context.coordinator.createController(view)
context.coordinator.controller?.initEngine()
context.coordinator.controller?.prepareEngine()
return view
}

/// Updates the presented `UIView` (and coordinator) to the latest configuration.
func updateUIView(_: KMViewContainer, context: Self.Context) {
DispatchQueue.main.async {
if showMapView {
context.coordinator.controller?.startEngine()
context.coordinator.controller?.startRendering()
if context.coordinator.controller?.isEnginePrepared == false {
context.coordinator.controller?.prepareEngine()
}
context.coordinator.controller?.activateEngine()
} else {
context.coordinator.controller?.stopRendering()
context.coordinator.controller?.stopEngine()
context.coordinator.controller?.pauseEngine()
context.coordinator.controller?.resetEngine()
}
}
}
Expand All @@ -42,8 +43,8 @@ struct KakaoMapView: UIViewRepresentable {

/// Cleans up the presented `UIView` (and coordinator) in anticipation of their removal.
static func dismantleUIView(_: KMViewContainer, coordinator: KakaoMapCoordinator) {
coordinator.controller?.stopRendering()
coordinator.controller?.stopEngine()
coordinator.controller?.pauseEngine()
coordinator.controller?.resetEngine()
}

class KakaoMapCoordinator: NSObject, MapControllerDelegate, KakaoMapEventDelegate {
Expand Down Expand Up @@ -94,25 +95,26 @@ struct KakaoMapView: UIViewRepresentable {
func addViews() {
let defaultPosition = MapPoint(longitude: defaultPoint.longitude, latitude: defaultPoint.latitude)
let mapviewInfo = MapviewInfo(viewName: "mapview", viewInfoName: "map", defaultPosition: defaultPosition, defaultLevel: shouldZoomOut ? 14 : 15)
controller?.addView(mapviewInfo)
}

if controller?.addView(mapviewInfo) == Result.OK {
guard let mapView = mapView else {
return
}
mapView.eventDelegate = self

if colorScheme == .light {
mapView.dimScreen.color = UIColor(white: 0, alpha: 0.4)
} else {
mapView.dimScreen.color = UIColor(white: 0, alpha: 0.15)
}
mapView.dimScreen.cover = .map
func addViewSucceeded(_: String, viewInfoName _: String) {
guard let mapView = mapView else {
return
}
mapView.eventDelegate = self

disableAllGestures(mapView)
createLabelLayer()
createPoiStyle()
createPois()
if colorScheme == .light {
mapView.dimScreen.color = UIColor(white: 0, alpha: 0.4)
} else {
mapView.dimScreen.color = UIColor(white: 0, alpha: 0.15)
}
mapView.dimScreen.cover = .map

disableAllGestures(mapView)
createLabelLayer()
createPoiStyle()
createPois()
}

func terrainDidTapped(kakaoMap _: KakaoMap, position _: MapPoint) {
Expand Down
4 changes: 3 additions & 1 deletion SNUTT-2022/SNUTT/Views/SNUTTApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Created by Jinsup Keum on 2022/03/19.
//

import KakaoMapsSDK
import KakaoSDKAuth
import KakaoSDKCommon
import SwiftUI
Expand All @@ -25,6 +26,7 @@ struct SNUTTApp: App {
)
let kakaoAppKey = Bundle.main.infoDictionary?["KAKAO_APP_KEY"] as! String
KakaoSDK.initSDK(appKey: kakaoAppKey)
SDKInitializer.InitSDK(appKey: kakaoAppKey)
}

var body: some Scene {
Expand All @@ -33,7 +35,7 @@ struct SNUTTApp: App {
.environment(\.dependencyContainer, appEnvironment.container)
.onOpenURL { url in
if AuthApi.isKakaoTalkLoginUrl(url) {
AuthController.handleOpenUrl(url: url)
_ = AuthController.handleOpenUrl(url: url)
}
Task {
do {
Expand Down

0 comments on commit 41480c3

Please sign in to comment.