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

[OS X] Use 10.10 Finder Sync icon indication #2340

Closed
guruz opened this issue Oct 20, 2014 · 16 comments
Closed

[OS X] Use 10.10 Finder Sync icon indication #2340

guruz opened this issue Oct 20, 2014 · 16 comments
Assignees
Labels
Enhancement Needs info ReadyToTest QA, please validate the fix/enhancement technical debt

Comments

@guruz
Copy link
Contributor

guruz commented Oct 20, 2014

If running on 10.10:

https://developer.apple.com/library/mac/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_10.html

FinderSync (FinderSync.framework). The FinderSync framework enables Finder extensions to:
Express interest in specific folder hierarchies
Provide "badges" to indicate the status of items inside those hierarchies
Provide dynamic menu items in Finder contextual menus, when the selected items (or the window target) are in those hierarchies
Provide a Toolbar Item that displays a menu with dynamic items (even if the selection is unrelated)

This would replace our overlay icon code.

https://developer.apple.com/library/mac/documentation/FinderSync/Reference/FinderSync_Framework/

@nemphys
Copy link

nemphys commented Jan 14, 2015

Yes, this is the way to go; I suppose DropBox is using this, since the overlays were missing when I first upgraded to 10.10 and after a few weeks (ie. DB update), they came back, but different than ever before.

@guruz guruz added this to the 1.9 - Multi-account milestone Jan 19, 2015
@guruz guruz assigned jturcotte and unassigned guruz Mar 26, 2015
@iliyasbasir
Copy link

Screen Shot

ownCloud

screen shot 2015-03-31 at 16 34 32

DropBox

screen shot 2015-03-31 at 16 34 18

@jturcotte
Copy link
Member

I tried to get it to work by hacking things together but I'm currently stuck in a corner: the FinderSync requires sandboxing to be enabled for the app extension bundle, and that means in return that the code can only communicate through unix sockets with other sandboxed applications (of the same "application group")

https://developer.apple.com/library/mac/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW24

I tried to mark the current socket path with temporary sandbox exceptions, or to tell the client to open the server inside the app group container path and OS X obviously doesn't let me open the socket for listening.

This means that we won't be able to use those fancy new icons unless we also make the desktop client application sandboxed. I'm assuming that this won't be trivial.

@guruz
Copy link
Contributor Author

guruz commented May 11, 2015

@danimo @dragotin ^^ FYI

@jturcotte
Copy link
Member

A bit of research seem to reveal that it shouldn't be necessary to have the client sandboxed. This page suggests using XPC as communication, but this would require running the sync engine in a launchd service, this one probably also sandboxed: https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Finder.html#//apple_ref/doc/uid/TP40014214-CH15-SW13

It could make sense to take the opportunity to split our syncing into a service. This would increase the security by sandboxing the communication with the server, would avoid UI lock-ups by avoiding doing the discovery on the client's main thread and allow using the FinderSync properly. The problem is that this will probably require quite some platform-specific code and the usual amount of bugs that this implies.

Another option it to have the XPC service only used as an intermediate communication end-point between the client and the finder extension, but this would be a bit of a hack.

@jturcotte
Copy link
Member

I tried XPC and I couldn't find a way to use it without servicing it from a helper process that need to be launched from launchd.

I got something working using an NSConnection to communicate from the sandboxed extension, that should work. I still need to find a way to update parent directories since I can't handle UPDATE_VIEW the same way, and also make sure that the old extension still work to support < 10.10.

@guruz
Copy link
Contributor Author

