mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
fixed the build again (removed all generic collections)
This commit is contained in:
@@ -41,7 +41,7 @@
|
|||||||
* | ASTextNode ASTextNode ASTextNode |
|
* | ASTextNode ASTextNode ASTextNode |
|
||||||
* ----------------------------------------
|
* ----------------------------------------
|
||||||
*/
|
*/
|
||||||
+ (NSString *)horizontalBoxStringForChildren:(NSArray<NSString *> *)children parent:(NSString *)parent;
|
+ (NSString *)horizontalBoxStringForChildren:(NSArray *)children parent:(NSString *)parent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders an ascii art box with the children aligned vertically.
|
* Renders an ascii art box with the children aligned vertically.
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
* | ASTextNode |
|
* | ASTextNode |
|
||||||
* ---------------------
|
* ---------------------
|
||||||
*/
|
*/
|
||||||
+ (NSString *)verticalBoxStringForChildren:(NSArray<NSString *> *)children parent:(NSString *)parent;
|
+ (NSString *)verticalBoxStringForChildren:(NSArray *)children parent:(NSString *)parent;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -53,13 +53,13 @@ typedef NS_ENUM(NSUInteger, PIDebugBoxPaddingLocation)
|
|||||||
|
|
||||||
@implementation ASAsciiArtBoxCreator
|
@implementation ASAsciiArtBoxCreator
|
||||||
|
|
||||||
+ (NSString *)horizontalBoxStringForChildren:(NSArray<NSString *> *)children parent:(NSString *)parent
|
+ (NSString *)horizontalBoxStringForChildren:(NSArray *)children parent:(NSString *)parent
|
||||||
{
|
{
|
||||||
if ([children count] == 0) {
|
if ([children count] == 0) {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMutableArray<NSArray<NSString *> *> *childrenLines = [NSMutableArray array];
|
NSMutableArray *childrenLines = [NSMutableArray array];
|
||||||
|
|
||||||
// split the children into lines
|
// split the children into lines
|
||||||
NSUInteger lineCountPerChild = 0;
|
NSUInteger lineCountPerChild = 0;
|
||||||
@@ -83,12 +83,12 @@ typedef NS_ENUM(NSUInteger, PIDebugBoxPaddingLocation)
|
|||||||
[childrenLines addObject:lines];
|
[childrenLines addObject:lines];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMutableArray<NSString *> *concatenatedLines = [NSMutableArray array];
|
NSMutableArray *concatenatedLines = [NSMutableArray array];
|
||||||
NSString *padding = [NSString debugbox_stringWithString:@" " repeatedCount:kDebugBoxPadding];
|
NSString *padding = [NSString debugbox_stringWithString:@" " repeatedCount:kDebugBoxPadding];
|
||||||
for (NSUInteger index = 0; index < lineCountPerChild; index++) {
|
for (NSUInteger index = 0; index < lineCountPerChild; index++) {
|
||||||
NSMutableString *line = [[NSMutableString alloc] init];
|
NSMutableString *line = [[NSMutableString alloc] init];
|
||||||
[line appendFormat:@"|%@",padding];
|
[line appendFormat:@"|%@",padding];
|
||||||
for (NSArray<NSString *> *childLines in childrenLines) {
|
for (NSArray *childLines in childrenLines) {
|
||||||
[line appendFormat:@"%@%@", childLines[index], padding];
|
[line appendFormat:@"%@%@", childLines[index], padding];
|
||||||
}
|
}
|
||||||
[line appendString:@"|"];
|
[line appendString:@"|"];
|
||||||
@@ -119,13 +119,13 @@ typedef NS_ENUM(NSUInteger, PIDebugBoxPaddingLocation)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSString *)verticalBoxStringForChildren:(NSArray<NSString *> *)children parent:(NSString *)parent
|
+ (NSString *)verticalBoxStringForChildren:(NSArray *)children parent:(NSString *)parent
|
||||||
{
|
{
|
||||||
if ([children count] == 0) {
|
if ([children count] == 0) {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMutableArray<NSString *> *childrenLines = [NSMutableArray array];
|
NSMutableArray *childrenLines = [NSMutableArray array];
|
||||||
|
|
||||||
NSUInteger maxChildLength = 0;
|
NSUInteger maxChildLength = 0;
|
||||||
for (NSString *child in children) {
|
for (NSString *child in children) {
|
||||||
@@ -167,7 +167,7 @@ typedef NS_ENUM(NSUInteger, PIDebugBoxPaddingLocation)
|
|||||||
return [childrenLines componentsJoinedByString:@"\n"];
|
return [childrenLines componentsJoinedByString:@"\n"];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSMutableArray *)appendTopAndBottomToBoxString:(NSMutableArray<NSString *> *)boxStrings parent:(NSString *)parent
|
+ (NSMutableArray *)appendTopAndBottomToBoxString:(NSMutableArray *)boxStrings parent:(NSString *)parent
|
||||||
{
|
{
|
||||||
NSUInteger totalLineLength = [boxStrings[0] length];
|
NSUInteger totalLineLength = [boxStrings[0] length];
|
||||||
[boxStrings addObject:[NSString debugbox_stringWithString:@"-" repeatedCount:totalLineLength]];
|
[boxStrings addObject:[NSString debugbox_stringWithString:@"-" repeatedCount:totalLineLength]];
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
/**
|
/**
|
||||||
* Used by other layout specs to create ascii art debug strings
|
* Used by other layout specs to create ascii art debug strings
|
||||||
*/
|
*/
|
||||||
+ (NSString *)asciiArtStringForChildren:(NSArray<id<ASLayoutableAsciiArtProtocol>> *)children parentName:(NSString *)parentName direction:(ASStackLayoutDirection)direction;
|
+ (NSString *)asciiArtStringForChildren:(NSArray *)children parentName:(NSString *)parentName direction:(ASStackLayoutDirection)direction;
|
||||||
+ (NSString *)asciiArtStringForChildren:(NSArray<id<ASLayoutableAsciiArtProtocol>> *)children parentName:(NSString *)parentName;
|
+ (NSString *)asciiArtStringForChildren:(NSArray *)children parentName:(NSString *)parentName;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ static NSString * const kDefaultChildrenKey = @"kDefaultChildrenKey";
|
|||||||
|
|
||||||
#pragma mark - ASLayoutableAsciiArtProtocol
|
#pragma mark - ASLayoutableAsciiArtProtocol
|
||||||
|
|
||||||
+ (NSString *)asciiArtStringForChildren:(NSArray<id<ASLayoutableAsciiArtProtocol>> *)children parentName:(NSString *)parentName direction:(ASStackLayoutDirection)direction
|
+ (NSString *)asciiArtStringForChildren:(NSArray *)children parentName:(NSString *)parentName direction:(ASStackLayoutDirection)direction
|
||||||
{
|
{
|
||||||
NSMutableArray *childStrings = [NSMutableArray array];
|
NSMutableArray *childStrings = [NSMutableArray array];
|
||||||
for (id<ASLayoutableAsciiArtProtocol> layoutChild in children) {
|
for (id<ASLayoutableAsciiArtProtocol> layoutChild in children) {
|
||||||
@@ -143,7 +143,7 @@ static NSString * const kDefaultChildrenKey = @"kDefaultChildrenKey";
|
|||||||
return [ASAsciiArtBoxCreator verticalBoxStringForChildren:childStrings parent:parentName];
|
return [ASAsciiArtBoxCreator verticalBoxStringForChildren:childStrings parent:parentName];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSString *)asciiArtStringForChildren:(NSArray<id<ASLayoutableAsciiArtProtocol>> *)children parentName:(NSString *)parentName
|
+ (NSString *)asciiArtStringForChildren:(NSArray *)children parentName:(NSString *)parentName
|
||||||
{
|
{
|
||||||
return [self asciiArtStringForChildren:children parentName:parentName direction:ASStackLayoutDirectionHorizontal];
|
return [self asciiArtStringForChildren:children parentName:parentName direction:ASStackLayoutDirectionHorizontal];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user