Skip to content

Commit

Permalink
Merge pull request #160 from Adventech/feature/fixes-widgets-iOS17
Browse files Browse the repository at this point in the history
Fixes widgets iOS 17
  • Loading branch information
EmersonCarpes authored May 3, 2024
2 parents 8764a1e + b9f54ea commit 2748caa
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 4 deletions.
20 changes: 18 additions & 2 deletions Sabbath School.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@
4E6B1A6C2AACDA42006B9283 /* NotificationCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EE8B6F4284D1FAA003C1A46 /* NotificationCenter.swift */; };
4E7B09892814CA3D00687C33 /* Encodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E7B09882814CA3D00687C33 /* Encodable.swift */; };
4E7B098C2814CA8A00687C33 /* Comparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E7B098B2814CA8A00687C33 /* Comparable.swift */; };
4E7E4F3F2B79715D00920230 /* ViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E7E4F3E2B79715D00920230 /* ViewExtensions.swift */; };
4E7E4F412B7971A900920230 /* WidgetConfigurationExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E7E4F402B7971A900920230 /* WidgetConfigurationExtensions.swift */; };
4E80B4232AC0A2DA002B6FBF /* SabbathSchoolTVApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E80B4222AC0A2DA002B6FBF /* SabbathSchoolTVApp.swift */; };
4E80B4252AC0A2DA002B6FBF /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E80B4242AC0A2DA002B6FBF /* ContentView.swift */; };
4E80B4272AC0A2DA002B6FBF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4E80B4262AC0A2DA002B6FBF /* Assets.xcassets */; };
Expand Down Expand Up @@ -393,6 +395,8 @@
4E6409F427C5593A00A43D89 /* ScrollView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScrollView.swift; sourceTree = "<group>"; };
4E7B09882814CA3D00687C33 /* Encodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Encodable.swift; sourceTree = "<group>"; };
4E7B098B2814CA8A00687C33 /* Comparable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Comparable.swift; sourceTree = "<group>"; };
4E7E4F3E2B79715D00920230 /* ViewExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewExtensions.swift; sourceTree = "<group>"; };
4E7E4F402B7971A900920230 /* WidgetConfigurationExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetConfigurationExtensions.swift; sourceTree = "<group>"; };
4E80B4202AC0A2D9002B6FBF /* SabbathSchoolTV.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SabbathSchoolTV.app; sourceTree = BUILT_PRODUCTS_DIR; };
4E80B4222AC0A2DA002B6FBF /* SabbathSchoolTVApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SabbathSchoolTVApp.swift; sourceTree = "<group>"; };
4E80B4242AC0A2DA002B6FBF /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -867,6 +871,15 @@
path = Protocols;
sourceTree = "<group>";
};
4E7E4F3D2B796FB900920230 /* Extensions */ = {
isa = PBXGroup;
children = (
4E7E4F3E2B79715D00920230 /* ViewExtensions.swift */,
4E7E4F402B7971A900920230 /* WidgetConfigurationExtensions.swift */,
);
path = Extensions;
sourceTree = "<group>";
};
4E80B4212AC0A2DA002B6FBF /* SabbathSchoolTV */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1621,6 +1634,7 @@
FE1E35012673C5DF00DAC2D6 /* Widget */ = {
isa = PBXGroup;
children = (
4E7E4F3D2B796FB900920230 /* Extensions */,
FED6B2D22680262E007093CE /* LessonInfoWidget */,
FE611A642674F9D2003CDDB5 /* TodayWidget */,
FE44266F26751C160038A863 /* Resources */,
Expand Down Expand Up @@ -2393,6 +2407,7 @@
FED6B3032680E0D9007093CE /* String.swift in Sources */,
FE611AAB267500F5003CDDB5 /* Day.swift in Sources */,
FEC92205267FB09100422F3D /* Color.swift in Sources */,
4E7E4F3F2B79715D00920230 /* ViewExtensions.swift in Sources */,
FE3FFA5426B11F4E0037539F /* QuarterlyGroup.swift in Sources */,
FE611AAD267500F5003CDDB5 /* Comment.swift in Sources */,
FE611AAC267500F5003CDDB5 /* LessonInfo.swift in Sources */,
Expand Down Expand Up @@ -2424,6 +2439,7 @@
FED6B2EB268026D0007093CE /* LessonInfoWidget.swift in Sources */,
FED6B2E6268026AE007093CE /* LessonInfoWidgetProvider.swift in Sources */,
FED6B3122680E6F7007093CE /* WidgetInteractor.swift in Sources */,
4E7E4F412B7971A900920230 /* WidgetConfigurationExtensions.swift in Sources */,
2F95D39F26C0B2E8008E6666 /* Audio.swift in Sources */,
FEC9219B267E452800422F3D /* Helper.swift in Sources */,
FED6B35826818BEA007093CE /* FeaturedTodayWidget.swift in Sources */,
Expand Down Expand Up @@ -2943,7 +2959,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = XVGX5G4YQ9;
Expand Down Expand Up @@ -3085,7 +3101,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = XVGX5G4YQ9;
ENABLE_BITCODE = NO;
Expand Down
21 changes: 21 additions & 0 deletions Widget/Extensions/ViewExtensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// ViewExtensions.swift
// WidgetExtension
//
// Created by Emerson Carpes on 11/02/24.
// Copyright © 2024 Adventech. All rights reserved.
//

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)
}
}
}
20 changes: 20 additions & 0 deletions Widget/Extensions/WidgetConfigurationExtensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// WidgetConfigurationExtensions.swift
// WidgetExtension
//
// Created by Emerson Carpes on 11/02/24.
// Copyright © 2024 Adventech. All rights reserved.
//

