-
Notifications
You must be signed in to change notification settings - Fork 2
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
Update on share menu icon #2
Comments
I did try to add the share menu and I think I made quite some progress, although there are some minor bugs. The two major problems I'm facing now is that I'm not able to retrieve the file URL from the NSItemProvider and also for some reason, I'm unable to get the data packet of the file for sharing, if I put a sample file URL in my code. Any idea how this can be sorted out @agungrbudiman? I'm really new to Swift & macOS development, so I apologize in advance if this is a trivial issue that I just don't understand. This is the code for the send button method in the share menu: `@IBAction func send(_ sender: AnyObject?) {
UPDATE: Change it to UTType.url.identifier fixed the issue! The only issue remaining is the get the selected Device. It would be great if we could store custom data types in User Defaults. I need to pass the selected Device to the main app which will then initiate the send packet command. |
[EDIT]:I got the issue fixed and the share extension is working. You can check it out in the nightly branch of my Soduto repository. It has quite a few bugs, so do let me know if you'd like in case anyone tries it out. Also, remember to enable the extension from System Preferences [ORIGINAL COMMENT]:@agungrbudiman This is probably going to be a long comment so I apologize beforehand. You can reply me later if you're busy right now. Can you give me some info about the Onto the issue:I create a variable in AppDelegate with After the user selects a device from the table, the code checks for the row number which was selected and stores it in User Defaults. Futthermore, it retrieves the file url of the content, which was selected to be shared (e.g.: images, videos, text files) and stores the file url to User Defaults. Now the extension sends a notification to the Darwin Notification System and closes the share extension window. The Darwin Notification is picked up by the observer in the main app inside the I can still send files from "Send Files" option in the menu bar of Soduto or by dragging a file to the menu bar icon which means the validDevices array inside ShareService.swift isn't empty. The uploadFile method checks if Sorry for reading this long comment. If you know where I'm going wrong, it'd be of great help if you tell me the reason. Pardon me if my code logic is flawed, this is the first swift project I tried, so my expectations aren't huge either. Critics are welcomed! |
Thank you for your hard work. I tried to add share extension before but then I realize I can't use any code from the main app. It's like building new app rather than just adding new interface. So I thought to rewrite all the logic from the main app into the share extension but it will be redundant. I thought another approach is to connect share extension and the main app just like |
Yeah, the main app and the extension are sandboxed which is the main issue here, hence they can't communicate with each other. It's a major challenge to pass data among them and I tried to use App Groups, User Defaults and the Darwin Notification Center to fill those gaps. The share extension works but there are a lot of bugs. Selecting multiple files and sending it, sends the same file over and over again. And the share extension works successfully only for files in the Downloads folder because macOS doesn't allow access to other directories. If I turn off app sandbox, then it works in other folders too. However, I don't know if there's any downside in disabling sandboxing, so I'm trying to find another workaround. Anyways, hail Stack Overflow! Nothing is possible without them 😂🙌 |
[UPDATE]:The share extension works almost fine now. I fixed the read access issues and the device availability issues. I can create a pull request if you (@agungrbudiman) want to but I'd prefer not to merge it with your beta branch as this yet isn't as stable as a beta version is supposed to. Multiple file sharing at once still doesn't work yet. If you have an alpha or nightly branch, I can create a pull request to merge it there. I loved this project and tried to contribute as much as I could to it, even though I don't know the basics of Swift. Even though the project is official not in development, the open-source community is extremely helpful which is why Soduto lives till this day :) |
I've created alpha branch, you can open a PR there. Yeah this project also my bridge to learning swift because I'm using mac and android, there is no other apps that could sync these two devices, especially sync notification. Regarding file sync/sharing I'm using syncthing, maybe you could give it a try. Sadly Soduto isn't get much traction like mentioned here, maybe because majority of mac person are using iPhone. I'm glad there are people still care about this project and continue giedrius-stanevicius work. |
@agungrbudiman Hey, just curious, do you know how the |
Any plans on including that share icon ?
The text was updated successfully, but these errors were encountered: