Skip to content
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.

Close modal window "activityPopover" not dismissed on iPad #166

Open
nuno opened this issue Sep 26, 2016 · 2 comments
Open

Close modal window "activityPopover" not dismissed on iPad #166

nuno opened this issue Sep 26, 2016 · 2 comments

Comments

@nuno
Copy link

nuno commented Sep 26, 2016

UPDATE: check my comment related to the NavigationWindow systemButton issue.

If the "share activityPopover" is open and you close the embedded browser (modal window) by tapping the close X on the left, the "share activityPopover" remains open. It should close if the embedded browser is closed. There is a way to force close/hide/dismiss the activityPopover on iPad?

// MODAL WINDOW
    <NavigationWindow id="navWin" platform="ios">
        <Window id="win" title="Loading…">

      <LeftNavButton>
                <Button systemButton="STOP" onClick="closeWin" title="X" />
            </LeftNavButton>

            <RightNavButton>
                <Button id="shareBtn" systemButton="ACTION" onClick="share" />
            </RightNavButton>
            <WebView id="webView" onLoad="pageLoaded"></WebView>
        </Window>
    </NavigationWindow>
// Method responsable for the share

function share(e) {
var Social = OS_IOS ? require('dk.napp.social') : {};
    if(OS_IOS && Alloy.isTablet){
      Social.activityPopover({
                view: $.shareBtn, //or  e.source  is the same.
                subject : pageTitle,
                text : pageTitle,
                url : $.webView.url,
                removeIcons : "print,copy,contact,camera",
            }, [{
                title : "Copy Link",
                type : "copyLink",
                image : "/images/socialBar/global-openinsafari.png",
                callback : function(e) {
                    //alert("You chose me!");
                }
            }, {
                title : "Open in Safari",
                type : "open.safari",
                image : "/images/socialBar/Safari.png",
                callback : function(e) {
                    //alert("You chose me!!");
                }
            }]);
    } 
}

/*
 * custom event handling 
 */
OS_IOS && require('dk.napp.social').addEventListener("complete", function(e){
    Ti.API.info("complete: " + JSON.stringify(e));
    if(e.activityName == "copyLink"){
        Ti.UI.Clipboard.setText($.webView.url);
    }
    if(e.activityName == "open.safari"){
        Ti.Platform.openURL($.webView.url);
    }
});



function closeWin() {
    if (OS_IOS){
        $.navWin.close();
    }

}

if (OS_IOS) {
    $.navWin.addEventListener("close", function() {
        $.destroy();
        $.off();
    });
}
@nuno
Copy link
Author

nuno commented Sep 27, 2016

I found another log message after I click on the navBar button I get:

[DEBUG] 2016-09-27 14:35:09.457 app[78793:16395663] Presenting view controllers on detached view controllers is discouraged <UINavigationController: 0x7fe752479600>.

@nuno
Copy link
Author

nuno commented Nov 14, 2016

The issue seems relate to the, NavigationWindow systemButton. Soon I put a button out of NavigationWindow the "activityPopover" is dismissed.

I do not want make a "custom Nav bar" just for this bug :(

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant