Skip to content

Commit 1307215

Browse files
committed
Migrate Calendar Widget to iOS 26
1 parent 38d5ae1 commit 1307215

File tree

5 files changed

+102
-43
lines changed

5 files changed

+102
-43
lines changed

ios/CalendarWidget/CalendarEventView.swift

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,34 @@ struct CalendarEventView: View {
6666
.widgetAccentable(false)
6767
.foregroundStyle(.white)
6868
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
69-
.background(ContainerRelativeShape()
70-
.fill(color).widgetAccentable(true)
71-
.clipShape(RoundedRectangle(cornerRadius: 10)))
69+
.calendarEventViewBackground(color: color)
70+
}
71+
}
72+
}
73+
74+
extension View {
75+
func calendarEventViewBackground(color: Color) -> some View {
76+
modifier(CalendarEventViewBackground(color: color))
77+
}
78+
}
79+
80+
struct CalendarEventViewBackground: ViewModifier {
81+
@Environment(\.widgetRenderingMode) var renderingMode
82+
83+
let color: Color
84+
85+
func body(content: Content) -> some View {
86+
if renderingMode == .accented {
87+
content
88+
.clipShape(ContainerRelativeShape())
89+
.overlay(
90+
ContainerRelativeShape()
91+
.stroke(.white, lineWidth: 1)
92+
)
93+
} else {
94+
content
95+
.background(color.widgetAccentable(true))
96+
.clipShape(ContainerRelativeShape())
7297
}
7398
}
7499
}

ios/CalendarWidget/CalendarWidget.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,19 @@ struct CalendarWidget: Widget {
7272
.description("An Overview About Your Upcoming Events.")
7373
}
7474
}
75+
76+
#Preview(as: .systemMedium) {
77+
CalendarWidget()
78+
} timeline: {
79+
CalendarWidgetEntry(
80+
date: Date(),
81+
entries: [
82+
CalendarEntry(id: "3", title: "Lineare Algebra für Informatik", status: "Test", startDate: Date.now, endDate: Date.now, location: ["Galileo Audimax"], color: nil),
83+
CalendarEntry(id: "4", title: "Einführung in die Buchführung", status: "Test", startDate: Date.now, endDate: Date.now, location: ["Audimax"], color: nil),
84+
CalendarEntry(id: "5", title: "Lineare Algebra für Informatik", status: "Test", startDate: Date.now, endDate: Date.now, location: ["Galileo Audimax"], color: nil),
85+
CalendarEntry(id: "1", title: "Lineare Algebra für Informatik", status: "Test", startDate: Date.now.addingTimeInterval(84_600), endDate: Date.now.addingTimeInterval(84_600), location: ["Galileo Audimax"], color: nil),
86+
CalendarEntry(id: "2", title: "Einführung in die Buchführung", status: "Test", startDate: Date.now.addingTimeInterval(84_600), endDate: Date.now.addingTimeInterval(84_600), location: ["Audimax"], color: nil)
87+
],
88+
size: .systemMedium
89+
)
90+
}

ios/CalendarWidget/CalendarWidgetContent.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ struct CalendarWidgetContent: View {
5959
ForEach((events[eventDate] ?? []).indices, id: \.self) { eventIndex in
6060
let event = events[eventDate]![eventIndex]
6161
CalendarEventView(event: event, color: event.eventColor, isFirst: eventIndex == 0)
62+
.calendarWidgetContentPadding()
6263
}
6364
}
6465
}
@@ -95,3 +96,20 @@ struct CalendarWidgetContent: View {
9596
}
9697
}
9798
}
99+
100+
extension View {
101+
func calendarWidgetContentPadding() -> some View {
102+
modifier(CalendarWidgetContentPadding())
103+
}
104+
}
105+
106+
struct CalendarWidgetContentPadding: ViewModifier {
107+
func body(content: Content) -> some View {
108+
if #available(iOS 26.0, *) {
109+
content
110+
.padding(.init(top: 0, leading: 0, bottom: 1, trailing: 0))
111+
} else {
112+
content
113+
}
114+
}
115+
}

ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>12.0</string>
24+
<string>13.0</string>
2525
</dict>
2626
</plist>

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
/* Begin PBXBuildFile section */
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11-
168FDA16CF21440F36F3BA05 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 534E3BD103D1288980E7922C /* Pods_Runner.framework */; };
1211
28169AD32B9BBE7200FCCFDC /* CalendarWidgetContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28169AD22B9BBE7200FCCFDC /* CalendarWidgetContent.swift */; };
1312
2817D9442B20F31E00ACB7B9 /* firebase_app_id_file.json in Resources */ = {isa = PBXBuildFile; fileRef = 2817D9432B20F31E00ACB7B9 /* firebase_app_id_file.json */; };
1413
2844DDE02B9643EF00E20EDA /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 2844DDDF2B9643EF00E20EDA /* Localizable.xcstrings */; };
@@ -32,6 +31,7 @@
3231
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
3332
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
3433
B87D83CC7CCD2AE11F26B7E2 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 099DD85638DD07B3ECB8FDE7 /* GoogleService-Info.plist */; };
34+
FE06AE6704E40199BD17F86E /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B353AB461F2610B712EFE14D /* Pods_Runner.framework */; };
3535
/* End PBXBuildFile section */
3636

