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

[OSX] App Store Sandbox Bookmarks API #6540

Closed
wants to merge 17 commits into from

Conversation

Mikolaytis
Copy link
Contributor

What does the pull request do?

Adds an API to work with App Store Sandbox Bookmarks. More info here #6537

@Mikolaytis
Copy link
Contributor Author

usage of the API:

  • set MacOsPlatformOptions.AppStoreSandbox to true in Program.cs
  • subscribe to Application.BookmarkAdded event and save all data info to disk, add cache of ISandboxBookmark in memory, make available in your app as Dictionary<string FilePath, byte[] bookmarkData>.
  • if you want to restore a bookmark object after app restart - get ISandboxBookmarkFactory from locator and create bookmarks from bookmarkData.
  • cover every access to file outside of sandbox with using(bookmark.Open()){ ...access code... }

@Mikolaytis
Copy link
Contributor Author

Mikolaytis commented Sep 3, 2021

Feature is done, but not tested. I will integrate result nuget to our app, our QA will test build, I will fix issues, and repeat until this will be production-ready.
[WIP] flag will be removed on successful app store release.

PS: Next must-have feature we will need and develop in the future - is support of in-app purchases.

@Mikolaytis
Copy link
Contributor Author

@kekekeks it's a big chance that this issue is known, but in case it's not, I want to note that RunLeakTests have a chance to fail randomly.

failed run = https://dev.azure.com/AvaloniaUI/AvaloniaUI/_build/results?buildId=15467&view=results
completed run = https://dev.azure.com/AvaloniaUI/AvaloniaUI/_build/results?buildId=15468&view=results

@Takoooooo
Copy link
Contributor

@kekekeks it's a big chance that this issue is known, but in case it's not, I want to note that RunLeakTests have a chance to fail randomly.

failed run = https://dev.azure.com/AvaloniaUI/AvaloniaUI/_build/results?buildId=15467&view=results
completed run = https://dev.azure.com/AvaloniaUI/AvaloniaUI/_build/results?buildId=15468&view=results

Yes, this is a known issue.If you know why this can happen we would be glad to know

@Mikolaytis Mikolaytis changed the title [WIP] [OSX] App Store Sandbox Bookmarks API [OSX] App Store Sandbox Bookmarks API Nov 12, 2021
@Mikolaytis
Copy link
Contributor Author

@danwalmsley

@kekekeks
Copy link
Member

Linux has something similar for sandboxed apps https://flatpak.github.io/xdg-desktop-portal/portal-docs.html#gdbus-org.freedesktop.portal.FileChooser but I don't see anything resembling bookmarks. Those might be tracked by the sandbox automatically.

/// This parameter enables <see cref="Application.SandboxBookmarkAdded"/> event.
/// It's called when a user selects a document in OpenFileDialog or SaveFileDialog or via <see cref="Application.UrlsOpened"/> event.
/// </summary>
public bool AppStoreSandbox { get; set; } = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not really familiar with macos sandboxing, but do we need this property? Is it a problem having always enabled event for sandbox? I assume it just will never be called in non-sandboxed app.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before calling this event I'm creating a sandbox bookmark for selected path from NSSavePanel/NSOpenPanel, I did not test it, but I think not calling sandbox apis in not sandboxed app is a good idea.

/// <summary>
/// File Path of the Bookmark
/// </summary>
string Url { get; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type "string" but name is "Url". Should it be "Uri" type with "file://" protocol?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kekekeks kekekeks mentioned this pull request Dec 21, 2021
@jmacato
Copy link
Member

jmacato commented Mar 10, 2022

Closing due to inactivity and merge conflicts. Please ping me if you're gonna work on this again.

@jmacato jmacato closed this Mar 10, 2022
@maxkatz6
Copy link
Member

To be continued in #7234

@maxkatz6 maxkatz6 mentioned this pull request Jun 8, 2022
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants