Skip to content

Commit

Permalink
Merge pull request #54 from DeveloperAcademy-POSTECH/feat/#25
Browse files Browse the repository at this point in the history
Feat/#25: set ProgressView and alarmDeadline
  • Loading branch information
grootwo authored May 23, 2024
2 parents 29f74ac + addc2b3 commit 52c1687
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions LiveTimeWidget/LiveTimeWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ struct LiveTimeWidget: Widget {
ProgressView(value: context.state.progressAmount, total: progressTotal)
.tint(context.state.step >= 3 ? .red : .customGreen)
}
.foregroundStyle(.white)
Image(context.state.step >= 3 ? "pilling" : "alarm")
}
.padding()
.background(.black)
} dynamicIsland: { context in
// dynamic island
DynamicIsland {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
version = "1.8">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
Expand Down
15 changes: 8 additions & 7 deletions MC2-Team3-Pilling/View/LiveActivityTestView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,22 @@ struct LiveActivityTestView: View {
return formatter
}()

@State private var alarmTime = dateFormatter.date(from: "\(Date.now.formatted(date: .numeric, time: .omitted))_09:13:00")!
@State private var alarmTime = dateFormatter.date(from: "\(Date.now.formatted(date: .numeric, time: .omitted))_11:34:10")!
@State private var currentDate = Date.now
let alarmDeadline: Double = 10 //
var restOfTime: TimeInterval {
currentDate.timeIntervalSince(alarmTime)
currentDate.timeIntervalSince(alarmTime) - alarmDeadline
}
var currentStep: Int {
if restOfTime < 0 { // 알람 시간 전
if restOfTime < -alarmDeadline - 1 { // 알람 시간 전
return -1
} else if 0 <= restOfTime && restOfTime <= 1 { // 알람 시간
} else if -alarmDeadline - 1 <= restOfTime && restOfTime <= -alarmDeadline { // 알람 시간
return 0
} else if restOfTime < 11 { // ~ 알람 시간 10초 이내
} else if restOfTime < -alarmDeadline + 11 { // ~ 알람 시간 10초 이내
return 1
} else if restOfTime < 21 { // ~ 알람 시간 20초 이내
} else if restOfTime < -alarmDeadline + 21 { // ~ 알람 시간 20초 이내
return 2
} else if restOfTime < 31 { // 알람 시간 후 ~
} else if restOfTime < -alarmDeadline + 31 { // 알람 시간 후 ~
return 3
} else {
return 4
Expand Down

0 comments on commit 52c1687

Please sign in to comment.