Skip to content

Commit

Permalink
Chore: 위젯버전 15.0으로 설정 및 1.3.0 배포버전
Browse files Browse the repository at this point in the history
  • Loading branch information
FirstDo committed Nov 10, 2024
1 parent 7cc25e3 commit 52cd717
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 63 deletions.
3 changes: 2 additions & 1 deletion Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let project = Project(
),
settings: .settings(
base: .init()
.marketingVersion("1.2.2")
.marketingVersion("1.3.0")
.swiftVersion("5.7")
.currentProjectVersion("1")
.appleGenericVersioningSystem(),
Expand All @@ -23,6 +23,7 @@ let project = Project(
platform: .iOS,
product: .appExtension,
bundleId: "com.yapp.moneymong.WidgetExtension",
deploymentTarget: .iOS(targetVersion: "15.0", devices: .iphone),
infoPlist: .extendingDefault(with: [
"CFBundleDisplayName": "$(PRODUCT_NAME)",
"NSExtension": [
Expand Down
14 changes: 14 additions & 0 deletions Projects/App/WidgetExtension/Sources/Utils/View+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import SwiftUI

extension View {
func widgetBackground(_ backgroundView: some View) -> some View {
if #available(iOSApplicationExtension 17.0, *) {
return containerBackground(for: .widget) {
backgroundView
}
} else {
return background(backgroundView)
}
}
}

21 changes: 21 additions & 0 deletions Projects/App/WidgetExtension/Sources/View/EmptyAgencyView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import SwiftUI
import WidgetKit

import DesignSystem

// 4 * 2 위젯일때 소속이 없을경우
struct EmptyAgencyView: View {
var body: some View {
VStack {
Image(uiImage: Images.mongLedgerWidget!)
(
Text("회비 관리할 ").foregroundColor(.white) +
Text("장부").foregroundColor(Color(uiColor: Colors.Blue._4)) +
Text("를 만들어주세요!").foregroundColor(.white)
)
.font(.system(size: 16, weight: .bold))

}
.widgetBackground(GradientBackgroundView())
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftUI

public struct GradientView: View {
public struct GradientBackgroundView: View {
public var body: some View {
LinearGradient(
stops: [
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@ import SwiftUI

import DesignSystem

struct MiniNotSelectedAgencyView: View {
// 2 * 2 위젯인데 소속이 없을경우
struct SmallEmptyAgencyView: View {
var body: some View {
VStack {
Image(uiImage: Images.mongLedgerWidgetMini!)
VStack {
(
Text("회비 관리할 ").foregroundStyle(.white) +
Text("장부").foregroundStyle(Color(uiColor: Colors.Blue._4)) +
Text("").foregroundStyle(.white)
Text("회비 관리할 ").foregroundColor(.white) +
Text("장부").foregroundColor(Color(uiColor: Colors.Blue._4)) +
Text("").foregroundColor(.white)
)
.font(.system(size: 16, weight: .bold))
Text("만들어주세요!")
.foregroundStyle(.white)
.font(.system(size: 16, weight: .bold))
}
}
.containerBackground(for: .widget) {
GradientView()
}
.widgetBackground(GradientBackgroundView())
}
}
13 changes: 2 additions & 11 deletions Projects/App/WidgetExtension/Sources/Widgets/MainWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct MainWidget: Widget {
var body: some WidgetConfiguration {
StaticConfiguration(kind: kind, provider: AgencyProvider()) { entry in
if entry.name.isEmpty {
NotSelectedAgencyView()
EmptyAgencyView()
} else {
MainWidgetEntryView(entry: entry)
}
Expand All @@ -22,7 +22,6 @@ struct MainWidget: Widget {
struct MainWidgetEntryView: View {
var entry: AgencyProvider.Entry


var body: some View {
VStack {
Link(destination: URL(string: "widget://CreateLedger")!) {
Expand Down Expand Up @@ -71,14 +70,6 @@ struct MainWidgetEntryView: View {
.frame(height: 24)
Spacer()
}
.containerBackground(for: .widget) {
Color(uiColor: Colors.Gray._1)
}
.widgetBackground(Color(uiColor: Colors.Gray._1))
}
}

#Preview(as: .systemMedium, widget: {
MainWidget()
}, timeline: {
AgencyEntry(date: .now, name: "머니몽", amount: 1000)
})
12 changes: 2 additions & 10 deletions Projects/App/WidgetExtension/Sources/Widgets/OCRWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct OCRWidget: Widget {
var body: some WidgetConfiguration {
StaticConfiguration(kind: kind, provider: AgencyProvider()) { entry in
if entry.name.isEmpty {
MiniNotSelectedAgencyView()
SmallEmptyAgencyView()
} else {
OCRWidgetEntryView()
}
Expand Down Expand Up @@ -37,14 +37,6 @@ struct OCRWidgetEntryView: View {
}
.padding(.vertical, 20)
.widgetURL(URL(string: "widget://OCR"))
.containerBackground(for: .widget) {
Color(uiColor: Colors.Gray._1)
}
.widgetBackground(Color(uiColor: Colors.Gray._1))
}
}

#Preview(as: .systemSmall, widget: {
OCRWidget()
}, timeline: {
AgencyEntry(date: .now, name: "머니몽", amount: 1000)
})
13 changes: 2 additions & 11 deletions Projects/App/WidgetExtension/Sources/Widgets/SecondWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct SecondWidget: Widget {
var body: some WidgetConfiguration {
StaticConfiguration(kind: kind, provider: AgencyProvider()) { entry in
if entry.name.isEmpty {
NotSelectedAgencyView()
EmptyAgencyView()
} else {
SecondWidgetEntryView(entry: entry)
}
Expand Down Expand Up @@ -73,15 +73,6 @@ struct SecondWidgetEntryView: View {
}
.padding(.horizontal, 10)
.padding(.vertical, 20)
.containerBackground(for: .widget) {
Color(uiColor: Colors.Gray._1)
}
.widgetBackground(Color(uiColor: Colors.Gray._1))
}
}

#Preview(as: .systemMedium) {
SecondWidget()
} timeline: {
AgencyEntry(date: .now, name: "", amount: 100000)
AgencyEntry(date: .now, name: "머니몽2", amount: 120000)
}

0 comments on commit 52cd717

Please sign in to comment.