Add “learn link”. Move “scan” button into QR code.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 8b9a1e41b4
commit 10f3f7fe13

@ -1,12 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "btnCamera--white.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

@ -1,12 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "btnCamera--white.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

@ -137,33 +137,29 @@ typedef void (^CustomLayoutBlock)();
[mainView autoPinToTopLayoutGuideOfViewController:self withInset:0]; [mainView autoPinToTopLayoutGuideOfViewController:self withInset:0];
[mainView autoPinToBottomLayoutGuideOfViewController:self withInset:0]; [mainView autoPinToBottomLayoutGuideOfViewController:self withInset:0];
// Scan Button // Learn More
UIView *scanButton = [UIView new]; UIView *learnMoreButton = [UIView new];
[scanButton [learnMoreButton
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(scanButtonTapped:)]]; addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self
[mainView addSubview:scanButton]; action:@selector(learnMoreButtonTapped:)]];
[scanButton autoPinWidthToSuperview]; [mainView addSubview:learnMoreButton];
[scanButton autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:ScaleFromIPhone5To7Plus(12.f, 25.f)]; [learnMoreButton autoPinWidthToSuperview];
[learnMoreButton autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:0];
UILabel *scanButtonLabel = [UILabel new];
scanButtonLabel.text = NSLocalizedString(@"SCAN_CODE_ACTION", UILabel *learnMoreLabel = [UILabel new];
@"Button label presented with camera icon while verifying privacy credentials. Shows the camera interface."); learnMoreLabel.attributedText = [[NSAttributedString alloc]
scanButtonLabel.font = [UIFont ows_regularFontWithSize:18.f]; initWithString:NSLocalizedString(@"PRIVACY_SAFETY_NUMBERS_LEARN_MORE",
scanButtonLabel.textColor = darkGrey; @"Label for a link to more information about safety numbers and verification.")
[scanButton addSubview:scanButtonLabel]; attributes:@{
[scanButtonLabel autoHCenterInSuperview]; NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle | NSUnderlinePatternSolid),
[scanButtonLabel autoPinEdgeToSuperviewEdge:ALEdgeBottom]; }];
learnMoreLabel.font = [UIFont ows_regularFontWithSize:ScaleFromIPhone5To7Plus(14.f, 16.f)];
UIImage *scanButtonImage = [UIImage imageNamed:@"btnCamera--white"]; learnMoreLabel.textColor = [UIColor ows_materialBlueColor];
OWSAssert(scanButtonImage); learnMoreLabel.textAlignment = NSTextAlignmentCenter;
UIImageView *scanButtonImageView = [UIImageView new]; [learnMoreButton addSubview:learnMoreLabel];
scanButtonImageView.image = [scanButtonImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; [learnMoreLabel autoPinWidthToSuperviewWithMargin:16.f];
scanButtonImageView.tintColor = darkGrey; [learnMoreLabel autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:ScaleFromIPhone5To7Plus(15.f, 20.f)];
[learnMoreLabel autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:ScaleFromIPhone5To7Plus(20.f, 25.f)];
[scanButton addSubview:scanButtonImageView];
[scanButtonImageView autoHCenterInSuperview];
[scanButtonImageView autoPinEdgeToSuperviewEdge:ALEdgeTop];
[scanButtonImageView autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:scanButtonLabel withOffset:-5.f];
// Instructions // Instructions
NSString *instructionsFormat = NSLocalizedString(@"PRIVACY_VERIFICATION_INSTRUCTIONS", NSString *instructionsFormat = NSLocalizedString(@"PRIVACY_VERIFICATION_INSTRUCTIONS",
@ -177,7 +173,7 @@ typedef void (^CustomLayoutBlock)();
instructionsLabel.lineBreakMode = NSLineBreakByWordWrapping; instructionsLabel.lineBreakMode = NSLineBreakByWordWrapping;
[mainView addSubview:instructionsLabel]; [mainView addSubview:instructionsLabel];
[instructionsLabel autoPinWidthToSuperviewWithMargin:16.f]; [instructionsLabel autoPinWidthToSuperviewWithMargin:16.f];
[instructionsLabel autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:scanButton withOffset:-ScaleFromIPhone5To7Plus(20.f, 30.f)]; [instructionsLabel autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:learnMoreButton withOffset:0];
// Fingerprint Label // Fingerprint Label
UILabel *fingerprintLabel = [UILabel new]; UILabel *fingerprintLabel = [UILabel new];
@ -224,10 +220,21 @@ typedef void (^CustomLayoutBlock)();
fingerprintImageView.layer.minificationFilter = kCAFilterNearest; fingerprintImageView.layer.minificationFilter = kCAFilterNearest;
[fingerprintView addSubview:fingerprintImageView]; [fingerprintView addSubview:fingerprintImageView];
UILabel *scanLabel = [UILabel new];
scanLabel.text = NSLocalizedString(@"PRIVACY_TAP_TO_SCAN", @"Button that shows the 'scan with camera' view.");
scanLabel.font = [UIFont ows_regularFontWithSize:16.f];
scanLabel.textColor = [UIColor whiteColor];
[scanLabel sizeToFit];
[fingerprintView addSubview:scanLabel];
fingerprintView.layoutBlock = ^{ fingerprintView.layoutBlock = ^{
CGFloat size = round(MIN(fingerprintView.width, fingerprintView.height) * 0.65f); CGFloat size = round(MIN(fingerprintView.width, fingerprintView.height) * 0.65f);
fingerprintImageView.frame = CGRectMake( fingerprintImageView.frame = CGRectMake(
round((fingerprintView.width - size) * 0.5f), round((fingerprintView.height - size) * 0.5f), size, size); round((fingerprintView.width - size) * 0.5f), round((fingerprintView.height - size) * 0.5f), size, size);
CGFloat scanY = round(fingerprintImageView.bottom
+ ((fingerprintView.height - fingerprintImageView.bottom) - scanLabel.height) * 0.33f);
scanLabel.frame = CGRectMake(
round((fingerprintView.width - scanLabel.width) * 0.5f), scanY, scanLabel.width, scanLabel.height);
}; };
} }
@ -325,10 +332,13 @@ typedef void (^CustomLayoutBlock)();
[self.navigationController pushViewController:scanView animated:YES]; [self.navigationController pushViewController:scanView animated:YES];
} }
- (void)scanButtonTapped:(UIGestureRecognizer *)gestureRecognizer - (void)learnMoreButtonTapped:(UIGestureRecognizer *)gestureRecognizer
{ {
if (gestureRecognizer.state == UIGestureRecognizerStateRecognized) { if (gestureRecognizer.state == UIGestureRecognizerStateRecognized) {
[self showScanner]; NSString *learnMoreURL = @"https://support.whispersystems.org/hc/en-us/articles/"
@"213134107-How-do-I-verify-the-person-I-m-sending-messages-to-is-who-they-say-they-"
@"are-";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:learnMoreURL]];
} }
} }
@ -342,7 +352,7 @@ typedef void (^CustomLayoutBlock)();
- (void)fingerprintViewTapped:(UIGestureRecognizer *)gestureRecognizer - (void)fingerprintViewTapped:(UIGestureRecognizer *)gestureRecognizer
{ {
if (gestureRecognizer.state == UIGestureRecognizerStateRecognized) { if (gestureRecognizer.state == UIGestureRecognizerStateRecognized) {
[self showSharingActivityWithCompletion:nil]; [self showScanner];
} }
} }

