Skip to content

Commit

Permalink
release 0.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
normansander committed Nov 12, 2014
1 parent 1aff428 commit 0938499
Show file tree
Hide file tree
Showing 13 changed files with 1,212 additions and 1,150 deletions.
1 change: 1 addition & 0 deletions CriticalMass.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
Expand Down
4 changes: 2 additions & 2 deletions CriticalMass/CriticalMass-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.5.1</string>
<string>0.5.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.5.1</string>
<string>0.5.2</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSRequiresIPhoneOS</key>
Expand Down
21 changes: 21 additions & 0 deletions CriticalMass/Images.xcassets/Reload.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Reload.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 8 additions & 6 deletions CriticalMass/PLConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ @implementation PLConstants
@end

// Debug
BOOL const kDebug = YES;
BOOL const kDebugEnableTestURL = YES;
BOOL const kDebugEnableTestLocation = YES;
BOOL const kDebugDisableHTTPRequests = YES;
BOOL const kDebug = NO;
BOOL const kDebugEnableTestURL = NO;
BOOL const kDebugEnableTestLocation = NO;
BOOL const kDebugDisableHTTPRequests = NO;
BOOL const kDebugInitialTabIndex = 0;

// Urls
NSString *const kUrlService = @"http://api.criticalmaps.net/get";
NSString *const kUrlServiceTest = @"http://api.criticalmaps.net/test";
//NSString *const kUrlService = @"http://criticalmass.stephanlindauer.de/get.php";
//NSString *const kUrlServiceTest = @"http://criticalmass.stephanlindauer.de/test.php";
//NSString *const kUrlTile = @"http://tile.openstreetmap.org/{z}/{x}/{y}.png";
NSString *const kUrlService = @"http://criticalmass.stephanlindauer.de/get.php";
NSString *const kUrlServiceTest = @"http://criticalmass.stephanlindauer.de/test.php";

// Notifications
NSString *const kNotificationInitialGpsDataReceived = @"initialGpsDataReceived";
Expand Down
4 changes: 2 additions & 2 deletions CriticalMass/PLData.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ - (void)request
NSString *requestUrl = (kDebug && kDebugEnableTestURL) ? kUrlServiceTest : kUrlService;

