Skip to content

Commit a8ad1d5

Browse files
authored
Merge pull request #267 from DeveloperAcademy-POSTECH/dev
dev to main merge
2 parents 796adad + 2238359 commit a8ad1d5

File tree

5 files changed

+57
-84
lines changed

5 files changed

+57
-84
lines changed

BusRoad.xcodeproj/project.pbxproj

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
/* Begin PBXBuildFile section */
1010
248377062ECDD30E0005F935 /* Secrets.plist in Resources */ = {isa = PBXBuildFile; fileRef = 931B33E52EA5DB1600ED7944 /* Secrets.plist */; };
1111
603D50272ECAB88C00476C7F /* Secrets.plist in Resources */ = {isa = PBXBuildFile; fileRef = 931B33E52EA5DB1600ED7944 /* Secrets.plist */; };
12-
603D54852ECDCE3E00476C7F /* Secrets.plist in Resources */ = {isa = PBXBuildFile; fileRef = 931B33E52EA5DB1600ED7944 /* Secrets.plist */; };
1312
60A8CDB02E7CE7B900530B92 /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = 60A8CDAF2E7CE7A100530B92 /* .swiftlint.yml */; };
1413
931B33E92EA5DB5D00ED7944 /* Lottie in Frameworks */ = {isa = PBXBuildFile; productRef = 931B33E82EA5DB5D00ED7944 /* Lottie */; };
1514
FEFDE9E22EB23C5200733205 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FEFDE9E12EB23C5200733205 /* WidgetKit.framework */; };
@@ -454,7 +453,7 @@
454453
CODE_SIGN_IDENTITY = "Apple Development";
455454
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
456455
CODE_SIGN_STYLE = Manual;
457-
CURRENT_PROJECT_VERSION = 1;
456+
CURRENT_PROJECT_VERSION = 24;
458457
DEVELOPMENT_TEAM = "";
459458
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = Y485RHY5J6;
460459
ENABLE_PREVIEWS = YES;
@@ -471,12 +470,12 @@
471470
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
472471
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
473472
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
474-
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
473+
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
475474
LD_RUNPATH_SEARCH_PATHS = (
476475
"$(inherited)",
477476
"@executable_path/Frameworks",
478477
);
479-
MARKETING_VERSION = 1.0;
478+
MARKETING_VERSION = 1.1.2;
480479
PRODUCT_BUNDLE_IDENTIFIER = com.untitled.BusRoad;
481480
PRODUCT_NAME = "$(TARGET_NAME)";
482481
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -503,7 +502,7 @@
503502
CODE_SIGN_IDENTITY = "Apple Development";
504503
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
505504
CODE_SIGN_STYLE = Manual;
506-
CURRENT_PROJECT_VERSION = 1;
505+
CURRENT_PROJECT_VERSION = 24;
507506
DEVELOPMENT_TEAM = "";
508507
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = Y485RHY5J6;
509508
ENABLE_PREVIEWS = YES;
@@ -520,12 +519,12 @@
520519
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
521520
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
522521
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
523-
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
522+
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
524523
LD_RUNPATH_SEARCH_PATHS = (
525524
"$(inherited)",
526525
"@executable_path/Frameworks",
527526
);
528-
MARKETING_VERSION = 1.0;
527+
MARKETING_VERSION = 1.1.2;
529528
PRODUCT_BUNDLE_IDENTIFIER = com.untitled.BusRoad;
530529
PRODUCT_NAME = "$(TARGET_NAME)";
531530
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -552,31 +551,35 @@
552551
CODE_SIGN_IDENTITY = "Apple Development";
553552
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
554553
CODE_SIGN_STYLE = Manual;
555-
CURRENT_PROJECT_VERSION = 1;
554+
CURRENT_PROJECT_VERSION = 24;
556555
DEVELOPMENT_TEAM = "";
557556
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = Y485RHY5J6;
558557
GENERATE_INFOPLIST_FILE = YES;
559558
INFOPLIST_FILE = ProgressWidget/Info.plist;
560559
INFOPLIST_KEY_CFBundleDisplayName = ProgressWidget;
561560
INFOPLIST_KEY_NSHumanReadableCopyright = "";
562-
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
561+
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
563562
LD_RUNPATH_SEARCH_PATHS = (
564563
"$(inherited)",
565564
"@executable_path/Frameworks",
566565
"@executable_path/../../Frameworks",
567566
);
568-
MARKETING_VERSION = 1.0;
567+
MARKETING_VERSION = 1.1.2;
569568
PRODUCT_BUNDLE_IDENTIFIER = com.untitled.BusRoad.BusRoadWidgetExtension;
570569
PRODUCT_NAME = "$(TARGET_NAME)";
571570
PROVISIONING_PROFILE_SPECIFIER = "";
572571
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = UntitledBusWidget;
573572
SKIP_INSTALL = YES;
574573
STRING_CATALOG_GENERATE_SYMBOLS = YES;
574+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
575+
SUPPORTS_MACCATALYST = NO;
576+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
577+
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
575578
SWIFT_APPROACHABLE_CONCURRENCY = YES;
576579
SWIFT_EMIT_LOC_STRINGS = YES;
577580
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
578581
SWIFT_VERSION = 5.0;
579-
TARGETED_DEVICE_FAMILY = "1,2";
582+
TARGETED_DEVICE_FAMILY = 1;
580583
};
581584
name = Debug;
582585
};
@@ -588,31 +591,35 @@
588591
CODE_SIGN_IDENTITY = "Apple Development";
589592
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
590593
CODE_SIGN_STYLE = Manual;
591-
CURRENT_PROJECT_VERSION = 1;
594+
CURRENT_PROJECT_VERSION = 24;
592595
DEVELOPMENT_TEAM = "";
593596
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = Y485RHY5J6;
594597
GENERATE_INFOPLIST_FILE = YES;
595598
INFOPLIST_FILE = ProgressWidget/Info.plist;
596599
INFOPLIST_KEY_CFBundleDisplayName = ProgressWidget;
597600
INFOPLIST_KEY_NSHumanReadableCopyright = "";
598-
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
601+
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
599602
LD_RUNPATH_SEARCH_PATHS = (
600603
"$(inherited)",
601604
"@executable_path/Frameworks",
602605
"@executable_path/../../Frameworks",
603606
);
604-
MARKETING_VERSION = 1.0;
607+
MARKETING_VERSION = 1.1.2;
605608
PRODUCT_BUNDLE_IDENTIFIER = com.untitled.BusRoad.BusRoadWidgetExtension;
606609
PRODUCT_NAME = "$(TARGET_NAME)";
607610
PROVISIONING_PROFILE_SPECIFIER = "";
608611
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = UntitledBusWidget;
609612
SKIP_INSTALL = YES;
610613
STRING_CATALOG_GENERATE_SYMBOLS = YES;
614+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
615+
SUPPORTS_MACCATALYST = NO;
616+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
617+
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
611618
SWIFT_APPROACHABLE_CONCURRENCY = YES;
612619
SWIFT_EMIT_LOC_STRINGS = YES;
613620
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
614621
SWIFT_VERSION = 5.0;
615-
TARGETED_DEVICE_FAMILY = "1,2";
622+
TARGETED_DEVICE_FAMILY = 1;
616623
};
617624
name = Release;
618625
};

