-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSWSettingsController.m
More file actions
100 lines (70 loc) · 3.64 KB
/
SWSettingsController.m
File metadata and controls
100 lines (70 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//
// SWSettingsController.m
// StarWorld
//
// Created by Aaron Baker on 12/3/11.
// Copyright (c) 2011 Inter Media Outdoors. All rights reserved.
//
#import "SWSettingsController.h"
@interface SWSettingsController (hidden)
- (void) launchFeedback;
@end
@implementation SWSettingsController
- (id)initWithNavigatorURL:(NSURL*)URL query:(NSDictionary*)query {
if ((self = [super init])) {
currentUser = [SWCurrentUser currentUserInstance];
//Style the table view
self.tableViewStyle = UITableViewStyleGrouped;
self.autoresizesForKeyboard = YES;
self.variableHeightRows = YES;
self.tableView.backgroundColor = RGBCOLOR(190,190,190);
self.navigationBarTintColor = [UIColor blackColor];
self.hidesBottomBarWhenPushed = YES;
self.title = @"Settings";
//Add Cells to datasource
if (currentUser.authenticated == YES) {
self.dataSource = [TTSectionedDataSource dataSourceWithObjects:
@"Accounts",
[TTTableTextItem itemWithText:@"Logout" delegate:self selector:@selector(logoutButtonPushed)],
@"Hey Team SW!",
[TTTableTextItem itemWithText:@"Send Feedback to Aaron" delegate:self selector:@selector(launchFeedback)],
nil];
} else {
self.dataSource = [TTSectionedDataSource dataSourceWithObjects:
@"Accounts",
[TTTableTextItem itemWithText:@"Register New Account" URL:@"tt://main/register"],
[TTTableTextItem itemWithText:@"Login" URL:@"tt://main/login"],
@"Hey Team SW!",
[TTTableTextItem itemWithText:@"Send Feedback to Aaron" delegate:self selector:@selector(launchFeedback)],
// @"More",
// [TTTableTextItem itemWithText:@"About StarWorld" URL:@""],
// [TTTableTextItem itemWithText:@"More From Aaron" URL:@""],
nil];
}
}
return self;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
-(void)logoutButtonPushed {
[currentUser logout];
self.dataSource = nil;
self.dataSource = [TTSectionedDataSource dataSourceWithObjects:
@"Accounts",
[TTTableTextItem itemWithText:@"Register New Account" URL:@"tt://main/register"],
[TTTableTextItem itemWithText:@"Login" URL:@"tt://main/login"],
@"Hey Team SW!",
[TTTableTextItem itemWithText:@"Send Feedback to Aaron" delegate:self selector:@selector(launchFeedback)],
// @"More",
// [TTTableTextItem itemWithText:@"About StarWorld" URL:@""],
// [TTTableTextItem itemWithText:@"More From Aaron" URL:@""],
nil];
}
///////////////////////////////////////////////////////////////////////////////////////////////////
-(void)launchFeedback {
[TestFlight openFeedbackView];
}
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void) dismiss {
[self.navigationController popViewControllerAnimated:NO];
}
@end