viezel/TiSocial.Framework

Close modal window "activityPopover" not dismissed on iPad

Opened this issue · 2 comments

nuno commented

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 commented

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 commented

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 :(