import SwiftUI

extension WidgetConfiguration {
func contentMarginsDisabledIfAvailable() -> some WidgetConfiguration {
if #available(iOSApplicationExtension 17.0, *) {
return self.contentMarginsDisabled()
}
else {
return self
}
}
}
1 change: 1 addition & 0 deletions Widget/LessonInfoWidget/LessonInfoWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ struct LessonInfoWidget: Widget {
.configurationDisplayName("This week's lesson".localized())
.description("Preview and access Sabbath School lesson for this week".localized())
.supportedFamilies([.systemLarge])
.contentMarginsDisabledIfAvailable()
}
}
1 change: 1 addition & 0 deletions Widget/TodayWidget/FeaturedTodayWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ struct FeaturedTodayWidget: Widget {
.configurationDisplayName("Today's lesson".localized())
.description("Get quick access the Sabbath School lesson for today, featuring the background image".localized())
.supportedFamilies([.systemSmall, .systemMedium])
.contentMarginsDisabledIfAvailable()
}
}
2 changes: 1 addition & 1 deletion Widget/TodayWidget/FeaturedTodayWidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct FeaturedTodayWidgetView : View {
.padding(.bottom, 5)
.padding(.leading, 20)
.padding(.trailing, 20)
.background(Color.init(UIColor.baseBlue))
.widgetBackground(Color.init(UIColor.baseBlue))
.foregroundColor(.white)
.cornerRadius(11)
.font(.system(size: 9, weight: .bold))
Expand Down
1 change: 1 addition & 0 deletions Widget/TodayWidget/TodayWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ struct TodayWidget: Widget {
.configurationDisplayName("Today's lesson".localized())
.description("Get quick access the Sabbath School lesson for today".localized())
.supportedFamilies([.systemSmall, .systemMedium])
.contentMarginsDisabledIfAvailable()
}
}
2 changes: 1 addition & 1 deletion Widget/TodayWidget/TodayWidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct TodayWidgetView : View {
.padding(.bottom, 5)
.padding(.leading, 20)
.padding(.trailing, 20)
.background(Color.init(UIColor.baseBlue))
.widgetBackground(Color.init(UIColor.baseBlue))
.foregroundColor(.white)
.cornerRadius(11)
.font(.system(size: 9, weight: .bold))
Expand Down

0 comments on commit 2748caa

Please sign in to comment.