3737
/* Begin PBXContainerItemProxy section */
@@ -72,7 +72,6 @@
7272
099DD85638DD07B3ECB8FDE7 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; };
7373
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
7474
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
75-
172A11A9A4AC1750860BCDD0 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
7675
28169AD22B9BBE7200FCCFDC /* CalendarWidgetContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarWidgetContent.swift; sourceTree = "<group>"; };
7776
2817D9432B20F31E00ACB7B9 /* firebase_app_id_file.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = firebase_app_id_file.json; sourceTree = SOURCE_ROOT; };
7877
2844DDDF2B9643EF00E20EDA /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
@@ -92,12 +91,11 @@
9291
28CBEFE12ACB1A25002DCDEC /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
9392
28ECAB092BBD8C7D008A3F17 /* ColorExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorExtension.swift; sourceTree = "<group>"; };
9493
28F2C31F2B29C62C00DC87B4 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
94+
2C7EB2C795DE285C1D450DF3 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
9595
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
96-
4A164CD074A70F4C1D4B8812 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
97-
534E3BD103D1288980E7922C /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
96+
48E0FE090C6AF99C32502713 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
9897
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
9998
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
100-
7705B30E2698F08D19E09EAB /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
10199
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
102100
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
103101
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
@@ -106,6 +104,8 @@
106104
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
107105
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
108106
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
107+
A360980CB6135F7BD4E8544E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
108+
B353AB461F2610B712EFE14D /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
109109
/* End PBXFileReference section */
110110

