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

[FEATURE REQUEST] Progress Indicator while sharing files between devices #9

Open
sannidhyaroy opened this issue Nov 30, 2022 · 31 comments
Labels
enhancement New feature or request

Comments

@sannidhyaroy
Copy link

I used Soduto to share 28 images from my MacBook to my android and it was extremely difficult to know when the transfer was completed. Soduto didn't show any transfer progress bar and on my android device, suddenly the notification centre was bloated with 28 seperate notifications for each image. It would have been possible to monitor the overall transfer progress if there were one or two files being shared but when multiple files are shared, it's incredibly difficult to know. Since, the download task on android is managed by KDE/Zorin Connect, it's probably not possible to do anything on the receiving end. So, I'll share two workarounds on what I think of:

  • Either, an upload progress window will show the transfer status.
  • Or, if Soduto detects that multiple files are being shared, it first zips them into one file and sends it, so that the overall transfer status can be seen on the android device. (This option is unlikely)
@agungrbudiman agungrbudiman added the enhancement New feature or request label Dec 1, 2022
@sannidhyaroy
Copy link
Author

sannidhyaroy commented Dec 2, 2022

UPDATE: Turns out that Soduto actually does this already! However the reason it's not showing in macOS 11 or later is because Soduto uses the deprecated NSNotificationCenter to manage notifications. I faced quite a lot of issues due to this and after I implemented the newer UNUserNotificationCenter, Soduto actually sends a notification whenever a file is received successfully. However, there is a little room for further improvement because if you transfer 100 files, you'd probably get 100 different alert notifications on your Mac. A full blown transfer window not only shows the progress, but can also prevent multiple notifications and just show a progress bar with label (let's say 42 out of 100 files received). I'll probably not close the issue as the above post is still relevant!
Notification Service

@electr1fy0
Copy link

electr1fy0 commented Dec 3, 2022

  • Or, if Soduto detects that multiple files are being shared, it first zips them into one file and sends it, so that the overall transfer status can be seen on the android device. (This option is unlikely)

Please NO. It will be highly annoying to unzip files which defeats the whole purpose of seamlessness.
I'll rather have the current way of doing things than going through a zip.
Just a notification of 'Transferred Successfully' at the end of any complete transfer process would be great as a minimum effort job.
As a proper solution, a progress bar would be nice.

Update: Had a look and updating everything to UNUserNotification is needed.

@sannidhyaroy
Copy link
Author

sannidhyaroy commented Dec 5, 2022

I agree with you because it's more of a hassle and that's why I mentioned that it's unlikely and an inefficient way of doing it. I did get the download complete notification working, so that's a step forward.

@electr1fy0
Copy link

@sannidhyaroy Can you share some more info on how I can replace the NSNotification to UNUserNotification myself?

@sannidhyaroy
Copy link
Author

sannidhyaroy commented Dec 5, 2022

@electr1fy0 You first make an if #available(macOS 11.0, *) statement and then implement the UNNotification System and move the NSNotification code to the else statement, as UNNotification isn't available in earlier macOS versions. If you want to learn about UNNotification, there's a YouTube video (https://youtu.be/mIztoF9CzP8) which will explain the basics of implementing it. Hope it helps you out! You could also check out the code from the beta branch of Soduto in my Git Repository

@electr1fy0
Copy link

electr1fy0 commented Dec 5, 2022

@sannidhyaroy I'm having some trouble compiling your beta repo.
Can you release a build based on the latest changes?
Edit: Nevermind, I got things running.
Screenshot 2022-12-05 at 4 18 47 PM

@sannidhyaroy
Copy link
Author

@electr1fy0 I released a build on the recent working version prior to adding the share extension here (https://github.com/sannidhyaroy/Soduto/releases/tag/v1.0.4-beta). The notification system and existing features work. I'll release a build with the share extension in the future if I can get it working. As of now, the app crashes when I try to send a file though it.

@electr1fy0
Copy link

Oh great, I managed to build it from your repo too and I do get the 'File Sending' notification.
What feels broken is the Launch on login thing.

@agungrbudiman agungrbudiman pinned this issue Dec 5, 2022
@sannidhyaroy
Copy link
Author

sannidhyaroy commented Dec 5, 2022

@electr1fy0 I did fix the "Launch on Login" issue but I'm yet to push those commits to GitHub. Apple broke the Login Items code with macOS Ventura and it now uses the SMAppService to manage Login Items. You can read more about it here

EDIT: I think I did push it to GitHub. Try to build and create an archive from Xcode using the source code of the most recent commit from my beta branch. Do let me know if you get it working. You can check the code in the Configuration.swift file inside public var launchOnLogin: Bool
Screenshot 2022-12-05 at 10 07 06 PM

A lot of features broke because Soduto wasn't in active development and hence the code was deprecated.

@electr1fy0
Copy link

Yes, you did push it in your fork but it's still broken at least for me.
I saw this code in your screenshot while checking it out.

IIRC it said SMAppService is missing or something.

@sannidhyaroy
Copy link
Author

That's weird! It does work for me, so I'd like to know more about the issues you are facing. Also, do note that the correct way to check if launch on login is enabled or not is to open the Activity Monitor and check for a process named "Soduto Launcher". If Soduto Launcher shows up inside Activity Monitor, it means launch on login is enabled. Don't check if Launch on Login is enabled from System Preferences. I don't know if it is a bug from Apple's side or it was meant to be like this but, if the toggle for Soduto is enabled in Login Items section of System Preferences, it just means that Soduto has the authorisation to enable/disable launch on login, else not. Alternatively, you can also look for the return value of SMAppService.Status from the Console app. If it's 0, it means launch on login is disabled, 1 means enabled, 2 means Soduto doesn't have the permission to change launch on login settings, so you need to enable the toggle from System Preferences and 3 means that the service couldn't be found.
Screenshot 2022-12-05 at 11 41 43 PM
You'll get this console message, if you turn on Launch on Login from disabled to enabled.

@electr1fy0
Copy link

@sannidhyaroy
Nope, it doesn't show up in the Console for me.
Also, the toggle looks like this:
image

Even the Soduto Share feature that you implemented in the nightly shows this:
image

Could you release a build so that I can be sure something is wrong on my end?

@sannidhyaroy
Copy link
Author

sannidhyaroy commented Dec 7, 2022

@electr1fy0 The - icon which shows up on the Launch on Login button is implying that you haven't given Soduto the authorisation to change your login item settings. Go to System Preferences > General > Login Items > toggle Soduto on. Soduto can't change the settings because macOS will block the request to change login settings to Soduto.
Screenshot 2022-12-07 at 5 43 13 PM
The current status of the Soduto app in your system is case requiresApproval. You can read more about this topic in the Apple Developer Documentation

Screenshot 2022-12-07 at 5 35 41 PM

I'll release a build, so check back within an hour or so... Since, I don't have a paid Apple Developer account, when you'll be installing Soduto, Gatekeeper will block the app from opening. You'll have to go to System Preferences > Privacy & Security and tap on Open Anyway from there to proceed.

@electr1fy0
Copy link

@sannidhyaroy

image
Something is wrong on my build probably.




You'll have to go to System Preferences > Privacy & Security and tap on Open Anyway from there to proceed.

Alternatively, we can Ctrl-Click the app in Finder and then click Open.

@sannidhyaroy
Copy link
Author

sannidhyaroy commented Dec 7, 2022

Something is wrong on my build probably

It may be possible that my code didn't fix it. Since, I can't reproduce the issue on my system, it'll be hard for me to actually fix it. I have released the beta build, so do let me know if you still face the issue or not. The nighly build (which has the share extension) will take longer for me to release. And about the issue, you're facing with the share extension, I released a commit yesterday which probably should have fixed the issue, so you can try to build the nightly branch again or wait for me to release the nightly build. Also, note that nightly is buggy (which is why it's nightly), so as of now, it works only for single files. If you try to select multiple files, it will send one file over and over again.

@sannidhyaroy
Copy link
Author

Even the Soduto Share feature that you implemented in the nightly shows this: image

I think I figured out the reason why this is happening. It's possible that share extension and the main app are unable to communicate with each other as they don't have the same App Group Key. I updated the Readme.md file in the nightly branch of my repository. The key depends on your Team Identifier key of your Apple ID, so it's different for everyone else. Hence, when you open Xcode the Target has a different key as compared to the code. Follow these steps to have them in the same App Group:

  • Select Soduto as Target in XCode. Go to Signing & Capabilities and under the App Groups section, copy the App Group key.

  • Open the SharedUserDefaults.swift file & paste the key in the suiteName variable.

    static let suiteName = "<your key here>"

  • Make sure you have the same App Group key for Soduto Share as selected target.

With that being said, I'd like to know whether you were having the device availability issues only with your build or does my build also not work?

@electr1fy0
Copy link

@sannidhyaroy That worked!

@sannidhyaroy
Copy link
Author

@sannidhyaroy That worked!

Glad to know, it's working!

@electr1fy0
Copy link

Unfortunately, I still couldn't get Launch on login working.
It does work perfectly on the builds you have released but I still get the - sign on my builds.

@sannidhyaroy
Copy link
Author

It does work perfectly on the builds you have released but I still get the - sign on my builds.

If it's working on the build that I released but not on yours, then there something wrong with the build options or frameworks in Xcode. The issue with Soduto Share was because we had to make sure the same App Group key was pasted in the code which I realized later and updated the readme accordingly, but I can't think of any possible reason why Launch on login might not be working on your build. If I find a possible reason, I will notify you and make necessary changes to the readme.

@sannidhyaroy
Copy link
Author

@electr1fy0 Hey, I tried to add actions, replies, requests and dismiss options in Soduto Notifications. I don't know if it's stable enough. I released a nightly build, so feel free to check it out.

@emdoe
Copy link

emdoe commented Jan 24, 2023

Hi @sannidhyaroy, thanks for the great job and I also got the - sign from your nightly released version.

@sannidhyaroy
Copy link
Author

Hi @sannidhyaroy, thanks for the great job and I also got the - sign from your nightly released version.

If you get the - sign beside the Launch on Login button, first you might take a look in System Preferences if you have enabled the toggle of Soduto under Login Items, just to be sure there's nothing wrong in your part. However, as others have reported that they're getting the same - icon, I'll try to fix it next month. Since I can't reproduce the bug on my system, it'd be hard for me to fix it but I'll see if I can do something.
Also, just a quick question: Do you get that sign when you clone my repo and build it yourself in Xcode or you have the issue even when you downloaded the dmg from my latest release?

And if you have a couple of minutes, it'd be great if you could open an issue regarding this in my repository, so that I can keep track of what is to be implemented and fixed in the next nightly version.

@electr1fy0
Copy link

For me, the DMG you released worked fine IIRC but not when I built myself.

@sannidhyaroy
Copy link
Author

For me, the DMG you released worked fine IIRC but not when I built myself.

Omg, that sounds confusing cuz @emdoe said that none worked for him.

@emdoe Can you do a fresh reinstall of Soduto Nightly? Make sure to remove the remaining files too using AppCleaner and remove all entries starting with Soduto from Keychain too and then report if you still are having issues with it, just to be sure if something else is causing the problem or not.

@emdoe
Copy link

emdoe commented Jan 25, 2023

It starts to seem really odd to me. After a fresh installation, the option on the login item has disappeared.

@sannidhyaroy
Copy link
Author

sannidhyaroy commented Jan 25, 2023

It starts to seem really odd to me. After a fresh installation, the option on the login item has disappeared.

You need to clear the .plist file of login items in your mac. This has nothing to do with Soduto and is a common macOS issue. I faced this same one time as well. Can you make a backup (of only this file)and then delete /Users/<your user name>/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm and reboot and see if it makes any difference? This should reset your login items in System Preferences hopefully but it's like a hit and miss so it may not work as well. If nothing works out and you can manually add Soduto to launch at startup until I find a fix for it.

@emdoe
Copy link

emdoe commented Jan 25, 2023

Thanks for the information! However, there is no changes and the option is still missing from the Allowing in the Background menu after cleaning and reinstalling.

@sannidhyaroy
Copy link
Author

Thanks for the information! However, there is no changes and the option is still missing from the Allowing in the Background menu after cleaning and reinstalling.

No idea, what's goin' on tbh 😂

@JokerQyou
Copy link

By manually adding Soduto to the login item list via System Settings, the menu item toggle returns to normal. And you can control the "launch on login" settings via the menu item again after that.

There's a way to manually trigger this issue: turn on the "launch on login" via menu item; then open System Settings, select Soduto in the login item list, then click on the "-" button to remove it. After that the "launch on login" menu item will show the "-" sign, and you cannot toggle it. Re-adding the login item to System Settings will fix this issue.

@JokerQyou
Copy link

JokerQyou commented Feb 20, 2024

I've created an PR (sannidhyaroy/pull/33) to address the "launch on login" menu item issue. Tested on macOS Ventura (13.2).

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

5 participants