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

feat(ios): add resolving Apple based app-groups directory #14

Merged
merged 3 commits into from
Apr 12, 2021
Merged

feat(ios): add resolving Apple based app-groups directory #14

merged 3 commits into from
Apr 12, 2021

Conversation

MegaMaddin
Copy link

Hello,

I'm currently in the process of getting rid of rn-fetch-blob due to the fact that is is being unmaintained for a while now. I stumbled across rn-file-access and like the simplicity and usage of modern languages.

To be able to switch over I need some additional features, starting with being able to resolve Apple's app-group directory for sharing content within an app-group. Please feel free to accept this pull-request.

Testing done

Since app-groups require a proper entitlement including a signing configuration, I haven't checked in that code in the example app, but will provide a code snippet for doing this.

To be able to test this change, follow those steps

  1. add the app-group entitlement in XCode and provide group.FileAccessExample as the group name
  2. select a proper signing profile to be able to use app-groups
  3. add the following code somewhere in example/src/App.tsx within the setInfo useEffect
    // AppGroups on Apple devices
    FileSystem.getAppGroupDir('group.FileAccessExample').then((groupDir) => {
      setInfo((prev) => {
        prev.push({
          key: 'getAppGroupDir(group.FileAccessExample)',
          value: groupDir,
        });

        return prev.slice();
      });
    });
  1. this should provide the following content
getAppGroupDir(group.FileAccessExample) /Users/username/Library/Developer/CoreSimulator/Devices/DEADC0DE-BEEF-C0F3-C0FE-DEADBEEF/data/Containers/Shared/AppGroup/DEADC0DE-BEEF-C0F3-C0FE-DEADBEEF

Thanks,
Martin

Copy link
Owner

@alpha0010 alpha0010 left a comment

Choose a reason for hiding this comment

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

Thanks for your pr; a couple changes and it should be good to go.

ios/FileAccess.swift Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
This commit adds the ability to resolve an app-groups shared directory. The
directory can be used for sharing data between apps belonging to the same
app-group.

Signed-off-by: Martin Mazein <[email protected]>
@MegaMaddin MegaMaddin requested a review from alpha0010 April 12, 2021 18:46
@alpha0010 alpha0010 merged commit 1e15e90 into alpha0010:master Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants