shlist

share and manage lists between multiple people
Log | Files | Refs

SettingsTableViewController.m (1849B)


      1 #import "SettingsTableViewController.h"
      2 
      3 #import "Network.h"
      4 
      5 @interface SettingsTableViewController () {
      6 	Network *netconn;
      7 }
      8 
      9 @property (weak, nonatomic) IBOutlet UILabel *phone_number_label;
     10 @property (weak, nonatomic) IBOutlet UILabel *device_id_label;
     11 @property (weak, nonatomic) IBOutlet UILabel *network_label;
     12 
     13 @end
     14 
     15 @implementation SettingsTableViewController
     16 
     17 - (void)viewDidLoad
     18 {
     19 	[super viewDidLoad];
     20 
     21 	NSNotificationCenter *default_center = [NSNotificationCenter defaultCenter];
     22 	// Listen for network connect/disconnect events and set the text field accordingly
     23 	[default_center addObserver:self selector:@selector(set_network_text_connected)
     24 			       name:@"NetworkConnectedNotification" object:nil];
     25 
     26 	[default_center addObserver:self selector:@selector(set_network_text_disconnected)
     27 			       name:@"NetworkDisconnectedNotification" object:nil];
     28 
     29 	netconn = [Network shared_network_connection];
     30 	NSString *device_id = [netconn get_device_id];
     31 
     32 	// Just show the first 8 characters of the device id (aka device fingerprint)
     33 	_device_id_label.text = [device_id substringToIndex:8];
     34 
     35 	if ([netconn connected])
     36 		[self set_network_text_connected];
     37 	else
     38 		[self set_network_text_disconnected];
     39 }
     40 
     41 - (void) set_network_text_connected
     42 {
     43 	_network_label.text = @"Connected";
     44 }
     45 
     46 - (void) set_network_text_disconnected
     47 {
     48 	_network_label.text = @"Disconnected";
     49 }
     50 
     51 - (void)didReceiveMemoryWarning
     52 {
     53 	[super didReceiveMemoryWarning];
     54 	// Dispose of any resources that can be recreated.
     55 }
     56 
     57 /*
     58 #pragma mark - Navigation
     59 
     60 // In a storyboard-based application, you will often want to do a little preparation before navigation
     61 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
     62     // Get the new view controller using [segue destinationViewController].
     63     // Pass the selected object to the new view controller.
     64 }
     65 */
     66 
     67 @end