Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Siri and shortcuts support #127

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,17 @@ target 'WidgetExtension' do
pod 'Cache'
end

def fix_config(config)
# https://github.com/CocoaPods/CocoaPods/issues/8891
if config.build_settings['DEVELOPMENT_TEAM'].nil?
config.build_settings['DEVELOPMENT_TEAM'] = 'XVGX5G4YQ9'
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
fix_config(config)
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.1'
end

Expand Down
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,6 @@ SPEC CHECKSUMS:
Wormholy: 3252bc3e55a1847ef9a0976c1377bd77bf3635fa
Zip: 414f59909701fda9a84ab774ebe0f5449b1082cc

PODFILE CHECKSUM: bf33aea4066de337002d0c9bdadd340cb5f88d21
PODFILE CHECKSUM: ddc27f5f1365b037934bb831febe8711c8156ea1

COCOAPODS: 1.11.3
36 changes: 32 additions & 4 deletions Sabbath School.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,14 @@
4E2882CA280CCB7000AB8C31 /* PublishingInfoData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E2882C9280CCB7000AB8C31 /* PublishingInfoData.swift */; };
4E2882CC280CCBB600AB8C31 /* PublishingInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E2882CB280CCBB600AB8C31 /* PublishingInfo.swift */; };
4E2882CE280CE46100AB8C31 /* PublishingInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E2882CD280CE46000AB8C31 /* PublishingInfoView.swift */; };
4E562ACB28C8C390006841F7 /* SabbathSchoolShortcuts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E562ACA28C8C390006841F7 /* SabbathSchoolShortcuts.swift */; };
4E562ACE28C8C448006841F7 /* ReadTodaySabbathSchoolIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E562ACD28C8C448006841F7 /* ReadTodaySabbathSchoolIntent.swift */; };
4E6409F527C5593B00A43D89 /* ScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E6409F427C5593A00A43D89 /* ScrollView.swift */; };
4E7B09892814CA3D00687C33 /* Encodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E7B09882814CA3D00687C33 /* Encodable.swift */; };
4E7B098C2814CA8A00687C33 /* Comparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E7B098B2814CA8A00687C33 /* Comparable.swift */; };
4EE2DF0827DA7AFC00812552 /* Array.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EE2DF0727DA7AFC00812552 /* Array.swift */; };
4EE8B6F5284D1FAA003C1A46 /* NotificationCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EE8B6F4284D1FAA003C1A46 /* NotificationCenter.swift */; };
4EFBFB9328C9EE56009FBD21 /* ListenTodaySabbathSchoolIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EFBFB9228C9EE56009FBD21 /* ListenTodaySabbathSchoolIntent.swift */; };
7A280F781ED7CF05003C7458 /* LoginWireFrame.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A280F771ED7CF05003C7458 /* LoginWireFrame.swift */; };
7A280F7A1ED7CF2C003C7458 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A280F791ED7CF2C003C7458 /* LoginView.swift */; };
7A280F851ED7D6B6003C7458 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7A280F841ED7D6B6003C7458 /* Assets.xcassets */; };
Expand Down Expand Up @@ -322,11 +325,14 @@
4E2882C9280CCB7000AB8C31 /* PublishingInfoData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishingInfoData.swift; sourceTree = "<group>"; };
4E2882CB280CCBB600AB8C31 /* PublishingInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishingInfo.swift; sourceTree = "<group>"; };
4E2882CD280CE46000AB8C31 /* PublishingInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishingInfoView.swift; sourceTree = "<group>"; };
4E562ACA28C8C390006841F7 /* SabbathSchoolShortcuts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SabbathSchoolShortcuts.swift; sourceTree = "<group>"; };
4E562ACD28C8C448006841F7 /* ReadTodaySabbathSchoolIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadTodaySabbathSchoolIntent.swift; sourceTree = "<group>"; };
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>"; };
4EE2DF0727DA7AFC00812552 /* Array.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Array.swift; sourceTree = "<group>"; };
4EE8B6F4284D1FAA003C1A46 /* NotificationCenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationCenter.swift; sourceTree = "<group>"; };
4EFBFB9228C9EE56009FBD21 /* ListenTodaySabbathSchoolIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListenTodaySabbathSchoolIntent.swift; sourceTree = "<group>"; };
523C8C93B698954EDD53FD14 /* Pods-SnapshotUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SnapshotUITests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SnapshotUITests/Pods-SnapshotUITests.release.xcconfig"; sourceTree = "<group>"; };
7A280F771ED7CF05003C7458 /* LoginWireFrame.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginWireFrame.swift; sourceTree = "<group>"; };
7A280F791ED7CF2C003C7458 /* LoginView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -720,6 +726,24 @@
path = API;
sourceTree = "<group>";
};
4E562AC928C8C21E006841F7 /* Siri */ = {
isa = PBXGroup;
children = (
4E562ACC28C8C404006841F7 /* Intents */,
4E562ACA28C8C390006841F7 /* SabbathSchoolShortcuts.swift */,
);
path = Siri;
sourceTree = "<group>";
};
4E562ACC28C8C404006841F7 /* Intents */ = {
isa = PBXGroup;
children = (
4E562ACD28C8C448006841F7 /* ReadTodaySabbathSchoolIntent.swift */,
4EFBFB9228C9EE56009FBD21 /* ListenTodaySabbathSchoolIntent.swift */,
);
path = Intents;
sourceTree = "<group>";
};
4E7B098A2814CA7400687C33 /* Protocols */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1308,6 +1332,7 @@
7AF191AA1ED7B89B000CCF0C /* Sabbath School */ = {
isa = PBXGroup;
children = (
4E562AC928C8C21E006841F7 /* Siri */,
2FC6F69927A8E0EA00BBC4A9 /* API */,
7A280F981EDA015D003C7458 /* Application */,
2F96FF4826C7186D0045DC6D /* Audio */,
Expand Down Expand Up @@ -1844,6 +1869,7 @@
FE0A0FD8264E0A4300BF945A /* GCPopupView.swift in Sources */,
7A3BCE321EE27717003EC12B /* BibleWireFrame.swift in Sources */,
7A280F9B1EDA015D003C7458 /* AppDelegate.swift in Sources */,
4E562ACE28C8C448006841F7 /* ReadTodaySabbathSchoolIntent.swift in Sources */,
2FA1FFE826F6BA6700E80868 /* Downloader.swift in Sources */,
7A280FC71EDA06F9003C7458 /* LoginButton.swift in Sources */,
2F96FF4C26C718A40045DC6D /* AudioPlaylistItemEmptyView.swift in Sources */,
Expand Down Expand Up @@ -1905,6 +1931,7 @@
FE611ABA267501F9003CDDB5 /* Constants.swift in Sources */,
FE1E34F326731A5F00DAC2D6 /* Spotlight.swift in Sources */,
FE5CC73B268914F000B9F061 /* QuarterlyController.swift in Sources */,
4EFBFB9328C9EE56009FBD21 /* ListenTodaySabbathSchoolIntent.swift in Sources */,
2F96FF6826CC9BBA0045DC6D /* Video.swift in Sources */,
7AF326181EFF92C700A04568 /* ReadEmptyView.swift in Sources */,
7A280FFE1EDD039C003C7458 /* LanguageItemView.swift in Sources */,
Expand All @@ -1931,6 +1958,7 @@
2F96FF7326CFF44F0045DC6D /* VideoView.swift in Sources */,
7A2810201EDDCEC9003C7458 /* LessonInteractor.swift in Sources */,
7A2810081EDD0C51003C7458 /* Navigation.swift in Sources */,
4E562ACB28C8C390006841F7 /* SabbathSchoolShortcuts.swift in Sources */,
7A3BCE2E1EE2753C003EC12B /* BibleController.swift in Sources */,
7A2810041EDD0675003C7458 /* LanguageInteractor.swift in Sources */,
7A2810291EDDE41F003C7458 /* ShimmeringNode.swift in Sources */,
Expand Down Expand Up @@ -2295,7 +2323,7 @@
CURRENT_PROJECT_VERSION = 1002;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = XVGX5G4YQ9;
ENABLE_BITCODE = YES;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Sabbath School/Application/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down Expand Up @@ -2435,7 +2463,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CURRENT_PROJECT_VERSION = 1002;
DEVELOPMENT_TEAM = XVGX5G4YQ9;
ENABLE_BITCODE = YES;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Sabbath School/Application/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down Expand Up @@ -2580,7 +2608,7 @@
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1002;
DEVELOPMENT_TEAM = XVGX5G4YQ9;
ENABLE_BITCODE = YES;
ENABLE_BITCODE = NO;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = Widget/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
Expand Down Expand Up @@ -2627,7 +2655,7 @@
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1002;
DEVELOPMENT_TEAM = XVGX5G4YQ9;
ENABLE_BITCODE = YES;
ENABLE_BITCODE = NO;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious on why did you had to disable bitcode? Is possible to work around it?

Copy link
Contributor Author

@EmersonCarpes EmersonCarpes Sep 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been deprecated with Xcode 14

https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes

Xcode no longer builds bitcode by default and generates a warning message if a project explicitly enables bitcode: “Building with bitcode is deprecated. Please update your project and/or target settings to disable bitcode.” The capability to build with bitcode will be removed in a future Xcode release. IPAs that contain bitcode will have the bitcode stripped before being submitted to the App Store. Debug symbols for past bitcode submissions remain available for download. (86118779)```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL... I guess it's good then 😅

GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = Widget/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
Expand Down
4 changes: 2 additions & 2 deletions Sabbath School/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return true
}

func launchQuarterlies() {
let quarterlyController = QuarterlyWireFrame.createQuarterlyModule()
func launchQuarterlies(initiateOpen: Bool = false) {
let quarterlyController = QuarterlyWireFrame.createQuarterlyModule(initiateOpen: initiateOpen)
Configuration.window?.rootViewController = quarterlyController
Configuration.window?.makeKeyAndVisible()
}
Expand Down
5 changes: 4 additions & 1 deletion Sabbath School/Lesson/Interactor/LessonInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class LessonInteractor: LessonInteractorInputProtocol {
self.publishingInfoStorage = APICache.storage?.transformCodable(ofType: PublishingInfoData.self)
}

func retrieveQuarterlyInfo(quarterlyIndex: String) {
func retrieveQuarterlyInfo(quarterlyIndex: String, completion: @escaping (QuarterlyInfo?) -> Void) {
let parsedIndex = Helper.parseIndex(index: quarterlyIndex)
let url = "\(Constants.API.URL)/\(parsedIndex.lang)/quarterlies/\(parsedIndex.quarter)/index.json"

Expand All @@ -47,12 +47,14 @@ class LessonInteractor: LessonInteractorInputProtocol {
if (try? self.storage?.existsObject(forKey: url)) != nil {
if let quarterlyInfo = try? self.storage?.entry(forKey: url) {
cachedObject = quarterlyInfo.object
completion(quarterlyInfo.object)
self.presenter?.didRetrieveQuarterlyInfo(quarterlyInfo: quarterlyInfo.object)
}
}

API.session.request(url).responseDecodable(of: QuarterlyInfo.self, decoder: Helper.SSJSONDecoder()) { response in
guard let quarterlyInfo = response.value else {
completion(nil)
self.presenter?.onError(response.error)
return
}
Expand All @@ -61,6 +63,7 @@ class LessonInteractor: LessonInteractorInputProtocol {
return
}

completion(quarterlyInfo)
self.presenter?.didRetrieveQuarterlyInfo(quarterlyInfo: quarterlyInfo)
try? self.storage?.setObject(quarterlyInfo, forKey: url)
}
Expand Down
2 changes: 1 addition & 1 deletion Sabbath School/Lesson/Presenter/LessonPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class LessonPresenter: LessonPresenterProtocol {

func configure() {
interactor?.configure()
interactor?.retrieveQuarterlyInfo(quarterlyIndex: quarterlyIndex!)
interactor?.retrieveQuarterlyInfo(quarterlyIndex: quarterlyIndex!, completion: { _ in })
interactor?.retrievePublishingInfo()
}

Expand Down
2 changes: 1 addition & 1 deletion Sabbath School/Lesson/Protocols/LessonProtocols.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ protocol LessonInteractorInputProtocol: AnyObject {
var presenter: LessonInteractorOutputProtocol? { get set }

func configure()
func retrieveQuarterlyInfo(quarterlyIndex: String)
func retrieveQuarterlyInfo(quarterlyIndex: String, completion: @escaping (QuarterlyInfo?) -> Void)
func retrievePublishingInfo()
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class QuarterlyController: QuarterlyControllerCommon {
let lastQuarterlyIndex = Preferences.currentQuarterly()
let languageCode = lastQuarterlyIndex.components(separatedBy: "-")
if let code = languageCode.first, Preferences.currentLanguage().code == code {
presenter?.presentLessonScreen(quarterlyIndex: lastQuarterlyIndex, initiateOpenToday: false)
presenter?.presentLessonScreen(quarterlyIndex: lastQuarterlyIndex, initiateOpenToday: initiateOpen ?? false
)
}
}
setupNavigationBar()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class SplitVc : UISplitViewController, UISplitViewControllerDelegate {
class QuarterlyWireFrame: QuarterlyWireFrameProtocol {
class func createQuarterlyModule(initiateOpen: Bool = false) -> ASNavigationController {
let controller: QuarterlyControllerProtocol = QuarterlyController()
controller.initiateOpen = initiateOpen
let presenter: QuarterlyPresenterProtocol & QuarterlyInteractorOutputProtocol = QuarterlyPresenter()
let wireFrame: QuarterlyWireFrameProtocol = QuarterlyWireFrame()
let interactor: QuarterlyInteractorInputProtocol = QuarterlyInteractor()
Expand Down
89 changes: 89 additions & 0 deletions Sabbath School/Siri/Intents/ListenTodaySabbathSchoolIntent.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Copyright (c) 2021 Adventech <info@adventech.io>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

import AppIntents
import UIKit
import SwiftAudio

@available(iOS 16.0, *)
struct ListenTodaySabbathSchoolIntent: AudioStartingIntent {

static var title: LocalizedStringResource = "Starting Sabbath School"
static var openAppWhenRun: Bool = false

@MainActor
func perform() async throws -> some IntentResult {
let lastQuarterlyIndex = Preferences.currentQuarterly()
retrieveAudio(quarterlyIndex: lastQuarterlyIndex)

return .result(value: true)
}

func retrieveAudio(quarterlyIndex: String) {
let audioInteractor = AudioInteractor()
let lessonInteractor = LessonInteractor()

lessonInteractor.retrieveQuarterlyInfo(quarterlyIndex: quarterlyIndex) { quarterlyInfo in
audioInteractor.retrieveAudio(quarterlyIndex: quarterlyIndex) { audio in
let finalAudio = audio.filter { $0.targetIndex.starts(with: getTodaysLessonIndex(dataSource: quarterlyInfo)) }

let audioItems: [AudioItem] = finalAudio.map { $0.audioItem() }

AudioPlayback.configure()
try? AudioPlayback.shared.add(items: audioItems, playWhenReady: false)
try? AudioPlayback.shared.jumpToItem(atIndex: 1, playWhenReady: true)

AudioPlayback.play()
}
}
}


func getTodaysLessonIndex(dataSource: QuarterlyInfo?) -> String {
guard let lessons = dataSource?.lessons else { return "" }
let today = Date()
let weekday = Calendar.current.component(.weekday, from: today)
let hour = Calendar.current.component(.hour, from: today)
var prevLessonIndex: String? = nil

for lesson in lessons {
let start = Calendar.current.compare(lesson.startDate, to: today, toGranularity: .day)
let end = Calendar.current.compare(lesson.endDate, to: today, toGranularity: .day)
let fallsBetween = ((start == .orderedAscending) || (start == .orderedSame)) && ((end == .orderedDescending) || (end == .orderedSame))

if fallsBetween {
if (weekday == 7 && hour < 12 && prevLessonIndex != nil) {
return prevLessonIndex!
} else {
return lesson.index
}
}
prevLessonIndex = lesson.index
}

if let firstLesson = lessons.first {
return firstLesson.index
}

return ""
}
}
39 changes: 39 additions & 0 deletions Sabbath School/Siri/Intents/ReadTodaySabbathSchoolIntent.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2021 Adventech <info@adventech.io>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

import AppIntents
import UIKit

@available(iOS 16.0, *)
struct ReadTodaySabbathSchoolIntent: AppIntent {

static var title: LocalizedStringResource = "Starting Sabbath School"
static var openAppWhenRun: Bool = true

@MainActor
func perform() async throws -> some IntentResult {
let appDelegate = UIApplication.shared.delegate as? AppDelegate
appDelegate?.launchQuarterlies(initiateOpen: true)

return .result(value: true)
}
}
Loading