mirror of
https://github.com/MacPass/MacPass.git
synced 2026-02-02 02:48:23 +00:00
Minor updates to view update.
This commit is contained in:
@@ -23,6 +23,14 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
typedef NS_ENUM(NSUInteger, MPOTPUpdateSource) {
|
||||||
|
MPOTPUpdateSourceQRImage,
|
||||||
|
MPOTPUpdateSourceURL,
|
||||||
|
MPOTPUpdateSourceSecret,
|
||||||
|
MPOTPUpdateSourceAlgorithm,
|
||||||
|
MPOTPUpdateSourceTimeSlice
|
||||||
|
};
|
||||||
|
|
||||||
@implementation MPTOTPSetupViewController
|
@implementation MPTOTPSetupViewController
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
@@ -30,10 +38,19 @@
|
|||||||
NSAssert([self.representedObject isKindOfClass:KPKEntry.class], @"represented object needs to be a KPKEntry");
|
NSAssert([self.representedObject isKindOfClass:KPKEntry.class], @"represented object needs to be a KPKEntry");
|
||||||
self.generator = [[KPKTimeOTPGenerator alloc] initWithEntry:((KPKEntry *)self.representedObject)];
|
self.generator = [[KPKTimeOTPGenerator alloc] initWithEntry:((KPKEntry *)self.representedObject)];
|
||||||
|
|
||||||
/**/
|
/* URL and QR code */
|
||||||
KPKEntry *entry = self.representedObject;
|
KPKEntry *entry = self.representedObject;
|
||||||
NSString *url = [entry attributeWithKey:kKPKAttributeKeyOTPOAuthURL].value;
|
NSString *url = [entry attributeWithKey:kKPKAttributeKeyOTPOAuthURL].value;
|
||||||
self.urlTextField.stringValue = url ? url : @"";
|
|
||||||
|
self.urlTextField.stringValue = @"";
|
||||||
|
|
||||||
|
if(url) {
|
||||||
|
NSURL *authURL = [NSURL URLWithString:url];
|
||||||
|
if(authURL.isTimeOTPURL) {
|
||||||
|
self.urlTextField.stringValue = authURL.absoluteString;
|
||||||
|
self.qrCodeImageView.image = [NSImage QRCodeImageWithString:authURL.absoluteString];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* secret */
|
/* secret */
|
||||||
NSString *secret = [self.generator.key base32EncodedString];
|
NSString *secret = [self.generator.key base32EncodedString];
|
||||||
@@ -83,4 +100,8 @@
|
|||||||
self.urlTextField.stringValue = otpURL.absoluteString;
|
self.urlTextField.stringValue = otpURL.absoluteString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)_updateView:(MPOTPUpdateSource)source {
|
||||||
|
// TODO: implement update
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<customView misplaced="YES" id="Hz6-mo-xeY">
|
<customView id="Hz6-mo-xeY">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="354" height="258"/>
|
<rect key="frame" x="0.0" y="0.0" width="354" height="258"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
@@ -64,13 +64,13 @@
|
|||||||
<constraint firstAttribute="width" constant="64" id="MhV-Ye-bQt"/>
|
<constraint firstAttribute="width" constant="64" id="MhV-Ye-bQt"/>
|
||||||
<constraint firstAttribute="height" constant="64" id="RRz-CV-k1H"/>
|
<constraint firstAttribute="height" constant="64" id="RRz-CV-k1H"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<imageCell key="cell" selectable="YES" editable="YES" enabled="NO" alignment="left" imageScaling="proportionallyDown" imageFrameStyle="grayBezel" id="BXB-xr-hqw"/>
|
<imageCell key="cell" selectable="YES" editable="YES" alignment="left" imageScaling="proportionallyDown" imageFrameStyle="grayBezel" id="BXB-xr-hqw"/>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="parseQRCode:" target="-2" id="5u9-xL-Haj"/>
|
<action selector="parseQRCode:" target="-2" id="5u9-xL-Haj"/>
|
||||||
</connections>
|
</connections>
|
||||||
</imageView>
|
</imageView>
|
||||||
</gridCell>
|
</gridCell>
|
||||||
<gridCell row="T2o-We-WjN" column="aZO-dP-SsW" id="0bn-HV-7V1">
|
<gridCell row="T2o-We-WjN" column="aZO-dP-SsW" xPlacement="leading" id="0bn-HV-7V1">
|
||||||
<button key="contentView" horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rsG-zm-Myq">
|
<button key="contentView" horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rsG-zm-Myq">
|
||||||
<rect key="frame" x="212" y="168" width="27" height="26"/>
|
<rect key="frame" x="212" y="168" width="27" height="26"/>
|
||||||
<buttonCell key="cell" type="disclosure" bezelStyle="roundedDisclosure" imagePosition="only" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="FzY-tZ-mVy">
|
<buttonCell key="cell" type="disclosure" bezelStyle="roundedDisclosure" imagePosition="only" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="FzY-tZ-mVy">
|
||||||
|
|||||||
Reference in New Issue
Block a user