Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safari plugin: Part 1 #15

Closed
11 tasks done
filimo opened this issue Sep 29, 2019 · 0 comments
Closed
11 tasks done

Safari plugin: Part 1 #15

filimo opened this issue Sep 29, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@filimo
Copy link
Owner

filimo commented Sep 29, 2019

Important

  1. Info.plist
<dict>
    <key>Allowed Domains</key>
    <array>
        <string>*</string>
    </array>
    <key>Level</key>
    <string>All</string>
</dict>
  1. Info.plist
<key>NSAppleEventsUsageDescription</key>
<string>ReaderTranslator communicates with other apps on your Mac when you choose to share a news item.</string>
  1. Info.plist
<key>AppIdentifierPrefix</key>
<string>$(AppIdentifierPrefix)</string>
  1. Add App Group
  2. See Important Implement macOS project target #20

Info

My question about CFNotificationCenterGetDarwinNotifyCenter on stackoverlow
Sharing data between iOS apps and app extensions
How to Build Safari App Extensions
More articles about it in #6

If the extension runs as a separate process then this is impossible: Memory allocated in one process is not available in a different process. – Martin R 9 hours ago
Sound strange I see CFNotificationCenterGetDarwinNotifyCenter manage it. – Victor Kushnerov 9 hours ago

Compare developer.apple.com/documentation/corefoundation/…: if center is a Darwin notification center then object and userInfo are ignored. – Martin R 9 hours ago
How max length a message name? – Victor Kushnerov 9 hours ago

I have no idea ... – Martin R 9 hours ago
I guess I have to use combine UserDefaults and CFNotificationCenterGetDarwinNotifyCenter to send some long text? – Victor Kushnerov 9 hours ago

Compare stackoverflow.com/a/35206961/1187415. – Martin R 9 hours ago
Thanks for point out that object and userInfo are ignored. I missed it. Why use UnsafeRawPointer in same process? – Victor Kushnerov 8 hours ago

Here is an example where the raw pointer is used to pass a pointer to a class instance to the callback function. – Martin R 8 hours ago
I see but I can't imagine a situation why it is necessary since class it is reference type? – Victor Kushnerov 8 hours ago
When I call some method with class type parameter I send a pointer. – Victor Kushnerov 8 hours ago

CFNotificationCenterPostNotification is actually a C function, and the callback is also a pure C function. C knows nothing about Swift types or instance pointers. That's why the object parameter is a UnsafeRawPointer (the Swift equivalent of void *). – Martin R 8 hours ago
Awesome, I got it now, thanks. – Victor Kushnerov 8 hours ago
I add stackoverflow.com/a/58188965/4067700 to help guys to get the goal quickly. The question is closed by me thanks @MartinR. – Victor Kushnerov 7 hours ago

@filimo filimo added the enhancement New feature or request label Sep 29, 2019
@filimo filimo self-assigned this Sep 29, 2019
filimo added a commit that referenced this issue Oct 2, 2019
#20 Implement macOS project target
#21 .lineLimit(nil) doesn't works for TextField
filimo added a commit that referenced this issue Oct 3, 2019
  - [x] **Improve:** Send shared messages every 1 second
  - [x] Improve speak method
filimo added a commit that referenced this issue Oct 3, 2019
filimo added a commit that referenced this issue Oct 4, 2019
  - disable/enable translating selected text in Safari by shortcut `Alt+Cmd+X`
  - disable/enable speaking selected text in Safari by shortcut `Alt+Cmd+Z`
@filimo filimo changed the title Safari plugin Safari plugin: part 1 Oct 5, 2019
@filimo filimo changed the title Safari plugin: part 1 Safari plugin: Part 1 Oct 5, 2019
filimo added a commit that referenced this issue Oct 5, 2019
Hack: it or `Divider()` required to display TranslatorView properly `Divider()` takes more space
Show Safari plugin status and click on status to switch on/off
filimo added a commit that referenced this issue Oct 5, 2019
Hack: it or `Divider()` required to display TranslatorView properly `Divider()` takes more space
filimo added a commit that referenced this issue Oct 5, 2019
filimo added a commit that referenced this issue Oct 5, 2019
filimo added a commit that referenced this issue Oct 5, 2019
@filimo filimo closed this as completed Oct 5, 2019
filimo added a commit that referenced this issue Oct 6, 2019
Implement Coordinator to WebView
Change window.location for empty newUrl
Prevent second PageWebView.load invoke while launching app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant