Skip to content

Commit 0938499

Browse files
committed
release 0.5.2
1 parent 1aff428 commit 0938499

File tree

13 files changed

+1212
-1150
lines changed

13 files changed

+1212
-1150
lines changed

CriticalMass.xcodeproj/project.pbxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@
467467
GCC_WARN_UNUSED_FUNCTION = YES;
468468
GCC_WARN_UNUSED_VARIABLE = YES;
469469
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
470+
ONLY_ACTIVE_ARCH = NO;
470471
SDKROOT = iphoneos;
471472
VALIDATE_PRODUCT = YES;
472473
};

CriticalMass/CriticalMass-Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>0.5.1</string>
20+
<string>0.5.2</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>0.5.1</string>
24+
<string>0.5.2</string>
2525
<key>LSApplicationCategoryType</key>
2626
<string></string>
2727
<key>LSRequiresIPhoneOS</key>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x",
6+
"filename" : "Reload.png"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
Loading

CriticalMass/PLConstants.m

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@ @implementation PLConstants
1313
@end
1414

1515
// Debug
16-
BOOL const kDebug = YES;
17-
BOOL const kDebugEnableTestURL = YES;
18-
BOOL const kDebugEnableTestLocation = YES;
19-
BOOL const kDebugDisableHTTPRequests = YES;
16+
BOOL const kDebug = NO;
17+
BOOL const kDebugEnableTestURL = NO;
18+
BOOL const kDebugEnableTestLocation = NO;
19+
BOOL const kDebugDisableHTTPRequests = NO;
2020
BOOL const kDebugInitialTabIndex = 0;
2121

2222
// Urls
23+
NSString *const kUrlService = @"http://api.criticalmaps.net/get";
24+
NSString *const kUrlServiceTest = @"http://api.criticalmaps.net/test";
25+
//NSString *const kUrlService = @"http://criticalmass.stephanlindauer.de/get.php";
26+
//NSString *const kUrlServiceTest = @"http://criticalmass.stephanlindauer.de/test.php";
2327
//NSString *const kUrlTile = @"http://tile.openstreetmap.org/{z}/{x}/{y}.png";
24-
NSString *const kUrlService = @"http://criticalmass.stephanlindauer.de/get.php";
25-
NSString *const kUrlServiceTest = @"http://criticalmass.stephanlindauer.de/test.php";
2628

2729
// Notifications
2830
NSString *const kNotificationInitialGpsDataReceived = @"initialGpsDataReceived";

CriticalMass/PLData.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ - (void)request
9696
NSString *requestUrl = (kDebug && kDebugEnableTestURL) ? kUrlServiceTest : kUrlService;
9797

9898
[_requestManager GET:requestUrl parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
99-
NSLog(@"JSON: %@", responseObject);
100-
_otherLocations = responseObject;
99+
_otherLocations = [responseObject objectForKey:@"locations"];
100+
NSLog(@"locations: %@", _otherLocations);
101101
[[NSNotificationCenter defaultCenter] postNotificationName:kNotificationPositionOthersChanged object:self];
102102
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
103103
NSLog(@"Error: %@", error);

CriticalMass/PLLabel.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@implementation PLLabel
1212

1313
- (void)drawTextInRect:(CGRect)rect {
14-
UIEdgeInsets insets = {10, 20, 10, 20};
14+
UIEdgeInsets insets = {10, 15, 10, 15};
1515
[super drawTextInRect:UIEdgeInsetsInsetRect(rect, insets)];
1616
}
1717

CriticalMass/PLTwitterViewController.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
//
88

99
#import <UIKit/UIKit.h>
10+
#import "STTWitter.h"
11+
#import "SAMLoadingView.h"
1012

1113
@interface PLTwitterViewController : UIViewController<UITableViewDataSource, UITableViewDelegate>{
14+
STTwitterAPI *_twitter;
1215
UITableView *_tableView;
1316
NSArray *_statuses;
17+
SAMLoadingView *_loadingView;
1418
}
1519

1620
@end

CriticalMass/PLTwitterViewController.m

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//
88

99
#import "PLTwitterViewController.h"
10-
#import "STTWitter.h"
1110
#import "PLLabel.h"
1211

1312
@interface PLTwitterViewController ()
@@ -19,17 +18,21 @@ @implementation PLTwitterViewController
1918
- (void)viewDidLoad {
2019
[super viewDidLoad];
2120

22-
PLLabel *label = [[PLLabel alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 70)];
21+
PLLabel *label = [[PLLabel alloc] initWithFrame:CGRectMake(0, 20, self.view.frame.size.width, 50)];
2322
label.text = @"Latest Tweets of #cmberlin";
2423
[label setFont: [UIFont fontWithName:@"HelveticaNeue-Medium" size:18.0f]];
2524
[self.view addSubview:label];
2625

26+
UIButton *reloadBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.view.frame.size.width-52, 35, 22, 20)];
27+
[reloadBtn setImage:[UIImage imageNamed:@"Reload"] forState:UIControlStateNormal];
28+
[reloadBtn addTarget:self action:@selector(onClickReload:) forControlEvents:UIControlEventTouchUpInside];
29+
[self.view addSubview:reloadBtn];
30+
2731
CGRect frame = CGRectMake(0, 70, self.view.frame.size.width, self.view.frame.size.height - 120);
2832

2933
_tableView = [[UITableView alloc] initWithFrame:frame style:UITableViewStylePlain];
3034
[_tableView setDelegate:self];
3135
[_tableView setDataSource:self];
32-
_tableView.rowHeight = 300;
3336