@ -940,6 +940,12 @@
/* Label for 'Work FAX' phone numbers. */ /* Label for 'Work FAX' phone numbers. */
"PHONE_NUMBER_TYPE_WORK_FAX" = "Work Fax"; "PHONE_NUMBER_TYPE_WORK_FAX" = "Work Fax";
/* Label for a link to more information about safety numbers and verification. */
"PRIVACY_SAFETY_NUMBERS_LEARN_MORE" = "Learn More";
/* Button that shows the 'scan with camera' view. */
"PRIVACY_TAP_TO_SCAN" = "Tap to Scan";
/* Alert body when verifying with {{contact name}} */ /* Alert body when verifying with {{contact name}} */
"PRIVACY_VERIFICATION_FAILED_I_HAVE_WRONG_KEY_FOR_THEM" = "This doesn't look like your safety number with %@. Are you verifying the correct contact?"; "PRIVACY_VERIFICATION_FAILED_I_HAVE_WRONG_KEY_FOR_THEM" = "This doesn't look like your safety number with %@. Are you verifying the correct contact?";
@ -1087,9 +1093,6 @@
/* Action sheet heading */ /* Action sheet heading */
"SAFETY_NUMBERS_ACTIONSHEET_TITLE" = "Your safety number with %@ has changed. You may wish to verify it."; "SAFETY_NUMBERS_ACTIONSHEET_TITLE" = "Your safety number with %@ has changed. You may wish to verify it.";
/* Button label presented with camera icon while verifying privacy credentials. Shows the camera interface. */
"SCAN_CODE_ACTION" = "Scan Code";
/* label presented once scanning (camera) view is visible. */ /* label presented once scanning (camera) view is visible. */
"SCAN_CODE_INSTRUCTIONS" = "Scan the QR Code on your contact's device."; "SCAN_CODE_INSTRUCTIONS" = "Scan the QR Code on your contact's device.";

Loading…
Cancel
Save