-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Pi Monitor Widget iPad OS support
- Loading branch information
Showing
30 changed files
with
1,030 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>IntentHandler</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>$(MARKETING_VERSION)</string> | ||
<key>CFBundleVersion</key> | ||
<string>$(CURRENT_PROJECT_VERSION)</string> | ||
<key>NSExtension</key> | ||
<dict> | ||
<key>NSExtensionAttributes</key> | ||
<dict> | ||
<key>IntentsRestrictedWhileLocked</key> | ||
<array/> | ||
<key>IntentsRestrictedWhileProtectedDataUnavailable</key> | ||
<array/> | ||
<key>IntentsSupported</key> | ||
<array> | ||
<string>SelectPiholeIntent</string> | ||
</array> | ||
</dict> | ||
<key>NSExtensionPointIdentifier</key> | ||
<string>com.apple.intents-service</string> | ||
<key>NSExtensionPrincipalClass</key> | ||
<string>$(PRODUCT_MODULE_NAME).IntentHandler</string> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.security.application-groups</key> | ||
<array> | ||
<string>group.dev.bunn.PiStatsMobile</string> | ||
</array> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// IntentHandler.swift | ||
// IntentHandler | ||
// | ||
// Created by Fernando Bunn on 30/09/2020. | ||
// | ||
|
||
import Intents | ||
|
||
class IntentHandler: INExtension, SelectPiholeIntentHandling { | ||
|
||
func providePiholeOptionsCollection(for intent: SelectPiholeIntent, with completion: @escaping (INObjectCollection<PiholeIntent>?, Error?) -> Void) { | ||
let piholes = validPiholes().map { | ||
PiholeIntent( | ||
identifier: $0.id.uuidString, | ||
display: $0.title | ||
) | ||
} | ||
let collection = INObjectCollection(items: piholes) | ||
completion(collection, nil) | ||
} | ||
|
||
func defaultPihole(for intent: SelectPiholeIntent) -> PiholeIntent? { | ||
if let pihole = validPiholes().first { | ||
return PiholeIntent( | ||
identifier: pihole.id.uuidString, | ||
display: pihole.title | ||
) | ||
} | ||
return nil | ||
} | ||
|
||
override func handler(for intent: INIntent) -> Any { | ||
return self | ||
} | ||
|
||
private func validPiholes() -> [Pihole] { | ||
Pihole.restoreAll().filter{ $0.hasPiMonitor } | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
167 changes: 167 additions & 0 deletions
167
PiStatsMobile/PiStatsMobile/Base.lproj/PiholeIntents.intentdefinition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>INEnums</key> | ||
<array/> | ||
<key>INIntentDefinitionModelVersion</key> | ||
<string>1.2</string> | ||
<key>INIntentDefinitionNamespace</key> | ||
<string>pwIO52</string> | ||
<key>INIntentDefinitionSystemVersion</key> | ||
<string>19H2</string> | ||
<key>INIntentDefinitionToolsBuildVersion</key> | ||
<string>12A7300</string> | ||
<key>INIntentDefinitionToolsVersion</key> | ||
<string>12.0.1</string> | ||
<key>INIntents</key> | ||
<array> | ||
<dict> | ||
<key>INIntentCategory</key> | ||
<string>information</string> | ||
<key>INIntentDescription</key> | ||
<string>Select Pihole to display stats</string> | ||
<key>INIntentDescriptionID</key> | ||
<string>9VVPSk</string> | ||
<key>INIntentEligibleForWidgets</key> | ||
<true/> | ||
<key>INIntentIneligibleForSuggestions</key> | ||
<true/> | ||
<key>INIntentLastParameterTag</key> | ||
<integer>2</integer> | ||
<key>INIntentName</key> | ||
<string>SelectPihole</string> | ||
<key>INIntentParameters</key> | ||
<array> | ||
<dict> | ||
<key>INIntentParameterConfigurable</key> | ||
<true/> | ||
<key>INIntentParameterDisplayName</key> | ||
<string>Pihole</string> | ||
<key>INIntentParameterDisplayNameID</key> | ||
<string>PiJeMO</string> | ||
<key>INIntentParameterDisplayPriority</key> | ||
<integer>1</integer> | ||
<key>INIntentParameterName</key> | ||
<string>pihole</string> | ||
<key>INIntentParameterObjectType</key> | ||
<string>PiholeIntent</string> | ||
<key>INIntentParameterObjectTypeNamespace</key> | ||
<string>pwIO52</string> | ||
<key>INIntentParameterPromptDialogs</key> | ||
<array> | ||
<dict> | ||
<key>INIntentParameterPromptDialogCustom</key> | ||
<true/> | ||
<key>INIntentParameterPromptDialogType</key> | ||
<string>Configuration</string> | ||
</dict> | ||
<dict> | ||
<key>INIntentParameterPromptDialogCustom</key> | ||
<true/> | ||
<key>INIntentParameterPromptDialogType</key> | ||
<string>Primary</string> | ||
</dict> | ||
</array> | ||
<key>INIntentParameterSupportsDynamicEnumeration</key> | ||
<true/> | ||
<key>INIntentParameterTag</key> | ||
<integer>2</integer> | ||
<key>INIntentParameterType</key> | ||
<string>Object</string> | ||
</dict> | ||
</array> | ||
<key>INIntentResponse</key> | ||
<dict> | ||
<key>INIntentResponseCodes</key> | ||
<array> | ||
<dict> | ||
<key>INIntentResponseCodeName</key> | ||
<string>success</string> | ||
<key>INIntentResponseCodeSuccess</key> | ||
<true/> | ||
</dict> | ||
<dict> | ||
<key>INIntentResponseCodeName</key> | ||
<string>failure</string> | ||
</dict> | ||
</array> | ||
</dict> | ||
<key>INIntentTitle</key> | ||
<string>Select Pihole</string> | ||
<key>INIntentTitleID</key> | ||
<string>XxlkUM</string> | ||
<key>INIntentType</key> | ||
<string>Custom</string> | ||
<key>INIntentVerb</key> | ||
<string>View</string> | ||
</dict> | ||
</array> | ||
<key>INTypes</key> | ||
<array> | ||
<dict> | ||
<key>INTypeDisplayName</key> | ||
<string>Pihole Intent</string> | ||
<key>INTypeDisplayNameID</key> | ||
<string>YlcCql</string> | ||
<key>INTypeLastPropertyTag</key> | ||
<integer>100</integer> | ||
<key>INTypeName</key> | ||
<string>PiholeIntent</string> | ||
<key>INTypeProperties</key> | ||
<array> | ||
<dict> | ||
<key>INTypePropertyDefault</key> | ||
<true/> | ||
<key>INTypePropertyDisplayPriority</key> | ||
<integer>1</integer> | ||
<key>INTypePropertyName</key> | ||
<string>identifier</string> | ||
<key>INTypePropertyTag</key> | ||
<integer>1</integer> | ||
<key>INTypePropertyType</key> | ||
<string>String</string> | ||
</dict> | ||
<dict> | ||
<key>INTypePropertyDefault</key> | ||
<true/> | ||
<key>INTypePropertyDisplayPriority</key> | ||
<integer>2</integer> | ||
<key>INTypePropertyName</key> | ||
<string>displayString</string> | ||
<key>INTypePropertyTag</key> | ||
<integer>2</integer> | ||
<key>INTypePropertyType</key> | ||
<string>String</string> | ||
</dict> | ||
<dict> | ||
<key>INTypePropertyDefault</key> | ||
<true/> | ||
<key>INTypePropertyDisplayPriority</key> | ||
<integer>3</integer> | ||
<key>INTypePropertyName</key> | ||
<string>pronunciationHint</string> | ||
<key>INTypePropertyTag</key> | ||
<integer>3</integer> | ||
<key>INTypePropertyType</key> | ||
<string>String</string> | ||
</dict> | ||
<dict> | ||
<key>INTypePropertyDefault</key> | ||
<true/> | ||
<key>INTypePropertyDisplayPriority</key> | ||
<integer>4</integer> | ||
<key>INTypePropertyName</key> | ||
<string>alternativeSpeakableMatches</string> | ||
<key>INTypePropertySupportsMultipleValues</key> | ||
<true/> | ||
<key>INTypePropertyTag</key> | ||
<integer>4</integer> | ||
<key>INTypePropertyType</key> | ||
<string>SpeakableString</string> | ||
</dict> | ||
</array> | ||
</dict> | ||
</array> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// Constants.swift | ||
// PiStatsMobile | ||
// | ||
// Created by Fernando Bunn on 02/10/2020. | ||
// | ||
|
||
import Foundation | ||
|
||
struct Constants { | ||
static let appGroup = "group.dev.bunn.PiStatsMobile" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// ViewUtils.swift | ||
// PiStatsMobile | ||
// | ||
// Created by Fernando Bunn on 01/10/2020. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ViewUtils { | ||
|
||
static func shieldStatusImageForDataProvider(_ dataProvider: PiholeDataProvider) -> some View { | ||
if dataProvider.hasErrorMessages || dataProvider.status == .enabledAndDisabled { | ||
return Image(systemName: UIConstants.SystemImages.piholeStatusWarning) | ||
.foregroundColor(UIConstants.Colors.statusWarning) | ||
} else if dataProvider.status == .allEnabled { | ||
return Image(systemName: UIConstants.SystemImages.piholeStatusOnline) | ||
.foregroundColor(UIConstants.Colors.statusOnline) | ||
} else { | ||
return Image(systemName: UIConstants.SystemImages.piholeStatusOffline) | ||
.foregroundColor(UIConstants.Colors.statusOffline) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.