From c62961ef6beebd3b64ce2fc10d38d3813f0c8d34 Mon Sep 17 00:00:00 2001 From: mt1622 Date: Thu, 11 Jan 2024 18:49:16 +0100 Subject: [PATCH 1/7] catty-142-exp Project crashes when "New Project" is selected. --- ...CatrobatTableViewControllerExtension.swift | 10 +++ src/Catty/Helpers/Util/Util.h | 12 ++++ src/Catty/Helpers/Util/Util.m | 62 +++++++++++++++++++ .../CatrobatTableViewController.m | 11 +--- 4 files changed, 85 insertions(+), 10 deletions(-) diff --git a/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift b/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift index e9a627541e..f62e702112 100644 --- a/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift +++ b/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift @@ -72,4 +72,14 @@ import Foundation return UIImage(named: "person.crop.circle#navbar") } } + + func createProject(inputName: String, isdefault: Bool) { + print("createProject bool: \(isdefault)") + + } + + func createProjectCreationDialogue() { + Util.askUser(forProject: #selector(createProject(inputName: isdefault: )), target: self, cancelAction: nil, with: nil, promptTitle: kLocalizedNewProject, promptMessage: kLocalizedProjectName, promptValue: nil, promptPlaceholder: kLocalizedEnterYourProjectNameHere, minInputLength: UInt(kMinNumOfProjectNameCharacters), maxInputLength: UInt(kMaxNumOfProjectNameCharacters), invalidInputAlertMessage: kLocalizedProjectNameAlreadyExistsDescription) + } + } diff --git a/src/Catty/Helpers/Util/Util.h b/src/Catty/Helpers/Util/Util.h index 70842efcfa..9c05bff033 100644 --- a/src/Catty/Helpers/Util/Util.h +++ b/src/Catty/Helpers/Util/Util.h @@ -97,6 +97,18 @@ if (__functor) __functor(__VA_ARGS__); \ invalidInputAlertMessage:(NSString* _Nullable)invalidInputAlertMessage existingNames:(NSArray* _Nullable)existingNames; ++ (void)askUserForProject:(SEL _Nullable)action + target:(id _Nullable)target + cancelAction:(SEL _Nullable)cancelAction + withObject:(id _Nullable)passingObject + promptTitle:(NSString* _Nullable)title + promptMessage:(NSString* _Nullable)message + promptValue:(NSString* _Nullable)value + promptPlaceholder:(NSString* _Nullable)placeholder + minInputLength:(NSUInteger)minInputLength + maxInputLength:(NSUInteger)maxInputLength + invalidInputAlertMessage:(NSString* _Nullable)invalidInputAlertMessage; + + (void)askUserForTextAndPerformAction:(SEL _Nullable)action target:(id _Nullable)target cancelAction:(SEL _Nullable)cancelAction diff --git a/src/Catty/Helpers/Util/Util.m b/src/Catty/Helpers/Util/Util.m index 33a787e976..ccd8241a18 100644 --- a/src/Catty/Helpers/Util/Util.m +++ b/src/Catty/Helpers/Util/Util.m @@ -157,6 +157,68 @@ + (NSString *)normalizedDescriptionWithFormat:(NSString *)descriptionFormat form return formatParameter != 1 ? [Util pluralString:desc] : [Util singularString:desc]; } ++ (void)askUserForProject:(SEL)action + target:(id)target + cancelAction:(SEL)cancelAction + withObject:(id)passingObject + promptTitle:(NSString*)title + promptMessage:(NSString*)message + promptValue:(NSString*)value + promptPlaceholder:(NSString*)placeholder + minInputLength:(NSUInteger)minInputLength + maxInputLength:(NSUInteger)maxInputLength + invalidInputAlertMessage:(NSString*)invalidInputAlertMessage + existingNames:(NSArray*)existingNames { + [[[[[[[[[AlertControllerBuilder textFieldAlertWithTitle:title message:message] + placeholder:placeholder] + initialText:value] + addCancelActionWithTitle:kLocalizedCancel handler:^{ + if (target && cancelAction) { + IMP imp = [target methodForSelector:cancelAction]; + void (*func)(id, SEL) = (void *)imp; + func(target, cancelAction); + } + }] + addDefaultActionWithTitle:kLocalizedFr handler:^(NSString *name) { + IMP imp = [target methodForSelector:action]; + if (target && action) { + if (passingObject) { + void (*func)(id, SEL, id, id, Boolean) = (void *)imp; + func(target, action, name, passingObject, true); + } else { + void (*func)(id, SEL, id, Boolean) = (void *)imp; + func(target, action, name, true); + } + } + }] addDefaultActionWithTitle:kLocalizedOK handler:^(NSString *name) { + IMP imp = [target methodForSelector:action]; + if (target && action) { + if (passingObject) { + void (*func)(id, SEL, id, id, Boolean) = (void *)imp; + func(target, action, name, passingObject, false); + } else { + void (*func)(id, SEL, id, Boolean) = (void *)imp; + func(target, action, name, false); + } + } + }] + valueValidator:^InputValidationResult *(NSString *name) { + InputValidationResult *result = [self validationResultWithName:name minLength:minInputLength maxlength:maxInputLength]; + + if (!result.valid) { + return result; + } + if ([name isEqualToString:kLocalizedNewElement]) { + return [InputValidationResult invalidInputWithLocalizedMessage:kLocalizedInvalidInputDescription]; + } + if ([existingNames containsObject:name]) { + return [InputValidationResult invalidInputWithLocalizedMessage:invalidInputAlertMessage]; + } + return [InputValidationResult validInput]; + }] build] + showWithController:[self topmostViewController]]; +} + + (void)askUserForUniqueNameAndPerformAction:(SEL)action target:(id)target cancelAction:(SEL)cancelAction diff --git a/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.m b/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.m index fd7af351b9..1f1cb52cad 100644 --- a/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.m +++ b/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.m @@ -240,16 +240,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath* switch (indexPath.row) { case kNewProjectVC: - [Util askUserForUniqueNameAndPerformAction:@selector(createAndOpenProjectWithName:) - target:self - promptTitle:kLocalizedNewProject - promptMessage:[NSString stringWithFormat:@"%@:", kLocalizedProjectName] - promptValue:nil - promptPlaceholder:kLocalizedEnterYourProjectNameHere - minInputLength:kMinNumOfProjectNameCharacters - maxInputLength:kMaxNumOfProjectNameCharacters - invalidInputAlertMessage:kLocalizedProjectNameAlreadyExistsDescription - existingNames:[Project allProjectNames]]; + [self createProjectCreationDialogue]; break; case kContinueProjectVC: if (!self.lastUsedProject) { From 32e5149223d50bed7abdba5fe8e2d161e1734bd6 Mon Sep 17 00:00:00 2001 From: mt1622 Date: Tue, 16 Jan 2024 18:50:44 +0100 Subject: [PATCH 2/7] catty-142 found cause for error, buttons work -> missing: loading default project --- ...CatrobatTableViewControllerExtension.swift | 11 +- src/Catty/Helpers/Util/Util.h | 7 +- src/Catty/Helpers/Util/Util.m | 278 ++++++++---------- .../CatrobatTableViewController.h | 5 +- .../CatrobatTableViewController.m | 1 - 5 files changed, 146 insertions(+), 156 deletions(-) diff --git a/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift b/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift index f62e702112..26946a57ae 100644 --- a/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift +++ b/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift @@ -76,10 +76,19 @@ import Foundation func createProject(inputName: String, isdefault: Bool) { print("createProject bool: \(isdefault)") + if isdefault + { + + } + else { + let project = self.projectManager.createProject(name: inputName, projectId: nil) + self.openProject(project) + } + } func createProjectCreationDialogue() { - Util.askUser(forProject: #selector(createProject(inputName: isdefault: )), target: self, cancelAction: nil, with: nil, promptTitle: kLocalizedNewProject, promptMessage: kLocalizedProjectName, promptValue: nil, promptPlaceholder: kLocalizedEnterYourProjectNameHere, minInputLength: UInt(kMinNumOfProjectNameCharacters), maxInputLength: UInt(kMaxNumOfProjectNameCharacters), invalidInputAlertMessage: kLocalizedProjectNameAlreadyExistsDescription) + Util.askUser(forProject: #selector(createProject(inputName: isdefault: )), target: self, promptTitle: kLocalizedNewProject, promptMessage: kLocalizedProjectName, promptValue: nil, promptPlaceholder: kLocalizedEnterYourProjectNameHere, minInputLength: UInt(kMinNumOfProjectNameCharacters), maxInputLength: UInt(kMaxNumOfProjectNameCharacters), invalidInputAlertMessage: kLocalizedProjectNameAlreadyExistsDescription, existingNames: Project.allProjectNames()) } } diff --git a/src/Catty/Helpers/Util/Util.h b/src/Catty/Helpers/Util/Util.h index 9c05bff033..7b74abd042 100644 --- a/src/Catty/Helpers/Util/Util.h +++ b/src/Catty/Helpers/Util/Util.h @@ -99,15 +99,14 @@ if (__functor) __functor(__VA_ARGS__); \ + (void)askUserForProject:(SEL _Nullable)action target:(id _Nullable)target - cancelAction:(SEL _Nullable)cancelAction - withObject:(id _Nullable)passingObject - promptTitle:(NSString* _Nullable)title + promptTitle:(NSString* _Nullable)title promptMessage:(NSString* _Nullable)message promptValue:(NSString* _Nullable)value promptPlaceholder:(NSString* _Nullable)placeholder minInputLength:(NSUInteger)minInputLength maxInputLength:(NSUInteger)maxInputLength - invalidInputAlertMessage:(NSString* _Nullable)invalidInputAlertMessage; + invalidInputAlertMessage:(NSString* _Nullable)invalidInputAlertMessage + existingNames:(NSArray* _Nullable)existingNames; + (void)askUserForTextAndPerformAction:(SEL _Nullable)action target:(id _Nullable)target diff --git a/src/Catty/Helpers/Util/Util.m b/src/Catty/Helpers/Util/Util.m index ccd8241a18..cf1addc683 100644 --- a/src/Catty/Helpers/Util/Util.m +++ b/src/Catty/Helpers/Util/Util.m @@ -56,16 +56,16 @@ + (NSString*)applicationDocumentsDirectory NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil; return basePath; - + } + (UIViewController *)topViewControllerInViewController:(UIViewController *)viewController { UIViewController *result = viewController; - + while (result.presentedViewController) { result = result.presentedViewController; } - + return result; } @@ -122,7 +122,7 @@ + (InputValidationResult*)validationResultWithName:(NSString *)name minLength:(N } else { return [InputValidationResult validInput]; } - + NSAssert(invalidNameMessage != nil, @"This case should already be handled"); return [InputValidationResult invalidInputWithLocalizedMessage:invalidNameMessage]; } @@ -158,64 +158,44 @@ + (NSString *)normalizedDescriptionWithFormat:(NSString *)descriptionFormat form } + (void)askUserForProject:(SEL)action - target:(id)target - cancelAction:(SEL)cancelAction - withObject:(id)passingObject - promptTitle:(NSString*)title - promptMessage:(NSString*)message - promptValue:(NSString*)value - promptPlaceholder:(NSString*)placeholder - minInputLength:(NSUInteger)minInputLength - maxInputLength:(NSUInteger)maxInputLength - invalidInputAlertMessage:(NSString*)invalidInputAlertMessage - existingNames:(NSArray*)existingNames { + target:(id)target + promptTitle:(NSString*)title + promptMessage:(NSString*)message + promptValue:(NSString*)value + promptPlaceholder:(NSString*)placeholder + minInputLength:(NSUInteger)minInputLength + maxInputLength:(NSUInteger)maxInputLength + invalidInputAlertMessage:(NSString*)invalidInputAlertMessage + existingNames:(NSArray*)existingNames { [[[[[[[[[AlertControllerBuilder textFieldAlertWithTitle:title message:message] - placeholder:placeholder] - initialText:value] - addCancelActionWithTitle:kLocalizedCancel handler:^{ - if (target && cancelAction) { - IMP imp = [target methodForSelector:cancelAction]; - void (*func)(id, SEL) = (void *)imp; - func(target, cancelAction); - } - }] - addDefaultActionWithTitle:kLocalizedFr handler:^(NSString *name) { - IMP imp = [target methodForSelector:action]; - if (target && action) { - if (passingObject) { - void (*func)(id, SEL, id, id, Boolean) = (void *)imp; - func(target, action, name, passingObject, true); - } else { - void (*func)(id, SEL, id, Boolean) = (void *)imp; - func(target, action, name, true); - } - } - }] addDefaultActionWithTitle:kLocalizedOK handler:^(NSString *name) { - IMP imp = [target methodForSelector:action]; - if (target && action) { - if (passingObject) { - void (*func)(id, SEL, id, id, Boolean) = (void *)imp; - func(target, action, name, passingObject, false); - } else { - void (*func)(id, SEL, id, Boolean) = (void *)imp; - func(target, action, name, false); - } - } - }] - valueValidator:^InputValidationResult *(NSString *name) { - InputValidationResult *result = [self validationResultWithName:name minLength:minInputLength maxlength:maxInputLength]; - - if (!result.valid) { - return result; - } - if ([name isEqualToString:kLocalizedNewElement]) { - return [InputValidationResult invalidInputWithLocalizedMessage:kLocalizedInvalidInputDescription]; - } - if ([existingNames containsObject:name]) { - return [InputValidationResult invalidInputWithLocalizedMessage:invalidInputAlertMessage]; - } - return [InputValidationResult validInput]; - }] build] + placeholder:placeholder] + initialText:value] + addCancelActionWithTitle:kLocalizedCancel handler:^{ + }] + addDefaultActionWithTitle:kLocalizedMyFirstProject handler:^(NSString *name) { + IMP imp = [target methodForSelector:action]; + void (*func)(id, SEL, id, Boolean) = (void *)imp; + func(target, action, name, true); + }] + addDefaultActionWithTitle:kLocalizedNewProject handler:^(NSString *name) { + IMP imp = [target methodForSelector:action]; + void (*func)(id, SEL, id, Boolean) = (void *)imp; + func(target, action, name, false); + }] + valueValidator:^InputValidationResult *(NSString *name) { + InputValidationResult *result = [self validationResultWithName:name minLength:minInputLength maxlength:maxInputLength]; + + if (!result.valid) { + return result; + } + if ([name isEqualToString:kLocalizedNewElement]) { + return [InputValidationResult invalidInputWithLocalizedMessage:kLocalizedInvalidInputDescription]; + } + if ([existingNames containsObject:name]) { + return [InputValidationResult invalidInputWithLocalizedMessage:invalidInputAlertMessage]; + } + return [InputValidationResult validInput]; + }] build] showWithController:[self topmostViewController]]; } @@ -232,41 +212,41 @@ + (void)askUserForUniqueNameAndPerformAction:(SEL)action invalidInputAlertMessage:(NSString*)invalidInputAlertMessage existingNames:(NSArray*)existingNames { [[[[[[[[AlertControllerBuilder textFieldAlertWithTitle:title message:message] - placeholder:placeholder] - initialText:value] - addCancelActionWithTitle:kLocalizedCancel handler:^{ - if (target && cancelAction) { - IMP imp = [target methodForSelector:cancelAction]; - void (*func)(id, SEL) = (void *)imp; - func(target, cancelAction); - } - }] - addDefaultActionWithTitle:kLocalizedOK handler:^(NSString *name) { - IMP imp = [target methodForSelector:action]; - if (target && action) { - if (passingObject) { - void (*func)(id, SEL, id, id) = (void *)imp; - func(target, action, name, passingObject); - } else { - void (*func)(id, SEL, id) = (void *)imp; - func(target, action, name); - } - } - }] - valueValidator:^InputValidationResult *(NSString *name) { - InputValidationResult *result = [self validationResultWithName:name minLength:minInputLength maxlength:maxInputLength]; - - if (!result.valid) { - return result; - } - if ([name isEqualToString:kLocalizedNewElement]) { - return [InputValidationResult invalidInputWithLocalizedMessage:kLocalizedInvalidInputDescription]; - } - if ([existingNames containsObject:name]) { - return [InputValidationResult invalidInputWithLocalizedMessage:invalidInputAlertMessage]; - } - return [InputValidationResult validInput]; - }] build] + placeholder:placeholder] + initialText:value] + addCancelActionWithTitle:kLocalizedCancel handler:^{ + if (target && cancelAction) { + IMP imp = [target methodForSelector:cancelAction]; + void (*func)(id, SEL) = (void *)imp; + func(target, cancelAction); + } + }] + addDefaultActionWithTitle:kLocalizedOK handler:^(NSString *name) { + IMP imp = [target methodForSelector:action]; + if (target && action) { + if (passingObject) { + void (*func)(id, SEL, id, id) = (void *)imp; + func(target, action, name, passingObject); + } else { + void (*func)(id, SEL, id) = (void *)imp; + func(target, action, name); + } + } + }] + valueValidator:^InputValidationResult *(NSString *name) { + InputValidationResult *result = [self validationResultWithName:name minLength:minInputLength maxlength:maxInputLength]; + + if (!result.valid) { + return result; + } + if ([name isEqualToString:kLocalizedNewElement]) { + return [InputValidationResult invalidInputWithLocalizedMessage:kLocalizedInvalidInputDescription]; + } + if ([existingNames containsObject:name]) { + return [InputValidationResult invalidInputWithLocalizedMessage:invalidInputAlertMessage]; + } + return [InputValidationResult validInput]; + }] build] showWithController:[self topmostViewController]]; } @@ -297,40 +277,40 @@ + (void)askUserForTextAndPerformAction:(SEL)action } + (void)askUserForVariableNameAndPerformAction:(SEL)action - target:(id)target - promptTitle:(NSString*)title - promptMessage:(NSString*)message - minInputLength:(NSUInteger)minInputLength - maxInputLength:(NSUInteger)maxInputLength - isList:(BOOL)isList - andTextField:(FormulaEditorTextView *)textView + target:(id)target + promptTitle:(NSString*)title + promptMessage:(NSString*)message + minInputLength:(NSUInteger)minInputLength + maxInputLength:(NSUInteger)maxInputLength + isList:(BOOL)isList + andTextField:(FormulaEditorTextView *)textView initialText:(NSString*)initialText { [[[[[[[AlertControllerBuilder textFieldAlertWithTitle:title message:message] - initialText: initialText] - addCancelActionWithTitle:kLocalizedCancel handler:^{ - [textView becomeFirstResponder]; - }] - addDefaultActionWithTitle:kLocalizedOK handler:^(NSString *name) { - if (target && action) { - IMP imp = [target methodForSelector:action]; - void (*func)(id, SEL, id, BOOL) = (void *)imp; - func(target, action, name, isList); - } - }] - valueValidator:^InputValidationResult *(NSString *name) { - NSString *invalidNameMessage = nil; - if (minInputLength > 0 && name.length < minInputLength) { - invalidNameMessage = [self normalizedDescriptionWithFormat:kLocalizedNoOrTooShortInputDescription formatParameter:minInputLength]; - } else if (maxInputLength > 0 && name.length > maxInputLength) { - invalidNameMessage = [self normalizedDescriptionWithFormat:kLocalizedTooLongInputDescription formatParameter:maxInputLength]; - } else { - return [InputValidationResult validInput]; - } - - NSAssert(invalidNameMessage != nil, @"This case should already be handled"); - return [InputValidationResult invalidInputWithLocalizedMessage:invalidNameMessage]; - }] build] + initialText: initialText] + addCancelActionWithTitle:kLocalizedCancel handler:^{ + [textView becomeFirstResponder]; + }] + addDefaultActionWithTitle:kLocalizedOK handler:^(NSString *name) { + if (target && action) { + IMP imp = [target methodForSelector:action]; + void (*func)(id, SEL, id, BOOL) = (void *)imp; + func(target, action, name, isList); + } + }] + valueValidator:^InputValidationResult *(NSString *name) { + NSString *invalidNameMessage = nil; + if (minInputLength > 0 && name.length < minInputLength) { + invalidNameMessage = [self normalizedDescriptionWithFormat:kLocalizedNoOrTooShortInputDescription formatParameter:minInputLength]; + } else if (maxInputLength > 0 && name.length > maxInputLength) { + invalidNameMessage = [self normalizedDescriptionWithFormat:kLocalizedTooLongInputDescription formatParameter:maxInputLength]; + } else { + return [InputValidationResult validInput]; + } + + NSAssert(invalidNameMessage != nil, @"This case should already be handled"); + return [InputValidationResult invalidInputWithLocalizedMessage:invalidNameMessage]; + }] build] showWithController:[Util topmostViewController]]; } @@ -341,7 +321,7 @@ + (NSString*)uniqueName:(NSString*)nameToCheck existingNames:(NSArray*)existingN if (lastChar == 0x20) { [uniqueName deleteCharactersInRange:NSMakeRange(([uniqueName length] - 1), 1)]; } - + NSUInteger counter = 0; NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\\(\\d\\)" options:NSRegularExpressionCaseInsensitive @@ -415,7 +395,7 @@ + (CGFloat)detectCBLanguageVersionFromXMLWithPath:(NSString*)xmlPath if (! xmlStringHeaderChunk) { return kCatrobatInvalidVersion; } - + // extract catrobatLanguageVersion field out of header NSString *languageVersionString = [xmlStringHeaderChunk stringBetweenString:@"" andString:@"" @@ -423,12 +403,12 @@ + (CGFloat)detectCBLanguageVersionFromXMLWithPath:(NSString*)xmlPath if (! languageVersionString) { return kCatrobatInvalidVersion; } - + // check if string contains valid number if (! [languageVersionString isValidNumber]) { return kCatrobatInvalidVersion; } - + CGFloat languageVersion = (CGFloat)[languageVersionString floatValue]; if (languageVersion < 0.0f) { return kCatrobatInvalidVersion; @@ -476,30 +456,30 @@ + (NSDictionary*)propertiesOfInstance:(id)instance { unsigned count; objc_property_t *properties = class_copyPropertyList([instance class], &count); - + NSMutableDictionary *propertiesDictionary = [NSMutableDictionary new]; - + unsigned i; for (i = 0; i < count; i++) { objc_property_t property = properties[i]; - + NSString *name = [NSString stringWithUTF8String:property_getName(property)]; - + // TODO use introspection if ([name isEqualToString:@"hash"] || [name isEqualToString:@"superclass"] || [name isEqualToString:@"description"] || [name isEqualToString:@"debugDescription"] || [name isEqualToString:@"brickCategoryType"] || [name isEqualToString:@"brickType"]) { continue; } - + NSObject *currentProperty = [instance valueForKey:name]; if(currentProperty != nil) [propertiesDictionary setValue:currentProperty forKey:name]; } - + free(properties); - + return propertiesDictionary; } @@ -507,7 +487,7 @@ + (NSString*)defaultSceneNameForSceneNumber:(NSUInteger)sceneNumber { NSString *sceneNumberAsString = [NSString stringWithFormat:@" %@", @(sceneNumber)]; NSString *sceneNameForSceneNumber = [kLocalizedScene stringByAppendingString:sceneNumberAsString]; - + return sceneNameForSceneNumber; } @@ -597,20 +577,20 @@ + (NSArray*) getSubsetOfTheMost:(NSUInteger)N usedBricksInDictionary:(NSDictiona NSArray *sortedBricks = [brickCountDictionary keysSortedByValueUsingComparator:^NSComparisonResult(id obj1, id obj2) { - NSNumber* number1 = (NSNumber*)obj1; - NSNumber* number2 = (NSNumber*)obj2; - if (number1 < number2) { - return NSOrderedDescending; - }else{ - return NSOrderedAscending; - } - }]; - + NSNumber* number1 = (NSNumber*)obj1; + NSNumber* number2 = (NSNumber*)obj2; + if (number1 < number2) { + return NSOrderedDescending; + }else{ + return NSOrderedAscending; + } + }]; + NSUInteger count = ([sortedBricks count] >= N) ? N : [sortedBricks count]; NSRange range; range.location = 0; range.length = count; - + return [sortedBricks subarrayWithRange:range]; } diff --git a/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.h b/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.h index e42475897e..01019eb7ed 100644 --- a/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.h +++ b/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.h @@ -23,6 +23,9 @@ #import #import "BaseTableViewController.h" -@interface CatrobatTableViewController : BaseTableViewController +@class CatrobatTableViewController; +@class ProjectManager; +@interface CatrobatTableViewController : BaseTableViewController +@property (nonatomic, strong) ProjectManager *projectManager; @end diff --git a/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.m b/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.m index 1f1cb52cad..44d46bb5c6 100644 --- a/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.m +++ b/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.m @@ -48,7 +48,6 @@ @interface CatrobatTableViewController () @property (nonatomic, strong) NSArray *imageNames; @property (nonatomic, strong) Project *lastUsedProject; @property (nonatomic, strong) Project *defaultProject; -@property (nonatomic, strong) ProjectManager *projectManager; @property (nonatomic, assign) CGFloat dynamicStatusBarHeight; @property (nonatomic, assign) CGFloat fixedStatusBarHeight; @end From f58ec80bbe4814aa9ee68f687393622b693deed7 Mon Sep 17 00:00:00 2001 From: mt1622 Date: Fri, 19 Jan 2024 18:12:01 +0100 Subject: [PATCH 3/7] catty-142 only 2nd alert missing --- src/Catty/DataModel/Project/Project.h | 2 +- src/Catty/DataModel/Project/Project.m | 4 ++-- .../CatrobatTableViewControllerExtension.swift | 5 ++++- src/Catty/IO/FileManager/CBFileManager.h | 1 + src/Catty/IO/FileManager/CBFileManager.m | 11 ++++++++++- .../CatrobatTableViewController.h | 1 + 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/Catty/DataModel/Project/Project.h b/src/Catty/DataModel/Project/Project.h index 3e053001aa..d8baa02d96 100644 --- a/src/Catty/DataModel/Project/Project.h +++ b/src/Catty/DataModel/Project/Project.h @@ -46,7 +46,7 @@ - (void)saveToDiskWithNotification:(BOOL)notify andCompletion:(void (^ _Nullable)(void))completion; - (BOOL)isLastUsedProject; - (void)setAsLastUsedProject; -- (void)translateDefaultProject; +- (void)translateDefaultProject:(NSString* _Nonnull)projectName; - (void)renameToProjectName:(NSString* _Nonnull)projectName andShowSaveNotification:(BOOL)showSaveNotification; - (void)renameToProjectName:(NSString* _Nonnull)projectName andProjectId:(NSString* _Nonnull)projectId andShowSaveNotification:(BOOL)showSaveNotification; - (void)setDescription:(NSString* _Nonnull)description; diff --git a/src/Catty/DataModel/Project/Project.m b/src/Catty/DataModel/Project/Project.m index a8acb15a9f..b62d4aae79 100644 --- a/src/Catty/DataModel/Project/Project.m +++ b/src/Catty/DataModel/Project/Project.m @@ -395,7 +395,7 @@ + (void)removeProjectFromDiskWithProjectName:(NSString*)projectName projectID:(N [fileManager addDefaultProjectToProjectsRootDirectoryIfNoProjectsExist]; } -- (void)translateDefaultProject +- (void)translateDefaultProject:(NSString*) projectName { NSUInteger index = 0; for (SpriteObject *spriteObject in self.scene.objects) { @@ -411,7 +411,7 @@ - (void)translateDefaultProject } ++index; } - [self renameToProjectName:kLocalizedMyFirstProject andShowSaveNotification:NO]; // saves to disk! + [self renameToProjectName:projectName andShowSaveNotification:NO]; } + (NSString*)basePath diff --git a/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift b/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift index 26946a57ae..97079cd463 100644 --- a/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift +++ b/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift @@ -78,7 +78,10 @@ import Foundation if isdefault { - + if let project = CBFileManager.shared().addDefaultProject(toProjectsRootDirectory: inputName) + { + self.openProject(project) + } } else { let project = self.projectManager.createProject(name: inputName, projectId: nil) diff --git a/src/Catty/IO/FileManager/CBFileManager.h b/src/Catty/IO/FileManager/CBFileManager.h index 8dbf537a6b..7ee08ad4e1 100644 --- a/src/Catty/IO/FileManager/CBFileManager.h +++ b/src/Catty/IO/FileManager/CBFileManager.h @@ -59,5 +59,6 @@ - (NSArray*)urls:(NSSearchPathDirectory)directory inDomainMask:(NSSearchPathDomainMask)domainMask; - (NSData*)read:(NSString*)path; - (BOOL)write:(NSData*)data toPath:(NSString*)path; +- (Project*)addDefaultProjectToProjectsRootDirectory:(NSString*)projectName; @end diff --git a/src/Catty/IO/FileManager/CBFileManager.m b/src/Catty/IO/FileManager/CBFileManager.m index 578cb0e7d4..62179b346b 100644 --- a/src/Catty/IO/FileManager/CBFileManager.m +++ b/src/Catty/IO/FileManager/CBFileManager.m @@ -302,7 +302,16 @@ - (void)addDefaultProjectToProjectsRootDirectoryIfNoProjectsExist [self addNewBundleProjectWithName:kDefaultProjectBundleName]; ProjectLoadingInfo *loadingInfo = [ProjectLoadingInfo projectLoadingInfoForProjectWithName:kDefaultProjectBundleName projectID:nil]; Project *project = [Project projectWithLoadingInfo:loadingInfo]; - [project translateDefaultProject]; + [project translateDefaultProject:kLocalizedMyFirstProject]; +} + +- (Project*)addDefaultProjectToProjectsRootDirectory:(NSString*)projectName +{ + [self addNewBundleProjectWithName:kDefaultProjectBundleName]; + ProjectLoadingInfo *loadingInfo = [ProjectLoadingInfo projectLoadingInfoForProjectWithName:kDefaultProjectBundleName projectID:nil]; + Project *project = [Project projectWithLoadingInfo:loadingInfo]; + [project translateDefaultProject:projectName]; + return project; } - (void)addNewBundleProjectWithName:(NSString*)projectName diff --git a/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.h b/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.h index 01019eb7ed..09762f1ab8 100644 --- a/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.h +++ b/src/Catty/ViewController/CatrobatTableViewController/CatrobatTableViewController.h @@ -26,6 +26,7 @@ @class CatrobatTableViewController; @class ProjectManager; + @interface CatrobatTableViewController : BaseTableViewController @property (nonatomic, strong) ProjectManager *projectManager; @end From 2263e33aa8da65dc0ba3a90e9a239a5fa84a6372 Mon Sep 17 00:00:00 2001 From: mt1622 Date: Mon, 12 Feb 2024 03:44:03 +0100 Subject: [PATCH 4/7] CATTY-142 added alert within projectsviewcontroller -> default objects are missing --- .../ViewController/Projects/MyProjectsViewController.h | 1 + .../ViewController/Projects/MyProjectsViewController.m | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Catty/ViewController/Projects/MyProjectsViewController.h b/src/Catty/ViewController/Projects/MyProjectsViewController.h index d193badf4e..db3609e6bc 100644 --- a/src/Catty/ViewController/Projects/MyProjectsViewController.h +++ b/src/Catty/ViewController/Projects/MyProjectsViewController.h @@ -24,6 +24,7 @@ #import "BaseTableViewController.h" #import "Project.h" + @interface MyProjectsViewController : BaseTableViewController @property (nonatomic, strong) Project *selectedProject; @end diff --git a/src/Catty/ViewController/Projects/MyProjectsViewController.m b/src/Catty/ViewController/Projects/MyProjectsViewController.m index a1f21ac936..826621c66a 100644 --- a/src/Catty/ViewController/Projects/MyProjectsViewController.m +++ b/src/Catty/ViewController/Projects/MyProjectsViewController.m @@ -144,7 +144,7 @@ - (void)toggleDetailCellsMode { - (void)addProjectAction:(id)sender { [self.tableView setEditing:false animated:YES]; - [Util askUserForUniqueNameAndPerformAction:@selector(createAndOpenProjectWithName:) + [Util askUserForProject:@selector(createAndOpenProjectWithName:) target:self promptTitle:kLocalizedNewProject promptMessage:[NSString stringWithFormat:@"%@:", kLocalizedProjectName] @@ -158,11 +158,10 @@ - (void)addProjectAction:(id)sender - (void)createAndOpenProjectWithName:(NSString*)projectName { - projectName = [Util uniqueName:projectName existingNames:[Project allProjectNames]]; + [self showLoadingView]; self.defaultProject = [self.projectManager createProjectWithName:projectName projectId:nil]; - if (self.defaultProject) { - [self addProject:self.defaultProject.header.programName]; + [self hideLoadingView]; [self openProject:self.defaultProject]; } } From a49471e8b98643c65937a9347c9c147c92911cf5 Mon Sep 17 00:00:00 2001 From: mt1622 Date: Tue, 20 Feb 2024 17:38:33 +0100 Subject: [PATCH 5/7] CreateProject Testcase fixed --- .../CatrobatTableViewControllerExtension.swift | 11 ++++++++++- src/CattyTests/Project/ProjectTests.swift | 2 +- src/CattyUITests/CreateProjectTests.swift | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift b/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift index 97079cd463..617ceb7f09 100644 --- a/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift +++ b/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift @@ -91,7 +91,16 @@ import Foundation } func createProjectCreationDialogue() { - Util.askUser(forProject: #selector(createProject(inputName: isdefault: )), target: self, promptTitle: kLocalizedNewProject, promptMessage: kLocalizedProjectName, promptValue: nil, promptPlaceholder: kLocalizedEnterYourProjectNameHere, minInputLength: UInt(kMinNumOfProjectNameCharacters), maxInputLength: UInt(kMaxNumOfProjectNameCharacters), invalidInputAlertMessage: kLocalizedProjectNameAlreadyExistsDescription, existingNames: Project.allProjectNames()) + Util.askUser(forProject: #selector(createProject(inputName: isdefault: )), + target: self, + promptTitle: kLocalizedNewProject, + promptMessage: kLocalizedProjectName, + promptValue: nil, + promptPlaceholder: kLocalizedEnterYourProjectNameHere, + minInputLength: UInt(kMinNumOfProjectNameCharacters), + maxInputLength: UInt(kMaxNumOfProjectNameCharacters), + invalidInputAlertMessage: kLocalizedProjectNameAlreadyExistsDescription, + existingNames: Project.allProjectNames()) } } diff --git a/src/CattyTests/Project/ProjectTests.swift b/src/CattyTests/Project/ProjectTests.swift index 6f9db579cc..f04f5bb443 100644 --- a/src/CattyTests/Project/ProjectTests.swift +++ b/src/CattyTests/Project/ProjectTests.swift @@ -369,7 +369,7 @@ class ProjectTests: XCTestCase { project.rename(toProjectName: "Project Name", andShowSaveNotification: true) XCTAssertTrue(project.saveNotificationShown) - project.translateDefaultProject() + project.translateDefaultProject("TestProject") XCTAssertFalse(project.saveNotificationShown) } diff --git a/src/CattyUITests/CreateProjectTests.swift b/src/CattyUITests/CreateProjectTests.swift index c8f829fa67..6fed43fd05 100644 --- a/src/CattyUITests/CreateProjectTests.swift +++ b/src/CattyUITests/CreateProjectTests.swift @@ -39,7 +39,7 @@ class CreateProjectTests: XCTestCase { app.tables.staticTexts[kLocalizedNewProject].tap() let alertQuery = app.alerts[kLocalizedNewProject] alertQuery.textFields[kLocalizedEnterYourProjectNameHere].typeText(projectName) - app.alerts[kLocalizedNewProject].buttons[kLocalizedOK].tap() + app.alerts[kLocalizedNewProject].buttons[kLocalizedNewProject].tap() XCTAssertNotNil(waitForElementToAppear(app.navigationBars[projectName])) addObjectAndDrawNewImage(name: testObject, in: app) @@ -105,7 +105,7 @@ class CreateProjectTests: XCTestCase { app.tables.staticTexts[kLocalizedNewProject].tap() let alertQuery = app.alerts[kLocalizedNewProject] alertQuery.textFields[kLocalizedEnterYourProjectNameHere].typeText(projectName) - app.alerts[kLocalizedNewProject].buttons[kLocalizedOK].tap() + app.alerts[kLocalizedNewProject].buttons[kLocalizedNewProject].tap() XCTAssertNotNil(waitForElementToAppear(app.navigationBars[projectName])) addObjectAndDrawNewImage(name: helloText, in: app) From a303fcd591bf42e863788df2add95d0debaa2f1f Mon Sep 17 00:00:00 2001 From: mt1622 Date: Wed, 21 Feb 2024 09:50:18 +0100 Subject: [PATCH 6/7] CATTY-142: Fixing Test-Issues --- .../CatrobatTableViewControllerExtension.swift | 9 ++------- src/CattyUITests/Extensions/XCTestCaseExtension.swift | 2 +- src/CattyUITests/ObjectTVCTests.swift | 2 +- src/CattyUITests/PocketCodeMainScreenTests.swift | 10 +++++----- src/CattyUITests/ProjectTVCTests.swift | 2 +- src/CattyUITests/ProjectsTVCTests.swift | 2 +- src/CattyUITests/ScenePresenterVCTests.swift | 4 ++-- 7 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift b/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift index 617ceb7f09..c49da51aea 100644 --- a/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift +++ b/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift @@ -75,11 +75,8 @@ import Foundation func createProject(inputName: String, isdefault: Bool) { print("createProject bool: \(isdefault)") - - if isdefault - { - if let project = CBFileManager.shared().addDefaultProject(toProjectsRootDirectory: inputName) - { + if isdefault { + if let project = CBFileManager.shared().addDefaultProject(toProjectsRootDirectory: inputName) { self.openProject(project) } } @@ -87,7 +84,6 @@ import Foundation let project = self.projectManager.createProject(name: inputName, projectId: nil) self.openProject(project) } - } func createProjectCreationDialogue() { @@ -102,5 +98,4 @@ import Foundation invalidInputAlertMessage: kLocalizedProjectNameAlreadyExistsDescription, existingNames: Project.allProjectNames()) } - } diff --git a/src/CattyUITests/Extensions/XCTestCaseExtension.swift b/src/CattyUITests/Extensions/XCTestCaseExtension.swift index 7f11d23771..e45c958a31 100644 --- a/src/CattyUITests/Extensions/XCTestCaseExtension.swift +++ b/src/CattyUITests/Extensions/XCTestCaseExtension.swift @@ -64,7 +64,7 @@ extension XCTestCase { let alert = waitForElementToAppear(app.alerts[kLocalizedNewProject]) alert.textFields[kLocalizedEnterYourProjectNameHere].typeText(name) - alert.buttons[kLocalizedOK].tap() + alert.buttons[kLocalizedNewProject].tap() XCTAssertNotNil(waitForElementToAppear(app.navigationBars[name])) } diff --git a/src/CattyUITests/ObjectTVCTests.swift b/src/CattyUITests/ObjectTVCTests.swift index 3716e586e8..30cfb045db 100644 --- a/src/CattyUITests/ObjectTVCTests.swift +++ b/src/CattyUITests/ObjectTVCTests.swift @@ -149,7 +149,7 @@ class ObjectTVCTests: XCTestCase { app.tables.staticTexts[kLocalizedNewProject].tap() let alertQuery = app.alerts[kLocalizedNewProject] alertQuery.textFields[kLocalizedEnterYourProjectNameHere].typeText(projectName) - app.alerts[kLocalizedNewProject].buttons[kLocalizedOK].tap() + app.alerts[kLocalizedNewProject].buttons[kLocalizedNewProject].tap() XCTAssertNotNil(waitForElementToAppear(app.navigationBars[projectName])) addObjectAndDrawNewImage(name: objectName, in: app) diff --git a/src/CattyUITests/PocketCodeMainScreenTests.swift b/src/CattyUITests/PocketCodeMainScreenTests.swift index 89f4976b33..04708dfbbe 100644 --- a/src/CattyUITests/PocketCodeMainScreenTests.swift +++ b/src/CattyUITests/PocketCodeMainScreenTests.swift @@ -47,7 +47,7 @@ class PocketCodeMainScreenTests: XCTestCase { app.tables.staticTexts[kLocalizedNewProject].tap() app.textFields[kLocalizedEnterYourProjectNameHere].tap() app.textFields[kLocalizedEnterYourProjectNameHere].typeText(testProject) - app.alerts[kLocalizedNewProject].buttons[kLocalizedOK].tap() + app.alerts[kLocalizedNewProject].buttons[kLocalizedNewProject].tap() // go back and try to add project with same name app.navigationBars[testProject].buttons[kLocalizedPocketCode].tap() @@ -55,7 +55,7 @@ class PocketCodeMainScreenTests: XCTestCase { app.tables.staticTexts[kLocalizedNewProject].tap() app.textFields[kLocalizedEnterYourProjectNameHere].tap() app.textFields[kLocalizedEnterYourProjectNameHere].typeText(testProject) - app.alerts[kLocalizedNewProject].buttons[kLocalizedOK].tap() + app.alerts[kLocalizedNewProject].buttons[kLocalizedNewProject].tap() // check if error message is displayed XCTAssert(waitForElementToAppear(app.alerts[kLocalizedPocketCode]).staticTexts[kLocalizedProjectNameAlreadyExistsDescription].exists) @@ -82,7 +82,7 @@ class PocketCodeMainScreenTests: XCTestCase { let alertQuery = waitForElementToAppear(app.alerts[kLocalizedNewProject]) waitForElementToAppear(alertQuery.textFields[kLocalizedEnterYourProjectNameHere]).tap() waitForElementToAppear(alertQuery.textFields[kLocalizedEnterYourProjectNameHere]).typeText(projectName) - waitForElementToAppear(alertQuery.buttons[kLocalizedOK]).tap() + waitForElementToAppear(alertQuery.buttons[kLocalizedNewProject]).tap() let alert = waitForElementToAppear(app.alerts[kLocalizedPocketCode]) XCTAssert(alert.exists) @@ -117,12 +117,12 @@ class PocketCodeMainScreenTests: XCTestCase { let newStaticText = tablesQuery.staticTexts[kLocalizedNewProject] let alertQuery = app.alerts[kLocalizedNewProject] let enterYourProjectNameHereTextField = alertQuery.textFields[kLocalizedEnterYourProjectNameHere] - let okButton = alertQuery.buttons[kLocalizedOK] + let projectButton = alertQuery.buttons[kLocalizedNewProject] for projectName in projectNames { newStaticText.tap() enterYourProjectNameHereTextField.typeText(projectName) - okButton.tap() + projectButton.tap() app.navigationBars[projectName].buttons[kLocalizedPocketCode].tap() } diff --git a/src/CattyUITests/ProjectTVCTests.swift b/src/CattyUITests/ProjectTVCTests.swift index b974ec1db9..e96d65ca46 100644 --- a/src/CattyUITests/ProjectTVCTests.swift +++ b/src/CattyUITests/ProjectTVCTests.swift @@ -51,7 +51,7 @@ class ProjectTVCTests: XCTestCase { app.tables.staticTexts[kLocalizedNewProject].tap() let alertQuery = app.alerts[kLocalizedNewProject] alertQuery.textFields[kLocalizedEnterYourProjectNameHere].typeText(projectName) - app.alerts[kLocalizedNewProject].buttons[kLocalizedOK].tap() + app.alerts[kLocalizedNewProject].buttons[kLocalizedNewProject].tap() XCTAssertNotNil(waitForElementToAppear(app.navigationBars[projectName])) //Add new Object diff --git a/src/CattyUITests/ProjectsTVCTests.swift b/src/CattyUITests/ProjectsTVCTests.swift index 53304e9df5..d5ff099fa6 100644 --- a/src/CattyUITests/ProjectsTVCTests.swift +++ b/src/CattyUITests/ProjectsTVCTests.swift @@ -40,7 +40,7 @@ class ProjectsTVCTests: XCTestCase { let alertQuery = waitForElementToAppear(app.alerts[kLocalizedNewProject]) alertQuery.textFields[kLocalizedEnterYourProjectNameHere].typeText(testProject) - app.alerts[kLocalizedNewProject].buttons[kLocalizedOK].tap() + app.alerts[kLocalizedNewProject].buttons[kLocalizedNewProject].tap() XCTAssert(waitForElementToAppear(app.navigationBars[testProject]).exists) app.navigationBars.buttons[kLocalizedProjects].tap() diff --git a/src/CattyUITests/ScenePresenterVCTests.swift b/src/CattyUITests/ScenePresenterVCTests.swift index 62f1e49319..2636852547 100644 --- a/src/CattyUITests/ScenePresenterVCTests.swift +++ b/src/CattyUITests/ScenePresenterVCTests.swift @@ -43,7 +43,7 @@ class ScenePresenterVCTests: XCTestCase { app.tables.staticTexts[kLocalizedNewProject].tap() let alertQuery = app.alerts[kLocalizedNewProject] alertQuery.textFields[kLocalizedEnterYourProjectNameHere].typeText(projectName) - app.alerts[kLocalizedNewProject].buttons[kLocalizedOK].tap() + app.alerts[kLocalizedNewProject].buttons[kLocalizedNewProject].tap() XCTAssertNotNil(waitForElementToAppear(app.navigationBars[projectName])) //Change orientation to landscape @@ -61,7 +61,7 @@ class ScenePresenterVCTests: XCTestCase { app.tables.staticTexts[kLocalizedNewProject].tap() let alertQuery = app.alerts[kLocalizedNewProject] alertQuery.textFields[kLocalizedEnterYourProjectNameHere].typeText(projectName) - app.alerts[kLocalizedNewProject].buttons[kLocalizedOK].tap() + app.alerts[kLocalizedNewProject].buttons[kLocalizedNewProject].tap() XCTAssertNotNil(waitForElementToAppear(app.navigationBars[projectName])) app.toolbars.buttons["Play"].tap() From f3129439bd84769151b5c59d349b16f9d2607671 Mon Sep 17 00:00:00 2001 From: mt1622 Date: Thu, 22 Feb 2024 08:59:36 +0100 Subject: [PATCH 7/7] Catty-142: fixed pipeline issues --- .../CatrobatTableViewControllerExtension.swift | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift b/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift index c49da51aea..38f879d1d0 100644 --- a/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift +++ b/src/Catty/Extension&Delegate&Protocol/Extensions/UIViewController/CatrobatTableViewControllerExtension.swift @@ -72,20 +72,19 @@ import Foundation return UIImage(named: "person.crop.circle#navbar") } } - + func createProject(inputName: String, isdefault: Bool) { print("createProject bool: \(isdefault)") if isdefault { if let project = CBFileManager.shared().addDefaultProject(toProjectsRootDirectory: inputName) { self.openProject(project) } - } - else { + } else { let project = self.projectManager.createProject(name: inputName, projectId: nil) self.openProject(project) } } - + func createProjectCreationDialogue() { Util.askUser(forProject: #selector(createProject(inputName: isdefault: )), target: self,