Skip to content

Commit

Permalink
We're getting close!
Browse files Browse the repository at this point in the history
- Implemented associated domains
- Implemented all the widget styles
- Renamed bundle IDs now that they are officially registered
  • Loading branch information
Stjin committed Jul 20, 2024
1 parent 6d0c664 commit aa9a570
Show file tree
Hide file tree
Showing 43 changed files with 1,990 additions and 502 deletions.
Binary file modified .DS_Store
Binary file not shown.
254 changes: 195 additions & 59 deletions AddyStatisticWidget/AddyStatisticWidget.swift

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions AddyStatisticWidget/AppIntent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import WidgetKit
import AppIntents

struct ConfigurationAppIntent: WidgetConfigurationIntent {
static var title: LocalizedStringResource { "Configuration" }
static var description: IntentDescription { "This is an example widget." }
static var title: LocalizedStringResource { "configuration" }
static var description: IntentDescription { "widget_configuration_description" }

// An example configurable parameter.
@Parameter(title: "Favorite Emoji", default: "😃")
var favoriteEmoji: String
@Parameter(title: "widget_configuration_parameter_colorful_background", default: false)
var colorfulBackground: Bool
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{
"images" : [
{
"filename" : "icon 1.png",
"filename" : "icon 1@0.5x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icon [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icon [email protected]",
"idiom" : "universal",
"scale" : "3x"
}
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.000",
"green" : "0.000",
"red" : "0.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.129",
"green" : "0.129",
"red" : "0.129"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
14 changes: 14 additions & 0 deletions AddyStatisticWidgetExtension.debug.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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.host.stjin.addy.debug</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)group.host.stjin.addy.debug</string>
</array>
</dict>
</plist>
4 changes: 2 additions & 2 deletions AddyStatisticWidgetExtension.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.host.stjin.addy.debug.dev</string>
<string>group.host.stjin.addy</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)group.host.stjin.addy.debug.dev</string>
<string>$(AppIdentifierPrefix)group.host.stjin.addy</string>
</array>
</dict>
</plist>
2 changes: 1 addition & 1 deletion InfoPlist.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "addy.io (DEBUG)"
"value" : "addy.io"
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions ShareExtension/ShareExtension.debug.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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.host.stjin.addy.debug</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)group.host.stjin.addy.debug</string>
</array>
</dict>
</plist>
4 changes: 2 additions & 2 deletions ShareExtension/ShareExtension.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.host.stjin.addy.debug.dev</string>
<string>group.host.stjin.addy</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)group.host.stjin.addy.debug.dev</string>
<string>$(AppIdentifierPrefix)group.host.stjin.addy</string>
</array>
</dict>
</plist>
74 changes: 31 additions & 43 deletions ShareExtension/ShareViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ class ShareViewController: UIViewController {
DispatchQueue.main.async {
// host the SwiftUI view
let contentView = UIHostingController(rootView: MailToActionSheet(mailToActionSheetData: MailToActionSheetData(value: text), openedThroughShareSheet: true, returnToApp: { aliasId in
self.open(url: URL(string: "addyio://alias/\(aliasId)")!)
self.close()
self.openAliasInApp(url: URL(string: "addyio://alias/\(aliasId)")!)
}, close: {
self.close()
}, openMailToShareSheet: { url in
Expand Down Expand Up @@ -77,13 +76,11 @@ class ShareViewController: UIViewController {
DispatchQueue.main.async {
// host the SwiftUI view
let contentView = UIHostingController(rootView: MailToActionSheet(mailToActionSheetData: MailToActionSheetData(value: text!.absoluteString), openedThroughShareSheet: true, returnToApp: { aliasId in
self.open(url: URL(string: "addyio://alias/\(aliasId)")!)
self.close()
self.openAliasInApp(url: URL(string: "addyio://alias/\(aliasId)")!)
}, close: {
self.close()
}, openMailToShareSheet: { url in
self.open(url: url)
self.close()
}))
self.addChild(contentView)
self.view.addSubview(contentView.view)
Expand All @@ -103,7 +100,7 @@ class ShareViewController: UIViewController {
}

} else {
close()
self.close()
return
}

Expand Down Expand Up @@ -134,27 +131,6 @@ class ShareViewController: UIViewController {

}

// override func viewWillAppear(_ animated: Bool) {
// super.viewWillAppear(animated)
//
// for item in extensionContext!.inputItems as! [NSExtensionItem] {
// if let attachments = item.attachments {
// for itemProvider in attachments {
// if itemProvider.hasItemConformingToTypeIdentifier("public.url") {
// itemProvider.loadItem(forTypeIdentifier: "public.url", options: nil, completionHandler: { (item, error) in
// let url = (item as! NSURL).absoluteURL!
//
// self.open(url: url)
// self.extensionContext!.completeRequest(returningItems: nil, completionHandler: nil)
// })
// }
// }
// }
// }
// }
//

//TODO: This is not working on iOS18DB3

/// Close the Share Extension
private func close() {
Expand All @@ -164,22 +140,34 @@ class ShareViewController: UIViewController {


private func open(url: URL) {
var responder: UIResponder? = self as UIResponder
let selector = #selector(openURL(_:))
SettingsManager(encrypted: true).putSettingsString(key: .pendingURLFromShareViewController, string: url.absoluteString)

while responder != nil {
if responder!.responds(to: selector) && responder != self {
responder!.perform(selector, with: url)

return
}

responder = responder?.next
}
}
// Create an alert
let alert = UIAlertController(title: String(localized: "shareviewcontroller_pending_url_scheduled"), message: String(localized: "shareviewcontroller_pending_url_scheduled_desc"), preferredStyle: .alert)

// Add an action to the alert
alert.addAction(UIAlertAction(title: String(localized: "understood"), style: .default, handler: { _ in
self.close()
}))

// Present the alert
self.present(alert, animated: true, completion: nil)
}

private func openAliasInApp(url: URL) {
SettingsManager(encrypted: true).putSettingsString(key: .pendingURLFromShareViewController, string: url.absoluteString)

@objc
private func openURL(_ url: URL) {
return
}
// Create an alert
let alert = UIAlertController(title: String(localized: "shareviewcontroller_pending_alias_scheduled"), message: String(localized: "shareviewcontroller_pending_alias_scheduled_desc"), preferredStyle: .alert)

// Add an action to the alert
alert.addAction(UIAlertAction(title: String(localized: "understood"), style: .default, handler: { _ in
self.close()
}))

// Present the alert
self.present(alert, animated: true, completion: nil)
}


}
Loading

0 comments on commit aa9a570

Please sign in to comment.