guruz commented May 22, 2015

                                                                                  Cab you clarify on "update parent directories"?                                                                                                                                                                                                                                                                                                                                        Congrats btw!                                                                                                                                                                                                                From: Jocelyn TurcotteSent: Freitag, 22. Mai 2015 16:54To: owncloud/clientReply To: owncloud/clientCc: Markus GoetzSubject: Re: [client] [OS X] Use 10.10 Finder Sync icon indication (#2340)I tried XPC and I couldn't find a way to use it without servicing it from a helper process that need to be launched from launchd.

I got something working using an NSConnection to communicate from the sandboxed extension, that should work. I still need to find a way to update parent directories since I can't handle UPDATE_VIEW the same way, and also make sure that the old extension still work to support < 10.10.

—Reply to this email directly or view it on GitHub.

@jturcotte
Copy link
Member

The client will update all file status when they change, I'm not sure what was the original purpose of UPDATE_VIEW, but in my case it seems like parent directories of synced files are the only one needing an force update (which UPDATE_VIEW triggers).

For example:
a
| - aa
| | - aaa
| | - aab
| | - aac

Once aaa through aac are done updating, UPDATE_VIEW is usually needed to get the OK status for a and aa, since a directory is marked as SYNC if any of it children are still syncing. So either I'll have to put the parent directory logic in UPDATE_VIEW, or even better put that logic directly in the SocketApi and get rid of the need for a force update in UPDATE_VIEW for all other plugins.

@jturcotte
Copy link
Member

I got it pretty well working in my temporary branch, most of the risk involved by the feature is cleared, But I still need to figure out how well that will work with non ad-hoc signing since the Mach port name needs to be prefixed by the signing team ID. Here is what I think is left to do

  • Get square unpadded icons
    • Figure out how we'll display the "shared" badge, since that makes the icon rectangular
  • Get an OS X dev account to be able to make sure that it works with real distribution code signing
  • Check if/why the extension isn't enabled by default and find a way to avoid asking the users to do it themselves
  • Disable the OwnCloudInjector code path on >=10.10 in case that the extension is already on the system
  • Remove the need for UPDATE_VIEW to re-query all file states, make sure that the client pushes everything that needs a status update

jturcotte added a commit to jturcotte/owncloud-client that referenced this issue Jun 15, 2015
This prepares the switch to the official FinderSync API on Yosemite
which requires the extension to run in a sandbox. This complicates
the usage of a local socket to communicate with a non-sandboxed GUI
client. An NSConnection is easier to use in this case, which we can
use as long as the server name (i.e. Mach port registered name) is
prefixed with the code signing Team Identifier.

A placeholder server implementation is also added to the client's
SocketApi which basically reproduces the interface of a QLocalSocket.
Most of the references to individual sockets we're only using
QIODevice methods so the type was simply reduced. A typedef to
replace the QLocalServer was the only other part needed.
jturcotte added a commit to jturcotte/owncloud-client that referenced this issue Jun 15, 2015
This uses the new official API to show overlay icons and add our
custom context menu entry instead of hooking directly into the
Finder process and intercept drawind routines.

A dummy desktopclient target is also in the project to allow debugging
directly in Xcode while the official client can be started from the
command line. Otherwise Xcode won't allow attaching to the debugee.

Dummy icon files have been added while we get proper icon produced.
We can't use the old icons since what we use for the legacy shell
integration is already padded according to where the badge should
appear on the full icon.
jturcotte added a commit to jturcotte/owncloud-client that referenced this issue Jun 16, 2015
jturcotte added a commit to jturcotte/owncloud-client that referenced this issue Jun 16, 2015
jturcotte added a commit to jturcotte/owncloud-client that referenced this issue Jun 17, 2015
It was only used on OS X and couldn't be used by the FinderSync
extension since that one runs in a sandbox. So use the same system
to load images in the legacy extension by shipping them in the
extension bundle instead of the owncloud.app bundle.

This is also given that the legacy extension needs padded icons
while the FinderSync one needs unpadded icons.
@jturcotte
Copy link
Member

I consider the feature done, but there are surely issues remaining, I added some quick testing info at https://github.com/owncloud/client/wiki/Testing-Scenarios-2.0

@jturcotte jturcotte added the ReadyToTest QA, please validate the fix/enhancement label Jul 28, 2015
@Dianafg76
Copy link

@jturcotte I need the steps to reproduce this issue. Thanks

@Dianafg76 Dianafg76 removed the ReadyToTest QA, please validate the fix/enhancement label Jul 29, 2015
@guruz
Copy link
Contributor Author

guruz commented Jul 29, 2015

Install 2.0 nightly build on OS X. Check if sync indicator icons show up in finder.

@guruz guruz added the ReadyToTest QA, please validate the fix/enhancement label Jul 29, 2015
@Dianafg76
Copy link

It is work ok. Many thanks
Desktop v ownCloud-2.0.0.2582-nightly20150731.pkg
I close

guruz added a commit that referenced this issue Aug 6, 2015
Remove need for UPDATE_VIEW to refetch the status #2340
@TomGem
Copy link

TomGem commented Aug 26, 2015

I just installed ownCloud-2.0.0.2666 on OS X 10.10.5 and since then the icons as well as the ownCloud finder actions (right click -> share with ownCloud) are gone. Both have been working with the 1.8.4 Client.

Futhermore, where is #2897 implemented, I can't find any options like those mentioned there?

Anyway, the most important thing, ownCloud 2.0 is syncing fine.

Please let me know if I can provide something.

@jturcotte
Copy link
Member

@TomGem The extension loading is now handled by OSX directly instead of having to inject the bundle directly in Finder, so you can find the option in [System Preferences / Extensions / Finder] where you should be able to enable the "ownCloud Extensions"

There are some situations where the extension wouldn't be enabled properly on the first install, but normally just enabling it there should make it available again. Let me know if that doesn't work for you.

@TomGem
Copy link

TomGem commented Aug 26, 2015

That's it, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Needs info ReadyToTest QA, please validate the fix/enhancement technical debt
Projects
None yet
Development

No branches or pull requests

8 participants