[_requestManager GET:requestUrl parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
_otherLocations = responseObject;
_otherLocations = [responseObject objectForKey:@"locations"];
NSLog(@"locations: %@", _otherLocations);
[[NSNotificationCenter defaultCenter] postNotificationName:kNotificationPositionOthersChanged object:self];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
Expand Down
2 changes: 1 addition & 1 deletion CriticalMass/PLLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@implementation PLLabel

- (void)drawTextInRect:(CGRect)rect {
UIEdgeInsets insets = {10, 20, 10, 20};
UIEdgeInsets insets = {10, 15, 10, 15};
[super drawTextInRect:UIEdgeInsetsInsetRect(rect, insets)];
}

Expand Down
4 changes: 4 additions & 0 deletions CriticalMass/PLTwitterViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
//

#import <UIKit/UIKit.h>
#import "STTWitter.h"
#import "SAMLoadingView.h"

@interface PLTwitterViewController : UIViewController<UITableViewDataSource, UITableViewDelegate>{
STTwitterAPI *_twitter;
UITableView *_tableView;
NSArray *_statuses;
SAMLoadingView *_loadingView;
}

@end
63 changes: 41 additions & 22 deletions CriticalMass/PLTwitterViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

#import "PLTwitterViewController.h"
#import "STTWitter.h"
#import "PLLabel.h"

@interface PLTwitterViewController ()
Expand All @@ -19,17 +18,21 @@ @implementation PLTwitterViewController
- (void)viewDidLoad {
[super viewDidLoad];

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

UIButton *reloadBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.view.frame.size.width-52, 35, 22, 20)];
[reloadBtn setImage:[UIImage imageNamed:@"Reload"] forState:UIControlStateNormal];
[reloadBtn addTarget:self action:@selector(onClickReload:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:reloadBtn];

CGRect frame = CGRectMake(0, 70, self.view.frame.size.width, self.view.frame.size.height - 120);

_tableView = [[UITableView alloc] initWithFrame:frame style:UITableViewStylePlain];
[_tableView setDelegate:self];
[_tableView setDataSource:self];
_tableView.rowHeight = 300;

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

[self.view addSubview:_tableView];


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

[twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {
_twitter = [STTwitterAPI twitterAPIAppOnlyWithConsumerKey:@"e0vyKNT3iC89SkUaIzEvX1oii" consumerSecret:@"151lpogCiUp4RhjRNZukl2tJSeGyskq37U8wmldFm9FDPfzBW8"];

_loadingView = [[SAMLoadingView alloc] initWithFrame: frame];
_loadingView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:_loadingView];

[self loadTweets];
}

- (void)loadTweets {
[_loadingView setHidden:NO];
[_twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {

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

[twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {
[_twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {

[twitter getSearchTweetsWithQuery:@"CMBerlin"
successBlock:^(NSDictionary *searchMetadata, NSArray *statuses) {
_statuses = statuses;
[_tableView reloadData];
} errorBlock:^(NSError *error) {
// ...
}];
[_twitter getSearchTweetsWithQuery:@"cmberlin"
successBlock:^(NSDictionary *searchMetadata, NSArray *statuses) {
_statuses = statuses;
[_tableView reloadData];
[_loadingView setHidden:YES];
} errorBlock:^(NSError *error) {
// ...
}];

} errorBlock:^(NSError *error) {
// ...
Expand All @@ -72,13 +85,24 @@ - (void)viewDidLoad {
} errorBlock:^(NSError *error) {
NSLog(@"-- error %@", error);
}];

}

- (void)didReceiveMemoryWarning {
- (void)viewWillAppear:(BOOL)animated{
[super viewDidAppear:animated];

[_tableView reloadData];
}

- (void)didReceiveMemoryWarning {

[super didReceiveMemoryWarning];
}

- (IBAction)onClickReload:(id)sender {
[self loadTweets];
}

#pragma mark - Data source

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

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

cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
cell.textLabel.numberOfLines = 0;
CGRect rect = CGRectMake(0, 0, cell.frame.size.width, 100);
cell.textLabel.frame = rect;
cell.textLabel.text = text;
cell.textLabel.layer.borderColor = [UIColor blackColor].CGColor;
cell.textLabel.layer.borderWidth = 4.0;
cell.detailTextLabel.text = [NSString stringWithFormat:@"@%@ | %@", screenName, dateString];

return cell;
Expand All @@ -119,5 +139,4 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
return 1;
}


@end
Binary file added Gfx/Reload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,243 changes: 1,127 additions & 1,116 deletions Gfx/gfx.ai

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ pod 'AFNetworking'
pod 'NSString-Hashes'
pod 'AccordionView'
pod 'TTTAttributedLabel'
pod 'STTwitter'
pod 'STTwitter'
pod 'SAMLoadingView'
3 changes: 3 additions & 0 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,23 @@ PODS:
- AFNetworking/NSURLConnection
- AFNetworking/NSURLSession
- NSString-Hashes (1.2.2)
- SAMLoadingView (0.1.0)
- STTwitter (0.1.5)
- TTTAttributedLabel (1.10.1)

DEPENDENCIES:
- AccordionView
- AFNetworking
- NSString-Hashes
- SAMLoadingView
- STTwitter
- TTTAttributedLabel

SPEC CHECKSUMS:
AccordionView: bc022d5ae3b05a96b0b1ccd41cf37cc6796161a7
AFNetworking: 0aabc6fae66d6e5d039eeb21c315843c7aae51ab
NSString-Hashes: ddf6e856e93d3c83c5d4ef8fcdea2a96ed77c6bc
SAMLoadingView: 11b746311268140f6a2380723215fe96a6d15dee
STTwitter: 60f28af91d622b9a3f74f28cd021413277d413bb
TTTAttributedLabel: 94bb04f1e005616002dd2cee0262a0082e533627

Expand Down

0 comments on commit 0938499

Please sign in to comment.