@@ -73,19 +73,6 @@ + (UIViewController *)topmostViewController {
7373 return [self topViewControllerInViewController: ROOTVIEW];
7474}
7575
76- + (void )alertWithText : (NSString *)text
77- {
78- [Util alertWithTitle: kLocalizedPocketCode andText: text];
79- }
80-
81- + (void )alertWithTitle : (NSString *)title andText : (NSString *)text
82- {
83- [[[[AlertControllerBuilder alertWithTitle: title message: text]
84- addCancelActionWithTitle: kLocalizedOK handler: nil ]
85- build ]
86- showWithController: [Util topmostViewController ]];
87- }
88-
8976+ (CATransition *)getPushCATransition
9077{
9178 CATransition *transition = [CATransition animation ];
@@ -135,7 +122,7 @@ + (InputValidationResult*)validationResultWithName:(NSString *)name minLength:(N
135122 } else {
136123 return [InputValidationResult validInput ];
137124 }
138-
125+
139126 NSAssert (invalidNameMessage != nil , @" This case should already be handled" );
140127 return [InputValidationResult invalidInputWithLocalizedMessage: invalidNameMessage];
141128}
@@ -206,7 +193,7 @@ + (void)askUserForUniqueNameAndPerformAction:(SEL)action
206193 }]
207194 valueValidator: ^InputValidationResult *(NSString *name) {
208195 InputValidationResult *result = [self validationResultWithName: name minLength: minInputLength maxlength: maxInputLength];
209-
196+
210197 if (!result.valid ) {
211198 return result;
212199 }
@@ -278,7 +265,7 @@ + (void)askUserForVariableNameAndPerformAction:(SEL)action
278265 } else {
279266 return [InputValidationResult validInput ];
280267 }
281-
268+
282269 NSAssert (invalidNameMessage != nil , @" This case should already be handled" );
283270 return [InputValidationResult invalidInputWithLocalizedMessage: invalidNameMessage];
284271 }] build ]
@@ -427,38 +414,38 @@ + (NSDictionary*)propertiesOfInstance:(id)instance
427414{
428415 unsigned count;
429416 objc_property_t *properties = class_copyPropertyList ([instance class ], &count);
430-
417+
431418 NSMutableDictionary *propertiesDictionary = [NSMutableDictionary new ];
432-
419+
433420 unsigned i;
434421 for (i = 0 ; i < count; i++)
435422 {
436423 objc_property_t property = properties[i];
437-
424+
438425 NSString *name = [NSString stringWithUTF8String: property_getName (property)];
439-
426+
440427 // TODO use introspection
441428 if ([name isEqualToString: @" hash" ] || [name isEqualToString: @" superclass" ]
442429 || [name isEqualToString: @" description" ] || [name isEqualToString: @" debugDescription" ]
443430 || [name isEqualToString: @" brickCategoryType" ] || [name isEqualToString: @" brickType" ]) {
444431 continue ;
445432 }
446-
433+
447434 NSObject *currentProperty = [instance valueForKey: name];
448435 if (currentProperty != nil )
449436 [propertiesDictionary setValue: currentProperty forKey: name];
450437 }
451-
438+
452439 free (properties);
453-
440+
454441 return propertiesDictionary;
455442}
456443
457444+ (NSString *)defaultSceneNameForSceneNumber : (NSUInteger )sceneNumber
458445{
459446 NSString *sceneNumberAsString = [NSString stringWithFormat: @" %@ " , @(sceneNumber)];
460447 NSString *sceneNameForSceneNumber = [kLocalizedScene stringByAppendingString: sceneNumberAsString];
461-
448+
462449 return sceneNameForSceneNumber;
463450}
464451
@@ -547,28 +534,6 @@ + (BOOL)isNetworkError:(NSError*)error
547534 return error && error.code != kCFURLErrorCancelled ;
548535}
549536
550- + (void )defaultAlertForNetworkError
551- {
552- if ([NSThread isMainThread ]) {
553- [[self class ] alertWithText: kLocalizedErrorInternetConnection ];
554- } else {
555- dispatch_async (dispatch_get_main_queue (), ^{
556- [Util defaultAlertForNetworkError ];
557- });
558- }
559- }
560-
561- + (void )defaultAlertForUnknownError
562- {
563- if ([NSThread isMainThread ]) {
564- [[self class ] alertWithText: kLocalizedErrorUnknown ];
565- } else {
566- dispatch_async (dispatch_get_main_queue (), ^{
567- [Util defaultAlertForUnknownError ];
568- });
569- }
570- }
571-
572537#pragma mark - brick statistics
573538
574539+ (NSDictionary *)getBrickInsertionDictionaryFromUserDefaults
@@ -627,7 +592,7 @@ + (NSArray*) getSubsetOfTheMost:(NSUInteger)N usedBricksInDictionary:(NSDictiona
627592 return NSOrderedAscending;
628593 }
629594 }];
630-
595+
631596 NSUInteger count = ([sortedBricks count ] >= N) ? N : [sortedBricks count ];
632597 NSRange range;
633598 range.location = 0 ;
@@ -677,36 +642,6 @@ + (NSString*)enableBlockedCharactersForString:(NSString*)string
677642 return string;
678643}
679644
680- + (void )showNotificationWithMessage : (NSString *)message
681- {
682- BDKNotifyHUD *notficicationHud = [BDKNotifyHUD notifyHUDWithImage: nil text: message];
683- UIViewController *vc = [Util topmostViewController ];
684-
685- notficicationHud.destinationOpacity = kBDKNotifyHUDDestinationOpacity ;
686- notficicationHud.center = CGPointMake (vc.view .center .x , vc.view .center .y );
687-
688- [vc.view addSubview: notficicationHud];
689- [notficicationHud presentWithDuration: kBDKNotifyHUDPresentationDuration
690- speed: kBDKNotifyHUDPresentationSpeed
691- inView: vc.view
692- completion: ^{ [notficicationHud removeFromSuperview ]; }];
693- }
694-
695- + (void )showNotificationForSaveAction {
696- BDKNotifyHUD *hud = [BDKNotifyHUD notifyHUDWithImage: [UIImage imageNamed: kBDKNotifyHUDCheckmarkImageName ] text: kLocalizedSaved ];
697- UIViewController *vc = [Util topmostViewController ];
698-
699- hud.destinationOpacity = kBDKNotifyHUDDestinationOpacity ;
700- hud.center = CGPointMake (vc.view .center .x , vc.view .center .y + kBDKNotifyHUDCenterOffsetY );
701- hud.tag = kSavedViewTag ;
702-
703- [vc.view addSubview: hud];
704- [hud presentWithDuration: kBDKNotifyHUDPresentationDuration
705- speed: kBDKNotifyHUDPresentationSpeed
706- inView: vc.view
707- completion: ^{ [hud removeFromSuperview ]; }];
708- }
709-
710645+ (void )openUrlExternal : (NSURL *)url
711646{
712647 [[UIApplication sharedApplication ] openURL: url options: [NSDictionary dictionary ] completionHandler: nil ];
0 commit comments