Configure larger widgets

release
Laurent 3 years ago
parent 92e980114e
commit 038107cd80
  1. 15
      LaunchWidget/CountdownView.swift
  2. 2
      LaunchWidget/LaunchWidget.swift
  3. 97
      LeCountdown.xcodeproj/xcshareddata/xcschemes/LaunchIntents.xcscheme
  4. 114
      LeCountdown.xcodeproj/xcshareddata/xcschemes/LaunchWidgetExtension.xcscheme
  5. 78
      LeCountdown.xcodeproj/xcshareddata/xcschemes/LeCountdown.xcscheme
  6. 2
      LeCountdown/CountdownScheduler.swift
  7. 8
      LeCountdown/Model/Model+Extensions.swift
  8. 3
      LeCountdown/Views/ContentView.swift

@ -44,13 +44,16 @@ struct CountdownMultiView: View {
HStack {
ForEach(countdowns) { countdown in
VStack {
Text(countdown.name ?? "")
Text(countdown.duration.minuteSecond)
Link(destination: countdown.url) {
VStack {
Text(countdown.name ?? "")
Text(countdown.duration.minuteSecond)
}
.font(self.font)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.font(self.font)
.widgetURL(countdown.url)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}.frame(maxWidth: .infinity)

@ -127,7 +127,7 @@ struct LaunchWidget: Widget {
}
.configurationDisplayName("Launch Widget")
.description("Select and launch your countdowns")
.supportedFamilies([.systemSmall, .accessoryCircular])
.supportedFamilies([.systemSmall, .systemMedium, .systemLarge, .accessoryRectangular])
}
}

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C438C7EF29812BB200BF3EF9"
BuildableName = "LaunchIntents.appex"
BlueprintName = "LaunchIntents"
ReferencedContainer = "container:LeCountdown.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C4060DBB297AE73B003FAB80"
BuildableName = "LeCountdown.app"
BlueprintName = "LeCountdown"
ReferencedContainer = "container:LeCountdown.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
askForAppToLaunch = "Yes"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C4060DBB297AE73B003FAB80"
BuildableName = "LeCountdown.app"
BlueprintName = "LeCountdown"
ReferencedContainer = "container:LeCountdown.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
askForAppToLaunch = "Yes"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C4060DBB297AE73B003FAB80"
BuildableName = "LeCountdown.app"
BlueprintName = "LeCountdown"
ReferencedContainer = "container:LeCountdown.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C438C7CD2981216200BF3EF9"
BuildableName = "LaunchWidgetExtension.appex"
BlueprintName = "LaunchWidgetExtension"
ReferencedContainer = "container:LeCountdown.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C4060DBB297AE73B003FAB80"
BuildableName = "LeCountdown.app"
BlueprintName = "LeCountdown"
ReferencedContainer = "container:LeCountdown.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
askForAppToLaunch = "Yes"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C4060DBB297AE73B003FAB80"
BuildableName = "LeCountdown.app"
BlueprintName = "LeCountdown"
ReferencedContainer = "container:LeCountdown.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "_XCWidgetKind"
value = ""
isEnabled = "NO">
</EnvironmentVariable>
<EnvironmentVariable
key = "_XCWidgetDefaultView"
value = "timeline"
isEnabled = "NO">
</EnvironmentVariable>
<EnvironmentVariable
key = "_XCWidgetFamily"
value = "medium"
isEnabled = "NO">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
askForAppToLaunch = "Yes"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C4060DBB297AE73B003FAB80"
BuildableName = "LeCountdown.app"
BlueprintName = "LeCountdown"
ReferencedContainer = "container:LeCountdown.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C4060DBB297AE73B003FAB80"
BuildableName = "LeCountdown.app"
BlueprintName = "LeCountdown"
ReferencedContainer = "container:LeCountdown.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C4060DBB297AE73B003FAB80"
BuildableName = "LeCountdown.app"
BlueprintName = "LeCountdown"
ReferencedContainer = "container:LeCountdown.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C4060DBB297AE73B003FAB80"
BuildableName = "LeCountdown.app"
BlueprintName = "LeCountdown"
ReferencedContainer = "container:LeCountdown.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

@ -56,8 +56,6 @@ class CountdownScheduler {
}
}
print("SCHEDULED @ \(Date())")
}
}

@ -15,8 +15,12 @@ extension Countdown {
return self.activity?.name
}
var url: URL? {
return URL(string: self.stringId)
var url: URL {
if let url = URL(string: self.stringId) {
return url
} else {
return URL(fileURLWithPath: self.stringId) // stupid fallthrough
}
}
static func fake(context: NSManagedObjectContext) -> Countdown {

@ -140,6 +140,9 @@ struct ContentView: View {
let urlString = url.absoluteString
if let countdown = viewContext.object(stringId: urlString) as? Countdown {
print("Start countdown: \(countdown.name ?? ""), \(countdown.duration)")
self._launchCountdown(countdown)
} else {
print("countdown not found with id = \(urlString)")

Loading…
Cancel
Save