From 3cd5aba41e91d7fb5e51ec6847a07d7c5f6b8d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EB=8F=99=EA=B7=9C?= Date: Tue, 13 Aug 2024 22:08:03 +0900 Subject: [PATCH 1/3] fix timer --- .../Form/Manage/ManageRecordViewModel.swift | 42 +++++++------------ .../Main/View/NavigationViewModel.swift | 4 ++ 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/dg-muscle-ios/sources/Presentation/History/View/Form/Manage/ManageRecordViewModel.swift b/dg-muscle-ios/sources/Presentation/History/View/Form/Manage/ManageRecordViewModel.swift index 7ad69e61..44fae39c 100644 --- a/dg-muscle-ios/sources/Presentation/History/View/Form/Manage/ManageRecordViewModel.swift +++ b/dg-muscle-ios/sources/Presentation/History/View/Form/Manage/ManageRecordViewModel.swift @@ -21,7 +21,6 @@ final class ManageRecordViewModel: ObservableObject { @Published var goal: Goal? @Published var strengthGoal: Goal? @Published var traingMode: Common.TrainingMode? - @Published var lastSelectedTime: Int? private let recordId: String private let getHeatMapColorUsecase: GetHeatMapColorUsecase @@ -32,7 +31,6 @@ final class ManageRecordViewModel: ObservableObject { private let subscribeTrainingModeUsecase: SubscribeTrainingModeUsecase private let checkGoalAchievedUsecase: CheckGoalAchievedUsecase private let checkStrengthGoalAchievedUsecase: CheckStrengthGoalAchievedUsecase - private let cancelExerciseTimerUsecase: CancelExerciseTimerUsecase private let registerExerciseTimerUsecase: RegisterExerciseTimerUsecase private var cancellables = Set() @@ -62,7 +60,6 @@ final class ManageRecordViewModel: ObservableObject { subscribeTrainingModeUsecase = .init(userRepository: userRepository) checkGoalAchievedUsecase = .init() checkStrengthGoalAchievedUsecase = .init() - cancelExerciseTimerUsecase = .init(exerciseTimerRepository: exerciseTimerRepository) registerExerciseTimerUsecase = .init(exerciseTimerRepository: exerciseTimerRepository) let color: Common.HeatMapColor = .init(domain: getHeatMapColorUsecase.implement()) @@ -85,32 +82,25 @@ final class ManageRecordViewModel: ObservableObject { Common.PushNotificationManager.shared.delete(ids: ["ExerciseTimer\(i)"]) } - if lastSelectedTime == time { - cancelExerciseTimerUsecase.implement() - lastSelectedTime = nil - } else { - if var date = Calendar.current.date(byAdding: .second, value: time, to: Date()) { - registerExerciseTimerUsecase.implement(timer: .init(targetDate: date)) + if var date = Calendar.current.date(byAdding: .second, value: time, to: Date()) { + registerExerciseTimerUsecase.implement(timer: .init(targetDate: date)) + + for i in (0..<10) { + Common.PushNotificationManager.shared.register( + title: "Ring Ring Ring...", + body: "Tap to stop alarm", + date: date, + id: "ExerciseTimer\(i)", + userInfo: [ + "type": "timer", + "targetDate": date + ] + ) - for i in (0..<10) { - Common.PushNotificationManager.shared.register( - title: "Ring Ring Ring...", - body: "Tap to stop alarm", - date: date, - id: "ExerciseTimer\(i)", - userInfo: [ - "type": "timer", - "targetDate": date - ] - ) - - if let updatedDate = Calendar.current.date(byAdding: .second, value: 3, to: date) { - date = updatedDate - } + if let updatedDate = Calendar.current.date(byAdding: .second, value: 3, to: date) { + date = updatedDate } } - - lastSelectedTime = time } } diff --git a/dg-muscle-ios/sources/Presentation/Main/View/NavigationViewModel.swift b/dg-muscle-ios/sources/Presentation/Main/View/NavigationViewModel.swift index 9a650092..dd375ab7 100644 --- a/dg-muscle-ios/sources/Presentation/Main/View/NavigationViewModel.swift +++ b/dg-muscle-ios/sources/Presentation/Main/View/NavigationViewModel.swift @@ -9,6 +9,7 @@ import Foundation import Domain import Combine import ExerciseTimer +import Common final class NavigationViewModel: ObservableObject { let subscribeExerciseTimerUsecase: SubscribeExerciseTimerUsecase @@ -25,6 +26,9 @@ final class NavigationViewModel: ObservableObject { func cancelTimer() { cancelExerciseTimerUsecase.implement() + for i in (0..<10) { + Common.PushNotificationManager.shared.delete(ids: ["ExerciseTimer\(i)"]) + } } private func bind() { From ae1e2aa0829f6df0ab306bce6e0e2546e9fd2303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EB=8F=99=EA=B7=9C?= Date: Tue, 13 Aug 2024 22:10:40 +0900 Subject: [PATCH 2/3] chore --- .github/workflows/build_and_test.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 9b319998..78a241ca 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -7,14 +7,6 @@ on: branches: ["main", "staging"] jobs: - list-macos-versions: - runs-on: ubuntu-latest - steps: - - name: Check available macOS versions - run: | - echo "Available macOS versions:" - curl -s https://api.github.com/meta | jq -r '.runner | .macos' - build: name: Build and Test default scheme using any available iPhone simulator runs-on: macos-14 From 8fb5da4bce74fbc024f2db7ab0f04585e0d809cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EB=8F=99=EA=B7=9C?= Date: Tue, 13 Aug 2024 22:13:22 +0900 Subject: [PATCH 3/3] change version --- Derived/InfoPlists/DgWidget-Info.plist | 2 +- Derived/InfoPlists/app-Info.plist | 2 +- Project.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Derived/InfoPlists/DgWidget-Info.plist b/Derived/InfoPlists/DgWidget-Info.plist index 94ed93e3..645b9a9e 100644 --- a/Derived/InfoPlists/DgWidget-Info.plist +++ b/Derived/InfoPlists/DgWidget-Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 2.11.0 + 2.10.0 CFBundleVersion 1 NSExtension diff --git a/Derived/InfoPlists/app-Info.plist b/Derived/InfoPlists/app-Info.plist index 2f0f563a..60117b8e 100644 --- a/Derived/InfoPlists/app-Info.plist +++ b/Derived/InfoPlists/app-Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.11.0 + 2.10.0 CFBundleURLTypes diff --git a/Project.swift b/Project.swift index 74b7042a..765e25ac 100644 --- a/Project.swift +++ b/Project.swift @@ -3,7 +3,7 @@ import ProjectDescription let projectName = "dg-muscle-ios" let widgetName = "DgWidget" let bundleId = "com.donggyu.dg-muscle-ios" -let appVersion: String = "2.11.0" +let appVersion: String = "2.10.0" enum Layer: String, CaseIterable { case Domain