Indicate if censorship circumvention is active in the main app settings view.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 320dfd89e3
commit 1dffdb5ca0

@ -75,6 +75,13 @@
[self updateTableContents]; [self updateTableContents];
} }
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self updateTableContents];
}
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
} }
@ -120,37 +127,47 @@
} }
customRowHeight:96.f customRowHeight:96.f
actionBlock:nil]]; actionBlock:nil]];
[section addItem:[OWSTableItem itemWithCustomCellBlock:^{
UITableViewCell *cell = [UITableViewCell new]; if (OWSSignalService.sharedInstance.isCensorshipCircumventionActive) {
cell.textLabel.text = NSLocalizedString( [section
@"NETWORK_STATUS_HEADER", @""); addItem:[OWSTableItem disclosureItemWithText:
cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f]; NSLocalizedString(@"NETWORK_STATUS_CENSORSHIP_CIRCUMVENTION_ACTIVE",
cell.textLabel.textColor = [UIColor blackColor]; @"Indicates to the user that censorship circumvention has been activated.")
actionBlock:^{
UILabel *accessoryLabel = [UILabel new]; [weakSelf showAdvanced];
accessoryLabel.font = [UIFont ows_regularFontWithSize:18.f]; }]];
switch ([TSSocketManager sharedManager].state) { } else {
case SocketManagerStateClosed: [section addItem:[OWSTableItem itemWithCustomCellBlock:^{
accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_OFFLINE", @""); UITableViewCell *cell = [UITableViewCell new];
accessoryLabel.textColor = [UIColor ows_redColor]; cell.textLabel.text = NSLocalizedString(@"NETWORK_STATUS_HEADER", @"");
break; cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f];
case SocketManagerStateConnecting: cell.textLabel.textColor = [UIColor blackColor];
accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_CONNECTING", @"");
accessoryLabel.textColor = [UIColor ows_yellowColor]; UILabel *accessoryLabel = [UILabel new];
break; accessoryLabel.font = [UIFont ows_regularFontWithSize:18.f];
case SocketManagerStateOpen: switch ([TSSocketManager sharedManager].state) {
accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_CONNECTED", @""); case SocketManagerStateClosed:
accessoryLabel.textColor = [UIColor ows_greenColor]; accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_OFFLINE", @"");
break; accessoryLabel.textColor = [UIColor ows_redColor];
break;
case SocketManagerStateConnecting:
accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_CONNECTING", @"");
accessoryLabel.textColor = [UIColor ows_yellowColor];
break;
case SocketManagerStateOpen:
accessoryLabel.text = NSLocalizedString(@"NETWORK_STATUS_CONNECTED", @"");
accessoryLabel.textColor = [UIColor ows_greenColor];
break;
}
[accessoryLabel sizeToFit];
cell.accessoryView = accessoryLabel;
return cell;
} }
[accessoryLabel sizeToFit]; actionBlock:^{
cell.accessoryView = accessoryLabel; [OWSAlerts showAlertWithTitle:NSLocalizedString(@"NETWORK_STATUS_HEADER", @"")
return cell; message:NSLocalizedString(@"NETWORK_STATUS_TEXT", @"")];
}]];
} }
actionBlock:^{
[OWSAlerts showAlertWithTitle:NSLocalizedString(@"NETWORK_STATUS_HEADER", @"")
message:NSLocalizedString(@"NETWORK_STATUS_TEXT", @"")];
}]];
[section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_INVITE_TITLE", [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_INVITE_TITLE",
@"Settings table view cell label") @"Settings table view cell label")
actionBlock:^{ actionBlock:^{

@ -792,6 +792,9 @@
/* No comment provided by engineer. */ /* No comment provided by engineer. */
"NETWORK_ERROR_RECOVERY" = "Please check you're online and try again."; "NETWORK_ERROR_RECOVERY" = "Please check you're online and try again.";
/* Indicates to the user that censorship circumvention has been activated. */
"NETWORK_STATUS_CENSORSHIP_CIRCUMVENTION_ACTIVE" = "Censorship Circumvention: On";
/* No comment provided by engineer. */ /* No comment provided by engineer. */
"NETWORK_STATUS_CONNECTED" = "Connected"; "NETWORK_STATUS_CONNECTED" = "Connected";

Loading…
Cancel
Save