Skip to content

Commit

Permalink
Implementation for #228 - Breakdown and refactor heavy application co…
Browse files Browse the repository at this point in the history
…ntrollers to a more manageable size from a code quantity point of view

Removed task action enumeration from modal task controller
  • Loading branch information
Emanuel Lupu-Marinei authored and Emanuel Lupu-Marinei committed May 10, 2017
1 parent e526ac6 commit 0928aea
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 26 deletions.
2 changes: 1 addition & 1 deletion AlfrescoActiviti/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>91</string>
<string>92</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand Down
2 changes: 1 addition & 1 deletion AlfrescoActiviti/Resources/Settings.bundle/Root.plist
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</dict>
<dict>
<key>DefaultValue</key>
<string>1.1 (91)</string>
<string>1.1 (92)</string>
<key>Key</key>
<string>Prefs_AppVersion</string>
<key>Title</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@
#import "AFATaskServices.h"
@class ASDKModelTask;

typedef NS_ENUM(NSInteger, AFAModalTaskDetailsActionType) {
AFAModalTaskDetailsActionTypeUndefined = -1,
AFAModalTaskDetailsActionTypeCreate = 0,
AFAModalTaskDetailsActionTypeUpdate
};

@protocol AFAModalTaskDetailsViewControllerDelegate <NSObject>

@optional
Expand All @@ -38,7 +32,6 @@ typedef NS_ENUM(NSInteger, AFAModalTaskDetailsActionType) {

- (void)executeAlertActionWithModel:(id)modelObject
completionBlock:(id)completionBlock;
- (AFAModalTaskDetailsActionType)actionType;

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
// Managers
#import "AFAProfileServices.h"
#import "AFAServiceRepository.h"
#import "AFAModalTaskDetailsCreateTaskAction.h"
#import "AFAModalTaskDetailsUpdateTaskAction.h"
#import "AFAModalTaskDetailsCreateChecklistAction.h"
@import ActivitiSDK;

// Models
Expand Down Expand Up @@ -198,7 +201,8 @@ - (IBAction)onConfirm:(id)sender {
__strong typeof(self) strongSelf = weakSelf;
if (!error) {
if ([self.confirmAlertAction respondsToSelector:@selector(executeAlertActionWithModel:completionBlock:)]) {
if (AFAModalTaskDetailsActionTypeCreate == [self.confirmAlertAction actionType]) {
if ([self.confirmAlertAction isKindOfClass:[AFAModalTaskDetailsCreateTaskAction class]] ||
[self.confirmAlertAction isKindOfClass:[AFAModalTaskDetailsCreateChecklistAction class]]) {
AFATaskCreateModel *taskCreateModel = [AFATaskCreateModel new];
taskCreateModel.taskName = self.nameTextField.text;
taskCreateModel.taskDescription = self.descriptionTextView.text;
Expand All @@ -207,14 +211,15 @@ - (IBAction)onConfirm:(id)sender {

[self.confirmAlertAction executeAlertActionWithModel:taskCreateModel
completionBlock:taskDetailsCompletionBlock];
} else if (AFAModalTaskDetailsActionTypeUpdate == [self.confirmAlertAction actionType]) {
} else if ([self.confirmAlertAction isKindOfClass:[AFAModalTaskDetailsUpdateTaskAction class]]) {
AFATaskUpdateModel *taskUpdate = [AFATaskUpdateModel new];
taskUpdate.taskName = self.nameTextField.text;
taskUpdate.taskDescription = self.descriptionTextView.text;

[self.confirmAlertAction executeAlertActionWithModel:taskUpdate
completionBlock:taskDetailsUpdateCompletionBlock];
}

}
} else {
[strongSelf.progressHUD dismiss];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,4 @@ - (void)executeAlertActionWithModel:(id)modelObject
completionBlock:completionBlock];
}

- (AFAModalTaskDetailsActionType)actionType {
return AFAModalTaskDetailsActionTypeCreate;
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,4 @@ - (void)executeAlertActionWithModel:(id)modelObject
completionBlock:completionBlock];
}

- (AFAModalTaskDetailsActionType)actionType {
return AFAModalTaskDetailsActionTypeCreate;
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,4 @@ - (void)executeAlertActionWithModel:(id)modelObject
withCompletionBlock:completionBlock];
}

- (AFAModalTaskDetailsActionType)actionType {
return AFAModalTaskDetailsActionTypeUpdate;
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ @implementation AFATaskListViewModel

- (NSString *)noRecordsLabelText {
return NSLocalizedString(kLocalizationListScreenNoTasksAvailableText, @"No tasks available text");

NSLocalizedString(kLocalizationProcessInstanceScreenNoProcessInstancesText, @"No process instances text");
}

- (NSString *)searchTextFieldPlacholderText {
NSLocalizedString(kLocalizationListScreenProcessInstancesText, @"process instances text");
return [NSString stringWithFormat:NSLocalizedString(kLocalizationListScreenSearchFieldPlaceholderFormat, @"Search bar format"), NSLocalizedString(kLocalizationListScreenTasksText, @"tasks text")];
}

Expand Down

0 comments on commit 0928aea

Please sign in to comment.