UI improvements

This commit is contained in:
Ali 2022-04-05 20:04:43 +04:00
parent c462b92952
commit fb0c10e29f
7 changed files with 16 additions and 2 deletions

View File

@ -18,5 +18,6 @@ typedef NS_ENUM(NSInteger, STPCardBrand) {
STPCardBrandDiscover, STPCardBrandDiscover,
STPCardBrandJCB, STPCardBrandJCB,
STPCardBrandDinersClub, STPCardBrandDinersClub,
STPCardBrandOther,
STPCardBrandUnknown, STPCardBrandUnknown,
}; };

View File

@ -19,6 +19,7 @@
case STPCardBrandMasterCard: return @"MasterCard"; case STPCardBrandMasterCard: return @"MasterCard";
case STPCardBrandUnknown: return @"Unknown"; case STPCardBrandUnknown: return @"Unknown";
case STPCardBrandVisa: return @"Visa"; case STPCardBrandVisa: return @"Visa";
case STPCardBrandOther: return @"Other";
} }
} }

View File

@ -66,7 +66,7 @@
@[@"492937", @"492937", @13, @(STPCardBrandVisa)], @[@"492937", @"492937", @13, @(STPCardBrandVisa)],
@[@"492939", @"492939", @13, @(STPCardBrandVisa)], @[@"492939", @"492939", @13, @(STPCardBrandVisa)],
@[@"492960", @"492960", @13, @(STPCardBrandVisa)], @[@"492960", @"492960", @13, @(STPCardBrandVisa)],
@[@"2", @"2", @16, @(STPCardBrandVisa)], @[@"2", @"2", @16, @(STPCardBrandOther)],
]; ];
NSMutableArray *binRanges = [NSMutableArray array]; NSMutableArray *binRanges = [NSMutableArray array];
for (NSArray *range in ranges) { for (NSArray *range in ranges) {

View File

@ -64,6 +64,8 @@
return STPCardBrandJCB; return STPCardBrandJCB;
} else if ([brand isEqualToString:@"diners club"]) { } else if ([brand isEqualToString:@"diners club"]) {
return STPCardBrandDinersClub; return STPCardBrandDinersClub;
} else if ([brand isEqualToString:@"other"]) {
return STPCardBrandOther;
} else { } else {
return STPCardBrandUnknown; return STPCardBrandUnknown;
} }
@ -114,6 +116,8 @@
return @"MasterCard"; return @"MasterCard";
case STPCardBrandVisa: case STPCardBrandVisa:
return @"Visa"; return @"Visa";
case STPCardBrandOther:
return @"Other";
default: default:
return @"Unknown"; return @"Unknown";
} }

View File

@ -51,6 +51,7 @@ NS_ASSUME_NONNULL_BEGIN
* An icon representing Visa. * An icon representing Visa.
*/ */
+ (UIImage *)visaCardImage; + (UIImage *)visaCardImage;
+ (UIImage *)otherCardImage;
/** /**
* An icon to use when the type of the card is unknown. * An icon to use when the type of the card is unknown.

View File

@ -48,6 +48,10 @@
return [self brandImageForCardBrand:STPCardBrandUnknown]; return [self brandImageForCardBrand:STPCardBrandUnknown];
} }
+ (UIImage *)otherCardCardImage {
return [self brandImageForCardBrand:STPCardBrandUnknown];
}
+ (UIImage *)brandImageForCardBrand:(STPCardBrand)brand { + (UIImage *)brandImageForCardBrand:(STPCardBrand)brand {
return [self brandImageForCardBrand:brand template:NO]; return [self brandImageForCardBrand:brand template:NO];
} }
@ -140,6 +144,9 @@
break; break;
case STPCardBrandVisa: case STPCardBrandVisa:
imageName = shouldUseTemplate ? @"stp_card_visa_template" : @"stp_card_visa"; imageName = shouldUseTemplate ? @"stp_card_visa_template" : @"stp_card_visa";
case STPCardBrandOther:
shouldUseTemplate = YES;
imageName = @"stp_card_placeholder_template";
break; break;
} }
UIImage *image = [self safeImageNamed:imageName UIImage *image = [self safeImageNamed:imageName

View File

@ -377,7 +377,7 @@ final class ChatPinnedMessageTitlePanelNode: ChatTitleAccessoryPanelNode {
self.listButton.layer.animateScale(from: 1.0, to: 0.01, duration: 0.2, removeOnCompletion: false) self.listButton.layer.animateScale(from: 1.0, to: 0.01, duration: 0.2, removeOnCompletion: false)
} }
} else { } else {
self.listButton.isHidden = !displayCloseButton self.listButton.isHidden = !displayListButton
self.listButton.layer.removeAllAnimations() self.listButton.layer.removeAllAnimations()
} }
} }