diff --git a/MacPass/MPTOTPSetupViewController.m b/MacPass/MPTOTPSetupViewController.m
index 80e76dce..ea2a17e9 100644
--- a/MacPass/MPTOTPSetupViewController.m
+++ b/MacPass/MPTOTPSetupViewController.m
@@ -48,42 +48,7 @@ typedef NS_ENUM(NSUInteger, MPOTPType) {
[super viewDidLoad];
NSAssert([self.representedObject isKindOfClass:KPKEntry.class], @"represented object needs to be a KPKEntry");
- /* algorithm */
- NSMenuItem *sha1Item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"HASH_SHA1", "SHA 1 hash algoritm menu item") action:NULL keyEquivalent:@""];
- sha1Item.tag = KPKOTPHashAlgorithmSha1;
- NSMenuItem *sha256Item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"HASH_SHA256", "SHA 256 hash algoritm menu item") action:NULL keyEquivalent:@""];
- sha256Item.tag = KPKOTPHashAlgorithmSha256;
- NSMenuItem *sha512Item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"HASH_SHA512", "SHA 512 hash algoritm menu item") action:NULL keyEquivalent:@""];
- sha512Item.tag = KPKOTPHashAlgorithmSha512;
-
- NSAssert(self.algorithmPopUpButton.menu.numberOfItems == 0, @"Hash algorithm menu needs to be empty");
- [self.algorithmPopUpButton.menu addItem:sha1Item];
- [self.algorithmPopUpButton.menu addItem:sha256Item];
- [self.algorithmPopUpButton.menu addItem:sha512Item];
-
- /* digits */
- NSAssert(self.digitCountPopUpButton.menu.numberOfItems == 0, @"Digit menu needs to be empty");
- for(NSUInteger digit = 6; digit <= 8; digit++) {
- NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%ld", digit] action:NULL keyEquivalent:@""];
- item.tag = digit;
- [self.digitCountPopUpButton.menu addItem:item];
- }
-
- NSAssert(self.typePopUpButton.menu.numberOfItems == 0, @"Type menu needs to be empty!");
- NSMenuItem *rfcItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"OTP_RFC", @"OTP type RFC ") action:NULL keyEquivalent:@""];
- rfcItem.tag = MPOTPTypeRFC;
- NSMenuItem *steamItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"OTP_STEAM", @"OTP type Steam ") action:NULL keyEquivalent:@""];
- steamItem.tag = MPOTPTypeSteam;
- NSMenuItem *customItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"OTP_CUSTOM", @"OTP custom type ") action:NULL keyEquivalent:@""];
- customItem.tag = MPOTPTypeCustom;
-
- [self.typePopUpButton.menu addItem:rfcItem];
- [self.typePopUpButton.menu addItem:steamItem];
- [self.typePopUpButton.menu addItem:customItem];
-
- [self.timeStepTextField bind:NSValueBinding toObject:self withKeyPath:NSStringFromSelector(@selector(timeSlice)) options:nil];
- [self.timeStepStepper bind:NSValueBinding toObject:self withKeyPath:NSStringFromSelector(@selector(timeSlice)) options:nil];
-
+ [self _setupView];
[self _updateView:MPOTPUpdateSourceEntry];
}
@@ -108,6 +73,44 @@ typedef NS_ENUM(NSUInteger, MPOTPType) {
[self _updateView:MPOTPUpdateSourceQRImage];
}
+- (void)_setupView {
+ /* algorithm */
+ NSMenuItem *sha1Item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"HASH_SHA1", "SHA 1 hash algoritm menu item") action:NULL keyEquivalent:@""];
+ sha1Item.tag = KPKOTPHashAlgorithmSha1;
+ NSMenuItem *sha256Item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"HASH_SHA256", "SHA 256 hash algoritm menu item") action:NULL keyEquivalent:@""];
+ sha256Item.tag = KPKOTPHashAlgorithmSha256;
+ NSMenuItem *sha512Item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"HASH_SHA512", "SHA 512 hash algoritm menu item") action:NULL keyEquivalent:@""];
+ sha512Item.tag = KPKOTPHashAlgorithmSha512;
+
+ NSAssert(self.algorithmPopUpButton.menu.numberOfItems == 0, @"Hash algorithm menu needs to be empty");
+ [self.algorithmPopUpButton.menu addItem:sha1Item];
+ [self.algorithmPopUpButton.menu addItem:sha256Item];
+ [self.algorithmPopUpButton.menu addItem:sha512Item];
+
+ /* digits */
+ NSAssert(self.digitCountPopUpButton.menu.numberOfItems == 0, @"Digit menu needs to be empty");
+ for(NSUInteger digit = 6; digit <= 8; digit++) {
+ NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%ld", digit] action:NULL keyEquivalent:@""];
+ item.tag = digit;
+ [self.digitCountPopUpButton.menu addItem:item];
+ }
+
+ NSAssert(self.typePopUpButton.menu.numberOfItems == 0, @"Type menu needs to be empty!");
+ NSMenuItem *rfcItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"OTP_RFC", @"OTP type RFC ") action:NULL keyEquivalent:@""];
+ rfcItem.tag = MPOTPTypeRFC;
+ NSMenuItem *steamItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"OTP_STEAM", @"OTP type Steam ") action:NULL keyEquivalent:@""];
+ steamItem.tag = MPOTPTypeSteam;
+ NSMenuItem *customItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"OTP_CUSTOM", @"OTP custom type ") action:NULL keyEquivalent:@""];
+ customItem.tag = MPOTPTypeCustom;
+
+ [self.typePopUpButton.menu addItem:rfcItem];
+ [self.typePopUpButton.menu addItem:steamItem];
+ [self.typePopUpButton.menu addItem:customItem];
+
+ [self.timeStepTextField bind:NSValueBinding toObject:self withKeyPath:NSStringFromSelector(@selector(timeSlice)) options:nil];
+ [self.timeStepStepper bind:NSValueBinding toObject:self withKeyPath:NSStringFromSelector(@selector(timeSlice)) options:nil];
+}
+
- (void)_updateView:(MPOTPUpdateSource)source {
/*
MPOTPUpdateSourceQRImage,
diff --git a/MacPass/MPTOTPSetupViewController.xib b/MacPass/MPTOTPSetupViewController.xib
index d4f0de0e..f1a00f03 100644
--- a/MacPass/MPTOTPSetupViewController.xib
+++ b/MacPass/MPTOTPSetupViewController.xib
@@ -26,7 +26,7 @@
-
+
@@ -51,7 +51,7 @@
-
+
@@ -61,7 +61,7 @@
-
+
@@ -75,7 +75,7 @@
-
+
@@ -85,7 +85,7 @@
-
+
@@ -99,7 +99,7 @@
-
+
@@ -107,9 +107,9 @@
-
+
-
+
@@ -117,10 +117,10 @@
-
+
-
+
@@ -130,7 +130,7 @@
-
+
@@ -141,7 +141,7 @@
-
+
@@ -151,7 +151,7 @@
-
+
@@ -162,7 +162,7 @@
-
+
@@ -172,7 +172,7 @@
-
+
@@ -182,13 +182,13 @@
-
+
-
+
@@ -198,7 +198,7 @@
-
+
@@ -210,14 +210,14 @@