diff --git a/SniffMeet/SniffMeet/Source/LocalNetwork/MPC/MPCManager.swift b/SniffMeet/SniffMeet/Source/LocalNetwork/MPC/MPCManager.swift index b2d5cc1..c420f15 100644 --- a/SniffMeet/SniffMeet/Source/LocalNetwork/MPC/MPCManager.swift +++ b/SniffMeet/SniffMeet/Source/LocalNetwork/MPC/MPCManager.swift @@ -101,21 +101,18 @@ final class MPCManager: NSObject { SNMLogger.error("error sending \(error.localizedDescription)") } } - - func sendData(profile: DogProfileDTO) { + + func sendData(data: Data) { guard !session.connectedPeers.isEmpty else { SNMLogger.log("no one is connected") return } - + do { - let dataToSend = MPCProfileDropDTO(token: nil, profile: profile, transitionMessage: nil) - let encodedData = try JSONEncoder().encode(dataToSend) - SNMLogger.info("encodedData is \(encodedData)") - sendProfileData(data: encodedData) - + try self.session.send(data, toPeers: session.connectedPeers, with: .reliable) + SNMLogger.log("DogProfileInfo 전송 성공") } catch { - SNMLogger.error("DogProfileInfo 전송 실패: \(error.localizedDescription)") + SNMLogger.error("DogProfileInfo 전송 실패 \(error.localizedDescription)") } } @@ -131,20 +128,6 @@ final class MPCManager: NSObject { SNMLogger.error("error sending \(error.localizedDescription)") } } - - private func updateProfile(dogInfo: UserInfo) { - guard let userID = SessionManager.shared.session?.user?.userID else { return } - profile = DogProfileDTO(id: userID, name: dogInfo.name, keywords: dogInfo.keywords, profileImage: dogInfo.profileImage) - } - - private func sendProfileData(data: Data) { - do { - try self.session.send(data, toPeers: session.connectedPeers, with: .reliable) - SNMLogger.log("DogProfileInfo 전송 성공") - } catch { - SNMLogger.error("DogProfileInfo 전송 실패 \(error.localizedDescription)") - } - } } // MARK: - MCSessionDelegate diff --git a/SniffMeet/SniffMeet/Source/LocalNetwork/NI/NIManager.swift b/SniffMeet/SniffMeet/Source/LocalNetwork/NI/NIManager.swift index 7614ef7..a75dfc9 100644 --- a/SniffMeet/SniffMeet/Source/LocalNetwork/NI/NIManager.swift +++ b/SniffMeet/SniffMeet/Source/LocalNetwork/NI/NIManager.swift @@ -11,15 +11,14 @@ import NearbyInteraction final class NIManager: NSObject { private var niSession: NISession? - private var mpcManager: MPCManager private var cancellables = Set() - private let minDistance: Float = 0.09 private let maxDistance: Float = 0.15 private let minDirection: simd_float3 = simd_float3(-0.6, -0.3, -1.0) private let maxDirection: simd_float3 = simd_float3(0.6, 0.3, -0.8) @Published var niPaired: Bool = false + var mpcManager: MPCManager var isViewTransitioning = PassthroughSubject() var viewTransitionInfo = Set()