111111
/* Begin PBXFrameworksBuildPhase section */
@@ -122,7 +122,7 @@
122122
isa = PBXFrameworksBuildPhase;
123123
buildActionMask = 2147483647;
124124
files = (
125-
168FDA16CF21440F36F3BA05 /* Pods_Runner.framework in Frameworks */,
125+
FE06AE6704E40199BD17F86E /* Pods_Runner.framework in Frameworks */,
126126
);
127127
runOnlyForDeploymentPostprocessing = 0;
128128
};
@@ -152,17 +152,17 @@
152152
children = (
153153
28A24B502B68F784007DF939 /* WidgetKit.framework */,
154154
28A24B522B68F784007DF939 /* SwiftUI.framework */,
155-
534E3BD103D1288980E7922C /* Pods_Runner.framework */,
155+
B353AB461F2610B712EFE14D /* Pods_Runner.framework */,
156156
);
157157
name = Frameworks;
158158
sourceTree = "<group>";
159159
};
160160
7235048790D2172A2171409C /* Pods */ = {
161161
isa = PBXGroup;
162162
children = (
163-
4A164CD074A70F4C1D4B8812 /* Pods-Runner.debug.xcconfig */,
164-
7705B30E2698F08D19E09EAB /* Pods-Runner.release.xcconfig */,
165-
172A11A9A4AC1750860BCDD0 /* Pods-Runner.profile.xcconfig */,
163+
A360980CB6135F7BD4E8544E /* Pods-Runner.debug.xcconfig */,
164+
48E0FE090C6AF99C32502713 /* Pods-Runner.release.xcconfig */,
165+
2C7EB2C795DE285C1D450DF3 /* Pods-Runner.profile.xcconfig */,
166166
);
167167
path = Pods;
168168
sourceTree = "<group>";
@@ -244,7 +244,7 @@
244244
isa = PBXNativeTarget;
245245
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
246246
buildPhases = (
247-
833FCDECE6666C3F146BDA41 /* [CP] Check Pods Manifest.lock */,
247+
627A952351CE75D6F18CD92A /* [CP] Check Pods Manifest.lock */,
248248
2812AFD02B21E4E400306CC7 /* [Crashlytics] Clear dSYM */,
249249
9740EEB61CF901F6004384FC /* Run Script */,
250250
97C146EA1CF9000F007C117D /* Sources */,
@@ -254,8 +254,8 @@
254254
9705A1C41CF9048500538489 /* Embed Frameworks */,
255255
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
256256
2812AFD12B21E52F00306CC7 /* [Crashlytics] Upload dSYM */,
257-
6111433B2A2B4B3A4F52D2A3 /* [CP] Embed Pods Frameworks */,
258-
C123C12DEA66976EA2298C63 /* [CP] Copy Pods Resources */,
257+
EBADD77312F1D3C5C612BC88 /* [CP] Embed Pods Frameworks */,
258+
24B10E3EE2A21E3870A3C31F /* [CP] Copy Pods Resources */,
259259
);
260260
buildRules = (
261261
);
@@ -334,6 +334,23 @@
334334
/* End PBXResourcesBuildPhase section */
335335

336336
/* Begin PBXShellScriptBuildPhase section */
337+
24B10E3EE2A21E3870A3C31F /* [CP] Copy Pods Resources */ = {
338+
isa = PBXShellScriptBuildPhase;
339+
buildActionMask = 2147483647;
340+
files = (
341+
);
342+
inputFileListPaths = (
343+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
344+
);
345+
name = "[CP] Copy Pods Resources";
346+
outputFileListPaths = (
347+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
348+
);
349+
runOnlyForDeploymentPostprocessing = 0;
350+
shellPath = /bin/sh;
351+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
352+
showEnvVarsInLog = 0;
353+
};
337354
2812AFD02B21E4E400306CC7 /* [Crashlytics] Clear dSYM */ = {
338355
isa = PBXShellScriptBuildPhase;
339356
buildActionMask = 2147483647;
@@ -386,24 +403,7 @@
386403
shellPath = /bin/sh;
387404
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n";
388405
};
389-
6111433B2A2B4B3A4F52D2A3 /* [CP] Embed Pods Frameworks */ = {
390-
isa = PBXShellScriptBuildPhase;
391-
buildActionMask = 2147483647;
392-
files = (
393-
);
394-
inputFileListPaths = (
395-
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
396-
);
397-
name = "[CP] Embed Pods Frameworks";
398-
outputFileListPaths = (
399-
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
400-
);
401-
runOnlyForDeploymentPostprocessing = 0;
402-
shellPath = /bin/sh;
403-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
404-
showEnvVarsInLog = 0;
405-
};
406-
833FCDECE6666C3F146BDA41 /* [CP] Check Pods Manifest.lock */ = {
406+
627A952351CE75D6F18CD92A /* [CP] Check Pods Manifest.lock */ = {
407407
isa = PBXShellScriptBuildPhase;
408408
buildActionMask = 2147483647;
409409
files = (
@@ -440,21 +440,21 @@
440440
shellPath = /bin/sh;
441441
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
442442
};
443-
C123C12DEA66976EA2298C63 /* [CP] Copy Pods Resources */ = {
443+
EBADD77312F1D3C5C612BC88 /* [CP] Embed Pods Frameworks */ = {
444444
isa = PBXShellScriptBuildPhase;
445445
buildActionMask = 2147483647;
446446
files = (
447447
);
448448
inputFileListPaths = (
449-
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
449+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
450450
);
451-
name = "[CP] Copy Pods Resources";
451+
name = "[CP] Embed Pods Frameworks";
452452
outputFileListPaths = (
453-
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
453+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
454454
);
455455
runOnlyForDeploymentPostprocessing = 0;
456456
shellPath = /bin/sh;
457-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
457+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
458458
showEnvVarsInLog = 0;
459459
};
460460
/* End PBXShellScriptBuildPhase section */
@@ -582,7 +582,7 @@
582582
ENABLE_BITCODE = NO;
583583
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
584584
INFOPLIST_FILE = Runner/Info.plist;
585-
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
585+
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
586586
LD_RUNPATH_SEARCH_PATHS = (
587587
"$(inherited)",
588588
"@executable_path/Frameworks",
@@ -862,7 +862,7 @@
862862
ENABLE_BITCODE = NO;
863863
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
864864
INFOPLIST_FILE = Runner/Info.plist;
865-
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
865+
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
866866
LD_RUNPATH_SEARCH_PATHS = (
867867
"$(inherited)",
868868
"@executable_path/Frameworks",
@@ -898,7 +898,7 @@
898898
EXCLUDED_ARCHS = "";
899899
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
900900
INFOPLIST_FILE = Runner/Info.plist;
901-
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
901+
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
902902
LD_RUNPATH_SEARCH_PATHS = (
903903
"$(inherited)",
904904
"@executable_path/Frameworks",

0 commit comments

Comments
 (0)