mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 19:57:27 -08:00
give user option of returning to zxing:// on cancel
git-svn-id: https://zxing.googlecode.com/svn/trunk@2631 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
add451d5bf
commit
b9cbb959c7
|
@ -16,7 +16,7 @@
|
|||
@class ResultAction;
|
||||
|
||||
|
||||
@interface ZXMainViewController : UIViewController <ZXingDelegate,UIActionSheetDelegate,ModalViewControllerDelegate> {
|
||||
@interface ZXMainViewController : UIViewController <ZXingDelegate,UIActionSheetDelegate,ModalViewControllerDelegate,UIAlertViewDelegate> {
|
||||
NSArray *actions;
|
||||
ParsedResult *result;
|
||||
}
|
||||
|
|
|
@ -143,8 +143,29 @@
|
|||
[self performResultAction];
|
||||
}
|
||||
|
||||
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
|
||||
NSString* returnUrl = [[NSUserDefaults standardUserDefaults] stringForKey:@"returnURL"];
|
||||
// NSLog(@"%@ %d", returnUrl, buttonIndex);
|
||||
if (returnUrl != nil && buttonIndex != 0) {
|
||||
NSURL *ourURL =
|
||||
[NSURL URLWithString:[returnUrl stringByReplacingOccurrencesOfString:@"{CODE}" withString:@""]];
|
||||
// NSLog(@"%@ %@", ourURL, returnUrl);
|
||||
[[UIApplication sharedApplication] openURL:ourURL];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)zxingControllerDidCancel:(ZXingWidgetController*)controller {
|
||||
[self dismissModalViewControllerAnimated:YES];
|
||||
NSString *returnUrl = [[NSUserDefaults standardUserDefaults] stringForKey:@"returnURL"];
|
||||
if (returnUrl != nil) {
|
||||
UIAlertView* alert = [[UIAlertView alloc]
|
||||
initWithTitle:@"Return to website?"
|
||||
message:nil
|
||||
delegate:self
|
||||
cancelButtonTitle:@"Cancel"
|
||||
otherButtonTitles:@"Return", nil];
|
||||
[alert show];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)confirmAndPerformAction:(ResultAction *)action {
|
||||
|
|
Loading…
Reference in a new issue