Skip to content

Commit 31f721e

Browse files
author
Денис Морозов
committed
Fix CR
1 parent a295887 commit 31f721e

6 files changed

Lines changed: 23 additions & 22 deletions

File tree

FTCTextEntryFormatting.xcodeproj/project.pbxproj

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
/* Begin PBXBuildFile section */
1010
21591A1641163D3E4D1A1F34 /* FTCDigitsInputFilterTestCaseWithZeroMaxLength.m in Sources */ = {isa = PBXBuildFile; fileRef = F515E4501F5D58CD00AEEC8C /* FTCDigitsInputFilterTestCaseWithZeroMaxLength.m */; };
11+
B10523501F84C4B6002B3F61 /* FTCDigitsInputFilterTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = B105234E1F84C497002B3F61 /* FTCDigitsInputFilterTestCase.m */; };
12+
B10523531F84C655002B3F61 /* FTCTextEntryFormattingConfigFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = B10523511F84C655002B3F61 /* FTCTextEntryFormattingConfigFactory.h */; };
13+
B10523541F84C655002B3F61 /* FTCTextEntryFormattingConfigFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = B10523521F84C655002B3F61 /* FTCTextEntryFormattingConfigFactory.m */; };
1114
B1EBF8E71F2315F90014F4CB /* FTCTextEntryFormatting.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B1EBF8DD1F2315F90014F4CB /* FTCTextEntryFormatting.framework */; };
1215
B1EBF9441F2316410014F4CB /* FTCNoFormattingFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = B1EBF9001F2316410014F4CB /* FTCNoFormattingFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; };
1316
B1EBF9451F2316410014F4CB /* FTCNoFormattingFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = B1EBF9011F2316410014F4CB /* FTCNoFormattingFormatter.m */; };
@@ -66,7 +69,6 @@
6669
B1EBF9DF1F231C190014F4CB /* FTCPostfixFormatterTestCaseWithNotEmptyPostfix.m in Sources */ = {isa = PBXBuildFile; fileRef = B1EBF9D71F231C190014F4CB /* FTCPostfixFormatterTestCaseWithNotEmptyPostfix.m */; };
6770
CCC1C0B14A2C0AF523465DB5 /* FTCMaskFormatterGenericConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = CCC1C3A298D5610F9EAECBC1 /* FTCMaskFormatterGenericConfig.h */; settings = {ATTRIBUTES = (Public, ); }; };
6871
CCC1CD063EECBF9CCDDE12F9 /* FTCMaskFormatterGenericConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = CCC1CD7598485396BE2F9CEF /* FTCMaskFormatterGenericConfig.m */; };
69-
F5859D5F1F5E4E1D00607B61 /* FTCDigitsInputFilterTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = F5859D5E1F5E4E1D00607B61 /* FTCDigitsInputFilterTestCase.m */; };
7072
/* End PBXBuildFile section */
7173

7274
/* Begin PBXContainerItemProxy section */
@@ -80,6 +82,9 @@
8082
/* End PBXContainerItemProxy section */
8183

8284
/* Begin PBXFileReference section */
85+
B105234E1F84C497002B3F61 /* FTCDigitsInputFilterTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FTCDigitsInputFilterTestCase.m; path = InputFilter/FTCDigitsInputFilterTestCase.m; sourceTree = "<group>"; };
86+
B10523511F84C655002B3F61 /* FTCTextEntryFormattingConfigFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTCTextEntryFormattingConfigFactory.h; sourceTree = "<group>"; };
87+
B10523521F84C655002B3F61 /* FTCTextEntryFormattingConfigFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FTCTextEntryFormattingConfigFactory.m; sourceTree = "<group>"; };
8388
B1370D1E1F4E849800E8EBA3 /* FTCTextEntryFormatting-prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FTCTextEntryFormatting-prefix.pch"; sourceTree = "<group>"; };
8489
B1EBF8DD1F2315F90014F4CB /* FTCTextEntryFormatting.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FTCTextEntryFormatting.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8590
B1EBF8E61F2315F90014F4CB /* FTCTextEntryFormattingTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FTCTextEntryFormattingTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -144,7 +149,6 @@
144149
CCC1C3A298D5610F9EAECBC1 /* FTCMaskFormatterGenericConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTCMaskFormatterGenericConfig.h; sourceTree = "<group>"; };
145150
CCC1CD7598485396BE2F9CEF /* FTCMaskFormatterGenericConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FTCMaskFormatterGenericConfig.m; sourceTree = "<group>"; };
146151
F515E4501F5D58CD00AEEC8C /* FTCDigitsInputFilterTestCaseWithZeroMaxLength.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FTCDigitsInputFilterTestCaseWithZeroMaxLength.m; path = InputFilter/FTCDigitsInputFilterTestCaseWithZeroMaxLength.m; sourceTree = "<group>"; };
147-
F5859D5E1F5E4E1D00607B61 /* FTCDigitsInputFilterTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FTCDigitsInputFilterTestCase.m; path = FormatCoordinator/FTCDigitsInputFilterTestCase.m; sourceTree = "<group>"; };
148152
/* End PBXFileReference section */
149153

