Skip to content

Commit

Permalink
Add More Ways to Help
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisballinger committed May 16, 2017
1 parent 9d29315 commit d34c453
Show file tree
Hide file tree
Showing 51 changed files with 58 additions and 127 deletions.
14 changes: 12 additions & 2 deletions ChatSecure/Classes/Controllers/OTRSettingsManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,18 @@ - (void) populateSettings
donateTitle = [NSString stringWithFormat:@"%@ 🆕", DONATE_STRING()];
}
OTRDonateSetting *donateSetting = [[OTRDonateSetting alloc] initWithTitle:donateTitle description:nil];
donateSetting.imageName = @"29-heart.png";
OTRSettingsGroup *donateGroup = [[OTRSettingsGroup alloc] initWithTitle:DONATE_STRING() settings:@[donateSetting]];
//donateSetting.imageName = @"29-heart.png";
OTRSetting *moreSetting = [[OTRSetting alloc] initWithTitle:MORE_WAYS_TO_HELP_STRING() description:nil];
moreSetting.actionBlock = ^void(id sender) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Purchase" bundle:[OTRAssets resourcesBundle]];
UIViewController *moreVC = [storyboard instantiateViewControllerWithIdentifier:@"moreWaysToHelp"];
UIViewController *sourceVC = sender;
if (![sender isKindOfClass:[UIViewController class]]) {
return;
}
[sourceVC presentViewController:moreVC animated:YES completion:nil];
};
OTRSettingsGroup *donateGroup = [[OTRSettingsGroup alloc] initWithTitle:DONATE_STRING() settings:@[donateSetting, moreSetting]];
[settingsGroups addObject:donateGroup];
}

Expand Down
2 changes: 1 addition & 1 deletion ChatSecure/Classes/Model/Settings/OTRBoolSetting.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ - (id) initWithTitle:(NSString *)newTitle description:(NSString *)newDescription
if (self = [super initWithTitle:newTitle description:newDescription settingsKey:newSettingsKey])
{
__weak typeof (self) weakSelf = self;
self.actionBlock = ^{
self.actionBlock = ^void(id sender) {
[weakSelf toggle];
};
self.defaultValue = [NSNumber numberWithBool:NO];
Expand Down
2 changes: 1 addition & 1 deletion ChatSecure/Classes/Model/Settings/OTRDonateSetting.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ -(id)initWithTitle:(NSString *)newTitle description:(NSString *)newDescription
self = [super initWithTitle:newTitle description:newDescription];
if (self) {
__weak typeof (self) weakSelf = self;
self.actionBlock = ^{
self.actionBlock = ^void(id sender){
[weakSelf openDonationDialog];
};
}
Expand Down
2 changes: 1 addition & 1 deletion ChatSecure/Classes/Model/Settings/OTRDoubleSetting.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ - (id) initWithTitle:(NSString *)newTitle description:(NSString *)newDescription
if (self = [super initWithTitle:newTitle description:newDescription settingsKey:newSettingsKey])
{
__weak typeof (self) weakSelf = self;
self.actionBlock = ^{
self.actionBlock = ^void(id sender){
[weakSelf editValue];
};
self.defaultValue = [NSNumber numberWithDouble:0.0];
Expand Down
2 changes: 1 addition & 1 deletion ChatSecure/Classes/Model/Settings/OTRFeedbackSetting.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ - (id) initWithTitle:(NSString*)newTitle description:(NSString*)newDescription
if (self = [super initWithTitle:newTitle description:newDescription])
{
__weak typeof(self)weakSelf = self;
self.actionBlock = ^{
self.actionBlock = ^void(id sender){
__strong typeof(weakSelf)strongSelf = weakSelf;
[strongSelf showView];
};
Expand Down
2 changes: 1 addition & 1 deletion ChatSecure/Classes/Model/Settings/OTRIntSetting.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ - (id) initWithTitle:(NSString *)newTitle description:(NSString *)newDescription
if (self = [super initWithTitle:newTitle description:newDescription settingsKey:newSettingsKey])
{
__weak typeof (self) weakSelf = self;
self.actionBlock = ^{
self.actionBlock = ^void(id sender){
[weakSelf editValue];
};
self.defaultValue = [NSNumber numberWithInt:0];
Expand Down
2 changes: 1 addition & 1 deletion ChatSecure/Classes/Model/Settings/OTRListSetting.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ -(id)initWithTitle:(NSString *)newTitle description:(NSString *)newDescription s
if (self = [super initWithTitle:newTitle description:newDescription settingsKey:newSettingsKey])
{
__weak typeof (self) weakSelf = self;
self.actionBlock = ^{
self.actionBlock = ^void(id sender){
__strong typeof(weakSelf)strongSelf = weakSelf;
[strongSelf editValue];
};
Expand Down
2 changes: 1 addition & 1 deletion ChatSecure/Classes/Model/Settings/OTRSetting.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
- (void) otrSetting:(OTRSetting*)setting showDetailViewControllerClass:(Class)viewControllerClass;
@end

typedef void (^OTRSettingActionBlock)(void);
typedef void (^OTRSettingActionBlock)(id sender);

@interface OTRSetting : NSObject

Expand Down
2 changes: 1 addition & 1 deletion ChatSecure/Classes/Model/Settings/OTRShareSetting.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ -(id)initWithTitle:(NSString *)newTitle description:(NSString *)newDescription
self = [super initWithTitle:newTitle description:newDescription];
if (self) {
__weak typeof(self)weakSelf = self;
self.actionBlock = ^{
self.actionBlock = ^void(id sender){
__strong typeof(weakSelf)strongSelf = weakSelf;
[strongSelf showActionSheet];
};
Expand Down
2 changes: 1 addition & 1 deletion ChatSecure/Classes/Model/Settings/OTRViewSetting.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ - (id) initWithTitle:(NSString*)newTitle description:(NSString*)newDescription v
{
viewControllerClass = newViewControllerClass;
__weak typeof (self) weakSelf = self;
self.actionBlock = ^{
self.actionBlock = ^void(id sender){
[weakSelf showView];
};
self.accessoryType = UITableViewCellAccessoryNone;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
OTRSetting *setting = [self.settingsManager settingAtIndexPath:indexPath];
OTRSettingActionBlock actionBlock = setting.actionBlock;
if (actionBlock) {
actionBlock();
actionBlock(self);
}
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
Expand Down
Loading

0 comments on commit d34c453

Please sign in to comment.