[ios] Fixed crush after attempting to logout or delete changes.

This commit is contained in:
VladiMihaylenko 2016-03-28 13:34:23 +03:00
parent 32f28f0aa4
commit ab210aa5b2
2 changed files with 14 additions and 8 deletions

View file

@ -226,7 +226,7 @@ using namespace osm_auth_ios;
}];
}
- (IBAction)logout
- (IBAction)logout:(UIButton *)sender
{
self.actionSheetFunctor = [self]
{
@ -234,7 +234,7 @@ using namespace osm_auth_ios;
AuthorizationStoreCredentials({});
[self cancel];
};
[self showWarningActionSheetWithActionTitle:L(@"logout")];
[self showWarningActionSheetWithActionTitle:L(@"logout") sourceView:sender];
}
- (IBAction)cancel
@ -242,7 +242,7 @@ using namespace osm_auth_ios;
[self.navigationController popViewControllerAnimated:YES];
}
- (IBAction)localChangesAction
- (IBAction)localChangesAction:(UIButton *)sender
{
self.actionSheetFunctor = [self]
{
@ -250,12 +250,12 @@ using namespace osm_auth_ios;
[self configChanges];
[self configEmptyProfile];
};
[self showWarningActionSheetWithActionTitle:L(@"delete")];
[self showWarningActionSheetWithActionTitle:L(@"delete") sourceView:sender];
}
#pragma mark - ActionSheet
- (void)showWarningActionSheetWithActionTitle:(NSString *)title
- (void)showWarningActionSheetWithActionTitle:(NSString *)title sourceView:(UIView *)view
{
NSString * cancel = L(@"cancel");
if (isIOS7)
@ -273,6 +273,12 @@ using namespace osm_auth_ios;
}];
[alertController addAction:cancelAction];
[alertController addAction:commonAction];
if (IPAD)
{
UIPopoverPresentationController * popPresenter = [alertController popoverPresentationController];
popPresenter.sourceView = view;
}
[self presentViewController:alertController animated:YES completion:nil];
}
}

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Wns-nH-AQU">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Wns-nH-AQU">
<dependencies>
<deployment version="2048" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
@ -1941,7 +1941,7 @@
<userDefinedRuntimeAttribute type="string" keyPath="coloringName" value="MWMGray"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="localChangesAction" destination="iZ6-Zi-bkZ" eventType="touchUpInside" id="Ycj-6E-vDD"/>
<action selector="localChangesAction:" destination="iZ6-Zi-bkZ" eventType="touchUpInside" id="4Gi-vX-ESJ"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Changes: 4" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6t0-ph-htV">
@ -2253,7 +2253,7 @@
<userDefinedRuntimeAttribute type="string" keyPath="layer.borderColorName" value="whitePrimaryText"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="logout" destination="iZ6-Zi-bkZ" eventType="touchUpInside" id="BCT-mT-JzT"/>
<action selector="logout:" destination="iZ6-Zi-bkZ" eventType="touchUpInside" id="FcC-iH-0c0"/>
</connections>
</button>
</subviews>