BusRoad/Component/RouteSuggestionView/RouteSelectButton.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ struct RouteSelectButton: View {
108108
Button {
109109
retrySearch()
110110
} label: {
111-
Text("처음으로")
111+
Text("다시 검색하기")
112112
.foregroundColor(Color.subLight)
113113
.font(.premed32)
114114
.frame(width: 305.wScaled, height: 64)

BusRoad/Feature/Walking/DevRouteMapView.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct DevRouteMapView: View {
3636

3737
var body: some View {
3838
Map(position: $camera) {
39+
3940
// 1) 경로
4041
if !tmapCoordinates.isEmpty {
4142
MapPolyline(coordinates: tmapCoordinates)
@@ -105,17 +106,17 @@ struct DevRouteMapView: View {
105106

106107
// --- (1) 유저가 첫 번째 좌표 근처라면: 첫 번째 → 두 번째로 방향 설정 ---
107108
if tmapCoordinates.count >= 2 {
108-
let first = tmapCoordinates[0]
109-
let second = tmapCoordinates[1]
109+
let first = tmapCoordinates[1]
110+
let second = tmapCoordinates[2]
110111

111112
let userLoc = CLLocation(latitude: user.latitude, longitude: user.longitude)
112113
let firstLoc = CLLocation(latitude: first.latitude, longitude: first.longitude)
113114

114115
// “근처” 판단 거리 (예: 15~20m)
115-
if userLoc.distance(from: firstLoc) < 20 {
116+
if userLoc.distance(from: firstLoc) < 40 {
116117
let hdg = bearing(from: first, to: second)
117118
camera = .camera(
118-
MapCamera(centerCoordinate: user,
119+
MapCamera(centerCoordinate: first,
119120
distance: firstPersonDistance,
120121
heading: hdg,
121122
pitch: firstPersonPitch)

BusRoad/Utility/Manager/AlightProximityManager.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Foundation
2-
//import UIKit
32
import CoreLocation
43
import Combine
54

@@ -275,10 +274,8 @@ final class AlightProximityManager: ObservableObject {
275274

276275
if shouldAnnounce {
277276
if remainingStations == 2 {
278-
// playHapticFeedback()
279277
voiceManager.announceTwoStations()
280278
} else if remainingStations == 1 {
281-
// playHapticFeedback()
282279
voiceManager.announceOneStation()
283280
}
284281
}
@@ -452,11 +449,6 @@ final class AlightProximityManager: ObservableObject {
452449
missedStationsCheck.removeAll()
453450
stationProximityState.removeAll()
454451
}
455-
456-
// private func playHapticFeedback() {
457-
// let generator = UINotificationFeedbackGenerator()
458-
// generator.notificationOccurred(.warning)
459-
// }
460452
}
461453

462454
// MARK: - 배열 safe 인덱스

ProgressWidget/ProgressLiveActivityManager.swift

Lines changed: 29 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ final class ProgressLiveActivityManager {
1818

1919
private var currentActivity: Activity<ProgressAttributes>?
2020
private var maxProgress: Double = 0.0
21-
private var isBusUpdating = false
2221

2322
private var lastWalkingUpdateTime: Date = .distantPast
2423
private var lastBusProgressUpdateTime: Date = .distantPast
2524
private var pendingStageUpdate: (nextStage: String, nextDestination: String, totalDistance: Double, remainingBusStops: Int, busTravelTime: Int)?
2625
private var pendingRemainingBusStops: Int?
26+
private var isBusProgressUpdating = false
27+
private var isRemainingStopsUpdating = false
2728

2829
private let updateQueue = DispatchQueue(label: "com.busroad.liveactivity.updateQueue")
2930

@@ -293,26 +294,22 @@ final class ProgressLiveActivityManager {
293294
func updateRemainingBusStops(remaining: Int) {
294295
updateQueue.async { [weak self] in
295296
guard let self = self else { return }
296-
297-
let timestamp = Date().timeIntervalSince1970
298-
299-
// 이미 다른 업데이트 중이라면 pending으로 저장하고 return
300-
if self.isBusUpdating {
301-
print("[남은 정류장 \(String(format: "%.3f", timestamp))] 대기 중 - pendingRemainingBusStops에 저장")
297+
298+
// 자기 자신의 플래그만 체크
299+
guard !self.isRemainingStopsUpdating else {
302300
self.pendingRemainingBusStops = remaining
303301
return
304302
}
305303

306-
self.isBusUpdating = true
307-
304+
self.isRemainingStopsUpdating = true
305+
308306
guard let activity = Activity<ProgressAttributes>.activities.first else {
309-
print("[LiveActivity] No active activity found for remaining bus stops update")
310-
self.isBusUpdating = false
307+
self.isRemainingStopsUpdating = false
311308
return
312309
}
313-
310+
314311
Self.remainingBusStops = remaining
315-
312+
316313
var updatedState = activity.content.state
317314
updatedState.remainingBusStops = remaining
318315
updatedState.subDescription = Self.subDescription(
@@ -321,17 +318,15 @@ final class ProgressLiveActivityManager {
321318
remainingBusStops: remaining,
322319
busTravelTime: updatedState.busTravelTime
323320
)
324-
321+
325322
Task {
326323
await activity.update(ActivityContent(state: updatedState, staleDate: nil))
327-
print("[남은 정류장 \(String(format: "%.3f", timestamp))] Updated remaining bus stops: \(remaining)")
324+
print("[남은 정류장] Updated: \(remaining)")
328325

329-
self.isBusUpdating = false
326+
self.isRemainingStopsUpdating = false
330327

331-
// 대기 중이던 값 있으면 바로 재실행
332328
if let pending = self.pendingRemainingBusStops {
333329
self.pendingRemainingBusStops = nil
334-
print("[남은 정류장 \(String(format: "%.3f", timestamp))] pendingRemainingBusStops 재실행")
335330
self.updateRemainingBusStops(remaining: pending)
336331
}
337332
}
@@ -342,70 +337,48 @@ final class ProgressLiveActivityManager {
342337
updateQueue.async { [weak self] in
343338
guard let self = self else { return }
344339

345-
let timestamp = Date().timeIntervalSince1970
346-
347-
// 1초 throttle을 먼저 체크 (isBusUpdating 전에)
348340
let now = Date()
349341
guard now.timeIntervalSince(self.lastBusProgressUpdateTime) >= 1.0 else {
350-
print("[버스 진행률 \(String(format: "%.3f", timestamp))] throttle로 스킵")
351342
return
352343
}
353344

354-
// 이미 업데이트 중이면 대기
355-
guard !self.isBusUpdating else {
356-
print("[버스 진행률 \(String(format: "%.3f", timestamp))] 이미 업데이트 중 - 스킵")
345+
// 자기 자신의 플래그만 체크
346+
guard !self.isBusProgressUpdating else {
357347
return
358348
}
359349

360-
self.isBusUpdating = true
350+
self.isBusProgressUpdating = true
361351
self.lastBusProgressUpdateTime = now
362352

363353
guard let activity = Activity<ProgressAttributes>.activities.first else {
364-
print("[LiveActivity] 버스 업데이트가 없습니다.")
365-
self.isBusUpdating = false
354+
self.isBusProgressUpdating = false
366355
return
367356
}
368357

369358
Self.busProgress = busProgress
370359

371-
let currentStage = activity.content.state.stage
372-
let currentLeftDistance = activity.content.state.leftDistance
373-
374-
let progressValue = ProgressLiveActivityManager.progress(
375-
for: currentStage,
376-
totalDistance: activity.content.state.totalDistance,
377-
leftDistance: currentLeftDistance,
378-
busProgess: busProgress,
379-
remainingBusStops: activity.content.state.remainingBusStops
380-
)
381-
382360
var updatedState = activity.content.state
383361
updatedState.busProgress = busProgress
384-
updatedState.currentProgressValue = progressValue
385-
updatedState.maxProgressValue = max(updatedState.maxProgressValue, progressValue)
362+
updatedState.currentProgressValue = busProgress
363+
updatedState.maxProgressValue = max(updatedState.maxProgressValue, busProgress)
386364

387365
Task {
388366
await activity.update(ActivityContent(state: updatedState, staleDate: nil))
389-
print("[버스 진행률 \(String(format: "%.3f", timestamp))] 업데이트 완료. busProgress: \(busProgress), progressValue: \(progressValue)")
390-
391-
self.isBusUpdating = false
367+
print("[버스 진행률] 업데이트 완료: \(busProgress)")
392368

393-
if let pending = self.pendingRemainingBusStops {
394-
self.pendingRemainingBusStops = nil
395-
self.updateRemainingBusStops(remaining: pending)
396-
}
369+
self.isBusProgressUpdating = false
397370
}
398371
}
399372
}
400-
401-
func endActivity() {
402-
Task {
403-
for activity in Activity<ProgressAttributes>.activities {
404-
await activity.end(ActivityContent(state: activity.content.state, staleDate: nil), dismissalPolicy: .after(Date().addingTimeInterval(3)))
405-
}
406-
currentActivity = nil
407-
print("Activity ended.")
373+
374+
func endActivity() {
375+
Task {
376+
for activity in Activity<ProgressAttributes>.activities {
377+
await activity.end(ActivityContent(state: activity.content.state, staleDate: nil), dismissalPolicy: .after(Date().addingTimeInterval(3)))
408378
}
379+
currentActivity = nil
380+
print("Activity ended.")
409381
}
410382
}
383+
}
411384

0 commit comments

Comments
 (0)