Skip to content

Latest commit

 

History

History
21 lines (17 loc) · 2.38 KB

DEVELOPMENT.md

File metadata and controls

21 lines (17 loc) · 2.38 KB

Technical overview

  • 'XDiscord' is the main app, it is un-sandboxed because it has to read from the temporary system directory (which seems to be impossible from the sandbox, read more about this here).
    Additionally, you can only give temporary AE exceptions to sandboxed applications, essentially meaning XDiscord would basically prompt you every time you opened Xcode, which is - frankly - insane.
    I can rant on and on about how awful the sandbox is, but this is pretty much the tldr explanation of why XDiscord is not in the app store.
  • XDiscord uses AppleEvents (leveraging the ScriptingBridge framework) to read the Xcode state in 5 second intervals.
  • XDiscord uses SwordRPC for rich presence publishing.
  • 'XDiscord Extension' is a very small extension that doesn't do a whole lot besides launching XDiscord (the app) and additionally, signaling it to show it's preferences.
    It is sandboxed for no other reason besides that apple seems to require extensions to be sandboxed.

    To communicate between extension and app, we're not using any fancy interprocess communication. Just good old url schemes (with some mild hardening to prevent driveby attacks).
    XPC is overly complicated and a bit overkill in this case.

  • XDiscord will check the defaults to see if it's extension has ever written a value there, if not, it will show an alert instructing you on how to enable the extension.
  • XDiscord (the app) will shut down if it can't detect a running instance of Xcode.

    If you have enabled XDiscord in the past, but have now decided to disable it, joke's on you! We won't show an alert in that usecase and the app will just quit.

AssetRenderer

Icons can be generated with the AssetRenderer CLI tool included in this repo.
This tool creates 512x512 icons for each file type that XCode can open, it's filenames being a hashed version of the UTI's.
Unless a major new version of XCode is released, or you wish to set up your own discord application using this code, you'll probably have no use for it.