@@ -21,7 +21,6 @@ final class ManageRecordViewModel: ObservableObject {
21
21
@Published var goal : Goal ?
22
22
@Published var strengthGoal : Goal ?
23
23
@Published var traingMode : Common . TrainingMode ?
24
- @Published var lastSelectedTime : Int ?
25
24
26
25
private let recordId : String
27
26
private let getHeatMapColorUsecase : GetHeatMapColorUsecase
@@ -32,7 +31,6 @@ final class ManageRecordViewModel: ObservableObject {
32
31
private let subscribeTrainingModeUsecase : SubscribeTrainingModeUsecase
33
32
private let checkGoalAchievedUsecase : CheckGoalAchievedUsecase
34
33
private let checkStrengthGoalAchievedUsecase : CheckStrengthGoalAchievedUsecase
35
- private let cancelExerciseTimerUsecase : CancelExerciseTimerUsecase
36
34
private let registerExerciseTimerUsecase : RegisterExerciseTimerUsecase
37
35
private var cancellables = Set < AnyCancellable > ( )
38
36
@@ -62,7 +60,6 @@ final class ManageRecordViewModel: ObservableObject {
62
60
subscribeTrainingModeUsecase = . init( userRepository: userRepository)
63
61
checkGoalAchievedUsecase = . init( )
64
62
checkStrengthGoalAchievedUsecase = . init( )
65
- cancelExerciseTimerUsecase = . init( exerciseTimerRepository: exerciseTimerRepository)
66
63
registerExerciseTimerUsecase = . init( exerciseTimerRepository: exerciseTimerRepository)
67
64
68
65
let color : Common . HeatMapColor = . init( domain: getHeatMapColorUsecase. implement ( ) )
@@ -85,32 +82,25 @@ final class ManageRecordViewModel: ObservableObject {
85
82
Common . PushNotificationManager. shared. delete ( ids: [ " ExerciseTimer \( i) " ] )
86
83
}
87
84
88
- if lastSelectedTime == time {
89
- cancelExerciseTimerUsecase. implement ( )
90
- lastSelectedTime = nil
91
- } else {
92
- if var date = Calendar . current. date ( byAdding: . second, value: time, to: Date ( ) ) {
93
- registerExerciseTimerUsecase. implement ( timer: . init( targetDate: date) )
85
+ if var date = Calendar . current. date ( byAdding: . second, value: time, to: Date ( ) ) {
86
+ registerExerciseTimerUsecase. implement ( timer: . init( targetDate: date) )
87
+
88
+ for i in ( 0 ..< 10 ) {
89
+ Common . PushNotificationManager. shared. register (
90
+ title: " Ring Ring Ring... " ,
91
+ body: " Tap to stop alarm " ,
92
+ date: date,
93
+ id: " ExerciseTimer \( i) " ,
94
+ userInfo: [
95
+ " type " : " timer " ,
96
+ " targetDate " : date
97
+ ]
98
+ )
94
99
95
- for i in ( 0 ..< 10 ) {
96
- Common . PushNotificationManager. shared. register (
97
- title: " Ring Ring Ring... " ,
98
- body: " Tap to stop alarm " ,
99
- date: date,
100
- id: " ExerciseTimer \( i) " ,
101
- userInfo: [
102
- " type " : " timer " ,
103
- " targetDate " : date
104
- ]
105
- )
106
-
107
- if let updatedDate = Calendar . current. date ( byAdding: . second, value: 3 , to: date) {
108
- date = updatedDate
109
- }
100
+ if let updatedDate = Calendar . current. date ( byAdding: . second, value: 3 , to: date) {
101
+ date = updatedDate
110
102
}
111
103
}
112
-
113
- lastSelectedTime = time
114
104
}
115
105
}
116
106
0 commit comments