Skip to content

Commit

Permalink
Merge branch 'main' into feat/#42
Browse files Browse the repository at this point in the history
  • Loading branch information
teabag759 authored May 22, 2024
2 parents 1cbb038 + bc6d272 commit 1afaecd
Show file tree
Hide file tree
Showing 16 changed files with 544 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scale" : "1x"
},
{
"filename" : "alarm (1).png",
"idiom" : "universal",
"scale" : "2x"
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified LiveTimeWidget/Assets.xcassets/alarm.imageset/alarm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 33 additions & 16 deletions LiveTimeWidget/LiveTimeWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,51 @@ struct LiveTimeWidget: Widget {
var body: some WidgetConfiguration {
ActivityConfiguration(for: LiveTimeAttributes.self) { context in
// lock screen & standby(잠금 화면과 notification center, 그리고 전체화면 버전)
HStack {
Image(systemName: "leaf.fill")
.foregroundStyle(.customGreen)
Text("잔디를 심을 시간이에요!")
Spacer()
Text(context.state.restOfTime, style: .relative)
.foregroundStyle(.customGreen)
.frame(width: 77, height: 30)
VStack {
HStack {
Image(systemName: "leaf.fill")
.foregroundStyle(.customGreen)
Text("잔디를 심을 시간이에요!")
Spacer()
Text(context.state.restOfTime, style: .relative)
.foregroundStyle(.customGreen)
.frame(width: 77, height: 30)
}
Divider()
ProgressView(value: context.state.progressAmount, total: 600)
.padding()
}
.padding()
} dynamicIsland: { context in
// dynamic island
DynamicIsland {
// expanded dynamic island bottom(다이나믹 아일랜드 꾹 눌러서 확장되는 버전)
DynamicIslandExpandedRegion(.leading) {
Image("alarm")
.resizable()
.scaledToFit()
}
DynamicIslandExpandedRegion(.trailing) {
Text(context.state.restOfTime, style: .relative)
.foregroundStyle(.customGreen)
}
DynamicIslandExpandedRegion(.bottom) {
VStack {
Text("잔디 심을 시간이에요!")
Text(context.state.restOfTime, style: .relative)
.foregroundStyle(.customGreen)
Button("click") {}
.tint(.customGreen)
Divider()
.frame(minHeight: 1)
.overlay(.customGreen)
Button(action: {}, label: {
Spacer()
Text("Button")
Spacer()
})
.foregroundColor(.customGreen)
.buttonStyle(.plain)
}
.padding()
}
} compactLeading: {
// compact leading(다이나믹 아일랜드 소형 버전 왼쪽)
Image(systemName: "leaf.fill")
.foregroundStyle(.customGreen)
Image("alarm")
} compactTrailing: {
// compact trailing(다이나믹 아일랜드 소형 버전 오른쪽)
Text(context.state.restOfTime, style: .relative)
Expand Down
16 changes: 12 additions & 4 deletions MC2-Team3-Pilling.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
21B273082BFB390C002BCC67 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21B273072BFB390C002BCC67 /* Model.swift */; };
21B2730C2BFB7301002BCC67 /* SwiftDataTestView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21B2730B2BFB7301002BCC67 /* SwiftDataTestView.swift */; };
21B2730E2BFB85E2002BCC67 /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21B2730D2BFB85E2002BCC67 /* Config.swift */; };
21B5E33B2BFCC83700D1FC06 /* PiriFirstView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21B5E33A2BFCC83700D1FC06 /* PiriFirstView.swift */; };
21B5E33D2BFCDB3A00D1FC06 /* PiriSecondView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21B5E33C2BFCDB3A00D1FC06 /* PiriSecondView.swift */; };
939C87E02BF307B600572EDC /* MC2_Team3_PillingApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 939C87DF2BF307B600572EDC /* MC2_Team3_PillingApp.swift */; };
939C87E22BF307B600572EDC /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 939C87E12BF307B600572EDC /* ContentView.swift */; };
939C87E42BF307B600572EDC /* Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = 939C87E32BF307B600572EDC /* Item.swift */; };
Expand Down Expand Up @@ -70,6 +72,8 @@
21B273072BFB390C002BCC67 /* Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = "<group>"; };
21B2730B2BFB7301002BCC67 /* SwiftDataTestView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftDataTestView.swift; sourceTree = "<group>"; };
21B2730D2BFB85E2002BCC67 /* Config.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Config.swift; sourceTree = "<group>"; };
21B5E33A2BFCC83700D1FC06 /* PiriFirstView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PiriFirstView.swift; sourceTree = "<group>"; };
21B5E33C2BFCDB3A00D1FC06 /* PiriSecondView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PiriSecondView.swift; sourceTree = "<group>"; };
939C87DC2BF307B600572EDC /* MC2-Team3-Pilling.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "MC2-Team3-Pilling.app"; sourceTree = BUILT_PRODUCTS_DIR; };
939C87DF2BF307B600572EDC /* MC2_Team3_PillingApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MC2_Team3_PillingApp.swift; sourceTree = "<group>"; };
939C87E12BF307B600572EDC /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -131,27 +135,29 @@
219E17582BF6ED79007B7DC1 /* View */ = {
isa = PBXGroup;
children = (
93EF92D52BFC4187004DEEF1 /* ChooseStatusView.swift */,
939C87E12BF307B600572EDC /* ContentView.swift */,
9B0411752BF593A0006F8BB9 /* MainView.swift */,
939C88312BF6B4AC00572EDC /* MedicineSheetView.swift */,
939C882D2BF5CC9100572EDC /* OnboardingFirstView.swift */,
939C88352BF6B9BC00572EDC /* OnboardingSecondView.swift */,
21B5E33A2BFCC83700D1FC06 /* PiriFirstView.swift */,
21B5E33C2BFCDB3A00D1FC06 /* PiriSecondView.swift */,
939C88732BFBA01C00572EDC /* PopoverView.swift */,
939C882F2BF5CC9F00572EDC /* SettingView.swift */,
939C88372BF6DF7000572EDC /* SplashScreenView.swift */,
939C88732BFBA01C00572EDC /* PopoverView.swift */,
21B2730B2BFB7301002BCC67 /* SwiftDataTestView.swift */,
93EF92D52BFC4187004DEEF1 /* ChooseStatusView.swift */,
);
path = View;
sourceTree = "<group>";
};
219E17592BF6ED88007B7DC1 /* Model */ = {
isa = PBXGroup;
children = (
1B6530432BFB7C1600452ACB /* LiveTimeAttributes.swift */,
21B2730D2BFB85E2002BCC67 /* Config.swift */,
939C87E32BF307B600572EDC /* Item.swift */,
1B6530432BFB7C1600452ACB /* LiveTimeAttributes.swift */,
21B273072BFB390C002BCC67 /* Model.swift */,
21B2730D2BFB85E2002BCC67 /* Config.swift */,
);
path = Model;
sourceTree = "<group>";
Expand Down Expand Up @@ -316,6 +322,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
21B5E33B2BFCC83700D1FC06 /* PiriFirstView.swift in Sources */,
939C87E22BF307B600572EDC /* ContentView.swift in Sources */,
93EF92D62BFC4187004DEEF1 /* ChooseStatusView.swift in Sources */,
939C882E2BF5CC9100572EDC /* OnboardingFirstView.swift in Sources */,
Expand All @@ -325,6 +332,7 @@
939C88362BF6B9BC00572EDC /* OnboardingSecondView.swift in Sources */,
939C88302BF5CC9F00572EDC /* SettingView.swift in Sources */,
939C88742BFBA01C00572EDC /* PopoverView.swift in Sources */,
21B5E33D2BFCDB3A00D1FC06 /* PiriSecondView.swift in Sources */,
21B2730C2BFB7301002BCC67 /* SwiftDataTestView.swift in Sources */,
939C87E42BF307B600572EDC /* Item.swift in Sources */,
9BE4AA1D2BF6E280008BE893 /* CustomFont.swift in Sources */,
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
55 changes: 34 additions & 21 deletions MC2-Team3-Pilling/Model/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,37 +50,46 @@ class Config{
}
}

