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

added view option for use on ipad #13

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ The `socialshare` variable is a reference to the Module object.
}
});
```
- for ipad use view option
``` js
socialshare.shareWithItems({
activityItems: [ itemSource ],
activities: [ customActivity ],
completionWithItemsHandler: function (e) {
if (e.errorCode !== null || e.errorDomain !== null || e.errorDescription !== null) {
alert('Error Occured: ' + e.errorDescription);
return;
}
},
view: $.idOfView
});
```

## Example
- Please see the `example/` folder.
Expand Down
6 changes: 6 additions & 0 deletions ios/Classes/AppceleratorSocialShareModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ class AppceleratorSocialshareModule: TiModule {
activityVC.completionWithItemsHandler = block
activityVC.excludedActivityTypes = excludedActivity

let sourceView = options?["view"] as? TiViewProxy
if sourceView != nil {
activityVC.popoverPresentationController?.sourceView = sourceView!.view
activityVC.popoverPresentationController?.sourceRect = sourceView!.rect.rect()
}

if var topController = UIApplication.shared.keyWindow?.rootViewController {
while let presentedViewController = topController.presentedViewController {
topController = presentedViewController
Expand Down