diff --git a/Signal/Images.xcassets/AppIcon.appiconset/Contents.json b/Signal/Images.xcassets/AppIcon.appiconset/Contents.json
index 52e5f9a4d..710c64c90 100644
--- a/Signal/Images.xcassets/AppIcon.appiconset/Contents.json
+++ b/Signal/Images.xcassets/AppIcon.appiconset/Contents.json
@@ -77,6 +77,11 @@
"idiom" : "ipad",
"filename" : "launch-icon-ipad@2x.png",
"scale" : "2x"
+ },
+ {
+ "idiom" : "ipad",
+ "size" : "83.5x83.5",
+ "scale" : "2x"
}
],
"info" : {
diff --git a/Signal/Images.xcassets/Contents.json b/Signal/Images.xcassets/Contents.json
new file mode 100644
index 000000000..da4a164c9
--- /dev/null
+++ b/Signal/Images.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/Signal/Images.xcassets/devices-icon.imageset/Contents.json b/Signal/Images.xcassets/devices-icon.imageset/Contents.json
new file mode 100644
index 000000000..32a80e337
--- /dev/null
+++ b/Signal/Images.xcassets/devices-icon.imageset/Contents.json
@@ -0,0 +1,26 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "ic_devices_ios.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "ic_devices_ios@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "ic_devices_ios@3x.png",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ },
+ "properties" : {
+ "template-rendering-intent" : "template"
+ }
+}
\ No newline at end of file
diff --git a/Signal/Images.xcassets/devices-icon.imageset/ic_devices_ios.png b/Signal/Images.xcassets/devices-icon.imageset/ic_devices_ios.png
new file mode 100644
index 000000000..d9509fd73
Binary files /dev/null and b/Signal/Images.xcassets/devices-icon.imageset/ic_devices_ios.png differ
diff --git a/Signal/Images.xcassets/devices-icon.imageset/ic_devices_ios@2x.png b/Signal/Images.xcassets/devices-icon.imageset/ic_devices_ios@2x.png
new file mode 100644
index 000000000..be4932065
Binary files /dev/null and b/Signal/Images.xcassets/devices-icon.imageset/ic_devices_ios@2x.png differ
diff --git a/Signal/Images.xcassets/devices-icon.imageset/ic_devices_ios@3x.png b/Signal/Images.xcassets/devices-icon.imageset/ic_devices_ios@3x.png
new file mode 100644
index 000000000..c2cef2ebc
Binary files /dev/null and b/Signal/Images.xcassets/devices-icon.imageset/ic_devices_ios@3x.png differ
diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist
index c5f1ab30c..381959b4e 100644
--- a/Signal/Signal-Info.plist
+++ b/Signal/Signal-Info.plist
@@ -38,7 +38,7 @@
CFBundleVersion
- 2.5.0.4
+ 2.5.0.5
ITSAppUsesNonExemptEncryption
LOGS_EMAIL
diff --git a/Signal/src/Storyboard/Storyboard.storyboard b/Signal/src/Storyboard/Storyboard.storyboard
index 398d17829..05dd1dd93 100644
--- a/Signal/src/Storyboard/Storyboard.storyboard
+++ b/Signal/src/Storyboard/Storyboard.storyboard
@@ -3,6 +3,7 @@
+
@@ -365,7 +366,7 @@ A0 09 9A FF A8 8A 09 99
-
+
@@ -380,7 +381,7 @@ A0 09 9A FF A8 8A 09 99
-
+
@@ -453,7 +454,7 @@ A0 09 9A FF A8 8A 09 99
-
+
@@ -481,7 +482,7 @@ A0 09 9A FF A8 8A 09 99
-
+
@@ -495,7 +496,7 @@ A0 09 9A FF A8 8A 09 99
-
+
@@ -745,7 +746,7 @@ A0 09 9A FF A8 8A 09 99
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1946,6 +2036,7 @@ A0 09 9A FF A8 8A 09 99
+
diff --git a/Signal/src/view controllers/OWSLinkDeviceViewController.h b/Signal/src/view controllers/OWSLinkDeviceViewController.h
index 66a2f0573..6138b94eb 100644
--- a/Signal/src/view controllers/OWSLinkDeviceViewController.h
+++ b/Signal/src/view controllers/OWSLinkDeviceViewController.h
@@ -4,7 +4,7 @@
@class OWSLinkedDevicesTableViewController;
-@interface OWSLinkDeviceViewController : OWSQRCodeScanningViewController
+@interface OWSLinkDeviceViewController : UIViewController
@property OWSLinkedDevicesTableViewController *linkedDevicesTableViewController;
diff --git a/Signal/src/view controllers/OWSLinkDeviceViewController.m b/Signal/src/view controllers/OWSLinkDeviceViewController.m
index 08565d5ee..84226493d 100644
--- a/Signal/src/view controllers/OWSLinkDeviceViewController.m
+++ b/Signal/src/view controllers/OWSLinkDeviceViewController.m
@@ -11,20 +11,50 @@
NS_ASSUME_NONNULL_BEGIN
+@interface OWSLinkDeviceViewController ()
+
+@property (strong, nonatomic) IBOutlet UIView *qrScanningView;
+@property (strong, nonatomic) IBOutlet UILabel *scanningInstructionsLabel;
+@property (strong, nonatomic) OWSQRCodeScanningViewController *qrScanningController;
+
+@end
+
@implementation OWSLinkDeviceViewController
- (void)viewDidLoad
{
[super viewDidLoad];
+
+ // HACK to get full width preview layer
+ CGRect oldFrame = self.qrScanningView.frame;
+ self.qrScanningView.frame = CGRectMake(
+ oldFrame.origin.x, oldFrame.origin.y, self.view.frame.size.width, self.view.frame.size.height / 2.0 - 32.0);
+ [self.qrScanningController resizeViews];
+ // END HACK to get full width preview layer
+
+ self.scanningInstructionsLabel.text = NSLocalizedString(
+ @"Scan the QR code displayed on the device to link.", @"QR Scanning screen instructions label");
self.title = NSLocalizedString(@"Link New Device", "Navigation title when scanning QR code to add new device.");
}
-- (void)viewDidAppear:(BOOL)animated
+- (void)viewWillAppear:(BOOL)animated
{
- [super viewDidAppear:animated];
+ [super viewWillAppear:animated];
}
-- (void)didDetectQRCodeWithString:(NSString *)string
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(nullable id)sender
+{
+ if ([segue.identifier isEqualToString:@"embedDeviceQRScanner"]) {
+ OWSQRCodeScanningViewController *qrScanningController
+ = (OWSQRCodeScanningViewController *)segue.destinationViewController;
+ qrScanningController.scanDelegate = self;
+ self.qrScanningController = qrScanningController;
+ }
+}
+
+
+// pragma mark - OWSQRScannerDelegate
+- (void)controller:(OWSQRCodeScanningViewController *)controller didDetectQRCodeWithString:(NSString *)string
{
NSString *title = NSLocalizedString(@"Link this device?", @"Alert title");
NSString *linkingDescription = NSLocalizedString(@"This device will be able to see your groups and contacts, read "
diff --git a/Signal/src/view controllers/OWSQRCodeScanningViewController.h b/Signal/src/view controllers/OWSQRCodeScanningViewController.h
index 9c85306b3..655a76291 100644
--- a/Signal/src/view controllers/OWSQRCodeScanningViewController.h
+++ b/Signal/src/view controllers/OWSQRCodeScanningViewController.h
@@ -3,6 +3,14 @@
#import
#import
+@class OWSQRCodeScanningViewController;
+
+@protocol OWSQRScannerDelegate
+
+- (void)controller:(OWSQRCodeScanningViewController *)controller didDetectQRCodeWithString:(NSString *)scannedString;
+
+@end
+
@interface OWSQRCodeScanningViewController : UIViewController
@property (nonatomic, strong) AVCaptureSession *session;
@@ -12,5 +20,9 @@
@property (nonatomic, strong) AVCaptureVideoPreviewLayer *prevLayer;
@property (nonatomic, strong) UIView *highlightView;
+@property (nonatomic, weak) UIViewController *scanDelegate;
+
+// HACK to resize views after embedding. Better would be to specify layout of preview layer as constraints.
+- (void)resizeViews;
@end
diff --git a/Signal/src/view controllers/OWSQRCodeScanningViewController.m b/Signal/src/view controllers/OWSQRCodeScanningViewController.m
index fb37fd549..43c3850c8 100644
--- a/Signal/src/view controllers/OWSQRCodeScanningViewController.m
+++ b/Signal/src/view controllers/OWSQRCodeScanningViewController.m
@@ -10,7 +10,6 @@
[super viewDidLoad];
self.title = NSLocalizedString(@"SCAN_KEY", @"");
-
self.highlightView = [[UIView alloc] init];
self.highlightView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin
| UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
@@ -36,15 +35,29 @@
self.output.metadataObjectTypes = [self.output availableMetadataObjectTypes];
self.prevLayer = [AVCaptureVideoPreviewLayer layerWithSession:self.session];
- self.prevLayer.frame = self.view.bounds;
+
self.prevLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
[self.view.layer insertSublayer:self.prevLayer atIndex:0];
- [self.session startRunning];
-
[self.view bringSubviewToFront:self.highlightView];
}
+- (void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:animated];
+ [self resizeViews];
+}
+
+- (void)viewDidAppear:(BOOL)animated
+{
+ [super viewDidAppear:animated];
+ [self.session startRunning];
+}
+
+- (void)resizeViews
+{
+ self.prevLayer.frame = self.view.bounds;
+}
- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputMetadataObjects:(NSArray *)metadataObjects
@@ -77,8 +90,10 @@
- (void)didDetectQRCodeWithString:(NSString *)string
{
- // Override in subclass. Subclass is responsible for dismissing this view controller.
- DDLogInfo(@"Scanned QRCode with string value: %@", string);
+ DDLogDebug(@"Scanned QRCode with string value: %@", string);
+ if (self.scanDelegate) {
+ [self.scanDelegate controller:self didDetectQRCodeWithString:string];
+ }
}
diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings
index 3b756b3cb..4937d7c1e 100644
Binary files a/Signal/translations/en.lproj/Localizable.strings and b/Signal/translations/en.lproj/Localizable.strings differ