-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #223 from mudkipme/feat/control-widget
feat: add iOS 18 control widget
- Loading branch information
Showing
18 changed files
with
166 additions
and
29 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
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
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
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,23 @@ | ||
// | ||
// OpenAppIntent.swift | ||
// MoeMemos | ||
// | ||
// Created by Mudkip on 2024/11/20. | ||
// | ||
|
||
import AppIntents | ||
import Env | ||
|
||
struct AppOpenIntent: AppIntent { | ||
static let title: LocalizedStringResource = "Launch Moe Memos" | ||
|
||
static let openAppWhenRun: Bool = true | ||
|
||
@Dependency | ||
var appPath: AppPath | ||
|
||
func perform() async throws -> some IntentResult { | ||
appPath.presentedSheet = .newMemo | ||
return .result() | ||
} | ||
} |
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,22 @@ | ||
// | ||
// QuickMemoWidget.swift | ||
// MoeMemos | ||
// | ||
// Created by Mudkip on 2024/11/20. | ||
// | ||
|
||
import WidgetKit | ||
import SwiftUI | ||
|
||
@available(iOS 18.0, *) | ||
struct QuickMemoWidget: ControlWidget { | ||
var body: some ControlWidgetConfiguration { | ||
StaticControlConfiguration(kind: "me.mudkip.MoeMemos.QuickMemoWidget") { | ||
ControlWidgetButton(action: AppOpenIntent()) { | ||
Label("Quick Memo", systemImage: "note.text.badge.plus") | ||
} | ||
} | ||
.displayName("Quick Memo") | ||
.description("Write a memo in Moe Memos.") | ||
} | ||
} |
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
Oops, something went wrong.