-
Notifications
You must be signed in to change notification settings - Fork 0
/
DebugTableViewController.m
206 lines (133 loc) · 6.17 KB
/
DebugTableViewController.m
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
//==============================================================================
//
// DebugTableViewController.m
// metaProject
//
// Created by krasylnikov on 13.07.13.
// Copyright (c) 2013 Design and Test lab. All rights reserved.
//
//==============================================================================
#import "DebugTableViewController.h"
//==============================================================================
@implementation DebugTableViewController
//==============================================================================
- (id)init
{
self = [super init];
if (self) {
// Custom initialization
self.title = @"Debug";
}
return self;
}
//==============================================================================
- (UITableViewCell *)emptyCellForTableView:(UITableView *)tableView
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.textLabel.text = @"";
cell.detailTextLabel.text = @"";
}
return cell;
}
//==============================================================================
- (UITableViewCell *)cellWithText:(NSString *)text detailText:(NSString *)detail
{
UITableViewCell *cell = [self emptyCellForTableView:self.tableView];
cell.textLabel.text = text ? text : @"N/A";
cell.detailTextLabel.text = detail ? detail : @"N/A";
return cell;
}
//==============================================================================
#pragma mark - View lifecycle
//==============================================================================
- (void)viewDidLoad
{
[super viewDidLoad];
_infoArray = [NSMutableArray array];
NSString *infoPlistPath = [NSBundle.mainBundle pathForResource:@"debugInfo" ofType:@"plist"];
NSDictionary *dbInfo = [NSDictionary dictionaryWithContentsOfFile:infoPlistPath];
[_infoArray addObject:[self cellWithText:@"Commit hash:" detailText:[dbInfo objectForKey:@"CommitHash"]]];
[_infoArray addObject:[self cellWithText:@"Commit date:" detailText:[dbInfo objectForKey:@"CommitDate"]]];
[_infoArray addObject:[self cellWithText:@"Built by:" detailText:[dbInfo objectForKey:@"GitUserName"]]];
[_infoArray addObject:[self cellWithText:@"Email:" detailText:[dbInfo objectForKey:@"GitUserEmail"]]];
[_infoArray addObject:[self cellWithText:@"Branch status:" detailText:[dbInfo objectForKey:@"BranchStatus"]]];
[_infoArray addObject:[self cellWithText:@"Build config:" detailText:[dbInfo objectForKey:@"BuildConfiguration"]]];
[_infoArray addObject:[self cellWithText:@"The \"IF\" coefficient:" detailText:[dbInfo objectForKey:@"IfCoef"]]];
UITableViewCell *cell = [self cellWithText:@"" detailText:@""];
[_infoArray addObject:cell];
NSArray *notices = [dbInfo objectForKey:@"Notices"];
UITextView *textView = [UITextView new];
textView.frame = cell.bounds;
NSString *allNotices = @"Release notices:\n\n";
for (NSString* s in notices)
allNotices = [NSString stringWithFormat:@"%@* %@\n", allNotices, s];
textView.text = allNotices;
[cell addSubview:textView];
cell.frame = CGRectMake(cell.frame.origin.x, cell.frame.origin.y, cell.frame.size.width, textView.frame.size.height);
[_infoArray addObject:[self cellWithText:@"Build date:" detailText:[dbInfo objectForKey:@"BuildTime"]]];
}
//==============================================================================
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
//==============================================================================
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
//==============================================================================
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
//==============================================================================
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
//==============================================================================
#pragma mark - Table view data source
//==============================================================================
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
//==============================================================================
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [_infoArray objectAtIndex:indexPath.row];
return cell.frame.size.height;
}
//==============================================================================
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return _infoArray.count;
}
//==============================================================================
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
return [_infoArray objectAtIndex:indexPath.row];
}
//==============================================================================
#pragma mark - Table view delegate
//==============================================================================
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.
/*
<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
*/
}
//==============================================================================
@end
//==============================================================================