From 15798f7e38ead50c093c8221adb934c61f99bcc5 Mon Sep 17 00:00:00 2001 From: Nakagami Mai Date: Tue, 5 Oct 2021 23:23:38 +0900 Subject: [PATCH 01/11] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E3=81=B8=E3=81=AE=E9=81=B7=E7=A7=BB=E3=81=A7=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 6 + .../Base.lproj/Main.storyboard | 43 ++++++- OneTimePasswordExample/SettingController.h | 16 +++ OneTimePasswordExample/SettingController.m | 118 ++++++++++++++++++ Podfile.lock | 2 +- Setting Controller.m | 8 ++ 6 files changed, 189 insertions(+), 4 deletions(-) create mode 100644 OneTimePasswordExample/SettingController.h create mode 100644 OneTimePasswordExample/SettingController.m create mode 100644 Setting Controller.m diff --git a/OneTimePasswordExample.xcodeproj/project.pbxproj b/OneTimePasswordExample.xcodeproj/project.pbxproj index 83174b4..ee63085 100644 --- a/OneTimePasswordExample.xcodeproj/project.pbxproj +++ b/OneTimePasswordExample.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ 08C8E27826BBA377006D4608 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 08C8E27726BBA377006D4608 /* Assets.xcassets */; }; 08C8E27B26BBA377006D4608 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 08C8E27926BBA377006D4608 /* LaunchScreen.storyboard */; }; 08C8E27E26BBA377006D4608 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 08C8E27D26BBA377006D4608 /* main.m */; }; + 4F8B41252703520D00CF6A1A /* SettingController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8B41242703520D00CF6A1A /* SettingController.m */; }; 9A376FD397E03D93D3D80530 /* libPods-OneTimePasswordExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C08B5529218DAFE111F19B53 /* libPods-OneTimePasswordExample.a */; }; /* End PBXBuildFile section */ @@ -30,6 +31,8 @@ 08C8E27A26BBA377006D4608 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 08C8E27C26BBA377006D4608 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 08C8E27D26BBA377006D4608 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 4F8B41242703520D00CF6A1A /* SettingController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SettingController.m; sourceTree = ""; }; + 4F8B4126270484D900CF6A1A /* SettingController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SettingController.h; sourceTree = ""; }; 62EA47A9FA5474BBDDECC144 /* Pods-OneTimePasswordExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneTimePasswordExample.debug.xcconfig"; path = "Target Support Files/Pods-OneTimePasswordExample/Pods-OneTimePasswordExample.debug.xcconfig"; sourceTree = ""; }; C08B5529218DAFE111F19B53 /* libPods-OneTimePasswordExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OneTimePasswordExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; C0CF9A46AE07C0F1865C69D3 /* Pods-OneTimePasswordExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneTimePasswordExample.release.xcconfig"; path = "Target Support Files/Pods-OneTimePasswordExample/Pods-OneTimePasswordExample.release.xcconfig"; sourceTree = ""; }; @@ -74,6 +77,8 @@ 08C8E26F26BBA376006D4608 /* SceneDelegate.m */, 08C8E27126BBA376006D4608 /* ViewController.h */, 08C8E27226BBA376006D4608 /* ViewController.m */, + 4F8B41242703520D00CF6A1A /* SettingController.m */, + 4F8B4126270484D900CF6A1A /* SettingController.h */, 08C8E27426BBA376006D4608 /* Main.storyboard */, 08C8E27726BBA377006D4608 /* Assets.xcassets */, 08C8E27926BBA377006D4608 /* LaunchScreen.storyboard */, @@ -197,6 +202,7 @@ files = ( 08C8E27326BBA376006D4608 /* ViewController.m in Sources */, 08C8E26D26BBA376006D4608 /* AppDelegate.m in Sources */, + 4F8B41252703520D00CF6A1A /* SettingController.m in Sources */, 08C8E27E26BBA377006D4608 /* main.m in Sources */, 08C8E27026BBA376006D4608 /* SceneDelegate.m in Sources */, ); diff --git a/OneTimePasswordExample/Base.lproj/Main.storyboard b/OneTimePasswordExample/Base.lproj/Main.storyboard index 5baab28..c15d789 100644 --- a/OneTimePasswordExample/Base.lproj/Main.storyboard +++ b/OneTimePasswordExample/Base.lproj/Main.storyboard @@ -1,8 +1,9 @@ - + - + + @@ -29,16 +30,27 @@ + + + + @@ -48,7 +60,32 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OneTimePasswordExample/SettingController.h b/OneTimePasswordExample/SettingController.h new file mode 100644 index 0000000..2e0ebdf --- /dev/null +++ b/OneTimePasswordExample/SettingController.h @@ -0,0 +1,16 @@ +// +// SettingController.h +// OneTimePasswordExample +// +// Created by Mai Nakagami on 2021/09/29. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SettingController : UITableViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/OneTimePasswordExample/SettingController.m b/OneTimePasswordExample/SettingController.m new file mode 100644 index 0000000..f977960 --- /dev/null +++ b/OneTimePasswordExample/SettingController.m @@ -0,0 +1,118 @@ +// +// SettingController.m +// OneTimePasswordExample +// +// Created by Mai Nakagami on 2021/09/28. +// + +#import "SettingController.h" + +#pragma mark - Settings item + +typedef NS_ENUM(UInt8, SettingsItem) { + SettingsItem1, + SettingsItem2, + SettingsItme3, +}; + +extern SettingsItem SettingsItemUnknown; + + +#pragma mark - Settings table view controller + +@interface SettingController () + +@property (nonatomic) SettingsItem settingsItem; + +@property (nonatomic) UIPickerView *pickerView; + +@property (nonatomic) NSArray *test1Patterns; +@property (nonatomic) NSArray *test2Patterns; +@property (nonatomic) NSArray *test3Patterns; + +@property (nonatomic) NSString *test1; +@property (nonatomic) NSString *test2; +@property (nonatomic) NSString *test3; + +@end + +@implementation SettingController + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.pickerView = [[UIPickerView alloc] init]; + self.pickerView.center = self.view.center; + self.pickerView.dataSource = self; + self.pickerView.delegate = self; + [self.view addSubview: self.pickerView]; + + self.test1Patterns = @[@"1", @"2", @"3"]; + self.test2Patterns = @[@"4", @"5", @"6"]; + self.test3Patterns = @[@"7", @"8", @"9"]; + + self.test1 = self.test1Patterns[0]; + self.test2 = self.test2Patterns[0]; + self.test3 = self.test3Patterns[0]; +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return 3; +} + +#pragma mark - Table view delegate + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + [self.pickerView selectRow:0 inComponent:0 animated:true]; + [self.pickerView reloadAllComponents]; + self.settingsItem = indexPath.row; +} + +#pragma mark - Picker view data source + +- (NSInteger)numberOfComponentsInPickerView:(nonnull UIPickerView *)pickerView { + return 1; +} + +- (NSInteger)pickerView:(nonnull UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { + return 3; +} + +#pragma mark - Picker view delegate + +- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { + switch (self.settingsItem) { + case SettingsItem1: + return self.test1Patterns[row]; + case SettingsItem2: + return self.test2Patterns[row]; + case SettingsItme3: + return self.test3Patterns[row]; + } + + return @""; +} + +- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { + switch (self.settingsItem) { + case SettingsItem1: + self.test1 = self.test1Patterns[row]; + break; + case SettingsItem2: + self.test2 = self.test2Patterns[row]; + break; + case SettingsItme3: + self.test3 = self.test3Patterns[row]; + break; + } + + [self.tableView reloadData]; +} +@end + diff --git a/Podfile.lock b/Podfile.lock index 4a2419f..ff91346 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -21,4 +21,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 07904d67eb13b9136ed0ec5bcece3229fe2f25a7 -COCOAPODS: 1.10.2 +COCOAPODS: 1.11.0 diff --git a/Setting Controller.m b/Setting Controller.m new file mode 100644 index 0000000..4511269 --- /dev/null +++ b/Setting Controller.m @@ -0,0 +1,8 @@ +// +// Setting Controller.m +// OneTimePasswordExample +// +// Created by 岡慶太郎 on 2021/09/28. +// + +#import From 1e4b82cef67ed9bd2e6cae6d3858a39b98f8a589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B2=A1=E6=85=B6=E5=A4=AA=E9=83=8E?= Date: Thu, 30 Sep 2021 23:05:51 +0900 Subject: [PATCH 02/11] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E3=81=B8=E3=81=AE=E9=81=B7=E7=A7=BB=E3=81=A7=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OneTimePasswordExample/SettingTableViewCell.h | 12 ++++++++++++ OneTimePasswordExample/SettingTableViewCell.m | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100644 OneTimePasswordExample/SettingTableViewCell.h create mode 100644 OneTimePasswordExample/SettingTableViewCell.m diff --git a/OneTimePasswordExample/SettingTableViewCell.h b/OneTimePasswordExample/SettingTableViewCell.h new file mode 100644 index 0000000..1e763a6 --- /dev/null +++ b/OneTimePasswordExample/SettingTableViewCell.h @@ -0,0 +1,12 @@ +// +// SettingTableViewCell.h +// OneTimePasswordExample +// +// Created by 岡慶太郎 on 2021/09/30. +// + +#ifndef SettingTableViewCell_h +#define SettingTableViewCell_h + + +#endif /* SettingTableViewCell_h */ diff --git a/OneTimePasswordExample/SettingTableViewCell.m b/OneTimePasswordExample/SettingTableViewCell.m new file mode 100644 index 0000000..bd3eaf4 --- /dev/null +++ b/OneTimePasswordExample/SettingTableViewCell.m @@ -0,0 +1,8 @@ +// +// SettingTableViewCell.m +// OneTimePasswordExample +// +// Created by 岡慶太郎 on 2021/09/30. +// + +#import From c32c0b7dac88a0079fb81f1fb74b9a49d4f2ae79 Mon Sep 17 00:00:00 2001 From: Nakagami Mai Date: Tue, 5 Oct 2021 23:27:06 +0900 Subject: [PATCH 03/11] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E3=81=B8=E3=81=AE=E9=81=B7=E7=A7=BB=E3=81=A7=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SettingTableViewCell.storyboard | 30 +++++++++++++++++++ .../SettingTableViewCell.xib | 18 +++++++++++ 2 files changed, 48 insertions(+) create mode 100644 OneTimePasswordExample/SettingTableViewCell.storyboard create mode 100644 OneTimePasswordExample/SettingTableViewCell.xib diff --git a/OneTimePasswordExample/SettingTableViewCell.storyboard b/OneTimePasswordExample/SettingTableViewCell.storyboard new file mode 100644 index 0000000..dd79351 --- /dev/null +++ b/OneTimePasswordExample/SettingTableViewCell.storyboard @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OneTimePasswordExample/SettingTableViewCell.xib b/OneTimePasswordExample/SettingTableViewCell.xib new file mode 100644 index 0000000..8b759e7 --- /dev/null +++ b/OneTimePasswordExample/SettingTableViewCell.xib @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + From d2e0a40e43203fe43d44745052de2e630308cce5 Mon Sep 17 00:00:00 2001 From: Nakagami Mai Date: Tue, 5 Oct 2021 22:21:33 +0900 Subject: [PATCH 04/11] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OneTimePasswordExample/SettingTableViewCell.h | 12 ---------- OneTimePasswordExample/SettingTableViewCell.m | 8 ------- .../SettingsTableViewCell.h | 19 +++++++++++++++ .../SettingsTableViewCell.m | 23 +++++++++++++++++++ 4 files changed, 42 insertions(+), 20 deletions(-) delete mode 100644 OneTimePasswordExample/SettingTableViewCell.h delete mode 100644 OneTimePasswordExample/SettingTableViewCell.m create mode 100644 OneTimePasswordExample/SettingsTableViewCell.h create mode 100644 OneTimePasswordExample/SettingsTableViewCell.m diff --git a/OneTimePasswordExample/SettingTableViewCell.h b/OneTimePasswordExample/SettingTableViewCell.h deleted file mode 100644 index 1e763a6..0000000 --- a/OneTimePasswordExample/SettingTableViewCell.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// SettingTableViewCell.h -// OneTimePasswordExample -// -// Created by 岡慶太郎 on 2021/09/30. -// - -#ifndef SettingTableViewCell_h -#define SettingTableViewCell_h - - -#endif /* SettingTableViewCell_h */ diff --git a/OneTimePasswordExample/SettingTableViewCell.m b/OneTimePasswordExample/SettingTableViewCell.m deleted file mode 100644 index bd3eaf4..0000000 --- a/OneTimePasswordExample/SettingTableViewCell.m +++ /dev/null @@ -1,8 +0,0 @@ -// -// SettingTableViewCell.m -// OneTimePasswordExample -// -// Created by 岡慶太郎 on 2021/09/30. -// - -#import diff --git a/OneTimePasswordExample/SettingsTableViewCell.h b/OneTimePasswordExample/SettingsTableViewCell.h new file mode 100644 index 0000000..84946b0 --- /dev/null +++ b/OneTimePasswordExample/SettingsTableViewCell.h @@ -0,0 +1,19 @@ +// +// SettingTableViewCell.h +// OneTimePasswordExample +// +// Created by MaiNakagami on 2021/09/30. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SettingsTableViewCell : UITableViewCell + +@property (weak, nonatomic) IBOutlet UILabel *titleLabel; +@property (weak, nonatomic) IBOutlet UILabel *valueLabel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/OneTimePasswordExample/SettingsTableViewCell.m b/OneTimePasswordExample/SettingsTableViewCell.m new file mode 100644 index 0000000..36d93ff --- /dev/null +++ b/OneTimePasswordExample/SettingsTableViewCell.m @@ -0,0 +1,23 @@ +// +// SettingTableViewCell.m +// OneTimePasswordExample +// +// Created by MaiNakagami on 2021/09/30. +// + +#import "SettingTableViewCell.h" + +@implementation SettingsTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end From d884330c43fdc8e92ac5e460d65cab756e6f709c Mon Sep 17 00:00:00 2001 From: Nakagami Mai Date: Tue, 5 Oct 2021 22:48:41 +0900 Subject: [PATCH 05/11] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OneTimePasswordExample/SettingController.m | 24 +++++++- .../SettingTableViewCell.xib | 55 +++++++++++++++---- .../SettingsTableViewCell.m | 2 +- 3 files changed, 68 insertions(+), 13 deletions(-) diff --git a/OneTimePasswordExample/SettingController.m b/OneTimePasswordExample/SettingController.m index f977960..aa89580 100644 --- a/OneTimePasswordExample/SettingController.m +++ b/OneTimePasswordExample/SettingController.m @@ -6,6 +6,7 @@ // #import "SettingController.h" +#import "SettingsTableViewCell.h" #pragma mark - Settings item @@ -66,6 +67,27 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger return 3; } +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + SettingsTableViewCell *cell = (SettingsTableViewCell *)[tableView dequeueReusableCellWithIdentifier: @"SettingsTableViewCell" forIndexPath:indexPath]; + + switch (indexPath.row) { + case 0: + cell.titleLabel.text = @"TEST1"; + cell.valueLabel.text = self.test1; + break; + case 1: + cell.titleLabel.text = @"TEST2"; + cell.valueLabel.text = self.test2; + break; + case 2: + cell.titleLabel.text = @"TEST3"; + cell.valueLabel.text = self.test3; + break; + } + + return cell; +} + #pragma mark - Table view delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { @@ -114,5 +136,5 @@ - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComp [self.tableView reloadData]; } -@end +@end diff --git a/OneTimePasswordExample/SettingTableViewCell.xib b/OneTimePasswordExample/SettingTableViewCell.xib index 8b759e7..631227f 100644 --- a/OneTimePasswordExample/SettingTableViewCell.xib +++ b/OneTimePasswordExample/SettingTableViewCell.xib @@ -1,18 +1,51 @@ - - + + + - - + + - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/OneTimePasswordExample/SettingsTableViewCell.m b/OneTimePasswordExample/SettingsTableViewCell.m index 36d93ff..40b44d4 100644 --- a/OneTimePasswordExample/SettingsTableViewCell.m +++ b/OneTimePasswordExample/SettingsTableViewCell.m @@ -5,7 +5,7 @@ // Created by MaiNakagami on 2021/09/30. // -#import "SettingTableViewCell.h" +#import "SettingsTableViewCell.h" @implementation SettingsTableViewCell From b29c2c6a6f0d229f9bccb5e48e94a523c6474158 Mon Sep 17 00:00:00 2001 From: Nakagami Mai Date: Tue, 5 Oct 2021 22:51:37 +0900 Subject: [PATCH 06/11] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 10 +++++++ .../Base.lproj/Main.storyboard | 26 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/OneTimePasswordExample.xcodeproj/project.pbxproj b/OneTimePasswordExample.xcodeproj/project.pbxproj index ee63085..635e20d 100644 --- a/OneTimePasswordExample.xcodeproj/project.pbxproj +++ b/OneTimePasswordExample.xcodeproj/project.pbxproj @@ -15,6 +15,8 @@ 08C8E27B26BBA377006D4608 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 08C8E27926BBA377006D4608 /* LaunchScreen.storyboard */; }; 08C8E27E26BBA377006D4608 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 08C8E27D26BBA377006D4608 /* main.m */; }; 4F8B41252703520D00CF6A1A /* SettingController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8B41242703520D00CF6A1A /* SettingController.m */; }; + 4F8B41292705F8CF00CF6A1A /* SettingsTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8B41282705F8CF00CF6A1A /* SettingsTableViewCell.m */; }; + 4F8B412D2709A50E00CF6A1A /* SettingTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4F8B412C2709A50E00CF6A1A /* SettingTableViewCell.xib */; }; 9A376FD397E03D93D3D80530 /* libPods-OneTimePasswordExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C08B5529218DAFE111F19B53 /* libPods-OneTimePasswordExample.a */; }; /* End PBXBuildFile section */ @@ -33,6 +35,9 @@ 08C8E27D26BBA377006D4608 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 4F8B41242703520D00CF6A1A /* SettingController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SettingController.m; sourceTree = ""; }; 4F8B4126270484D900CF6A1A /* SettingController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SettingController.h; sourceTree = ""; }; + 4F8B41272705F8A900CF6A1A /* SettingsTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SettingsTableViewCell.h; sourceTree = ""; }; + 4F8B41282705F8CF00CF6A1A /* SettingsTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SettingsTableViewCell.m; sourceTree = ""; }; + 4F8B412C2709A50E00CF6A1A /* SettingTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SettingTableViewCell.xib; sourceTree = ""; }; 62EA47A9FA5474BBDDECC144 /* Pods-OneTimePasswordExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneTimePasswordExample.debug.xcconfig"; path = "Target Support Files/Pods-OneTimePasswordExample/Pods-OneTimePasswordExample.debug.xcconfig"; sourceTree = ""; }; C08B5529218DAFE111F19B53 /* libPods-OneTimePasswordExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OneTimePasswordExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; C0CF9A46AE07C0F1865C69D3 /* Pods-OneTimePasswordExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneTimePasswordExample.release.xcconfig"; path = "Target Support Files/Pods-OneTimePasswordExample/Pods-OneTimePasswordExample.release.xcconfig"; sourceTree = ""; }; @@ -71,6 +76,8 @@ 08C8E26A26BBA376006D4608 /* OneTimePasswordExample */ = { isa = PBXGroup; children = ( + 4F8B41272705F8A900CF6A1A /* SettingsTableViewCell.h */, + 4F8B41282705F8CF00CF6A1A /* SettingsTableViewCell.m */, 08C8E26B26BBA376006D4608 /* AppDelegate.h */, 08C8E26C26BBA376006D4608 /* AppDelegate.m */, 08C8E26E26BBA376006D4608 /* SceneDelegate.h */, @@ -80,6 +87,7 @@ 4F8B41242703520D00CF6A1A /* SettingController.m */, 4F8B4126270484D900CF6A1A /* SettingController.h */, 08C8E27426BBA376006D4608 /* Main.storyboard */, + 4F8B412C2709A50E00CF6A1A /* SettingTableViewCell.xib */, 08C8E27726BBA377006D4608 /* Assets.xcassets */, 08C8E27926BBA377006D4608 /* LaunchScreen.storyboard */, 08C8E27C26BBA377006D4608 /* Info.plist */, @@ -164,6 +172,7 @@ files = ( 08C8E27B26BBA377006D4608 /* LaunchScreen.storyboard in Resources */, 08C8E27826BBA377006D4608 /* Assets.xcassets in Resources */, + 4F8B412D2709A50E00CF6A1A /* SettingTableViewCell.xib in Resources */, 08C8E27626BBA376006D4608 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -202,6 +211,7 @@ files = ( 08C8E27326BBA376006D4608 /* ViewController.m in Sources */, 08C8E26D26BBA376006D4608 /* AppDelegate.m in Sources */, + 4F8B41292705F8CF00CF6A1A /* SettingsTableViewCell.m in Sources */, 4F8B41252703520D00CF6A1A /* SettingController.m in Sources */, 08C8E27E26BBA377006D4608 /* main.m in Sources */, 08C8E27026BBA376006D4608 /* SceneDelegate.m in Sources */, diff --git a/OneTimePasswordExample/Base.lproj/Main.storyboard b/OneTimePasswordExample/Base.lproj/Main.storyboard index c15d789..9455976 100644 --- a/OneTimePasswordExample/Base.lproj/Main.storyboard +++ b/OneTimePasswordExample/Base.lproj/Main.storyboard @@ -71,15 +71,39 @@ - + + + + + + + + + + + + + From 5a1ad3a5fb9f73300212295dedcb4fbee79cc6d1 Mon Sep 17 00:00:00 2001 From: Nakagami Mai Date: Thu, 7 Oct 2021 00:17:18 +0900 Subject: [PATCH 07/11] =?UTF-8?q?=E3=82=A2=E3=83=AB=E3=82=B4=E3=83=AA?= =?UTF-8?q?=E3=82=BA=E3=83=A0=E3=82=92=E9=81=B8=E6=8A=9E=E3=81=A7=E3=81=8D?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B=E3=80=80?= =?UTF-8?q?=E3=83=89=E3=83=A9=E3=83=A0=E3=81=AE=E8=A1=8C=E6=95=B0=E3=81=AE?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E3=81=A7=E3=82=A8=E3=83=A9=E3=83=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OneTimePasswordExample/SettingController.m | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/OneTimePasswordExample/SettingController.m b/OneTimePasswordExample/SettingController.m index aa89580..8580e35 100644 --- a/OneTimePasswordExample/SettingController.m +++ b/OneTimePasswordExample/SettingController.m @@ -48,9 +48,9 @@ - (void)viewDidLoad { self.pickerView.delegate = self; [self.view addSubview: self.pickerView]; - self.test1Patterns = @[@"1", @"2", @"3"]; - self.test2Patterns = @[@"4", @"5", @"6"]; - self.test3Patterns = @[@"7", @"8", @"9"]; + self.test1Patterns = @[@"SHA1", @"SHA256", @"SHA512"]; + self.test2Patterns = @[@"4", @"5", @"6", @"7", @"8", @"9", @"10"]; + self.test3Patterns = @[@"30", @"60"]; self.test1 = self.test1Patterns[0]; self.test2 = self.test2Patterns[0]; @@ -72,15 +72,15 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N switch (indexPath.row) { case 0: - cell.titleLabel.text = @"TEST1"; + cell.titleLabel.text = @"アルゴリズム"; cell.valueLabel.text = self.test1; break; case 1: - cell.titleLabel.text = @"TEST2"; + cell.titleLabel.text = @"OTP桁数"; cell.valueLabel.text = self.test2; break; case 2: - cell.titleLabel.text = @"TEST3"; + cell.titleLabel.text = @"タイムステップ数"; cell.valueLabel.text = self.test3; break; } @@ -103,7 +103,16 @@ - (NSInteger)numberOfComponentsInPickerView:(nonnull UIPickerView *)pickerView { } - (NSInteger)pickerView:(nonnull UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { - return 3; + switch (component) { + case 0: + return self.test1Patterns.count; + case 1: + return self.test2Patterns.count; + case 2: + return self.test3Patterns.count; + default: + return 0; + } } #pragma mark - Picker view delegate From dd88dbbf243772784287454f63060077e59680ab Mon Sep 17 00:00:00 2001 From: Nakagami Mai Date: Mon, 11 Oct 2021 22:58:55 +0900 Subject: [PATCH 08/11] =?UTF-8?q?=E3=82=A2=E3=83=AB=E3=82=B4=E3=83=AA?= =?UTF-8?q?=E3=82=BA=E3=83=A0=E3=82=92=E9=81=B8=E6=8A=9E=E3=81=A7=E3=81=8D?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B=20?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E4=BD=9C=E6=88=90=E5=AE=8C=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OneTimePasswordExample/SettingController.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/OneTimePasswordExample/SettingController.m b/OneTimePasswordExample/SettingController.m index 8580e35..a618eb3 100644 --- a/OneTimePasswordExample/SettingController.m +++ b/OneTimePasswordExample/SettingController.m @@ -37,7 +37,9 @@ @interface SettingController () @end -@implementation SettingController +@implementation SettingController { + NSIndexPath * pickerIndexPath; +} - (void)viewDidLoad { [super viewDidLoad]; @@ -91,9 +93,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N #pragma mark - Table view delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + self.settingsItem = indexPath.row; [self.pickerView selectRow:0 inComponent:0 animated:true]; [self.pickerView reloadAllComponents]; - self.settingsItem = indexPath.row; } #pragma mark - Picker view data source @@ -103,12 +105,12 @@ - (NSInteger)numberOfComponentsInPickerView:(nonnull UIPickerView *)pickerView { } - (NSInteger)pickerView:(nonnull UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { - switch (component) { - case 0: + switch (self.settingsItem) { + case SettingsItem1: return self.test1Patterns.count; - case 1: + case SettingsItem2: return self.test2Patterns.count; - case 2: + case SettingsItme3: return self.test3Patterns.count; default: return 0; From 56dae2b4423a9d8335b38699c5ec260918e1caca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=AD=E7=A5=9E=E8=88=9E?= Date: Wed, 13 Oct 2021 23:29:17 +0900 Subject: [PATCH 09/11] =?UTF-8?q?=E3=82=A2=E3=83=AB=E3=82=B4=E3=83=AA?= =?UTF-8?q?=E3=82=BA=E3=83=A0=E3=82=92=E9=81=B8=E6=8A=9E=E3=81=A7=E3=81=8D?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base.lproj/Main.storyboard | 23 +++++++++++++++++-- OneTimePasswordExample/ViewController.m | 4 +++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/OneTimePasswordExample/Base.lproj/Main.storyboard b/OneTimePasswordExample/Base.lproj/Main.storyboard index 9455976..8ddcb5e 100644 --- a/OneTimePasswordExample/Base.lproj/Main.storyboard +++ b/OneTimePasswordExample/Base.lproj/Main.storyboard @@ -35,7 +35,7 @@ - + @@ -105,10 +105,29 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/OneTimePasswordExample/ViewController.m b/OneTimePasswordExample/ViewController.m index 3dbfaaa..ff1fd30 100644 --- a/OneTimePasswordExample/ViewController.m +++ b/OneTimePasswordExample/ViewController.m @@ -36,10 +36,12 @@ - (void)initOneTimePasswordToken { NSString *name = @"..."; NSString *issuer = @"..."; NSString *secretString = @"..."; + OTPAlgorithm *algorithm = @"OTPAlgorithm algorithm"; NSData *secretData = [NSData dataWithBase32String:secretString]; - self.token = [OTPToken tokenWithType:OTPTokenTypeTimer secret:secretData name:name issuer:issuer ]; + self.token = [OTPToken tokenWithType:OTPTokenTypeTimer secret:secretData name:name issuer:issuer]; + self.token.algorithm = *algorithm; } - (void)initOneTimePasswordView { From ead77c41c7d93f7169fd1db82f42bf98da65340e Mon Sep 17 00:00:00 2001 From: Nakagami Mai Date: Thu, 14 Oct 2021 23:48:58 +0900 Subject: [PATCH 10/11] =?UTF-8?q?=E3=82=A2=E3=83=AB=E3=82=B4=E3=83=AA?= =?UTF-8?q?=E3=82=BA=E3=83=A0=E3=82=92=E6=8A=9E=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base.lproj/Main.storyboard | 65 +++++++++++++++---- OneTimePasswordExample/SettingController.h | 4 ++ OneTimePasswordExample/SettingController.m | 8 +-- OneTimePasswordExample/ViewController.h | 2 +- OneTimePasswordExample/ViewController.m | 5 +- 5 files changed, 63 insertions(+), 21 deletions(-) diff --git a/OneTimePasswordExample/Base.lproj/Main.storyboard b/OneTimePasswordExample/Base.lproj/Main.storyboard index 8ddcb5e..a72e003 100644 --- a/OneTimePasswordExample/Base.lproj/Main.storyboard +++ b/OneTimePasswordExample/Base.lproj/Main.storyboard @@ -12,7 +12,7 @@ - + @@ -35,9 +35,16 @@ - + + @@ -53,23 +60,34 @@ + + - + - + + @@ -109,26 +127,45 @@ - + + + + + + + + + + + + + + + + + + + + - - + + - - + - - - + + + - + + - + diff --git a/OneTimePasswordExample/SettingController.h b/OneTimePasswordExample/SettingController.h index 2e0ebdf..bf6b828 100644 --- a/OneTimePasswordExample/SettingController.h +++ b/OneTimePasswordExample/SettingController.h @@ -11,6 +11,10 @@ NS_ASSUME_NONNULL_BEGIN @interface SettingController : UITableViewController +@property (nonatomic) NSString *test1; +@property (nonatomic) NSString *test2; +@property (nonatomic) NSString *test3; + @end NS_ASSUME_NONNULL_END diff --git a/OneTimePasswordExample/SettingController.m b/OneTimePasswordExample/SettingController.m index a618eb3..bc91cf4 100644 --- a/OneTimePasswordExample/SettingController.m +++ b/OneTimePasswordExample/SettingController.m @@ -7,6 +7,7 @@ #import "SettingController.h" #import "SettingsTableViewCell.h" +#import "ViewController.h" #pragma mark - Settings item @@ -31,10 +32,6 @@ @interface SettingController () @property (nonatomic) NSArray *test2Patterns; @property (nonatomic) NSArray *test3Patterns; -@property (nonatomic) NSString *test1; -@property (nonatomic) NSString *test2; -@property (nonatomic) NSString *test3; - @end @implementation SettingController { @@ -133,9 +130,12 @@ - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row f } - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { + UIStoryboardSegue *segue; + ViewController *viewController = segue.destinationViewController; switch (self.settingsItem) { case SettingsItem1: self.test1 = self.test1Patterns[row]; + viewController.test.text = self.test1; break; case SettingsItem2: self.test2 = self.test2Patterns[row]; diff --git a/OneTimePasswordExample/ViewController.h b/OneTimePasswordExample/ViewController.h index 3cfd969..73dc68c 100644 --- a/OneTimePasswordExample/ViewController.h +++ b/OneTimePasswordExample/ViewController.h @@ -8,7 +8,7 @@ #import @interface ViewController : UIViewController - +@property (weak, nonatomic) IBOutlet UILabel *test; @end diff --git a/OneTimePasswordExample/ViewController.m b/OneTimePasswordExample/ViewController.m index ff1fd30..aeb6cdc 100644 --- a/OneTimePasswordExample/ViewController.m +++ b/OneTimePasswordExample/ViewController.m @@ -7,6 +7,7 @@ #import "ViewController.h" #import "OneTimePassword.h" +#import "SettingController.h" #import #import @@ -36,12 +37,12 @@ - (void)initOneTimePasswordToken { NSString *name = @"..."; NSString *issuer = @"..."; NSString *secretString = @"..."; - OTPAlgorithm *algorithm = @"OTPAlgorithm algorithm"; + SettingController *settingController; NSData *secretData = [NSData dataWithBase32String:secretString]; self.token = [OTPToken tokenWithType:OTPTokenTypeTimer secret:secretData name:name issuer:issuer]; - self.token.algorithm = *algorithm; + self.token.algorithm = @"OTPAlgorithm algorithm"; } - (void)initOneTimePasswordView { From 27c5ae796eb97a47a0af9683b2a96f0f5b157dbf Mon Sep 17 00:00:00 2001 From: Nakagami Mai Date: Sat, 16 Oct 2021 00:08:27 +0900 Subject: [PATCH 11/11] =?UTF-8?q?=E3=82=A2=E3=83=AB=E3=82=B4=E3=83=AA?= =?UTF-8?q?=E3=82=BA=E3=83=A0=E3=82=92=E9=81=B8=E6=8A=9E=E3=81=A7=E3=81=8D?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C=E3=80=80=E5=80=A4=E3=81=AE=E5=8F=97=E3=81=91=E6=B8=A1?= =?UTF-8?q?=E3=81=97=E5=AE=8C=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base.lproj/Main.storyboard | 52 ++----------------- OneTimePasswordExample/SettingController.m | 11 ++-- OneTimePasswordExample/ViewController.h | 4 +- OneTimePasswordExample/ViewController.m | 3 +- 4 files changed, 16 insertions(+), 54 deletions(-) diff --git a/OneTimePasswordExample/Base.lproj/Main.storyboard b/OneTimePasswordExample/Base.lproj/Main.storyboard index a72e003..4ed1ae6 100644 --- a/OneTimePasswordExample/Base.lproj/Main.storyboard +++ b/OneTimePasswordExample/Base.lproj/Main.storyboard @@ -35,16 +35,9 @@ - + - @@ -64,7 +57,6 @@ - @@ -76,7 +68,7 @@ - + @@ -129,44 +121,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OneTimePasswordExample/SettingController.m b/OneTimePasswordExample/SettingController.m index bc91cf4..a996bd6 100644 --- a/OneTimePasswordExample/SettingController.m +++ b/OneTimePasswordExample/SettingController.m @@ -130,12 +130,9 @@ - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row f } - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { - UIStoryboardSegue *segue; - ViewController *viewController = segue.destinationViewController; switch (self.settingsItem) { case SettingsItem1: self.test1 = self.test1Patterns[row]; - viewController.test.text = self.test1; break; case SettingsItem2: self.test2 = self.test2Patterns[row]; @@ -148,4 +145,12 @@ - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComp [self.tableView reloadData]; } +-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender +{ + ViewController *viewController = segue.destinationViewController; + viewController.test1 = self.test1; + viewController.test2 = self.test2; + viewController.test3 = self.test3; +} + @end diff --git a/OneTimePasswordExample/ViewController.h b/OneTimePasswordExample/ViewController.h index 73dc68c..0157d2d 100644 --- a/OneTimePasswordExample/ViewController.h +++ b/OneTimePasswordExample/ViewController.h @@ -8,7 +8,9 @@ #import @interface ViewController : UIViewController -@property (weak, nonatomic) IBOutlet UILabel *test; +@property (nonatomic) NSString *test1; +@property (nonatomic) NSString *test2; +@property (nonatomic) NSString *test3; @end diff --git a/OneTimePasswordExample/ViewController.m b/OneTimePasswordExample/ViewController.m index aeb6cdc..cb7b102 100644 --- a/OneTimePasswordExample/ViewController.m +++ b/OneTimePasswordExample/ViewController.m @@ -17,6 +17,7 @@ @interface ViewController () @property (weak, nonatomic) IBOutlet UILabel *oneTimePasswordLabel; @property (weak, nonatomic) IBOutlet UAProgressView *oneTimePasswordProgressView; +@property (weak, nonatomic) IBOutlet UILabel *test; @property (nonatomic, assign) CGFloat localProgress; @@ -31,13 +32,13 @@ - (void)viewDidLoad { [self initOneTimePasswordView]; [NSTimer scheduledTimerWithTimeInterval:0.03 target:self selector:@selector(updateOneTimePasswordView:) userInfo:nil repeats:YES]; + } - (void)initOneTimePasswordToken { NSString *name = @"..."; NSString *issuer = @"..."; NSString *secretString = @"..."; - SettingController *settingController; NSData *secretData = [NSData dataWithBase32String:secretString];