3437
UIBezierPath *path = [UIBezierPath bezierPath];
3538
[path moveToPoint:CGPointMake(0, 70.0)];
@@ -47,23 +50,33 @@ - (void)viewDidLoad {
4750
//_tableVC.tableView.tableHeaderView = [self headerView];
4851

4952
[self.view addSubview:_tableView];
50-
5153

52-
STTwitterAPI *twitter = [STTwitterAPI twitterAPIAppOnlyWithConsumerKey:@"e0vyKNT3iC89SkUaIzEvX1oii" consumerSecret:@"151lpogCiUp4RhjRNZukl2tJSeGyskq37U8wmldFm9FDPfzBW8"];
5354

54-
[twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {
55+
_twitter = [STTwitterAPI twitterAPIAppOnlyWithConsumerKey:@"e0vyKNT3iC89SkUaIzEvX1oii" consumerSecret:@"151lpogCiUp4RhjRNZukl2tJSeGyskq37U8wmldFm9FDPfzBW8"];
56+
57+
_loadingView = [[SAMLoadingView alloc] initWithFrame: frame];
58+
_loadingView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
59+
[self.view addSubview:_loadingView];
60+
61+
[self loadTweets];
62+
}
63+
64+
- (void)loadTweets {
65+
[_loadingView setHidden:NO];
66+
[_twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {
5567

5668
NSLog(@"Access granted with %@", bearerToken);
5769

58-
[twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {
70+
[_twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {
5971

60-
[twitter getSearchTweetsWithQuery:@"CMBerlin"
61-
successBlock:^(NSDictionary *searchMetadata, NSArray *statuses) {
62-
_statuses = statuses;
63-
[_tableView reloadData];
64-
} errorBlock:^(NSError *error) {
65-
// ...
66-
}];
72+
[_twitter getSearchTweetsWithQuery:@"cmberlin"
73+
successBlock:^(NSDictionary *searchMetadata, NSArray *statuses) {
74+
_statuses = statuses;
75+
[_tableView reloadData];
76+
[_loadingView setHidden:YES];
77+
} errorBlock:^(NSError *error) {
78+
// ...
79+
}];
6780

6881
} errorBlock:^(NSError *error) {
6982
// ...
@@ -72,13 +85,24 @@ - (void)viewDidLoad {
7285
} errorBlock:^(NSError *error) {
7386
NSLog(@"-- error %@", error);
7487
}];
88+
7589
}
7690

77-
- (void)didReceiveMemoryWarning {
91+
- (void)viewWillAppear:(BOOL)animated{
92+
[super viewDidAppear:animated];
93+
94+
[_tableView reloadData];
95+
}
7896

97+
- (void)didReceiveMemoryWarning {
98+
7999
[super didReceiveMemoryWarning];
80100
}
81101

102+
- (IBAction)onClickReload:(id)sender {
103+
[self loadTweets];
104+
}
105+
82106
#pragma mark - Data source
83107

84108
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
@@ -93,6 +117,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
93117
if (cell == nil) {
94118
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"TwitterCell"];
95119
cell.selectionStyle = UITableViewCellSelectionStyleNone;
120+
cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
121+
cell.textLabel.numberOfLines = 0;
96122
}
97123

98124
NSDictionary *status = [_statuses objectAtIndex:indexPath.row];
@@ -101,13 +127,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
101127
NSString *screenName = [status valueForKeyPath:@"user.screen_name"];
102128
NSString *dateString = [status valueForKey:@"created_at"];
103129

104-
cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
105-
cell.textLabel.numberOfLines = 0;
106-
CGRect rect = CGRectMake(0, 0, cell.frame.size.width, 100);
107-
cell.textLabel.frame = rect;
108130
cell.textLabel.text = text;
109-
cell.textLabel.layer.borderColor = [UIColor blackColor].CGColor;
110-
cell.textLabel.layer.borderWidth = 4.0;
111131
cell.detailTextLabel.text = [NSString stringWithFormat:@"@%@ | %@", screenName, dateString];
112132

113133
return cell;
@@ -119,5 +139,4 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
119139
return 1;
120140
}
121141

122-
123142
@end

Gfx/Reload.png

1.45 KB
Loading

Gfx/gfx.ai

Lines changed: 1127 additions & 1116 deletions
Large diffs are not rendered by default.

Podfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ pod 'AFNetworking'
88
pod 'NSString-Hashes'
99
pod 'AccordionView'
1010
pod 'TTTAttributedLabel'
11-
pod 'STTwitter'
11+
pod 'STTwitter'
12+
pod 'SAMLoadingView'

Podfile.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,23 @@ PODS:
2222
- AFNetworking/NSURLConnection
2323
- AFNetworking/NSURLSession
2424
- NSString-Hashes (1.2.2)
25+
- SAMLoadingView (0.1.0)
2526
- STTwitter (0.1.5)
2627
- TTTAttributedLabel (1.10.1)
2728

2829
DEPENDENCIES:
2930
- AccordionView
3031
- AFNetworking
3132
- NSString-Hashes
33+
- SAMLoadingView
3234
- STTwitter
3335
- TTTAttributedLabel
3436

3537
SPEC CHECKSUMS:
3638
AccordionView: bc022d5ae3b05a96b0b1ccd41cf37cc6796161a7
3739
AFNetworking: 0aabc6fae66d6e5d039eeb21c315843c7aae51ab
3840
NSString-Hashes: ddf6e856e93d3c83c5d4ef8fcdea2a96ed77c6bc
41+
SAMLoadingView: 11b746311268140f6a2380723215fe96a6d15dee
3942
STTwitter: 60f28af91d622b9a3f74f28cd021413277d413bb
4043
TTTAttributedLabel: 94bb04f1e005616002dd2cee0262a0082e533627
4144

0 commit comments

Comments
 (0)