Add relevant base-classes for Hashtag-Widget (IOS-37)

This commit is contained in:
Nathan Mattes 2023-03-21 23:06:08 +01:00
parent a99f3a152b
commit d3680618da
6 changed files with 198 additions and 2 deletions

View File

@ -150,6 +150,8 @@
D8A6AB6C291C5136003AB663 /* MastodonLoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A6AB6B291C5136003AB663 /* MastodonLoginViewController.swift */; };
D8E5C346296DAB84007E76A7 /* DataSourceFacade+Status+History.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8E5C345296DAB84007E76A7 /* DataSourceFacade+Status+History.swift */; };
D8E5C349296DB8A3007E76A7 /* StatusEditHistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8E5C348296DB8A3007E76A7 /* StatusEditHistoryViewController.swift */; };
D8F8A03A29CA5C15000195DD /* HashtagWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F8A03929CA5C15000195DD /* HashtagWidgetView.swift */; };
D8F8A03C29CA5CB6000195DD /* HashtagWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F8A03B29CA5CB6000195DD /* HashtagWidget.swift */; };
DB0009A626AEE5DC009B9D2D /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = DB0009A926AEE5DC009B9D2D /* Intents.intentdefinition */; settings = {ATTRIBUTES = (codegen, ); }; };
DB0009A726AEE5DC009B9D2D /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = DB0009A926AEE5DC009B9D2D /* Intents.intentdefinition */; };
DB0140CF25C42AEE00F9F3CF /* OSLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0140CE25C42AEE00F9F3CF /* OSLog.swift */; };
@ -794,6 +796,8 @@
D8A6FE6629325F5900666A47 /* Localizable.stringsdict */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; path = Localizable.stringsdict; sourceTree = "<group>"; };
D8E5C345296DAB84007E76A7 /* DataSourceFacade+Status+History.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DataSourceFacade+Status+History.swift"; sourceTree = "<group>"; };
D8E5C348296DB8A3007E76A7 /* StatusEditHistoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusEditHistoryViewController.swift; sourceTree = "<group>"; };
D8F8A03929CA5C15000195DD /* HashtagWidgetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HashtagWidgetView.swift; sourceTree = "<group>"; };
D8F8A03B29CA5CB6000195DD /* HashtagWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HashtagWidget.swift; sourceTree = "<group>"; };
DB0009A826AEE5DC009B9D2D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; name = Base; path = Base.lproj/Intents.intentdefinition; sourceTree = "<group>"; };
DB0009AD26AEE5E4009B9D2D /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Intents.strings; sourceTree = "<group>"; };
DB0140CE25C42AEE00F9F3CF /* OSLog.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSLog.swift; sourceTree = "<group>"; };
@ -1461,6 +1465,7 @@
2A86A14329892700007F1062 /* Variants */ = {
isa = PBXGroup;
children = (
D8F8A03829CA5C02000195DD /* Hashtag */,
2A86A14429892709007F1062 /* FollowersCount */,
2A86A14729892B1B007F1062 /* MultiFollowersCount */,
2A9D0662298C045000BF38CB /* LatestFollowers */,
@ -1833,6 +1838,15 @@
path = "Edit History";
sourceTree = "<group>";
};
D8F8A03829CA5C02000195DD /* Hashtag */ = {
isa = PBXGroup;
children = (
D8F8A03929CA5C15000195DD /* HashtagWidgetView.swift */,
D8F8A03B29CA5CB6000195DD /* HashtagWidget.swift */,
);
path = Hashtag;
sourceTree = "<group>";
};
DB01409B25C40BB600F9F3CF /* Onboarding */ = {
isa = PBXGroup;
children = (
@ -3510,7 +3524,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D8F8A03A29CA5C15000195DD /* HashtagWidgetView.swift in Sources */,
2A33062D2987DBFA001D4C51 /* FollowersCountHistory.swift in Sources */,
D8F8A03C29CA5CB6000195DD /* HashtagWidget.swift in Sources */,
2A9D0666298C05A800BF38CB /* LatestFollowersWidgetView.swift in Sources */,
2AB5011E299243FB00346092 /* WidgetExtension.intentdefinition in Sources */,
2A86A14B2989326E007F1062 /* MultiFollowersCountWidgetView.swift in Sources */,

View File

@ -62,8 +62,9 @@
<key>NSUserActivityTypes</key>
<array>
<string>FollowersCountIntent</string>
<string>MultiFollowersCountIntent</string>
<string>HashtagIntent</string>
<string>LatestFollowersIntent</string>
<string>MultiFollowersCountIntent</string>
<string>SendPostIntent</string>
</array>
<key>UIApplicationSceneManifest</key>

View File

@ -31,6 +31,8 @@
<key>IntentsSupported</key>
<array>
<string>FollowersCountIntent</string>
<string>HashtagIntent</string>
<string>LatestFollowersIntent</string>
<string>MultiFollowersCountIntent</string>
<string>SendPostIntent</string>
</array>

View File

@ -9,7 +9,7 @@
<key>INIntentDefinitionNamespace</key>
<string>88xZPY</string>
<key>INIntentDefinitionSystemVersion</key>
<string>22D49</string>
<string>22D68</string>
<key>INIntentDefinitionToolsBuildVersion</key>
<string>14C18</string>
<key>INIntentDefinitionToolsVersion</key>
@ -348,8 +348,38 @@
<true/>
<key>INIntentIneligibleForSuggestions</key>
<true/>
<key>INIntentLastParameterTag</key>
<integer>1</integer>
<key>INIntentName</key>
<string>LatestFollowers</string>
<key>INIntentParameters</key>
<array>
<dict>
<key>INIntentParameterConfigurable</key>
<true/>
<key>INIntentParameterDisplayName</key>
<string>Parameter</string>
<key>INIntentParameterDisplayNameID</key>
<string>sFTGjN</string>
<key>INIntentParameterDisplayPriority</key>
<integer>1</integer>
<key>INIntentParameterMetadata</key>
<dict>
<key>INIntentParameterMetadataCapitalization</key>
<string>Sentences</string>
<key>INIntentParameterMetadataDefaultValueID</key>
<string>Cnairs</string>
</dict>
<key>INIntentParameterName</key>
<string>parameter</string>
<key>INIntentParameterSupportsResolution</key>
<true/>
<key>INIntentParameterTag</key>
<integer>1</integer>
<key>INIntentParameterType</key>
<string>String</string>
</dict>
</array>
<key>INIntentResponse</key>
<dict>
<key>INIntentResponseCodes</key>
@ -375,6 +405,89 @@
<key>INIntentVerb</key>
<string>View</string>
</dict>
<dict>
<key>INIntentCategory</key>
<string>information</string>
<key>INIntentDescription</key>
<string>Hashtag</string>
<key>INIntentDescriptionID</key>
<string>A1rwKl</string>
<key>INIntentEligibleForWidgets</key>
<true/>
<key>INIntentIneligibleForSuggestions</key>
<true/>
<key>INIntentLastParameterTag</key>
<integer>1</integer>
<key>INIntentName</key>
<string>Hashtag</string>
<key>INIntentParameters</key>
<array>
<dict>
<key>INIntentParameterConfigurable</key>
<true/>
<key>INIntentParameterDisplayName</key>
<string>Hashtag</string>
<key>INIntentParameterDisplayNameID</key>
<string>GTUbZg</string>
<key>INIntentParameterDisplayPriority</key>
<integer>1</integer>
<key>INIntentParameterMetadata</key>
<dict>
<key>INIntentParameterMetadataCapitalization</key>
<string>Sentences</string>
<key>INIntentParameterMetadataDefaultValueID</key>
<string>YdkgW1</string>
</dict>
<key>INIntentParameterName</key>
<string>hashtag</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>INIntentParameterSupportsResolution</key>
<true/>
<key>INIntentParameterTag</key>
<integer>1</integer>
<key>INIntentParameterType</key>
<string>String</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>Hashtag</string>
<key>INIntentTitleID</key>
<string>OcUp1W</string>
<key>INIntentType</key>
<string>Custom</string>
<key>INIntentVerb</key>
<string>View</string>
</dict>
</array>
<key>INTypes</key>
<array/>

View File

@ -0,0 +1,41 @@
// Copyright © 2023 Mastodon gGmbH. All rights reserved.
import WidgetKit
import SwiftUI
struct HashtagWidgetProvider: IntentTimelineProvider {
func placeholder(in context: Context) -> HashtagWidgetTimelineEntry {
.init(date: Date())
}
func getSnapshot(for configuration: Intent, in context: Context, completion: @escaping (HashtagWidgetTimelineEntry) -> Void) {
//TODO: Implement
}
func getTimeline(for configuration: HashtagIntent, in context: Context, completion: @escaping (Timeline<HashtagWidgetTimelineEntry>) -> Void) {
//TODO: Implement
}
}
struct HashtagWidgetTimelineEntry: TimelineEntry {
var date: Date
//TODO: implement, add relevant information
}
struct HashtagWidget: Widget {
private var availableFamilies: [WidgetFamily] {
if #available(iOS 16, *) {
return [.systemMedium, .systemLarge, .accessoryRectangular]
} else {
return [.systemMedium, .systemLarge]
}
}
var body: some WidgetConfiguration {
IntentConfiguration(kind: "Hashtag", intent: HashtagIntent.self, provider: HashtagWidgetProvider()) { entry in
HashtagWidgetView()
}
.supportedFamilies(availableFamilies)
}
}

View File

@ -0,0 +1,23 @@
// Copyright © 2023 Mastodon gGmbH. All rights reserved.
import SwiftUI
struct HashtagWidgetView: View {
var body: some View {
//TODO: Lockscreen has a different design
HStack {
VStack {
Text("Username")
Text("@user@mastodon.social")
}
Text("Toot")
VStack {
Image(systemName: "arrow.2.squarepath")
Text("Reblog Count")
Image(systemName: "star")
Text("Star Count")
Text("#Hashtag")
}
}
}
}