ShareKit icon indicating copy to clipboard operation
ShareKit copied to clipboard

Mail does not dismiss if user uses + button

Open ideashower opened this issue 14 years ago • 5 comments

see: http://www.ideashower.com/support/read-it-later/ril-pro-220-email-screen-does-not-disaper/

ideashower avatar Aug 30 '10 18:08 ideashower

Hello, I've faced the same problem. Here is a quick fix :

in SHK.m add this condition to the - (void)viewWasDismissed method :

  • (void) viewWasDismissed { if (self.isDismissingView) { //.....The rest of the body } }

Jakil avatar Sep 21 '10 19:09 Jakil

had the same problem here too, thanks for posting the fix!!

taberrr avatar Dec 17 '10 01:12 taberrr

Same to me. Jakil fix works! But there's no feedback to the user, just the sent sound after a few seconds.

rsodre avatar Jun 13 '11 22:06 rsodre

I have been experiencing the same problem as noted in the URL posted by ideashower (who I believe is Nate). When a user clicks 'Send' or 'Save Draft' or 'Delete Draft' the email window does not close.

I tried the fix that Jakil found, but it did not resolve the problem. Here is the code with Jakil's fix, is this how the fix was to be implemented?

- (void)viewWasDismissed
{
    if (self.isDismissingView) {

        self.isDismissingView = NO;

        if (currentView != nil)
            currentView = nil;

        if (pendingView)
        {
            // This is an ugly way to do it, but it works.
            // There seems to be an issue chaining modal views otherwise
            // See: http://github.com/ideashower/ShareKit/issues#issue/24
            [self performSelector:@selector(showPendingView) withObject:nil afterDelay:0.02];
            return;
        }

    }
}

anilnatha avatar May 01 '12 22:05 anilnatha

After some more searching, turns out someone else had this problem and found a solution that resolved my problem. The resolution is described by jeanfabre in this issue thread https://github.com/ideashower/ShareKit/issues/41

Simply add the following line of code:

[controller dismissModalViewControllerAnimated:YES];

To the end of the method - (void)mailComposeController:didFinishWithResult:error: in SHKMail.m

It should look like this when it's all said and done:

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
    [[SHK currentHelper] hideCurrentViewControllerAnimated:YES];

    switch (result) 
    {
        case MFMailComposeResultSent:
            [self sendDidFinish];
            break;
        case MFMailComposeResultSaved:
            [self sendDidFinish];
            break;
        case MFMailComposeResultCancelled:
            [self sendDidCancel];
            break;
        case MFMailComposeResultFailed:
            [self sendDidFailWithError:nil];
            break;
    }

    [controller dismissModalViewControllerAnimated:YES];
}

anilnatha avatar May 01 '12 23:05 anilnatha