Fixing issue when returning to iphone app and refreshing feeds while not on feed list page.

This commit is contained in:
Samuel Clay 2011-08-26 09:34:30 -07:00
parent 551eebe66a
commit 15c5554200
5 changed files with 25 additions and 74 deletions

View file

@ -1,56 +0,0 @@
upstream app_server {
server 127.0.0.1:8000 fail_timeout=1;
}
server {
listen 80 default;
client_max_body_size 4M;
server_name _;
location /media/admin/ {
alias /usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/contrib/admin/media/;
}
location /media/ {
expires max;
keepalive_timeout 1;
root /home/sclay/newsblur;
}
location /favicon.ico {
alias /home/sclay/newsblur/media/img/favicon.png;
expires max;
access_log off;
}
location ^~ /crossdomain.xml {
expires max;
alias /home/sclay/newsblur/media/crossdomain.xml;
types {
text/x-cross-domain-policy xml;
}
}
location ^~ /robots.txt {
expires max;
alias /home/sclay/newsblur/media/robots.txt;
}
location /munin/ {
alias /var/cache/munin/www/;
}
location / {
if (-f /home/sclay/newsblur/media/maintenance.html) {
rewrite ^(.*)$ /media/maintenance.html last;
break;
}
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://app_server;
break;
}
}
}

6
fabfile.py vendored
View file

@ -33,8 +33,8 @@ env.roledefs ={
'local': ['localhost'],
'app': ['app01.newsblur.com'],
'web': ['www.newsblur.com'],
'db': ['db01.newsblur.com'],
'task': ['task01.newsblur.com', 'task02.newsblur.com', 'db02.newsblur.com', '199.15.250.233'],
'db': ['db01.newsblur.com', 'db02.newsblur.com'],
'task': ['task01.newsblur.com', 'task02.newsblur.com', 'task03.newsblur.com'],
}
# ================
@ -350,7 +350,7 @@ def configure_nginx():
put("config/nginx.conf", "/usr/local/nginx/conf/nginx.conf", use_sudo=True)
sudo("mkdir -p /usr/local/nginx/conf/sites-enabled")
sudo("mkdir -p /var/log/nginx")
put("config/newsblur.conf", "/usr/local/nginx/conf/sites-enabled/newsblur.conf", use_sudo=True)
put("config/nginx.newsblur.conf", "/usr/local/nginx/conf/sites-enabled/newsblur.conf", use_sudo=True)
put("config/nginx-init", "/etc/init.d/nginx", use_sudo=True)
sudo("chmod 0755 /etc/init.d/nginx")
sudo("/usr/sbin/update-rc.d -f nginx defaults")

View file

@ -63,16 +63,18 @@ blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
[pull setDelegate:self];
[self.feedTitlesTable addSubview:pull];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(returnToApp)
name:UIApplicationWillEnterForegroundNotification
object:nil];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(returnToApp)
name:UIApplicationWillEnterForegroundNotification
object:nil];
[super viewDidLoad];
}
- (void)viewWillAppear:(BOOL)animated {
[self.feedTitlesTable deselectRowAtIndexPath:[feedTitlesTable indexPathForSelectedRow] animated:animated];
[self.feedTitlesTable deselectRowAtIndexPath:[feedTitlesTable indexPathForSelectedRow]
animated:animated];
if (appDelegate.activeFeedIndexPath) {
// NSLog(@"Refreshing feed at %d / %d: %@", appDelegate.activeFeedIndexPath.section, appDelegate.activeFeedIndexPath.row, [appDelegate activeFeed]);
[self.feedTitlesTable beginUpdates];
@ -88,9 +90,12 @@ blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
[self updateFeedsWithIntelligence:previousLevel newLevel:newLevel];
}
}
[self.intelligenceControl setImage:[UIImage imageNamed:@"bullet_red.png"] forSegmentAtIndex:0];
[self.intelligenceControl setImage:[UIImage imageNamed:@"bullet_yellow.png"] forSegmentAtIndex:1];
[self.intelligenceControl setImage:[UIImage imageNamed:@"bullet_green.png"] forSegmentAtIndex:2];
[self.intelligenceControl setImage:[UIImage imageNamed:@"bullet_red.png"]
forSegmentAtIndex:0];
[self.intelligenceControl setImage:[UIImage imageNamed:@"bullet_yellow.png"]
forSegmentAtIndex:1];
[self.intelligenceControl setImage:[UIImage imageNamed:@"bullet_green.png"]
forSegmentAtIndex:2];
[self.intelligenceControl addTarget:self
action:@selector(selectIntelligence)
forControlEvents:UIControlEventValueChanged];
@ -155,16 +160,16 @@ blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#pragma mark Initialization
- (void)returnToApp {
NSDate *decayDate = [[NSDate alloc] initWithTimeIntervalSinceNow:(-10*60)];
NSDate *decayDate = [[NSDate alloc] initWithTimeIntervalSinceNow:(1/*-10*60*/)];
NSLog(@"Last Update: %@ - %f", self.lastUpdate, [self.lastUpdate timeIntervalSinceDate:decayDate]);
if ([self.lastUpdate timeIntervalSinceDate:decayDate] < 0) {
[self fetchFeedList:NO];
[self fetchFeedList:YES];
}
[decayDate release];
}
- (void)fetchFeedList:(BOOL)showLoader {
if (showLoader) {
if (showLoader && appDelegate.feedsViewController.view.window) {
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
HUD.labelText = @"On its way...";
}
@ -226,7 +231,9 @@ blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
NSDictionary *results = [[NSDictionary alloc]
initWithDictionary:[jsonString JSONValue]];
appDelegate.activeUsername = [results objectForKey:@"user"];
[appDelegate setTitle:[results objectForKey:@"user"]];
if (appDelegate.feedsViewController.view.window) {
[appDelegate setTitle:[results objectForKey:@"user"]];
}
self.dictFolders = [results objectForKey:@"flat_folders"];
self.dictFeeds = [results objectForKey:@"feeds"];
// NSLog(@"Received Feeds: %@", dictFolders);

View file

@ -12,7 +12,7 @@
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
// #define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.host:8000"]
#define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
#define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.host:8000"]
// #define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
#endif

View file

@ -3,7 +3,7 @@
// NewsBlur
//
// Created by Samuel Clay on 6/16/10.
// Copyright __MyCompanyName__ 2010. All rights reserved.
// Copyright NewsBlur 2010. All rights reserved.
//
#import <UIKit/UIKit.h>