Skip to content

Commit

Permalink
Merge branch 'main' into pr/2055
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimillian committed May 8, 2024
2 parents 3b93d5c + ccad00a commit 411025d
Show file tree
Hide file tree
Showing 27 changed files with 1,098 additions and 74 deletions.
316 changes: 304 additions & 12 deletions IceCubesApp.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9F7788C42BE652B1004E6BEF"
BuildableName = "IceCubesAppWidgetsExtensionExtension.appex"
BlueprintName = "IceCubesAppWidgetsExtensionExtension"
ReferencedContainer = "container:IceCubesApp.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9FBFE638292A715500C250E9"
BuildableName = "Ice Cubes.app"
BlueprintName = "IceCubesApp"
ReferencedContainer = "container:IceCubesApp.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</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 = "9FBFE638292A715500C250E9"
BuildableName = "Ice Cubes.app"
BlueprintName = "IceCubesApp"
ReferencedContainer = "container:IceCubesApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "_XCWidgetKind"
value = ""
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "_XCWidgetDefaultView"
value = "timeline"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "_XCWidgetFamily"
value = "systemMedium"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
askForAppToLaunch = "Yes"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9FBFE638292A715500C250E9"
BuildableName = "Ice Cubes.app"
BlueprintName = "IceCubesApp"
ReferencedContainer = "container:IceCubesApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
8 changes: 4 additions & 4 deletions IceCubesApp/Resources/Localization/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -20574,7 +20574,7 @@
}
}
},
"Compose a status" : {
"Compose a post" : {
"localizations" : {
"de" : {
"stringUnit" : {
Expand Down Expand Up @@ -40783,7 +40783,7 @@
}
}
},
"Send a text status" : {
"Send a post" : {
"localizations" : {
"de" : {
"stringUnit" : {
Expand All @@ -40793,7 +40793,7 @@
}
}
},
"Send a text status to Mastodon using Ice Cubes" : {
"Send a text post to Mastodon with Ice Cubes" : {
"localizations" : {
"de" : {
"stringUnit" : {
Expand All @@ -40803,7 +40803,7 @@
}
}
},
"Send text status to Mastodon" : {
"Send post to Mastodon" : {
"localizations" : {
"de" : {
"stringUnit" : {
Expand Down
43 changes: 43 additions & 0 deletions IceCubesAppIntents/AppAccountEntity.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import AppAccount
import AppIntents
import Env
import Foundation
import Models
import Network

extension IntentDescription: @unchecked Sendable {}
extension TypeDisplayRepresentation: @unchecked Sendable {}

public struct AppAccountEntity: Identifiable, AppEntity {
public var id: String { account.id }

public let account: AppAccount

public static let defaultQuery = DefaultAppAccountEntityQuery()

public static let typeDisplayRepresentation: TypeDisplayRepresentation = "AppAccount"

public var displayRepresentation: DisplayRepresentation {
DisplayRepresentation(title: "\(account.accountName ?? account.server)")
}
}

public struct DefaultAppAccountEntityQuery: EntityQuery {
public init() {}

public func entities(for identifiers: [AppAccountEntity.ID]) async throws -> [AppAccountEntity] {
return await AppAccountsManager.shared.availableAccounts.filter { account in
identifiers.contains { id in
id == account.id
}
}.map { AppAccountEntity(account: $0) }
}

public func suggestedEntities() async throws -> [AppAccountEntity] {
await AppAccountsManager.shared.availableAccounts.map { .init(account: $0) }
}

public func defaultResult() async -> AppAccountEntity? {
await .init(account: AppAccountsManager.shared.currentAccount)
}
}
8 changes: 4 additions & 4 deletions IceCubesAppIntents/AppShortcuts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ struct AppShortcuts: AppShortcutsProvider {
"Post \(\.$content) in \(.applicationName)",
"Post a status on Mastodon with \(.applicationName)",
],
shortTitle: "Compose a status",
shortTitle: "Compose a post",
systemImageName: "square.and.pencil"
)
AppShortcut(
intent: InlinePostIntent(),
phrases: [
"Write a status with \(.applicationName)",
"Send on Status on Mastodon with \(.applicationName)",
"Write a post with \(.applicationName)",
"Send on post on Mastodon with \(.applicationName)",
],
shortTitle: "Send a text status",
shortTitle: "Send a post",
systemImageName: "square.and.pencil"
)
AppShortcut(
Expand Down
41 changes: 3 additions & 38 deletions IceCubesAppIntents/InlinePostIntent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,48 +33,13 @@ enum PostVisibility: String, AppEnum {
}
}

struct AppAccountWrapper: Identifiable, AppEntity {
var id: String { account.id }

let account: AppAccount

static var defaultQuery = DefaultAppAccountQuery()

static var typeDisplayRepresentation: TypeDisplayRepresentation = "AppAccount"

var displayRepresentation: DisplayRepresentation {
DisplayRepresentation(title: "\(account.accountName ?? account.server)")
}
}

struct DefaultAppAccountQuery: EntityQuery {
func entities(for identifiers: [AppAccountWrapper.ID]) async throws -> [AppAccountWrapper] {
return await AppAccountsManager.shared.availableAccounts.filter { account in
identifiers.contains { id in
id == account.id
}
}.map { AppAccountWrapper(account: $0) }
}

func suggestedEntities() async throws -> [AppAccountWrapper] {
await AppAccountsManager.shared.availableAccounts.map { .init(account: $0) }
}

func defaultResult() async -> AppAccountWrapper? {
await .init(account: AppAccountsManager.shared.currentAccount)
}
}

struct InlinePostIntent: AppIntent {
static let title: LocalizedStringResource = "Send text status to Mastodon"
static var description: IntentDescription {
"Send a text status to Mastodon using Ice Cubes"
}

static let title: LocalizedStringResource = "Send post to Mastodon"
static let description: IntentDescription = "Send a text post to Mastodon with Ice Cubes"
static let openAppWhenRun: Bool = false

@Parameter(title: "Account", requestValueDialog: IntentDialog("Account"))
var account: AppAccountWrapper
var account: AppAccountEntity

@Parameter(title: "Post visibility", requestValueDialog: IntentDialog("Visibility of your post"))
var visibility: PostVisibility
Expand Down
5 changes: 1 addition & 4 deletions IceCubesAppIntents/PostImageIntent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import Foundation

struct PostImageIntent: AppIntent {
static let title: LocalizedStringResource = "Post an image to Mastodon"
static var description: IntentDescription {
"Use Ice Cubes to post a status with an image to Mastodon"
}

static let description: IntentDescription = "Use Ice Cubes to compose a post with an image to Mastodon"
static let openAppWhenRun: Bool = true

@Parameter(title: "Image",
Expand Down
7 changes: 2 additions & 5 deletions IceCubesAppIntents/PostIntent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ import AppIntents
import Foundation

struct PostIntent: AppIntent {
static let title: LocalizedStringResource = "Post status to Mastodon"
static var description: IntentDescription {
"Use Ice Cubes to post a status to Mastodon"
}

static let title: LocalizedStringResource = "Compose a post to Mastodon"
static let description: IntentDescription = "Use Ice Cubes to compose a post for Mastodon"
static let openAppWhenRun: Bool = true

@Parameter(title: "Post content", inputConnectionBehavior: .connectToPreviousIntentResult)
Expand Down
5 changes: 1 addition & 4 deletions IceCubesAppIntents/TabIntent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ enum TabEnum: String, AppEnum, Sendable {

struct TabIntent: AppIntent {
static let title: LocalizedStringResource = "Open on a tab"
static var description: IntentDescription {
"Open the app on a specific tab"
}

static let description: IntentDescription = "Open the app on a specific tab"
static let openAppWhenRun: Bool = true

@Parameter(title: "Selected tab")
Expand Down
37 changes: 37 additions & 0 deletions IceCubesAppIntents/TimelineFilterEntity.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import AppAccount
import AppIntents
import Env
import Foundation
import Models
import Network
import Timeline

public struct TimelineFilterEntity: Identifiable, AppEntity {
public var id: String { timeline.id }

public let timeline: TimelineFilter

public static let defaultQuery = DefaultTimelineEntityQuery()

public static let typeDisplayRepresentation: TypeDisplayRepresentation = "TimelineFilter"

public var displayRepresentation: DisplayRepresentation {
DisplayRepresentation(title: "\(timeline.title)")
}
}

public struct DefaultTimelineEntityQuery: EntityQuery {
public init() {}

public func entities(for _: [TimelineFilter.ID]) async throws -> [TimelineFilterEntity] {
[.home, .trending, .federated, .local].map { .init(timeline: $0) }
}

public func suggestedEntities() async throws -> [TimelineFilterEntity] {
[.home, .trending, .federated, .local].map { .init(timeline: $0) }
}

public func defaultResult() async -> TimelineFilterEntity? {
.init(timeline: .home)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.859",
"green" : "0.267",
"red" : "0.675"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions IceCubesAppWidgetsExtension/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading

0 comments on commit 411025d

Please sign in to comment.