let days = ["", "", "", "", "", "", ""]
func DayDateToString(date: Date) -> String {
let format = "yyyy-MM-dd HH:mm:ss"
let dateFormatter = DateFormatter()
dateFormatter.timeZone = TimeZone.current
dateFormatter.dateFormat = format
return dateFormatter.string(from: date)
}
func DayStringToDate(dateString: String) -> Date? {
let format = "yyyy-MM-dd HH:mm:ss"
let dateFormatter = DateFormatter()
dateFormatter.timeZone = TimeZone.current
dateFormatter.dateFormat = format
return dateFormatter.date(from: dateString)
}
func AlarmDateToString(date: Date) -> String {
let format = "HH:mm"

func DateToString(date: Date,format:String) -> String {

let dateFormatter = DateFormatter()
dateFormatter.timeZone = TimeZone.current
dateFormatter.dateFormat = format
return dateFormatter.string(from: date)
}
func StringToDate(dateString: String,format:String) -> Date? {

let dateFormatter = DateFormatter()
dateFormatter.timeZone = TimeZone.current
dateFormatter.dateFormat = format

return dateFormatter.date(from: dateString)
}

func AlarmStringToDate(dateString: String) -> Date? {
let format = "HH:mm"
let dateFormatter = DateFormatter()
dateFormatter.timeZone = TimeZone.current
dateFormatter.dateFormat = format

return dateFormatter.date(from: dateString)
}


// func AlarmDateToString(date: Date) -> String {
// let format = "HH:mm"
// let dateFormatter = DateFormatter()
// dateFormatter.timeZone = TimeZone.current
// dateFormatter.dateFormat = format
// return dateFormatter.string(from: date)
// }
// func AlarmStringToDate(dateString: String) -> Date? {
// let format = "HH:mm"
// let dateFormatter = DateFormatter()
// dateFormatter.timeZone = TimeZone.current
// dateFormatter.dateFormat = format
// return dateFormatter.date(from: dateString)
// }

static let dummyPillInfos: [PillInfo] = [
PillInfo(pillName: "쎄스콘정", intakeDay: 21, placeboDay: 7),
PillInfo(pillName: "미뉴렛정", intakeDay: 21, placeboDay: 7),
Expand All @@ -96,10 +105,14 @@ class Config{
PillInfo(pillName: "야스민정", intakeDay: 21, placeboDay: 7),
PillInfo(pillName: "야즈정", intakeDay: 24, placeboDay: 4),
PillInfo(pillName: "클래라정", intakeDay: 26, placeboDay: 2)

]



}
let myArray: [Int] = [1, 2 , 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3]
var colorArr:[Color] = [.customGray,.customGreen,.customGreen,.white]
let days = ["", "", "", "", "", "", ""]
let dayformat = "yyyy-MM-dd"
let dayToHourformat = "yyyy-MM-dd HH:mm:ss"
let Hourformat = "HH:mm"

1 change: 1 addition & 0 deletions MC2-Team3-Pilling/Model/LiveTimeAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ struct LiveTimeAttributes: ActivityAttributes {

public struct ContentState: Codable, Hashable {
var restOfTime: Date
var progressAmount: Double
}
}
31 changes: 27 additions & 4 deletions MC2-Team3-Pilling/Model/Model.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,44 @@ final class PeriodPill:Identifiable{
@Relationship var pillInfo:PillInfo
var startIntake:String
var finishIntake:String? = nil
var intakeCal:[Int]
var intakeCalTime:[String]
var intakeCal:[DayData]
var missDay:Int

// init(pillInfo: PillInfo, startIntake: String) {
// self.id = UUID()
// self.pillInfo = pillInfo
// self.startIntake = startIntake
// self.intakeCal = []
// self.missDay = 0
// }
init(pillInfo: PillInfo, startIntake: String) {
self.id = UUID()
self.pillInfo = pillInfo
self.startIntake = startIntake
self.intakeCal = []
self.intakeCalTime = []
self.intakeCal = Array(repeating: DayData(), count: pillInfo.wholeDay)
self.missDay = 0
}

}

@Model
final class DayData:Identifiable{
@Attribute(.unique) let id:UUID
var status:Int
var time:String?
var sideEffect:[Bool]
var memo:String

init() {
self.id = UUID()
self.status = 0
self.sideEffect = Array(repeating: false, count: 3)
self.memo = ""
}


}

@Model
final class PillInfo:Identifiable{
@Attribute(.unique) let id:UUID
Expand Down
Loading

0 comments on commit 1afaecd

Please sign in to comment.