150154
/* Begin PBXFrameworksBuildPhase section */
@@ -201,6 +205,8 @@
201205
B1EBF8FB1F2316410014F4CB /* Src */ = {
202206
isa = PBXGroup;
203207
children = (
208+
B10523511F84C655002B3F61 /* FTCTextEntryFormattingConfigFactory.h */,
209+
B10523521F84C655002B3F61 /* FTCTextEntryFormattingConfigFactory.m */,
204210
B1EBF8FE1F2316410014F4CB /* Core */,
205211
B1EBF92D1F2316410014F4CB /* Money */,
206212
B1EBF93C1F2316410014F4CB /* Tools */,
@@ -375,7 +381,7 @@
375381
F515E4521F5D58D200AEEC8C /* InputFilter */ = {
376382
isa = PBXGroup;
377383
children = (
378-
F5859D5E1F5E4E1D00607B61 /* FTCDigitsInputFilterTestCase.m */,
384+
B105234E1F84C497002B3F61 /* FTCDigitsInputFilterTestCase.m */,
379385
F515E4501F5D58CD00AEEC8C /* FTCDigitsInputFilterTestCaseWithZeroMaxLength.m */,
380386
);
381387
name = InputFilter;
@@ -390,6 +396,7 @@
390396
files = (
391397
B1EBF9751F2316410014F4CB /* FTCMoneyEntryNotEditingInputFilter.h in Headers */,
392398
B1EBF9731F2316410014F4CB /* FTCMoneyEntryNotEditingFormatter.h in Headers */,
399+
B10523531F84C655002B3F61 /* FTCTextEntryFormattingConfigFactory.h in Headers */,
393400
B1EBF9551F2316410014F4CB /* FTCFilteredString.h in Headers */,
394401
B1EBF9711F2316410014F4CB /* FTCMoneyEntryFormatUtils.h in Headers */,
395402
B1EBF94C1F2316410014F4CB /* FTCTextEntry.h in Headers */,
@@ -523,6 +530,7 @@
523530
B1EBF9561F2316410014F4CB /* FTCFilteredString.m in Sources */,
524531
B1EBF95C1F2316410014F4CB /* FTCLimitedLengthInputFilter.m in Sources */,
525532
B1EBF9501F2316410014F4CB /* FTCTextEntryFormatCoordinatorHelper.m in Sources */,
533+
B10523541F84C655002B3F61 /* FTCTextEntryFormattingConfigFactory.m in Sources */,
526534
B1EBF9451F2316410014F4CB /* FTCNoFormattingFormatter.m in Sources */,
527535
B1EBF96C1F2316410014F4CB /* FTCIntegralMoneyAmountEntryNotEditingInputFilter.m in Sources */,
528536
B1EBF9481F2316410014F4CB /* FTCMaskFormatter.m in Sources */,
@@ -549,7 +557,7 @@
549557
buildActionMask = 2147483647;
550558
files = (
551559
B1EBF9DA1F231C190014F4CB /* FTCMaskFormatterTestCase.m in Sources */,
552-
F5859D5F1F5E4E1D00607B61 /* FTCDigitsInputFilterTestCase.m in Sources */,
560+
B10523501F84C4B6002B3F61 /* FTCDigitsInputFilterTestCase.m in Sources */,
553561
B1EBF9DE1F231C190014F4CB /* FTCPostfixFormatterTestCaseWithNilPostfix.m in Sources */,
554562
B1EBF9DF1F231C190014F4CB /* FTCPostfixFormatterTestCaseWithNotEmptyPostfix.m in Sources */,
555563
B1EBF9DD1F231C190014F4CB /* FTCPostfixFormatterTestCaseWithEmptyPostfix.m in Sources */,

Src/Core/Formatting/MaskFormatter/FTCMaskFormatterGenericConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
2626

2727
@property (nonatomic, readwrite) BOOL cutTail; // default NO
2828

29-
- (instancetype)initWithFormat:(NSString *)format NS_DESIGNATED_INITIALIZER;
29+
- (instancetype)initWithMask:(NSString *)mask maskCharacter:(NSString *)maskCharacter NS_DESIGNATED_INITIALIZER;
3030

3131
- (instancetype)init NS_UNAVAILABLE;
3232

Src/Core/Formatting/MaskFormatter/FTCMaskFormatterGenericConfig.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ @implementation FTCMaskFormatterGenericConfig
2626
@synthesize maskCharacter = _maskCharacter;
2727
@synthesize countMaskCharacters = _countMaskCharacters;
2828

29-
- (instancetype)initWithFormat:(NSString *)format
29+
- (instancetype)initWithMask:(NSString *)mask maskCharacter:(NSString *)maskCharacter
3030
{
31-
assert( nil != format );
32-
assert( format.length > 1 );
31+
assert( nil != mask );
32+
assert( maskCharacter.length == 1 );
3333

3434
self = [super init];
3535

36-
_mask = [format substringFromIndex:1];
37-
_maskCharacter = [format characterAtIndex:0];
36+
_mask = mask;
37+
_maskCharacter = [maskCharacter characterAtIndex:0];
3838
_cutTail = NO;
3939

4040
NSUInteger countMaskCharacters = 0;

Src/FTCTextEntryFormattingConfigFactory.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ NS_ASSUME_NONNULL_BEGIN
99

1010
@interface FTCTextEntryFormattingConfigFactory : NSObject
1111

12-
+ (FTCTextEntryFormattingConfig *)mobilePhoneConfigWithFormat:(NSString *)format NS_SWIFT_NAME( mobilePhoneConfig(with:) );
1312
+ (FTCTextEntryFormattingConfig *)mobilePhoneConfigWithMask:(NSString *)mask
14-
maskChar:(unichar)maskChar NS_SWIFT_NAME( mobilePhoneConfig(with:maskChar:) );
13+
maskChar:(NSString *)maskChar NS_SWIFT_NAME( mobilePhoneConfig(with:maskChar:) );
1514

1615
+ (FTCTextEntryFormattingConfig *)moneyConfigWithCurrency:(nullable NSString *)currency
1716
onlyIntegral:(BOOL)onlyIntegral NS_SWIFT_NAME( moneyConfig(with:onlyIntegral:) );

Src/FTCTextEntryFormattingConfigFactory.m

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
@implementation FTCTextEntryFormattingConfigFactory
1919

20-
+ (FTCTextEntryFormattingConfig *)mobilePhoneConfigWithFormat:(NSString *)format
20+
+ (FTCTextEntryFormattingConfig *)mobilePhoneConfigWithMask:(NSString *)mask maskChar:(NSString *)maskChar
2121
{
22-
__auto_type maskConfig = [[FTCMaskFormatterGenericConfig alloc] initWithFormat:format];
22+
__auto_type maskConfig = [[FTCMaskFormatterGenericConfig alloc] initWithMask:mask maskCharacter:maskChar];
2323

2424
__auto_type maskFormatter = [[FTCMaskFormatter alloc] initWithConfig:maskConfig];
2525
__auto_type inputFilter = [[FTCDigitsValueFilter alloc] initWithMaxLength:maskConfig.countMaskCharacters];
@@ -34,12 +34,6 @@ + (FTCTextEntryFormattingConfig *)mobilePhoneConfigWithFormat:(NSString *)format
3434
return formattingConfig;
3535
}
3636

37-
+ (FTCTextEntryFormattingConfig *)mobilePhoneConfigWithMask:(NSString *)mask
38-
maskChar:(unichar)maskChar
39-
{
40-
return [self mobilePhoneConfigWithFormat:[NSString stringWithFormat:@"%c%@", maskChar, mask]];
41-
}
42-
4337
+ (FTCTextEntryFormattingConfig *)moneyConfigWithCurrency:(nullable NSString *)currency onlyIntegral:(BOOL)onlyIntegral
4438
{
4539
__auto_type formattingConfig = [[FTCTextEntryFormattingConfig alloc] init];

UnitTests/Formatters/FTCMaskFormatter/FTCMaskFormatterTestCase.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ - (void)setUp
3535
{
3636
[super setUp];
3737

38-
FTCMaskFormatterGenericConfig *configWithCutTail = [[FTCMaskFormatterGenericConfig alloc] initWithFormat:@"__ _ _ _ _"];
38+
FTCMaskFormatterGenericConfig *configWithCutTail = [[FTCMaskFormatterGenericConfig alloc] initWithMask:@"_ _ _ _ _" maskCharacter:@"_"];
3939
configWithCutTail.cutTail = YES;
4040

4141
formatterWithCutTail = [[FTCMaskFormatter alloc] initWithConfig:configWithCutTail];
4242

43-
FTCMaskFormatterGenericConfig *configWithoutCutTail = [[FTCMaskFormatterGenericConfig alloc] initWithFormat:@"__ _ _ _ _"];
43+
FTCMaskFormatterGenericConfig *configWithoutCutTail = [[FTCMaskFormatterGenericConfig alloc] initWithMask:@"_ _ _ _ _" maskCharacter:@"_"];
4444
configWithoutCutTail.cutTail = NO;
4545

4646
formatterWithoutCutTail = [[FTCMaskFormatter alloc] initWithConfig:configWithoutCutTail];

0 commit comments

Comments
 (0)