Last active
August 29, 2015 14:17
-
-
Save coronarob/a2ae8a6a87e192fe018b to your computer and use it in GitHub Desktop.
Function to show the activity popup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local shareButton -- will define later | |
local function showShare() | |
local popupName = "activity" | |
local isAvailable = native.canShowPopup( popupName ) | |
local isSimulator = "simulator" == system.getInfo( "environment" ) | |
-- If it is possible to show the popup | |
if isAvailable then | |
local listener = {} | |
function listener:popup( event ) | |
print( "name(" .. event.name .. ") type(" .. event.type .. ") activity(" .. tostring(event.activity) .. ") action(" .. tostring(event.action) .. ")" ) | |
end | |
-- Show the popup | |
native.showPopup( popupName, | |
{ | |
items = items, | |
-- excludedActivities = { "UIActivityTypeCopyToPasteboard", }, | |
listener = listener, | |
origin = shareButton.contentBounds, | |
permittedArrowDirections={ "up", "down" } | |
}) | |
else | |
if isSimulator then | |
native.showAlert( "Build for device", "This plugin is not supported on the Corona Simulator, please build for an iOS/Android device or the Xcode simulator", { "OK" } ) | |
else | |
-- Popup isn't available.. Show error message | |
native.showAlert( "Error", "Can't display the view controller. Are you running iOS 7 or later?", { "OK" } ) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment