Skip to content

Commit

Permalink
More fixes for #107
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzoPrimi committed May 30, 2017
1 parent ce195ad commit 43bdc19
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ooniprobe/View/AboutViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#import "PBRevealViewController.h"
#import "RoundedButton.h"
#import "AppDelegate.h"
#import "TestStorage.h"
#import "UIBarButtonItem+Badge.h"

@interface AboutViewController : UIViewController
@property (nonatomic, strong) IBOutlet UILabel *titleLabel;
Expand Down
9 changes: 9 additions & 0 deletions ooniprobe/View/AboutViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,18 @@ - (void)viewDidLoad {
[self.textLabel setText:[NSString stringWithFormat:@"%@\n%@",NSLocalizedString(@"about_text_1", nil), NSLocalizedString(@"about_text_2", nil)]];
[self.ppButton setTitle:[NSString stringWithFormat:@"%@", NSLocalizedString(@"view_data_policy", nil)] forState:UIControlStateNormal];
[self.versionLabel setText:[NSString stringWithFormat:@"ooniprobe: %@\nmeasurement-kit: %s", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"], mk_version()]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadDot) name:@"reloadTable" object:nil];
[self reloadDot];
}

- (void)reloadDot{
if ([TestStorage new_tests]){
self.navigationItem.leftBarButtonItem.badgeValue = @" ";
self.navigationItem.leftBarButtonItem.badgeBGColor = color_ok_green;
}
}


-(IBAction)learn_more:(id)sender{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://ooni.torproject.org/"]];
}
Expand Down
8 changes: 6 additions & 2 deletions ooniprobe/View/LeftMenuTableViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// information on the copying conditions.

#import "LeftMenuTableViewController.h"
#import "PastTestsViewController.h"

@interface LeftMenuTableViewController ()
@property (nonatomic, strong) NSArray *menuItems;
Expand Down Expand Up @@ -56,8 +57,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}

- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"toRun_tests"] || [[segue identifier] isEqualToString:@"toSettings"] || [[segue identifier] isEqualToString:@"toAbout"])
[TestStorage set_all_viewed];
if ([[segue identifier] isEqualToString:@"toRun_tests"] || [[segue identifier] isEqualToString:@"toSettings"] || [[segue identifier] isEqualToString:@"toAbout"]){
UINavigationController *navController = (UINavigationController*)self.revealViewController.mainViewController;
if ([([navController viewControllers][0]) isKindOfClass:[PastTestsViewController class]])
[TestStorage set_all_viewed];
}
}

@end
2 changes: 2 additions & 0 deletions ooniprobe/View/SettingsTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#import "PBRevealViewController.h"
#import "UIView+Toast.h"
#import "AppDelegate.h"
#import "TestStorage.h"
#import "UIBarButtonItem+Badge.h"

@interface SettingsTableViewController : UITableViewController <UITextFieldDelegate> {
NSArray *privacyItems;
Expand Down
9 changes: 9 additions & 0 deletions ooniprobe/View/SettingsTableViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ - (void)viewDidLoad {
initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self.view action:@selector(endEditing:)];
keyboardToolbar.items = @[flexBarButton, doneBarButton];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadDot) name:@"reloadTable" object:nil];
[self reloadDot];
}

- (void)reloadDot{
if ([TestStorage new_tests]){
self.navigationItem.leftBarButtonItem.badgeValue = @" ";
self.navigationItem.leftBarButtonItem.badgeBGColor = color_ok_green;
}
}

- (void)didReceiveMemoryWarning {
Expand Down

0 comments on commit 43bdc19

Please sign in to comment.