Merge branch 'master' into facebook_share
* master: (107 commits) Adding scroll to comments button to share bar. Thanks @afita. Turning off microformats for more errors. Fixing errors in timeouts to show the correct error. Also fixing microformats parsing issue and allow IPv6 URLs in enclosures to be ignored, fixing a bunch of feeds. Cleaning redis stories for 1% of all feed fetches. Refreshing feed on fetch. Fiddling with logging on dupe feeds. Adding bs facebook assets. Better to push together than to spread apart. Diffing html is hard. Changing logging colors for social activities. Delaying Paypal return, fixing privacy css, and adding convenience function. Adding esc shortcut key in keyboard shortcuts. Also turning on privacy features for public beta testing. Fixing the missing story titles bug. Turns out it happens when a story title is loaded twice but the reuslting map contains an undefined, which nullifies the rest of the stories. Doh! Fixing hostname for Firefox content handler. Adding share info to saved stories. Revert "Failing marking a story as read in ios now shows an error." Failing marking a story as read in ios now shows an error. Consistency b/w ios and web for unsaving a story. Adding unread counter to All Sites. Allowing regular users to change read_filter on socialfeeds. Changing icons on welcome page. ...
|
@ -96,7 +96,7 @@ class MClassifierFeed(mongo.Document):
|
|||
def __unicode__(self):
|
||||
user = User.objects.get(pk=self.user_id)
|
||||
if self.feed_id:
|
||||
feed = Feed.objects.get(pk=self.feed_id)
|
||||
feed = Feed.get_by_id(self.feed_id)
|
||||
else:
|
||||
feed = User.objects.get(pk=self.social_user_id)
|
||||
return "%s - %s/%s: (%s) %s" % (user, self.feed_id, self.social_user_id, self.score, feed)
|
||||
|
|
|
@ -244,7 +244,7 @@ def share_story(request, token):
|
|||
code = -1
|
||||
|
||||
if feed_id:
|
||||
feed = Feed.objects.get(pk=feed_id)
|
||||
feed = Feed.get_by_id(feed_id)
|
||||
else:
|
||||
if rss_url:
|
||||
feed = Feed.get_feed_from_url(rss_url, create=True, fetch=True)
|
||||
|
|
|
@ -100,7 +100,7 @@ class MCategorySite(mongo.Document):
|
|||
}
|
||||
|
||||
def __unicode__(self):
|
||||
feed = Feed.objects.get(pk=self.feed_id)
|
||||
feed = Feed.get_by_id(self.feed_id)
|
||||
return "%s: %s" % (self.category_title, feed)
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -150,7 +150,7 @@ def follow_twitter_account(request):
|
|||
code = 1
|
||||
message = "OK"
|
||||
|
||||
logging.user(request, "~BB~FRFollowing Twitter: %s" % username)
|
||||
logging.user(request, "~BB~FR~SKFollowing Twitter: %s" % username)
|
||||
|
||||
if username not in ['samuelclay', 'newsblur']:
|
||||
return HttpResponseForbidden
|
||||
|
|
84
apps/profile/migrations/0020_hide_mobile.py
Normal file
|
@ -0,0 +1,84 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
# Deleting field 'Profile.hide_mobile'
|
||||
db.delete_column('profile_profile', 'hide_mobile')
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Adding field 'Profile.hide_mobile'
|
||||
db.add_column('profile_profile', 'hide_mobile',
|
||||
self.gf('django.db.models.fields.BooleanField')(default=False),
|
||||
keep_default=False)
|
||||
|
||||
|
||||
models = {
|
||||
'auth.group': {
|
||||
'Meta': {'object_name': 'Group'},
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
|
||||
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
|
||||
},
|
||||
'auth.permission': {
|
||||
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
|
||||
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
|
||||
},
|
||||
'auth.user': {
|
||||
'Meta': {'object_name': 'User'},
|
||||
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
|
||||
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
||||
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
|
||||
},
|
||||
'contenttypes.contenttype': {
|
||||
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
|
||||
},
|
||||
'profile.profile': {
|
||||
'Meta': {'object_name': 'Profile'},
|
||||
'collapsed_folders': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
|
||||
'dashboard_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||
'feed_pane_size': ('django.db.models.fields.IntegerField', [], {'default': '240'}),
|
||||
'has_found_friends': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
|
||||
'has_setup_feeds': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
|
||||
'has_trained_intelligence': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
|
||||
'hide_getting_started': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'is_premium': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'last_seen_ip': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
|
||||
'last_seen_on': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||
'preferences': ('django.db.models.fields.TextField', [], {'default': "'{}'"}),
|
||||
'secret_token': ('django.db.models.fields.CharField', [], {'max_length': '12', 'null': 'True', 'blank': 'True'}),
|
||||
'send_emails': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
||||
'stripe_4_digits': ('django.db.models.fields.CharField', [], {'max_length': '4', 'null': 'True', 'blank': 'True'}),
|
||||
'stripe_id': ('django.db.models.fields.CharField', [], {'max_length': '24', 'null': 'True', 'blank': 'True'}),
|
||||
'timezone': ('vendor.timezones.fields.TimeZoneField', [], {'default': "'America/New_York'", 'max_length': '100'}),
|
||||
'tutorial_finished': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.User']"}),
|
||||
'view_settings': ('django.db.models.fields.TextField', [], {'default': "'{}'"})
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['profile']
|
|
@ -12,8 +12,9 @@ from django.core.mail import EmailMultiAlternatives
|
|||
from django.core.urlresolvers import reverse
|
||||
from django.template.loader import render_to_string
|
||||
from apps.reader.models import UserSubscription
|
||||
from apps.rss_feeds.models import Feed
|
||||
from apps.rss_feeds.models import Feed, MStory
|
||||
from apps.rss_feeds.tasks import NewFeeds
|
||||
from apps.feed_import.models import GoogleReaderImporter
|
||||
from utils import log as logging
|
||||
from utils import json_functions as json
|
||||
from utils.user_functions import generate_secret_token
|
||||
|
@ -34,7 +35,6 @@ class Profile(models.Model):
|
|||
has_setup_feeds = models.NullBooleanField(default=False, null=True, blank=True)
|
||||
has_found_friends = models.NullBooleanField(default=False, null=True, blank=True)
|
||||
has_trained_intelligence = models.NullBooleanField(default=False, null=True, blank=True)
|
||||
hide_mobile = models.BooleanField(default=False)
|
||||
last_seen_on = models.DateTimeField(default=datetime.datetime.now)
|
||||
last_seen_ip = models.CharField(max_length=50, blank=True, null=True)
|
||||
dashboard_date = models.DateTimeField(default=datetime.datetime.now)
|
||||
|
@ -55,7 +55,6 @@ class Profile(models.Model):
|
|||
'has_setup_feeds': self.has_setup_feeds,
|
||||
'has_found_friends': self.has_found_friends,
|
||||
'has_trained_intelligence': self.has_trained_intelligence,
|
||||
'hide_mobile': self.hide_mobile,
|
||||
'dashboard_date': self.dashboard_date
|
||||
}
|
||||
|
||||
|
@ -91,6 +90,11 @@ class Profile(models.Model):
|
|||
shared_stories = MSharedStory.objects.filter(user_id=self.user.pk)
|
||||
print " ---> Deleting %s shared stories" % shared_stories.count()
|
||||
for story in shared_stories:
|
||||
try:
|
||||
original_story = MStory.objects.get(pk=story.story_db_id)
|
||||
original_story.sync_redis()
|
||||
except MStory.DoesNotExist:
|
||||
pass
|
||||
story.delete()
|
||||
|
||||
subscriptions = MSocialSubscription.objects.filter(subscription_user_id=self.user.pk)
|
||||
|
@ -165,6 +169,10 @@ class Profile(models.Model):
|
|||
stale_feeds = list(set([f.feed_id for f in stale_feeds]))
|
||||
self.queue_new_feeds(new_feeds=stale_feeds)
|
||||
|
||||
def import_reader_starred_items(self, count=20):
|
||||
importer = GoogleReaderImporter(self.user)
|
||||
importer.import_starred_items(count=count)
|
||||
|
||||
def send_new_user_email(self):
|
||||
if not self.user.email or not self.send_emails:
|
||||
return
|
||||
|
|
|
@ -338,16 +338,16 @@ class UserSubscription(models.Model):
|
|||
story = MStory.objects.filter(story_feed_id=self.feed_id, story_guid=story_id)[0]
|
||||
now = datetime.datetime.utcnow()
|
||||
date = now if now > story.story_date else story.story_date # For handling future stories
|
||||
m, _ = MUserStory.objects.get_or_create(story=story, user_id=self.user_id,
|
||||
m, _ = MUserStory.objects.get_or_create(story_id=story_id, user_id=self.user_id,
|
||||
feed_id=self.feed_id, defaults={
|
||||
'read_date': date,
|
||||
'story_id': story_id,
|
||||
'story': story,
|
||||
'story_date': story.story_date,
|
||||
})
|
||||
|
||||
return data
|
||||
|
||||
def calculate_feed_scores(self, silent=False, stories_db=None):
|
||||
def calculate_feed_scores(self, silent=False, stories=None):
|
||||
# now = datetime.datetime.strptime("2009-07-06 22:30:03", "%Y-%m-%d %H:%M:%S")
|
||||
now = datetime.datetime.now()
|
||||
UNREAD_CUTOFF = now - datetime.timedelta(days=settings.DAYS_OF_UNREAD)
|
||||
|
@ -376,23 +376,23 @@ class UserSubscription(models.Model):
|
|||
read_stories = MUserStory.objects(user_id=self.user_id,
|
||||
feed_id=self.feed_id,
|
||||
read_date__gte=self.mark_read_date)
|
||||
# if not silent:
|
||||
# logging.info(' ---> [%s] Read stories: %s' % (self.user, datetime.datetime.now() - now))
|
||||
read_stories_ids = [us.story_id for us in read_stories]
|
||||
stories_db = stories_db or MStory.objects(story_feed_id=self.feed_id,
|
||||
story_date__gte=date_delta)
|
||||
# if not silent:
|
||||
# logging.info(' ---> [%s] MStory: %s' % (self.user, datetime.datetime.now() - now))
|
||||
|
||||
if not stories:
|
||||
stories_db = MStory.objects(story_feed_id=self.feed_id,
|
||||
story_date__gte=date_delta)
|
||||
stories = Feed.format_stories(stories_db, self.feed_id)
|
||||
|
||||
oldest_unread_story_date = now
|
||||
unread_stories_db = []
|
||||
for story in stories_db:
|
||||
if story.story_date < date_delta:
|
||||
unread_stories = []
|
||||
for story in stories:
|
||||
if story['story_date'] < date_delta:
|
||||
continue
|
||||
if hasattr(story, 'story_guid') and story.story_guid not in read_stories_ids:
|
||||
unread_stories_db.append(story)
|
||||
if story.story_date < oldest_unread_story_date:
|
||||
oldest_unread_story_date = story.story_date
|
||||
stories = Feed.format_stories(unread_stories_db, self.feed_id)
|
||||
if story['id'] not in read_stories_ids:
|
||||
unread_stories.append(story)
|
||||
if story['story_date'] < oldest_unread_story_date:
|
||||
oldest_unread_story_date = story['story_date']
|
||||
|
||||
# if not silent:
|
||||
# logging.info(' ---> [%s] Format stories: %s' % (self.user, datetime.datetime.now() - now))
|
||||
|
||||
|
@ -408,7 +408,7 @@ class UserSubscription(models.Model):
|
|||
'feed': apply_classifier_feeds(classifier_feeds, self.feed),
|
||||
}
|
||||
|
||||
for story in stories:
|
||||
for story in unread_stories:
|
||||
scores.update({
|
||||
'author' : apply_classifier_authors(classifier_authors, story),
|
||||
'tags' : apply_classifier_tags(classifier_tags, story),
|
||||
|
|
|
@ -15,6 +15,7 @@ urlpatterns = patterns('',
|
|||
url(r'^favicons', views.load_feed_favicons, name='load-feed-favicons'),
|
||||
url(r'^river_stories', views.load_river_stories__redis, name='load-river-stories'),
|
||||
url(r'^refresh_feeds', views.refresh_feeds, name='refresh-feeds'),
|
||||
url(r'^feed_unread_count', views.feed_unread_count, name='feed-unread-count'),
|
||||
url(r'^starred_stories', views.load_starred_stories, name='load-starred-stories'),
|
||||
url(r'^mark_all_as_read', views.mark_all_as_read, name='mark-all-as-read'),
|
||||
url(r'^mark_story_as_read', views.mark_story_as_read, name='mark-story-as-read'),
|
||||
|
|
|
@ -279,7 +279,7 @@ def load_feeds_flat(request):
|
|||
|
||||
feeds = {}
|
||||
flat_folders = {" ": []}
|
||||
iphone_version = "1.5"
|
||||
iphone_version = "1.7"
|
||||
|
||||
if include_favicons == 'false': include_favicons = False
|
||||
if update_counts == 'false': update_counts = False
|
||||
|
@ -353,7 +353,7 @@ def load_feeds_flat(request):
|
|||
}
|
||||
return data
|
||||
|
||||
@ratelimit(minutes=1, requests=20)
|
||||
@ratelimit(minutes=1, requests=10)
|
||||
@never_cache
|
||||
@json.json_view
|
||||
def refresh_feeds(request):
|
||||
|
@ -407,6 +407,33 @@ def refresh_feeds(request):
|
|||
|
||||
return {'feeds': feeds, 'social_feeds': social_feeds}
|
||||
|
||||
@never_cache
|
||||
@json.json_view
|
||||
def feed_unread_count(request):
|
||||
user = get_user(request)
|
||||
feed_ids = request.REQUEST.getlist('feed_id')
|
||||
social_feed_ids = [feed_id for feed_id in feed_ids if 'social:' in feed_id]
|
||||
feed_ids = list(set(feed_ids) - set(social_feed_ids))
|
||||
|
||||
feeds = {}
|
||||
if feed_ids:
|
||||
feeds = UserSubscription.feeds_with_updated_counts(user, feed_ids=feed_ids)
|
||||
|
||||
social_feeds = {}
|
||||
if social_feed_ids:
|
||||
social_feeds = MSocialSubscription.feeds_with_updated_counts(user, social_feed_ids=social_feed_ids)
|
||||
|
||||
if settings.DEBUG:
|
||||
if len(feed_ids):
|
||||
feed_title = Feed.get_by_id(feed_ids[0]).feed_title
|
||||
elif len(social_feed_ids) == 1:
|
||||
feed_title = MSocialProfile.objects.get(user_id=social_feed_ids[0].replace('social:', '')).username
|
||||
else:
|
||||
feed_title = "%s feeds" % (len(feeds) + len(social_feeds))
|
||||
logging.user(request, "~FBUpdating unread count on: %s" % feed_title)
|
||||
|
||||
return {'feeds': feeds, 'social_feeds': social_feeds}
|
||||
|
||||
def refresh_feed(request, feed_id):
|
||||
user = get_user(request)
|
||||
feed = get_object_or_404(Feed, pk=feed_id)
|
||||
|
@ -557,7 +584,7 @@ def load_single_feed(request, feed_id):
|
|||
if dupe_feed_id: data['dupe_feed_id'] = dupe_feed_id
|
||||
if not usersub:
|
||||
data.update(feed.canonical())
|
||||
|
||||
|
||||
return data
|
||||
|
||||
def load_feed_page(request, feed_id):
|
||||
|
@ -572,13 +599,14 @@ def load_feed_page(request, feed_id):
|
|||
feed.s3_page):
|
||||
if settings.PROXY_S3_PAGES:
|
||||
key = settings.S3_PAGES_BUCKET.get_key(feed.s3_pages_key)
|
||||
compressed_data = key.get_contents_as_string()
|
||||
response = HttpResponse(compressed_data, mimetype="text/html; charset=utf-8")
|
||||
response['Content-Encoding'] = 'gzip'
|
||||
if key:
|
||||
compressed_data = key.get_contents_as_string()
|
||||
response = HttpResponse(compressed_data, mimetype="text/html; charset=utf-8")
|
||||
response['Content-Encoding'] = 'gzip'
|
||||
|
||||
logging.user(request, "~FYLoading original page, proxied: ~SB%s bytes" %
|
||||
(len(compressed_data)))
|
||||
return response
|
||||
logging.user(request, "~FYLoading original page, proxied: ~SB%s bytes" %
|
||||
(len(compressed_data)))
|
||||
return response
|
||||
else:
|
||||
logging.user(request, "~FYLoading original page, non-proxied")
|
||||
return HttpResponseRedirect('//%s/%s' % (settings.S3_PAGES_BUCKET_NAME,
|
||||
|
@ -606,12 +634,21 @@ def load_starred_stories(request):
|
|||
|
||||
mstories = MStarredStory.objects(user_id=user.pk).order_by('-starred_date')[offset:offset+limit]
|
||||
stories = Feed.format_stories(mstories)
|
||||
|
||||
stories, user_profiles = MSharedStory.stories_with_comments_and_profiles(stories, user.pk, check_all=True)
|
||||
|
||||
story_ids = [story['id'] for story in stories]
|
||||
story_feed_ids = list(set(s['story_feed_id'] for s in stories))
|
||||
usersub_ids = UserSubscription.objects.filter(user__pk=user.pk, feed__pk__in=story_feed_ids).values('feed__pk')
|
||||
usersub_ids = [us['feed__pk'] for us in usersub_ids]
|
||||
unsub_feed_ids = list(set(story_feed_ids).difference(set(usersub_ids)))
|
||||
unsub_feeds = Feed.objects.filter(pk__in=unsub_feed_ids)
|
||||
unsub_feeds = dict((feed.pk, feed.canonical(include_favicon=False)) for feed in unsub_feeds)
|
||||
shared_stories = MSharedStory.objects(user_id=user.pk,
|
||||
story_guid__in=story_ids)\
|
||||
.only('story_guid', 'shared_date', 'comments')
|
||||
shared_stories = dict([(story.story_guid, dict(shared_date=story.shared_date, comments=story.comments))
|
||||
for story in shared_stories])
|
||||
|
||||
for story in stories:
|
||||
story_date = localtime_for_timezone(story['story_date'], user.profile.timezone)
|
||||
|
@ -622,15 +659,22 @@ def load_starred_stories(request):
|
|||
story['read_status'] = 1
|
||||
story['starred'] = True
|
||||
story['intelligence'] = {
|
||||
'feed': 0,
|
||||
'feed': 1,
|
||||
'author': 0,
|
||||
'tags': 0,
|
||||
'title': 0,
|
||||
}
|
||||
if story['id'] in shared_stories:
|
||||
story['shared'] = True
|
||||
story['shared_comments'] = strip_tags(shared_stories[story['id']]['comments'])
|
||||
|
||||
logging.user(request, "~FCLoading starred stories: ~SB%s stories" % (len(stories)))
|
||||
|
||||
return dict(stories=stories, feeds=unsub_feeds)
|
||||
return {
|
||||
"stories": stories,
|
||||
"user_profiles": user_profiles,
|
||||
"feeds": unsub_feeds,
|
||||
}
|
||||
|
||||
@json.json_view
|
||||
def load_river_stories__redis(request):
|
||||
|
@ -768,11 +812,15 @@ def mark_story_as_read(request):
|
|||
else:
|
||||
data = dict(code=-1, errors=["User is not subscribed to this feed."])
|
||||
|
||||
r = redis.Redis(connection_pool=settings.REDIS_POOL)
|
||||
r.publish(request.user.username, 'feed:%s' % feed_id)
|
||||
|
||||
return data
|
||||
|
||||
@ajax_login_required
|
||||
@json.json_view
|
||||
def mark_feed_stories_as_read(request):
|
||||
r = redis.Redis(connection_pool=settings.REDIS_POOL)
|
||||
feeds_stories = request.REQUEST.get('feeds_stories', "{}")
|
||||
feeds_stories = json.decode(feeds_stories)
|
||||
for feed_id, story_ids in feeds_stories.items():
|
||||
|
@ -791,6 +839,8 @@ def mark_feed_stories_as_read(request):
|
|||
data = usersub.mark_story_ids_as_read(story_ids)
|
||||
except (UserSubscription.DoesNotExist, Feed.DoesNotExist):
|
||||
return dict(code=-1, error="No feed exists for feed_id: %d" % feed_id)
|
||||
|
||||
r.publish(request.user.username, 'feed:%s' % feed_id)
|
||||
|
||||
return data
|
||||
|
||||
|
@ -800,6 +850,7 @@ def mark_social_stories_as_read(request):
|
|||
code = 1
|
||||
errors = []
|
||||
data = {}
|
||||
r = redis.Redis(connection_pool=settings.REDIS_POOL)
|
||||
users_feeds_stories = request.REQUEST.get('users_feeds_stories', "{}")
|
||||
users_feeds_stories = json.decode(users_feeds_stories)
|
||||
|
||||
|
@ -828,6 +879,8 @@ def mark_social_stories_as_read(request):
|
|||
errors.append("No feed exists for feed_id %d." % feed_id)
|
||||
else:
|
||||
continue
|
||||
r.publish(request.user.username, 'feed:%s' % feed_id)
|
||||
r.publish(request.user.username, 'social:%s' % social_user_id)
|
||||
|
||||
data.update(code=code, errors=errors)
|
||||
return data
|
||||
|
@ -880,7 +933,10 @@ def mark_story_as_unread(request):
|
|||
m.delete()
|
||||
except MUserStory.DoesNotExist:
|
||||
logging.user(request, "~BY~SB~FRCouldn't find read story to mark as unread.")
|
||||
|
||||
|
||||
r = redis.Redis(connection_pool=settings.REDIS_POOL)
|
||||
r.publish(request.user.username, 'feed:%s' % feed_id)
|
||||
|
||||
logging.user(request, "~FY~SBUnread~SN story in feed: %s %s" % (feed, dirty_count))
|
||||
|
||||
return data
|
||||
|
@ -1304,7 +1360,7 @@ def send_story_email(request):
|
|||
else:
|
||||
story, _ = MStory.find_story(feed_id, story_id)
|
||||
story = Feed.format_story(story, feed_id, text=True)
|
||||
feed = Feed.objects.get(pk=story['story_feed_id'])
|
||||
feed = Feed.get_by_id(story['story_feed_id'])
|
||||
text = render_to_string('mail/email_story_text.xhtml', locals())
|
||||
html = render_to_string('mail/email_story_html.xhtml', locals())
|
||||
subject = "%s is sharing a story with you: \"%s\"" % (from_name, story['story_title'])
|
||||
|
|
|
@ -14,6 +14,8 @@ class Command(BaseCommand):
|
|||
make_option("-s", "--silent", dest="silent", default=False, action="store_true", help="Inverse verbosity."),
|
||||
make_option("-u", "--user", dest="user", nargs=1, help="Specify user id or username"),
|
||||
make_option("-d", "--daemon", dest="daemonize", action="store_true"),
|
||||
make_option("-D", "--days", dest="days", nargs=1, default=1, type='int'),
|
||||
make_option("-O", "--offset", dest="offset", nargs=1, default=0, type='int'),
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
|
@ -27,18 +29,22 @@ class Command(BaseCommand):
|
|||
else:
|
||||
users = User.objects.filter(username=options['user'])
|
||||
else:
|
||||
users = User.objects.filter(profile__last_seen_on__gte=datetime.datetime.now()-datetime.timedelta(days=1))
|
||||
users = User.objects.filter(profile__last_seen_on__gte=datetime.datetime.now()-datetime.timedelta(days=options['days'])).order_by('pk')
|
||||
|
||||
user_count = users.count()
|
||||
for i, u in enumerate(users):
|
||||
if i < options['offset']: continue
|
||||
if options['all']:
|
||||
usersubs = UserSubscription.objects.filter(user=u, active=True)
|
||||
else:
|
||||
usersubs = UserSubscription.objects.filter(user=u, needs_unread_recalc=True)
|
||||
print " ---> %s has %s feeds (%s/%s)" % (u.username, usersubs.count(), i+1, user_count)
|
||||
|
||||
for sub in usersubs:
|
||||
sub.calculate_feed_scores(silent=options['silent'])
|
||||
try:
|
||||
sub.calculate_feed_scores(silent=options['silent'])
|
||||
except Exception, e:
|
||||
print " ***> Exception: %s" % e
|
||||
continue
|
||||
|
||||
def daemonize():
|
||||
"""
|
||||
|
|
|
@ -18,5 +18,5 @@ class Command(BaseCommand):
|
|||
if options['title']:
|
||||
feed = Feed.objects.get(feed_title__icontains=options['title'])
|
||||
else:
|
||||
feed = Feed.objects.get(pk=options['feed'])
|
||||
feed = Feed.get_by_id(options['feed'])
|
||||
feed.update(force=options['force'], single_threaded=True, verbose=2)
|
86
apps/rss_feeds/migrations/0060_feedloadtime.py
Normal file
|
@ -0,0 +1,86 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
||||
def forwards(self, orm):
|
||||
# Deleting model 'FeedLoadtime'
|
||||
db.delete_table('rss_feeds_feedloadtime')
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Adding model 'FeedLoadtime'
|
||||
db.create_table('rss_feeds_feedloadtime', (
|
||||
('feed', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['rss_feeds.Feed'])),
|
||||
('loadtime', self.gf('django.db.models.fields.FloatField')()),
|
||||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
('date_accessed', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
|
||||
))
|
||||
db.send_create_signal('rss_feeds', ['FeedLoadtime'])
|
||||
|
||||
|
||||
models = {
|
||||
'rss_feeds.duplicatefeed': {
|
||||
'Meta': {'object_name': 'DuplicateFeed'},
|
||||
'duplicate_address': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
|
||||
'duplicate_feed_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'db_index': 'True'}),
|
||||
'duplicate_link': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'db_index': 'True'}),
|
||||
'feed': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'duplicate_addresses'", 'to': "orm['rss_feeds.Feed']"}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
|
||||
},
|
||||
'rss_feeds.feed': {
|
||||
'Meta': {'ordering': "['feed_title']", 'object_name': 'Feed', 'db_table': "'feeds'"},
|
||||
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}),
|
||||
'active_premium_subscribers': ('django.db.models.fields.IntegerField', [], {'default': '-1', 'db_index': 'True'}),
|
||||
'active_subscribers': ('django.db.models.fields.IntegerField', [], {'default': '-1', 'db_index': 'True'}),
|
||||
'average_stories_per_month': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'branch_from_feed': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['rss_feeds.Feed']", 'null': 'True', 'blank': 'True'}),
|
||||
'creation': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'days_to_trim': ('django.db.models.fields.IntegerField', [], {'default': '90'}),
|
||||
'errors_since_good': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'etag': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
|
||||
'exception_code': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'favicon_color': ('django.db.models.fields.CharField', [], {'max_length': '6', 'null': 'True', 'blank': 'True'}),
|
||||
'favicon_not_found': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'feed_address': ('django.db.models.fields.URLField', [], {'max_length': '255', 'db_index': 'True'}),
|
||||
'feed_address_locked': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
|
||||
'feed_link': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '1000', 'null': 'True', 'blank': 'True'}),
|
||||
'feed_link_locked': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'feed_title': ('django.db.models.fields.CharField', [], {'default': "'[Untitled]'", 'max_length': '255', 'null': 'True', 'blank': 'True'}),
|
||||
'fetched_once': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'has_feed_exception': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
|
||||
'has_page': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
|
||||
'has_page_exception': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
|
||||
'hash_address_and_link': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_index': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'is_push': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
|
||||
'known_good': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
|
||||
'last_load_time': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'last_modified': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'last_update': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
|
||||
'min_to_decay': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||
'next_scheduled_update': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
|
||||
'num_subscribers': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
|
||||
'premium_subscribers': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
|
||||
'queued_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
|
||||
's3_icon': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
|
||||
's3_page': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
|
||||
'stories_last_month': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
||||
},
|
||||
'rss_feeds.feeddata': {
|
||||
'Meta': {'object_name': 'FeedData'},
|
||||
'feed': ('utils.fields.AutoOneToOneField', [], {'related_name': "'data'", 'unique': 'True', 'to': "orm['rss_feeds.Feed']"}),
|
||||
'feed_classifier_counts': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'feed_tagline': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'popular_authors': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}),
|
||||
'popular_tags': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
|
||||
'story_count_history': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'})
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['rss_feeds']
|
|
@ -29,7 +29,7 @@ from utils.feed_functions import levenshtein_distance
|
|||
from utils.feed_functions import timelimit, TimeoutError
|
||||
from utils.feed_functions import relative_timesince
|
||||
from utils.feed_functions import seconds_timesince
|
||||
from utils.story_functions import strip_tags, htmldiff
|
||||
from utils.story_functions import strip_tags, htmldiff, strip_comments
|
||||
|
||||
ENTRY_NEW, ENTRY_UPDATED, ENTRY_SAME, ENTRY_ERR = range(4)
|
||||
|
||||
|
@ -182,13 +182,14 @@ class Feed(models.Model):
|
|||
return self
|
||||
except IntegrityError:
|
||||
duplicate_feed = Feed.objects.filter(feed_address=self.feed_address, feed_link=self.feed_link)
|
||||
logging.debug("%s: %s" % (self.feed_address, duplicate_feed))
|
||||
logging.debug(' ***> [%-30s] Feed deleted.' % (unicode(self)[:30]))
|
||||
if duplicate_feed:
|
||||
if self.pk != duplicate_feed[0].pk:
|
||||
merge_feeds(self.pk, duplicate_feed[0].pk)
|
||||
merge_feeds(self.pk, duplicate_feed[0].pk, force=True)
|
||||
return duplicate_feed[0]
|
||||
|
||||
# Feed has been deleted. Just ignore it.
|
||||
logging.debug("%s: %s" % (self.feed_address, duplicate_feed))
|
||||
logging.debug(' ***> [%-30s] Feed deleted (%s).' % (unicode(self)[:30], self.pk))
|
||||
return
|
||||
|
||||
def sync_redis(self):
|
||||
|
@ -275,7 +276,11 @@ class Feed(models.Model):
|
|||
|
||||
@classmethod
|
||||
def task_feeds(cls, feeds, queue_size=12):
|
||||
logging.debug(" ---> Tasking %s feeds..." % feeds.count())
|
||||
if isinstance(feeds, Feed):
|
||||
logging.debug(" ---> Tasking feed: %s" % feeds)
|
||||
feeds = [feeds]
|
||||
else:
|
||||
logging.debug(" ---> Tasking %s feeds..." % len(feeds))
|
||||
|
||||
feed_queue = []
|
||||
for f in feeds:
|
||||
|
@ -289,7 +294,7 @@ class Feed(models.Model):
|
|||
def update_all_statistics(self, full=True, force=False):
|
||||
self.count_subscribers()
|
||||
count_extra = False
|
||||
if random.random() > .9 or not self.data.popular_tags or not self.data.popular_authors:
|
||||
if random.random() > .98 or not self.data.popular_tags or not self.data.popular_authors:
|
||||
count_extra = True
|
||||
if force or (full and count_extra):
|
||||
self.count_stories()
|
||||
|
@ -596,7 +601,7 @@ class Feed(models.Model):
|
|||
for r in res:
|
||||
dates[r.key] = r.value
|
||||
year = int(re.findall(r"(\d{4})-\d{1,2}", r.key)[0])
|
||||
if year < min_year:
|
||||
if year < min_year and year > 2000:
|
||||
min_year = year
|
||||
|
||||
# Add on to existing months, always amending up, never down. (Current month
|
||||
|
@ -606,7 +611,7 @@ class Feed(models.Model):
|
|||
year = int(re.findall(r"(\d{4})-\d{1,2}", current_month)[0])
|
||||
if current_month not in dates or dates[current_month] < current_count:
|
||||
dates[current_month] = current_count
|
||||
if year < min_year:
|
||||
if year < min_year and year > 2000:
|
||||
min_year = year
|
||||
|
||||
# Assemble a list with 0's filled in for missing months,
|
||||
|
@ -703,14 +708,7 @@ class Feed(models.Model):
|
|||
disp.add_jobs([[self.pk]])
|
||||
feed = disp.run_jobs()
|
||||
|
||||
try:
|
||||
feed = Feed.objects.get(pk=feed.pk)
|
||||
except Feed.DoesNotExist:
|
||||
# Feed has been merged after updating. Find the right feed.
|
||||
duplicate_feeds = DuplicateFeed.objects.filter(duplicate_feed_id=feed.pk)
|
||||
if duplicate_feeds:
|
||||
feed = duplicate_feeds[0].feed
|
||||
|
||||
feed = Feed.get_by_id(feed.pk)
|
||||
feed.last_update = datetime.datetime.utcnow()
|
||||
feed.set_next_scheduled_update()
|
||||
|
||||
|
@ -741,12 +739,13 @@ class Feed(models.Model):
|
|||
ENTRY_SAME:0,
|
||||
ENTRY_ERR:0
|
||||
}
|
||||
|
||||
|
||||
for story in stories:
|
||||
if not story.get('title'):
|
||||
continue
|
||||
|
||||
story_content = story.get('story_content')
|
||||
story_content = strip_comments(story_content)
|
||||
story_tags = self.get_tags(story)
|
||||
story_link = self.get_permalink(story)
|
||||
|
||||
|
@ -922,6 +921,7 @@ class Feed(models.Model):
|
|||
except IndexError, e:
|
||||
logging.debug(' ***> [%-30s] ~BRError trimming feed: %s' % (unicode(self)[:30], e))
|
||||
return
|
||||
|
||||
extra_stories = MStory.objects(story_feed_id=self.pk,
|
||||
story_date__lte=story_trim_date)
|
||||
extra_stories_count = extra_stories.count()
|
||||
|
@ -931,7 +931,19 @@ class Feed(models.Model):
|
|||
existing_story_count = MStory.objects(story_feed_id=self.pk).count()
|
||||
print "Deleted %s stories, %s left." % (extra_stories_count,
|
||||
existing_story_count)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def clean_invalid_ids():
|
||||
history = MFeedFetchHistory.objects(status_code=500, exception__contains='InvalidId:')
|
||||
urls = set()
|
||||
for h in history:
|
||||
u = re.split('InvalidId: (.*?) is not a valid ObjectId\\n$', h.exception)[1]
|
||||
urls.add((h.feed_id, u))
|
||||
|
||||
for f, u in urls:
|
||||
print "db.stories.remove({\"story_feed_id\": %s, \"_id\": \"%s\"})" % (f, u)
|
||||
|
||||
|
||||
def get_stories(self, offset=0, limit=25, force=False):
|
||||
stories_db = MStory.objects(story_feed_id=self.pk)[offset:offset+limit]
|
||||
stories = self.format_stories(stories_db, self.pk)
|
||||
|
@ -1395,13 +1407,16 @@ class MStory(mongo.Document):
|
|||
def sync_all_redis(cls, story_feed_id=None):
|
||||
r = redis.Redis(connection_pool=settings.REDIS_STORY_POOL)
|
||||
DAYS_OF_UNREAD = datetime.datetime.now() - datetime.timedelta(days=settings.DAYS_OF_UNREAD)
|
||||
feed = None
|
||||
if story_feed_id:
|
||||
feed = Feed.get_by_id(story_feed_id)
|
||||
stories = cls.objects.filter(story_date__gte=DAYS_OF_UNREAD)
|
||||
if story_feed_id:
|
||||
stories = stories.filter(story_feed_id=story_feed_id)
|
||||
r.delete('F:%s' % story_feed_id)
|
||||
r.delete('zF:%s' % story_feed_id)
|
||||
|
||||
print " ---> Syncing %s stories in %s" % (stories.count(), story_feed_id)
|
||||
|
||||
logging.info(" ---> [%-30s] ~FMSyncing ~SB%s~SN stories to redis" % (feed and feed.title[:30] or story_feed_id, stories.count()))
|
||||
for story in stories:
|
||||
story.sync_redis(r)
|
||||
|
||||
|
@ -1455,7 +1470,11 @@ class MStarredStory(mongo.Document):
|
|||
self.story_original_content = None
|
||||
super(MStarredStory, self).save(*args, **kwargs)
|
||||
|
||||
@property
|
||||
def guid_hash(self):
|
||||
return hashlib.sha1(self.story_guid).hexdigest()
|
||||
|
||||
|
||||
class MFeedFetchHistory(mongo.Document):
|
||||
feed_id = mongo.IntField()
|
||||
status_code = mongo.IntField()
|
||||
|
@ -1544,14 +1563,6 @@ class MFeedPushHistory(mongo.Document):
|
|||
return push_history
|
||||
|
||||
|
||||
class FeedLoadtime(models.Model):
|
||||
feed = models.ForeignKey(Feed)
|
||||
date_accessed = models.DateTimeField(auto_now=True)
|
||||
loadtime = models.FloatField()
|
||||
|
||||
def __unicode__(self):
|
||||
return "%s: %s sec" % (self.feed, self.loadtime)
|
||||
|
||||
class DuplicateFeed(models.Model):
|
||||
duplicate_address = models.CharField(max_length=255, db_index=True)
|
||||
duplicate_link = models.CharField(max_length=255, null=True, db_index=True)
|
||||
|
@ -1586,9 +1597,13 @@ def merge_feeds(original_feed_id, duplicate_feed_id, force=False):
|
|||
return
|
||||
|
||||
logging.info(" ---> Feed: [%s - %s] %s - %s" % (original_feed_id, duplicate_feed_id,
|
||||
original_feed, original_feed.feed_link))
|
||||
logging.info(" --> %s / %s" % (original_feed.feed_address, original_feed.feed_link))
|
||||
logging.info(" --> %s / %s" % (duplicate_feed.feed_address, duplicate_feed.feed_link))
|
||||
original_feed, original_feed.feed_link))
|
||||
logging.info(" ++> %s: %s / %s" % (original_feed.pk,
|
||||
original_feed.feed_address,
|
||||
original_feed.feed_link))
|
||||
logging.info(" --> %s: %s / %s" % (duplicate_feed.pk,
|
||||
duplicate_feed.feed_address,
|
||||
duplicate_feed.feed_link))
|
||||
|
||||
user_subs = UserSubscription.objects.filter(feed=duplicate_feed)
|
||||
for user_sub in user_subs:
|
||||
|
@ -1619,9 +1634,13 @@ def merge_feeds(original_feed_id, duplicate_feed_id, force=False):
|
|||
dupe_feed.feed = original_feed
|
||||
dupe_feed.duplicate_feed_id = duplicate_feed.pk
|
||||
dupe_feed.save()
|
||||
|
||||
|
||||
logging.debug(' ---> Dupe subscribers: %s, Original subscribers: %s' %
|
||||
(duplicate_feed.num_subscribers, original_feed.num_subscribers))
|
||||
duplicate_feed.delete()
|
||||
original_feed.count_subscribers()
|
||||
logging.debug(' ---> Now original subscribers: %s' %
|
||||
(original_feed.num_subscribers))
|
||||
|
||||
MSharedStory.switch_feed(original_feed_id, duplicate_feed_id)
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class UpdateFeeds(Task):
|
|||
from apps.statistics.models import MStatistics
|
||||
|
||||
mongodb_replication_lag = int(MStatistics.get('mongodb_replication_lag', 0))
|
||||
compute_scores = bool(mongodb_replication_lag < 60)
|
||||
compute_scores = bool(mongodb_replication_lag < 10)
|
||||
|
||||
options = {
|
||||
'fake': bool(MStatistics.get('fake_fetch')),
|
||||
|
@ -63,7 +63,7 @@ class UpdateFeeds(Task):
|
|||
|
||||
for feed_pk in feed_pks:
|
||||
try:
|
||||
feed = Feed.objects.get(pk=feed_pk)
|
||||
feed = Feed.get_by_id(feed_pk)
|
||||
feed.update(**options)
|
||||
except Feed.DoesNotExist:
|
||||
logging.info(" ---> Feed doesn't exist: [%s]" % feed_pk)
|
||||
|
@ -83,7 +83,7 @@ class NewFeeds(Task):
|
|||
'force': True,
|
||||
}
|
||||
for feed_pk in feed_pks:
|
||||
feed = Feed.objects.get(pk=feed_pk)
|
||||
feed = Feed.get_by_id(feed_pk)
|
||||
feed.update(options=options)
|
||||
|
||||
class PushFeeds(Task):
|
||||
|
@ -103,5 +103,5 @@ class PushFeeds(Task):
|
|||
'compute_scores': compute_scores,
|
||||
'mongodb_replication_lag': mongodb_replication_lag,
|
||||
}
|
||||
feed = Feed.objects.get(pk=feed_id)
|
||||
feed = Feed.get_by_id(feed_id)
|
||||
feed.update(options=options)
|
||||
|
|
|
@ -57,16 +57,19 @@ class MSocialProfile(mongo.Document):
|
|||
following_user_ids = mongo.ListField(mongo.IntField())
|
||||
follower_user_ids = mongo.ListField(mongo.IntField())
|
||||
unfollowed_user_ids = mongo.ListField(mongo.IntField())
|
||||
requested_follow_user_ids = mongo.ListField(mongo.IntField())
|
||||
popular_publishers = mongo.StringField()
|
||||
stories_last_month = mongo.IntField(default=0)
|
||||
average_stories_per_month = mongo.IntField(default=0)
|
||||
story_count_history = mongo.ListField()
|
||||
feed_classifier_counts = mongo.DictField()
|
||||
favicon_color = mongo.StringField(max_length=6)
|
||||
protected = mongo.BooleanField()
|
||||
private = mongo.BooleanField()
|
||||
|
||||
meta = {
|
||||
'collection': 'social_profile',
|
||||
'indexes': ['user_id', 'following_user_ids', 'follower_user_ids', 'unfollowed_user_ids'],
|
||||
'indexes': ['user_id', 'following_user_ids', 'follower_user_ids', 'unfollowed_user_ids', 'requested_follow_user_ids'],
|
||||
'allow_inheritance': False,
|
||||
'index_drop_dups': True,
|
||||
}
|
||||
|
@ -100,7 +103,7 @@ class MSocialProfile(mongo.Document):
|
|||
|
||||
super(MSocialProfile, self).save(*args, **kwargs)
|
||||
if self.user_id not in self.following_user_ids:
|
||||
self.follow_user(self.user_id)
|
||||
self.follow_user(self.user_id, force=True)
|
||||
self.count_follows()
|
||||
|
||||
@property
|
||||
|
@ -266,6 +269,8 @@ class MSocialProfile(mongo.Document):
|
|||
'feed_address': "http://%s%s" % (domain, reverse('shared-stories-rss-feed',
|
||||
kwargs={'user_id': self.user_id, 'username': self.username_slug})),
|
||||
'feed_link': self.blurblog_url,
|
||||
'protected': self.protected,
|
||||
'private': self.private,
|
||||
}
|
||||
if not compact:
|
||||
params.update({
|
||||
|
@ -299,6 +304,7 @@ class MSocialProfile(mongo.Document):
|
|||
params['followers_everybody'] = followers_everybody[:FOLLOWERS_LIMIT]
|
||||
params['following_youknow'] = following_youknow[:FOLLOWERS_LIMIT]
|
||||
params['following_everybody'] = following_everybody[:FOLLOWERS_LIMIT]
|
||||
params['requested_follow'] = common_follows_with_user in self.requested_follow_user_ids
|
||||
if include_following_user or common_follows_with_user:
|
||||
if not include_following_user:
|
||||
include_following_user = common_follows_with_user
|
||||
|
@ -337,33 +343,46 @@ class MSocialProfile(mongo.Document):
|
|||
|
||||
if check_unfollowed and user_id in self.unfollowed_user_ids:
|
||||
return
|
||||
|
||||
if self.user_id == user_id:
|
||||
followee = self
|
||||
else:
|
||||
followee = MSocialProfile.get_user(user_id)
|
||||
|
||||
logging.debug(" ---> ~FB~SB%s~SN (%s) following %s" % (self.username, self.user_id, user_id))
|
||||
|
||||
if user_id not in self.following_user_ids:
|
||||
self.following_user_ids.append(user_id)
|
||||
elif not force:
|
||||
return
|
||||
|
||||
if not followee.protected or force:
|
||||
if user_id not in self.following_user_ids:
|
||||
self.following_user_ids.append(user_id)
|
||||
elif not force:
|
||||
return
|
||||
|
||||
if user_id in self.unfollowed_user_ids:
|
||||
self.unfollowed_user_ids.remove(user_id)
|
||||
self.count_follows()
|
||||
self.save()
|
||||
|
||||
if self.user_id == user_id:
|
||||
followee = self
|
||||
else:
|
||||
followee = MSocialProfile.get_user(user_id)
|
||||
if self.user_id not in followee.follower_user_ids:
|
||||
if followee.protected and not force:
|
||||
if self.user_id not in followee.requested_follow_user_ids:
|
||||
followee.requested_follow_user_ids.append(self.user_id)
|
||||
MFollowRequest.add(self.user_id, user_id)
|
||||
elif self.user_id not in followee.follower_user_ids:
|
||||
followee.follower_user_ids.append(self.user_id)
|
||||
followee.count_follows()
|
||||
followee.save()
|
||||
|
||||
followee.count_follows()
|
||||
followee.save()
|
||||
|
||||
if followee.protected and not force:
|
||||
from apps.social.tasks import EmailFollowRequest
|
||||
EmailFollowRequest.apply_async(kwargs=dict(follower_user_id=self.user_id,
|
||||
followee_user_id=user_id),
|
||||
countdown=settings.SECONDS_TO_DELAY_CELERY_EMAILS)
|
||||
return
|
||||
|
||||
following_key = "F:%s:F" % (self.user_id)
|
||||
r.sadd(following_key, user_id)
|
||||
follower_key = "F:%s:f" % (user_id)
|
||||
r.sadd(follower_key, self.user_id)
|
||||
|
||||
|
||||
if self.user_id != user_id:
|
||||
MInteraction.new_follow(follower_user_id=self.user_id, followee_user_id=user_id)
|
||||
MActivity.new_follow(follower_user_id=self.user_id, followee_user_id=user_id)
|
||||
|
@ -372,6 +391,8 @@ class MSocialProfile(mongo.Document):
|
|||
socialsub.needs_unread_recalc = True
|
||||
socialsub.save()
|
||||
|
||||
MFollowRequest.remove(self.user_id, user_id)
|
||||
|
||||
if not force:
|
||||
from apps.social.tasks import EmailNewFollower
|
||||
EmailNewFollower.apply_async(kwargs=dict(follower_user_id=self.user_id,
|
||||
|
@ -410,6 +431,11 @@ class MSocialProfile(mongo.Document):
|
|||
followee.follower_user_ids.remove(self.user_id)
|
||||
followee.count_follows()
|
||||
followee.save()
|
||||
if self.user_id in followee.requested_follow_user_ids:
|
||||
followee.requested_follow_user_ids.remove(self.user_id)
|
||||
followee.count_follows()
|
||||
followee.save()
|
||||
MFollowRequest.remove(self.user_id, user_id)
|
||||
|
||||
following_key = "F:%s:F" % (self.user_id)
|
||||
r.srem(following_key, user_id)
|
||||
|
@ -490,7 +516,61 @@ class MSocialProfile(mongo.Document):
|
|||
MSentEmail.record(receiver_user_id=user.pk, sending_user_id=follower_user_id,
|
||||
email_type='new_follower')
|
||||
|
||||
logging.user(user, "~BB~FR~SBSending email for new follower: %s" % follower_profile.username)
|
||||
logging.user(user, "~BB~FM~SBSending email for new follower: %s" % follower_profile.username)
|
||||
|
||||
def send_email_for_follow_request(self, follower_user_id):
|
||||
user = User.objects.get(pk=self.user_id)
|
||||
if follower_user_id not in self.requested_follow_user_ids:
|
||||
logging.user(user, "~FMNo longer being followed by %s" % follower_user_id)
|
||||
return
|
||||
if not user.email:
|
||||
logging.user(user, "~FMNo email to send to, skipping.")
|
||||
return
|
||||
elif not user.profile.send_emails:
|
||||
logging.user(user, "~FMDisabled emails, skipping.")
|
||||
return
|
||||
if self.user_id == follower_user_id:
|
||||
return
|
||||
|
||||
emails_sent = MSentEmail.objects.filter(receiver_user_id=user.pk,
|
||||
sending_user_id=follower_user_id,
|
||||
email_type='follow_request')
|
||||
day_ago = datetime.datetime.now() - datetime.timedelta(days=1)
|
||||
for email in emails_sent:
|
||||
if email.date_sent > day_ago:
|
||||
logging.user(user, "~SK~FMNot sending follow request email, already sent before. NBD.")
|
||||
return
|
||||
|
||||
follower_profile = MSocialProfile.get_user(follower_user_id)
|
||||
common_followers, _ = self.common_follows(follower_user_id, direction='followers')
|
||||
common_followings, _ = self.common_follows(follower_user_id, direction='following')
|
||||
if self.user_id in common_followers:
|
||||
common_followers.remove(self.user_id)
|
||||
if self.user_id in common_followings:
|
||||
common_followings.remove(self.user_id)
|
||||
common_followers = MSocialProfile.profiles(common_followers)
|
||||
common_followings = MSocialProfile.profiles(common_followings)
|
||||
|
||||
data = {
|
||||
'user': user,
|
||||
'follower_profile': follower_profile,
|
||||
'common_followers': common_followers,
|
||||
'common_followings': common_followings,
|
||||
}
|
||||
|
||||
text = render_to_string('mail/email_follow_request.txt', data)
|
||||
html = render_to_string('mail/email_follow_request.xhtml', data)
|
||||
subject = "%s has requested to follow your Blurblog on NewsBlur" % follower_profile.username
|
||||
msg = EmailMultiAlternatives(subject, text,
|
||||
from_email='NewsBlur <%s>' % settings.HELLO_EMAIL,
|
||||
to=['%s <%s>' % (user.username, user.email)])
|
||||
msg.attach_alternative(html, "text/html")
|
||||
msg.send()
|
||||
|
||||
MSentEmail.record(receiver_user_id=user.pk, sending_user_id=follower_user_id,
|
||||
email_type='follow_request')
|
||||
|
||||
logging.user(user, "~BB~FM~SBSending email for follow request: %s" % follower_profile.username)
|
||||
|
||||
def save_feed_story_history_statistics(self):
|
||||
"""
|
||||
|
@ -742,9 +822,12 @@ class MSocialSubscription(mongo.Document):
|
|||
return [story_id for story_id in story_ids if story_id and story_id != 'None']
|
||||
|
||||
@classmethod
|
||||
def feed_stories(cls, user_id, social_user_ids, offset=0, limit=6, order='newest', read_filter='all'):
|
||||
def feed_stories(cls, user_id, social_user_ids, offset=0, limit=6, order='newest', read_filter='all', relative_user_id=None):
|
||||
r = redis.Redis(connection_pool=settings.REDIS_STORY_POOL)
|
||||
|
||||
if not relative_user_id:
|
||||
relative_user_id = user_id
|
||||
|
||||
if order == 'oldest':
|
||||
range_func = r.zrange
|
||||
else:
|
||||
|
@ -764,9 +847,9 @@ class MSocialSubscription(mongo.Document):
|
|||
r.delete(unread_ranked_stories_keys)
|
||||
|
||||
for social_user_id in social_user_ids:
|
||||
us = cls.objects.get(user_id=user_id, subscription_user_id=social_user_id)
|
||||
us = cls.objects.get(user_id=relative_user_id, subscription_user_id=social_user_id)
|
||||
story_guids = us.get_stories(offset=0, limit=100,
|
||||
# order=order, read_filter=read_filter,
|
||||
order=order, read_filter=read_filter,
|
||||
withscores=True)
|
||||
if story_guids:
|
||||
r.zadd(unread_ranked_stories_keys, **dict(story_guids))
|
||||
|
@ -798,7 +881,11 @@ class MSocialSubscription(mongo.Document):
|
|||
logging.user(request, "~FYRead story in social subscription: %s" % (sub_username))
|
||||
|
||||
for story_id in set(story_ids):
|
||||
story = MSharedStory.objects.get(user_id=self.subscription_user_id, story_guid=story_id)
|
||||
try:
|
||||
story = MSharedStory.objects.get(user_id=self.subscription_user_id,
|
||||
story_guid=story_id)
|
||||
except MSharedStory.DoesNotExist:
|
||||
continue
|
||||
now = datetime.datetime.utcnow()
|
||||
date = now if now > story.story_date else story.story_date # For handling future stories
|
||||
if not feed_id:
|
||||
|
@ -917,7 +1004,7 @@ class MSocialSubscription(mongo.Document):
|
|||
if story_feed_ids:
|
||||
read_stories = MUserStory.objects(user_id=self.user_id,
|
||||
feed_id__in=story_feed_ids,
|
||||
story_id__in=story_ids)
|
||||
story_id__in=story_ids).only('story_id')
|
||||
read_stories_ids = list(set(rs.story_id for rs in read_stories))
|
||||
|
||||
oldest_unread_story_date = now
|
||||
|
@ -1333,9 +1420,15 @@ class MSharedStory(mongo.Document):
|
|||
return shared
|
||||
|
||||
@classmethod
|
||||
def sync_all_redis(cls):
|
||||
def sync_all_redis(cls, drop=False):
|
||||
r = redis.Redis(connection_pool=settings.REDIS_POOL)
|
||||
s = redis.Redis(connection_pool=settings.REDIS_STORY_POOL)
|
||||
if drop:
|
||||
for key_name in ["C", "S"]:
|
||||
keys = r.keys("%s:*" % key_name)
|
||||
print " ---> Removing %s keys named %s:*" % (len(keys), key_name)
|
||||
for key in keys:
|
||||
r.delete(key)
|
||||
for story in cls.objects.all():
|
||||
story.sync_redis_shares(redis_conn=r)
|
||||
story.sync_redis_story(redis_conn=s)
|
||||
|
@ -1417,7 +1510,7 @@ class MSharedStory(mongo.Document):
|
|||
return comment, profiles
|
||||
|
||||
@classmethod
|
||||
def stories_with_comments_and_profiles(cls, stories, user_id, check_all=False, public=False):
|
||||
def stories_with_comments_and_profiles(cls, stories, user_id, check_all=False):
|
||||
r = redis.Redis(connection_pool=settings.REDIS_POOL)
|
||||
friend_key = "F:%s:F" % (user_id)
|
||||
profile_user_ids = set()
|
||||
|
@ -1482,7 +1575,16 @@ class MSharedStory(mongo.Document):
|
|||
|
||||
profiles = MSocialProfile.objects.filter(user_id__in=list(profile_user_ids))
|
||||
profiles = [profile.to_json(compact=True) for profile in profiles]
|
||||
|
||||
|
||||
# Toss public comments by private profiles
|
||||
profiles_dict = dict((profile['user_id'], profile) for profile in profiles)
|
||||
for story in stories:
|
||||
commented_by_public = story.get('commented_by_public') or [c['user_id'] for c in story['public_comments']]
|
||||
for user_id in commented_by_public:
|
||||
if profiles_dict[user_id]['private']:
|
||||
story['public_comments'] = [c for c in story['public_comments'] if c['user_id'] != user_id]
|
||||
story['comment_count_public'] -= 1
|
||||
|
||||
return stories, profiles
|
||||
|
||||
@staticmethod
|
||||
|
@ -1551,7 +1653,7 @@ class MSharedStory(mongo.Document):
|
|||
social_service = MSocialServices.objects.get(user_id=self.user_id)
|
||||
user = User.objects.get(pk=self.user_id)
|
||||
|
||||
logging.user(user, "~BM~FBPosting to %s: ~SB%s" % (service, message))
|
||||
logging.user(user, "~BM~FGPosting to %s: ~SB%s" % (service, message))
|
||||
|
||||
if service == 'twitter':
|
||||
posted = social_service.post_to_twitter(message)
|
||||
|
@ -1595,7 +1697,7 @@ class MSharedStory(mongo.Document):
|
|||
reply_user_profile = MSocialProfile.get_user(reply.user_id)
|
||||
sent_emails = 0
|
||||
|
||||
story_feed = Feed.objects.get(pk=self.story_feed_id)
|
||||
story_feed = Feed.get_by_id(self.story_feed_id)
|
||||
comment = self.comments_with_author()
|
||||
profile_user_ids = set([comment['user_id']])
|
||||
reply_user_ids = list(r['user_id'] for r in comment['replies'])
|
||||
|
@ -1667,7 +1769,7 @@ class MSharedStory(mongo.Document):
|
|||
logging.user(original_user, "~FMDisabled emails, skipping.")
|
||||
return
|
||||
|
||||
story_feed = Feed.objects.get(pk=self.story_feed_id)
|
||||
story_feed = Feed.get_by_id(self.story_feed_id)
|
||||
comment = self.comments_with_author()
|
||||
profile_user_ids = set([comment['user_id']])
|
||||
reply_user_ids = [reply['user_id'] for reply in comment['replies']]
|
||||
|
@ -1815,7 +1917,7 @@ class MSocialServices(mongo.Document):
|
|||
'syncing': self.syncing_facebook,
|
||||
},
|
||||
'gravatar': {
|
||||
'gravatar_picture_url': "http://www.gravatar.com/avatar/" + \
|
||||
'gravatar_picture_url': "https://www.gravatar.com/avatar/" + \
|
||||
hashlib.md5(user.email).hexdigest()
|
||||
},
|
||||
'upload': {
|
||||
|
@ -1858,18 +1960,18 @@ class MSocialServices(mongo.Document):
|
|||
|
||||
def sync_twitter_friends(self):
|
||||
user = User.objects.get(pk=self.user_id)
|
||||
logging.user(user, "~BB~FRTwitter import starting...")
|
||||
logging.user(user, "~BG~FMTwitter import starting...")
|
||||
|
||||
api = self.twitter_api()
|
||||
if not api:
|
||||
logging.user(user, "~BB~FRTwitter import ~SBfailed~SN: no api access.")
|
||||
logging.user(user, "~BG~FMTwitter import ~SBfailed~SN: no api access.")
|
||||
self.syncing_twitter = False
|
||||
self.save()
|
||||
return
|
||||
|
||||
friend_ids = list(unicode(friend.id) for friend in tweepy.Cursor(api.friends).items())
|
||||
if not friend_ids:
|
||||
logging.user(user, "~BB~FRTwitter import ~SBfailed~SN: no friend_ids.")
|
||||
logging.user(user, "~BG~FMTwitter import ~SBfailed~SN: no friend_ids.")
|
||||
self.syncing_twitter = False
|
||||
self.save()
|
||||
return
|
||||
|
@ -1919,24 +2021,24 @@ class MSocialServices(mongo.Document):
|
|||
# followers += 1
|
||||
|
||||
user = User.objects.get(pk=self.user_id)
|
||||
logging.user(user, "~BM~FRTwitter import: %s users, now following ~SB%s~SN with ~SB%s~SN follower-backs" % (len(self.twitter_friend_ids), len(following), followers))
|
||||
logging.user(user, "~BG~FMTwitter import: %s users, now following ~SB%s~SN with ~SB%s~SN follower-backs" % (len(self.twitter_friend_ids), len(following), followers))
|
||||
|
||||
return following
|
||||
|
||||
def sync_facebook_friends(self):
|
||||
user = User.objects.get(pk=self.user_id)
|
||||
logging.user(user, "~BB~FRFacebook import starting...")
|
||||
logging.user(user, "~BG~FMFacebook import starting...")
|
||||
|
||||
graph = self.facebook_api()
|
||||
if not graph:
|
||||
logging.user(user, "~BB~FRFacebook import ~SBfailed~SN: no api access.")
|
||||
logging.user(user, "~BG~FMFacebook import ~SBfailed~SN: no api access.")
|
||||
self.syncing_facebook = False
|
||||
self.save()
|
||||
return
|
||||
|
||||
friends = graph.get_connections("me", "friends")
|
||||
if not friends:
|
||||
logging.user(user, "~BB~FRFacebook import ~SBfailed~SN: no friend_ids.")
|
||||
logging.user(user, "~BG~FMFacebook import ~SBfailed~SN: no friend_ids.")
|
||||
self.syncing_facebook = False
|
||||
self.save()
|
||||
return
|
||||
|
@ -1986,7 +2088,7 @@ class MSocialServices(mongo.Document):
|
|||
# followers += 1
|
||||
|
||||
user = User.objects.get(pk=self.user_id)
|
||||
logging.user(user, "~BB~FRFacebook import: %s users, now following ~SB%s~SN with ~SB%s~SN follower-backs" % (len(self.facebook_friend_ids), len(following), followers))
|
||||
logging.user(user, "~BG~FMFacebook import: %s users, now following ~SB%s~SN with ~SB%s~SN follower-backs" % (len(self.facebook_friend_ids), len(following), followers))
|
||||
|
||||
return following
|
||||
|
||||
|
@ -2014,7 +2116,7 @@ class MSocialServices(mongo.Document):
|
|||
profile.photo_url = self.upload_picture_url
|
||||
elif service == 'gravatar':
|
||||
user = User.objects.get(pk=self.user_id)
|
||||
profile.photo_url = "http://www.gravatar.com/avatar/" + \
|
||||
profile.photo_url = "https://www.gravatar.com/avatar/" + \
|
||||
hashlib.md5(user.email).hexdigest()
|
||||
profile.save()
|
||||
return profile
|
||||
|
@ -2063,7 +2165,7 @@ class MInteraction(mongo.Document):
|
|||
|
||||
meta = {
|
||||
'collection': 'interactions',
|
||||
'indexes': [('user_id', '-date'), 'category'],
|
||||
'indexes': [('user_id', '-date'), 'category', 'with_user_id'],
|
||||
'allow_inheritance': False,
|
||||
'index_drop_dups': True,
|
||||
'ordering': ['-date'],
|
||||
|
@ -2262,7 +2364,7 @@ class MActivity(mongo.Document):
|
|||
|
||||
meta = {
|
||||
'collection': 'activities',
|
||||
'indexes': [('user_id', '-date'), 'category'],
|
||||
'indexes': [('user_id', '-date'), 'category', 'with_user_id'],
|
||||
'allow_inheritance': False,
|
||||
'index_drop_dups': True,
|
||||
'ordering': ['-date'],
|
||||
|
@ -2450,3 +2552,27 @@ class MActivity(mongo.Document):
|
|||
cls.objects.get_or_create(user_id=user_id,
|
||||
with_user_id=user_id,
|
||||
category="signup")
|
||||
|
||||
class MFollowRequest(mongo.Document):
|
||||
follower_user_id = mongo.IntField(unique_with='followee_user_id')
|
||||
followee_user_id = mongo.IntField()
|
||||
date = mongo.DateTimeField(default=datetime.datetime.now)
|
||||
|
||||
meta = {
|
||||
'collection': 'follow_request',
|
||||
'indexes': ['follower_user_id', 'followee_user_id'],
|
||||
'ordering': ['-date'],
|
||||
'allow_inheritance': False,
|
||||
'index_drop_dups': True,
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def add(cls, follower_user_id, followee_user_id):
|
||||
cls.objects.get_or_create(follower_user_id=follower_user_id,
|
||||
followee_user_id=followee_user_id)
|
||||
|
||||
@classmethod
|
||||
def remove(cls, follower_user_id, followee_user_id):
|
||||
cls.objects.filter(follower_user_id=follower_user_id,
|
||||
followee_user_id=followee_user_id).delete()
|
||||
|
||||
|
|
|
@ -17,6 +17,12 @@ class EmailNewFollower(Task):
|
|||
def run(self, follower_user_id, followee_user_id):
|
||||
user_profile = MSocialProfile.get_user(followee_user_id)
|
||||
user_profile.send_email_for_new_follower(follower_user_id)
|
||||
|
||||
class EmailFollowRequest(Task):
|
||||
|
||||
def run(self, follower_user_id, followee_user_id):
|
||||
user_profile = MSocialProfile.get_user(followee_user_id)
|
||||
user_profile.send_email_for_follow_request(follower_user_id)
|
||||
|
||||
class EmailCommentReplies(Task):
|
||||
|
||||
|
|
|
@ -42,10 +42,13 @@ def render_story_comments(context, story):
|
|||
@register.inclusion_tag('social/story_comment.xhtml', takes_context=True)
|
||||
def render_story_comment(context, story, comment):
|
||||
user = context['user']
|
||||
MEDIA_URL = settings.MEDIA_URL
|
||||
|
||||
return {
|
||||
'user': user,
|
||||
'story': story,
|
||||
'comment': comment,
|
||||
'MEDIA_URL': MEDIA_URL,
|
||||
}
|
||||
|
||||
@register.inclusion_tag('mail/email_story_comment.xhtml')
|
||||
|
|
|
@ -6,6 +6,7 @@ urlpatterns = patterns('',
|
|||
url(r'^share_story/?$', views.mark_story_as_shared, name='mark-story-as-shared'),
|
||||
url(r'^unshare_story/?$', views.mark_story_as_unshared, name='mark-story-as-unshared'),
|
||||
url(r'^load_user_friends/?$', views.load_user_friends, name='load-user-friends'),
|
||||
url(r'^load_follow_requests/?$', views.load_follow_requests, name='load-follow-requests'),
|
||||
url(r'^profile/?$', views.profile, name='profile'),
|
||||
url(r'^load_user_profile/?$', views.load_user_profile, name='load-user-profile'),
|
||||
url(r'^save_user_profile/?$', views.save_user_profile, name='save-user-profile'),
|
||||
|
@ -14,6 +15,8 @@ urlpatterns = patterns('',
|
|||
url(r'^activities/?$', views.load_activities, name='social-activities'),
|
||||
url(r'^follow/?$', views.follow, name='social-follow'),
|
||||
url(r'^unfollow/?$', views.unfollow, name='social-unfollow'),
|
||||
url(r'^approve_follower/?$', views.approve_follower, name='social-approve-follower'),
|
||||
url(r'^ignore_follower/?$', views.ignore_follower, name='social-ignore-follower'),
|
||||
url(r'^feed_trainer', views.social_feed_trainer, name='social-feed-trainer'),
|
||||
url(r'^public_comments/?$', views.story_public_comments, name='story-public-comments'),
|
||||
url(r'^save_comment_reply/?$', views.save_comment_reply, name='social-save-comment-reply'),
|
||||
|
|
|
@ -6,13 +6,15 @@ from bson.objectid import ObjectId
|
|||
from django.shortcuts import get_object_or_404, render_to_response
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.sites.models import Site
|
||||
from django.template.loader import render_to_string
|
||||
from django.http import HttpResponse, HttpResponseRedirect, Http404
|
||||
from django.http import HttpResponse, HttpResponseRedirect, Http404, HttpResponseForbidden
|
||||
from django.conf import settings
|
||||
from django.template import RequestContext
|
||||
from django.utils import feedgenerator
|
||||
from apps.rss_feeds.models import MStory, Feed, MStarredStory
|
||||
from apps.social.models import MSharedStory, MSocialServices, MSocialProfile, MSocialSubscription, MCommentReply
|
||||
from apps.social.models import MInteraction, MActivity
|
||||
from apps.social.models import MInteraction, MActivity, MFollowRequest
|
||||
from apps.social.tasks import PostToService, EmailCommentReplies, EmailStoryReshares
|
||||
from apps.analyzer.models import MClassifierTitle, MClassifierAuthor, MClassifierFeed, MClassifierTag
|
||||
from apps.analyzer.models import apply_classifier_titles, apply_classifier_feeds, apply_classifier_authors, apply_classifier_tags
|
||||
|
@ -21,9 +23,8 @@ from apps.reader.models import MUserStory, UserSubscription
|
|||
from apps.profile.models import Profile
|
||||
from utils import json_functions as json
|
||||
from utils import log as logging
|
||||
from utils import PyRSS2Gen as RSS
|
||||
from utils.user_functions import get_user, ajax_login_required
|
||||
from utils.view_functions import render_to
|
||||
from utils.view_functions import render_to, is_true
|
||||
from utils.story_functions import format_story_link_date__short
|
||||
from utils.story_functions import format_story_link_date__long
|
||||
from utils.story_functions import strip_tags
|
||||
|
@ -43,6 +44,7 @@ def load_social_stories(request, user_id, username=None):
|
|||
order = request.REQUEST.get('order', 'newest')
|
||||
read_filter = request.REQUEST.get('read_filter', 'all')
|
||||
stories = []
|
||||
message = ""
|
||||
|
||||
if page: offset = limit * (int(page) - 1)
|
||||
now = localtime_for_timezone(datetime.datetime.now(), user.profile.timezone)
|
||||
|
@ -54,7 +56,9 @@ def load_social_stories(request, user_id, username=None):
|
|||
except MSocialSubscription.DoesNotExist:
|
||||
socialsub = None
|
||||
|
||||
if socialsub and (read_filter == 'unread' or order == 'oldest'):
|
||||
if social_profile.private and not social_profile.is_followed_by_user(user.pk):
|
||||
message = "%s has a private blurblog and you must be following them in order to read it." % social_profile.username
|
||||
elif socialsub and (read_filter == 'unread' or order == 'oldest'):
|
||||
story_ids = socialsub.get_stories(order=order, read_filter=read_filter, offset=offset, limit=limit)
|
||||
story_date_order = "%sshared_date" % ('' if order == 'oldest' else '-')
|
||||
if story_ids:
|
||||
|
@ -66,7 +70,7 @@ def load_social_stories(request, user_id, username=None):
|
|||
stories = Feed.format_stories(mstories)
|
||||
|
||||
if not stories:
|
||||
return dict(stories=[])
|
||||
return dict(stories=[], message=message)
|
||||
|
||||
checkpoint1 = time.time()
|
||||
|
||||
|
@ -185,20 +189,25 @@ def load_river_blurblog(request):
|
|||
order = request.REQUEST.get('order', 'newest')
|
||||
read_filter = request.REQUEST.get('read_filter', 'unread')
|
||||
relative_user_id = request.REQUEST.get('relative_user_id', None)
|
||||
user_perspective = request.REQUEST.get('user_perspective', None)
|
||||
now = localtime_for_timezone(datetime.datetime.now(), user.profile.timezone)
|
||||
UNREAD_CUTOFF = datetime.datetime.utcnow() - datetime.timedelta(days=settings.DAYS_OF_UNREAD)
|
||||
|
||||
|
||||
if user_perspective:
|
||||
up = User.objects.get(username=settings.HOMEPAGE_USERNAME)
|
||||
relative_user_id = up.pk
|
||||
|
||||
if not relative_user_id:
|
||||
relative_user_id = get_user(request).pk
|
||||
|
||||
if not social_user_ids:
|
||||
socialsubs = MSocialSubscription.objects.filter(user_id=user.pk)
|
||||
socialsubs = MSocialSubscription.objects.filter(user_id=relative_user_id)
|
||||
social_user_ids = [s.subscription_user_id for s in socialsubs]
|
||||
|
||||
offset = (page-1) * limit
|
||||
limit = page * limit - 1
|
||||
|
||||
story_ids, story_dates = MSocialSubscription.feed_stories(user.pk, social_user_ids,
|
||||
story_ids, story_dates = MSocialSubscription.feed_stories(relative_user_id, social_user_ids,
|
||||
offset=offset, limit=limit,
|
||||
order=order, read_filter=read_filter)
|
||||
mstories = MStory.objects(id__in=story_ids)
|
||||
|
@ -335,15 +344,19 @@ def load_social_page(request, user_id, username=None, **kwargs):
|
|||
user_social_services = MSocialServices.get_user(user.pk)
|
||||
user_following_social_profile = user_social_profile.is_following_user(social_user_id)
|
||||
social_profile = MSocialProfile.get_user(social_user_id)
|
||||
|
||||
params = dict(user_id=social_user.pk)
|
||||
if feed_id:
|
||||
params['story_feed_id'] = feed_id
|
||||
mstories = MSharedStory.objects(**params).order_by('-shared_date')[offset:offset+limit+1]
|
||||
stories = Feed.format_stories(mstories)
|
||||
if len(stories) > limit:
|
||||
has_next_page = True
|
||||
stories = stories[:-1]
|
||||
|
||||
if social_profile.private and (not user.is_authenticated() or
|
||||
not social_profile.is_followed_by_user(user.pk)):
|
||||
stories = []
|
||||
else:
|
||||
params = dict(user_id=social_user.pk)
|
||||
if feed_id:
|
||||
params['story_feed_id'] = feed_id
|
||||
mstories = MSharedStory.objects(**params).order_by('-shared_date')[offset:offset+limit+1]
|
||||
stories = Feed.format_stories(mstories)
|
||||
if len(stories) > limit:
|
||||
has_next_page = True
|
||||
stories = stories[:-1]
|
||||
|
||||
checkpoint1 = time.time()
|
||||
|
||||
|
@ -447,8 +460,7 @@ def story_public_comments(request):
|
|||
stories = MSharedStory.objects.filter(story_feed_id=feed_id, story_guid=story_id).limit(1)
|
||||
stories = Feed.format_stories(stories)
|
||||
stories, profiles = MSharedStory.stories_with_comments_and_profiles(stories, relative_user_id,
|
||||
check_all=True,
|
||||
public=True)
|
||||
check_all=True)
|
||||
|
||||
if format == 'html':
|
||||
stories = MSharedStory.attach_users_to_stories(stories, profiles)
|
||||
|
@ -594,8 +606,18 @@ def save_comment_reply(request):
|
|||
original_message = None
|
||||
|
||||
if not reply_comments:
|
||||
return json.json_response(request, {'code': -1, 'message': 'Reply comments cannot be empty.'})
|
||||
|
||||
return json.json_response(request, {
|
||||
'code': -1,
|
||||
'message': 'Reply comments cannot be empty.',
|
||||
})
|
||||
|
||||
commenter_profile = MSocialProfile.get_user(comment_user_id)
|
||||
if commenter_profile.protected and not commenter_profile.is_followed_by_user(request.user.pk):
|
||||
return json.json_response(request, {
|
||||
'code': -1,
|
||||
'message': 'You must be following %s to reply to them.' % commenter_profile.username,
|
||||
})
|
||||
|
||||
shared_story = MSharedStory.objects.get(user_id=comment_user_id,
|
||||
story_feed_id=feed_id,
|
||||
story_guid=story_id)
|
||||
|
@ -763,11 +785,16 @@ def profile(request):
|
|||
|
||||
user_profile = MSocialProfile.get_user(user_id)
|
||||
user_profile.count_follows()
|
||||
|
||||
activities = []
|
||||
if not user_profile.private or user_profile.is_followed_by_user(user.pk):
|
||||
activities, _ = MActivity.user(user_id, page=1, public=True, categories=categories)
|
||||
|
||||
user_profile = user_profile.to_json(include_follows=True, common_follows_with_user=user.pk)
|
||||
profile_ids = set(user_profile['followers_youknow'] + user_profile['followers_everybody'] +
|
||||
user_profile['following_youknow'] + user_profile['following_everybody'])
|
||||
profiles = MSocialProfile.profiles(profile_ids)
|
||||
activities, _ = MActivity.user(user_id, page=1, public=True, categories=categories)
|
||||
|
||||
logging.user(request, "~BB~FRLoading social profile: %s" % user_profile['username'])
|
||||
|
||||
payload = {
|
||||
|
@ -777,6 +804,7 @@ def profile(request):
|
|||
'followers_everybody': user_profile['followers_everybody'],
|
||||
'following_youknow': user_profile['following_youknow'],
|
||||
'following_everybody': user_profile['following_everybody'],
|
||||
'requested_follow': user_profile['requested_follow'],
|
||||
'profiles': dict([(p.user_id, p.to_json(compact=True)) for p in profiles]),
|
||||
'activities': activities,
|
||||
}
|
||||
|
@ -816,6 +844,8 @@ def save_user_profile(request):
|
|||
profile.location = data['location']
|
||||
profile.bio = data['bio']
|
||||
profile.website = website
|
||||
profile.protected = is_true(data.get('protected', False))
|
||||
profile.private = is_true(data.get('private', False))
|
||||
profile.save()
|
||||
|
||||
social_services = MSocialServices.objects.get(user_id=request.user.pk)
|
||||
|
@ -841,6 +871,23 @@ def save_blurblog_settings(request):
|
|||
|
||||
return dict(code=1, user_profile=profile.to_json(include_follows=True, include_settings=True))
|
||||
|
||||
@json.json_view
|
||||
def load_follow_requests(request):
|
||||
user = get_user(request.user)
|
||||
follow_request_users = MFollowRequest.objects.filter(followee_user_id=user.pk)
|
||||
follow_request_user_ids = [f.follower_user_id for f in follow_request_users]
|
||||
request_profiles = MSocialProfile.profiles(follow_request_user_ids)
|
||||
request_profiles = [p.to_json(include_following_user=user.pk) for p in request_profiles]
|
||||
|
||||
if len(request_profiles):
|
||||
logging.user(request, "~BB~FRLoading Follow Requests (%s requests)" % (
|
||||
len(request_profiles),
|
||||
))
|
||||
|
||||
return {
|
||||
'request_profiles': request_profiles,
|
||||
}
|
||||
|
||||
@json.json_view
|
||||
def load_user_friends(request):
|
||||
user = get_user(request.user)
|
||||
|
@ -897,7 +944,10 @@ def follow(request):
|
|||
}
|
||||
follow_subscription = MSocialSubscription.feeds(calculate_all_scores=True, **social_params)
|
||||
|
||||
logging.user(request, "~BB~FRFollowing: %s" % follow_profile.username)
|
||||
if follow_profile.protected:
|
||||
logging.user(request, "~BB~FR~SBRequested~SN follow from: ~SB%s" % follow_profile.username)
|
||||
else:
|
||||
logging.user(request, "~BB~FRFollowing: ~SB%s" % follow_profile.username)
|
||||
|
||||
return {
|
||||
"user_profile": profile.to_json(include_follows=True),
|
||||
|
@ -927,13 +977,47 @@ def unfollow(request):
|
|||
profile.unfollow_user(unfollow_user_id)
|
||||
unfollow_profile = MSocialProfile.get_user(unfollow_user_id)
|
||||
|
||||
logging.user(request, "~BB~FRUnfollowing: %s" % unfollow_profile.username)
|
||||
logging.user(request, "~BB~FRUnfollowing: ~SB%s" % unfollow_profile.username)
|
||||
|
||||
return {
|
||||
'user_profile': profile.to_json(include_follows=True),
|
||||
'unfollow_profile': unfollow_profile.to_json(common_follows_with_user=request.user.pk),
|
||||
}
|
||||
|
||||
|
||||
@ajax_login_required
|
||||
@json.json_view
|
||||
def approve_follower(request):
|
||||
profile = MSocialProfile.get_user(request.user.pk)
|
||||
user_id = int(request.POST['user_id'])
|
||||
follower_profile = MSocialProfile.get_user(user_id)
|
||||
code = -1
|
||||
|
||||
logging.user(request, "~BB~FRApproving follow: ~SB%s" % follower_profile.username)
|
||||
|
||||
if user_id in profile.requested_follow_user_ids:
|
||||
follower_profile.follow_user(request.user.pk, force=True)
|
||||
code = 1
|
||||
|
||||
return {'code': code}
|
||||
|
||||
@ajax_login_required
|
||||
@json.json_view
|
||||
def ignore_follower(request):
|
||||
profile = MSocialProfile.get_user(request.user.pk)
|
||||
user_id = int(request.POST['user_id'])
|
||||
follower_profile = MSocialProfile.get_user(user_id)
|
||||
code = -1
|
||||
|
||||
logging.user(request, "~BB~FR~SK~SBNOT~SN approving follow: ~SB%s" % follower_profile.username)
|
||||
|
||||
if user_id in profile.requested_follow_user_ids:
|
||||
follower_profile.unfollow_user(request.user.pk)
|
||||
code = 1
|
||||
|
||||
return {'code': code}
|
||||
|
||||
|
||||
@json.json_view
|
||||
def find_friends(request):
|
||||
query = request.GET.get('query')
|
||||
|
@ -1037,37 +1121,58 @@ def shared_stories_rss_feed(request, user_id, username):
|
|||
|
||||
username = username and username.lower()
|
||||
profile = MSocialProfile.get_user(user.pk)
|
||||
params = {'username': profile.username_slug, 'user_id': user.pk}
|
||||
if not username or profile.username_slug.lower() != username:
|
||||
params = {'username': profile.username_slug, 'user_id': user.pk}
|
||||
return HttpResponseRedirect(reverse('shared-stories-rss-feed', kwargs=params))
|
||||
|
||||
social_profile = MSocialProfile.get_user(user_id)
|
||||
|
||||
current_site = Site.objects.get_current()
|
||||
current_site = current_site and current_site.domain
|
||||
|
||||
if social_profile.private:
|
||||
return HttpResponseForbidden
|
||||
|
||||
data = {}
|
||||
data['title'] = social_profile.title
|
||||
data['link'] = social_profile.blurblog_url
|
||||
data['description'] = "Stories shared by %s on NewsBlur." % user.username
|
||||
data['lastBuildDate'] = datetime.datetime.utcnow()
|
||||
data['items'] = []
|
||||
data['generator'] = 'NewsBlur'
|
||||
data['generator'] = 'NewsBlur - http://www.newsblur.com'
|
||||
data['docs'] = None
|
||||
data['author_name'] = user.username
|
||||
data['feed_url'] = "http://%s%s" % (
|
||||
current_site,
|
||||
reverse('shared-stories-rss-feed', kwargs=params),
|
||||
)
|
||||
rss = feedgenerator.Atom1Feed(**data)
|
||||
|
||||
shared_stories = MSharedStory.objects.filter(user_id=user.pk).order_by('-shared_date')[:25]
|
||||
for shared_story in shared_stories:
|
||||
feed = Feed.get_by_id(shared_story.story_feed_id)
|
||||
content = render_to_string('social/rss_story.xhtml', {
|
||||
'feed': feed,
|
||||
'user': user,
|
||||
'social_profile': social_profile,
|
||||
'shared_story': shared_story,
|
||||
'content': (shared_story.story_content_z and
|
||||
zlib.decompress(shared_story.story_content_z))
|
||||
})
|
||||
story_data = {
|
||||
'title': shared_story.story_title,
|
||||
'link': shared_story.story_permalink,
|
||||
'description': shared_story.story_content_z and zlib.decompress(shared_story.story_content_z),
|
||||
'author': shared_story.story_author_name,
|
||||
'description': content,
|
||||
'author_name': shared_story.story_author_name,
|
||||
'categories': shared_story.story_tags,
|
||||
'guid': shared_story.story_guid,
|
||||
'pubDate': shared_story.shared_date,
|
||||
'unique_id': shared_story.story_guid,
|
||||
'pubdate': shared_story.shared_date,
|
||||
}
|
||||
data['items'].append(RSS.RSSItem(**story_data))
|
||||
rss.add_item(**story_data)
|
||||
|
||||
rss = RSS.RSS2(**data)
|
||||
|
||||
return HttpResponse(rss.to_xml())
|
||||
logging.user(request, "~FBGenerating ~SB%s~SN's RSS feed: ~FM%s" % (
|
||||
user.username,
|
||||
request.META['HTTP_USER_AGENT'][:100]
|
||||
))
|
||||
return HttpResponse(rss.writeString('utf-8'))
|
||||
|
||||
@json.json_view
|
||||
def social_feed_trainer(request):
|
||||
|
@ -1122,7 +1227,7 @@ def load_social_settings(request, social_user_id, username=None):
|
|||
def load_interactions(request):
|
||||
user_id = request.REQUEST.get('user_id', None)
|
||||
categories = request.GET.getlist('category')
|
||||
if not user_id:
|
||||
if not user_id or 'null' in user_id:
|
||||
user_id = get_user(request).pk
|
||||
page = max(1, int(request.REQUEST.get('page', 1)))
|
||||
limit = request.REQUEST.get('limit')
|
||||
|
@ -1146,7 +1251,7 @@ def load_interactions(request):
|
|||
def load_activities(request):
|
||||
user_id = request.REQUEST.get('user_id', None)
|
||||
categories = request.GET.getlist('category')
|
||||
if user_id:
|
||||
if user_id and 'null' not in user_id:
|
||||
user_id = int(user_id)
|
||||
user = User.objects.get(pk=user_id)
|
||||
else:
|
||||
|
|
|
@ -45,6 +45,10 @@ def ios(request):
|
|||
return render_to_response('static/ios.xhtml', {},
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
def android(request):
|
||||
return render_to_response('static/android.xhtml', {},
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
def ios_download(request):
|
||||
return render_to_response('static/ios_download.xhtml', {},
|
||||
context_instance=RequestContext(request))
|
||||
|
|
|
@ -22,3 +22,8 @@
|
|||
199.15.251.154 task09 task09.newsblur.com
|
||||
199.15.251.137 task10 task10.newsblur.com
|
||||
199.15.251.155 task11 task11.newsblur.com
|
||||
|
||||
54.242.38.48 task01a task01a.newsblur.com ec2-54-242-38-48.compute-1.amazonaws.com
|
||||
184.72.214.147 task02a task02a.newsblur.com ec2-184-72-214-147.compute-1.amazonaws.com
|
||||
107.20.103.16 task03a task03a.newsblur.com ec2-107-20-103-16.compute-1.amazonaws.com
|
||||
50.17.12.16 task04a task04a.newsblur.com ec2-50-17-12-16.compute-1.amazonaws.com
|
||||
|
|
|
@ -7,7 +7,7 @@ REDISPORT=6379
|
|||
EXEC=/usr/local/bin/redis-server
|
||||
CLIEXEC=/usr/local/bin/redis-cli
|
||||
|
||||
PIDFILE=/var/log/redis.pid
|
||||
PIDFILE=/var/run/redis.pid
|
||||
CONF="/etc/redis.conf"
|
||||
|
||||
case "$1" in
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Redis configuration file example
|
||||
|
||||
# Note on units: when memory size is needed, it is possible to specifiy
|
||||
# Note on units: when memory size is needed, it is possible to specify
|
||||
# it in the usual form of 1k 5GB 4M and so forth:
|
||||
#
|
||||
# 1k => 1000 bytes
|
||||
|
@ -18,7 +18,7 @@ daemonize yes
|
|||
|
||||
# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
|
||||
# default. You can specify a custom pid file location here.
|
||||
pidfile /var/log/redis.pid
|
||||
pidfile /var/run/redis.pid
|
||||
|
||||
# Accept connections on the specified port, default is 6379.
|
||||
# If port 0 is specified Redis will not listen on a TCP socket.
|
||||
|
@ -37,7 +37,7 @@ port 6379
|
|||
# unixsocketperm 755
|
||||
|
||||
# Close the connection after a client is idle for N seconds (0 to disable)
|
||||
timeout 300
|
||||
timeout 0
|
||||
|
||||
# Set server verbosity to 'debug'
|
||||
# it can be one of:
|
||||
|
@ -45,7 +45,7 @@ timeout 300
|
|||
# verbose (many rarely useful info, but not a mess like the debug level)
|
||||
# notice (moderately verbose, what you want in production probably)
|
||||
# warning (only very important / critical messages are logged)
|
||||
loglevel verbose
|
||||
loglevel notice
|
||||
|
||||
# Specify the log file name. Also 'stdout' can be used to force
|
||||
# Redis to log on the standard output. Note that if you use standard
|
||||
|
@ -82,17 +82,47 @@ databases 16
|
|||
# after 60 sec if at least 10000 keys changed
|
||||
#
|
||||
# Note: you can disable saving at all commenting all the "save" lines.
|
||||
#
|
||||
# It is also possible to remove all the previously configured save
|
||||
# points by adding a save directive with a single empty string argument
|
||||
# like in the following example:
|
||||
#
|
||||
# save ""
|
||||
|
||||
save 900 1
|
||||
save 300 10
|
||||
save 60 10000
|
||||
|
||||
# By default Redis will stop accepting writes if RDB snapshots are enabled
|
||||
# (at least one save point) and the latest background save failed.
|
||||
# This will make the user aware (in an hard way) that data is not persisting
|
||||
# on disk properly, otherwise chances are that no one will notice and some
|
||||
# distater will happen.
|
||||
#
|
||||
# If the background saving process will start working again Redis will
|
||||
# automatically allow writes again.
|
||||
#
|
||||
# However if you have setup your proper monitoring of the Redis server
|
||||
# and persistence, you may want to disable this feature so that Redis will
|
||||
# continue to work as usually even if there are problems with disk,
|
||||
# permissions, and so forth.
|
||||
stop-writes-on-bgsave-error yes
|
||||
|
||||
# Compress string objects using LZF when dump .rdb databases?
|
||||
# For default that's set to 'yes' as it's almost always a win.
|
||||
# If you want to save some CPU in the saving child set it to 'no' but
|
||||
# the dataset will likely be bigger if you have compressible values or keys.
|
||||
rdbcompression yes
|
||||
|
||||
# Since verison 5 of RDB a CRC64 checksum is placed at the end of the file.
|
||||
# This makes the format more resistant to corruption but there is a performance
|
||||
# hit to pay (around 10%) when saving and loading RDB files, so you can disable it
|
||||
# for maximum performances.
|
||||
#
|
||||
# RDB files created with checksum disabled have a checksum of zero that will
|
||||
# tell the loading code to skip the check.
|
||||
rdbchecksum yes
|
||||
|
||||
# The filename where to dump the DB
|
||||
dbfilename dump.rdb
|
||||
|
||||
|
@ -126,7 +156,7 @@ dir /var/lib/redis
|
|||
# is still in progress, the slave can act in two different ways:
|
||||
#
|
||||
# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
|
||||
# still reply to client requests, possibly with out of data data, or the
|
||||
# still reply to client requests, possibly with out of date data, or the
|
||||
# data set may just be empty if this is the first synchronization.
|
||||
#
|
||||
# 2) if slave-serve-stale data is set to 'no' the slave will reply with
|
||||
|
@ -135,6 +165,52 @@ dir /var/lib/redis
|
|||
#
|
||||
slave-serve-stale-data yes
|
||||
|
||||
# You can configure a slave instance to accept writes or not. Writing against
|
||||
# a slave instance may be useful to store some ephemeral data (because data
|
||||
# written on a slave will be easily deleted after resync with the master) but
|
||||
# may also cause problems if clients are writing to it because of a
|
||||
# misconfiguration.
|
||||
#
|
||||
# Since Redis 2.6 by default slaves are read-only.
|
||||
#
|
||||
# Note: read only slaves are not designed to be exposed to untrusted clients
|
||||
# on the internet. It's just a protection layer against misuse of the instance.
|
||||
# Still a read only slave exports by default all the administrative commands
|
||||
# such as CONFIG, DEBUG, and so forth. To a limited extend you can improve
|
||||
# security of read only slaves using 'rename-command' to shadow all the
|
||||
# administrative / dangerous commands.
|
||||
slave-read-only yes
|
||||
|
||||
# Slaves send PINGs to server in a predefined interval. It's possible to change
|
||||
# this interval with the repl_ping_slave_period option. The default value is 10
|
||||
# seconds.
|
||||
#
|
||||
# repl-ping-slave-period 10
|
||||
|
||||
# The following option sets a timeout for both Bulk transfer I/O timeout and
|
||||
# master data or ping response timeout. The default value is 60 seconds.
|
||||
#
|
||||
# It is important to make sure that this value is greater than the value
|
||||
# specified for repl-ping-slave-period otherwise a timeout will be detected
|
||||
# every time there is low traffic between the master and the slave.
|
||||
#
|
||||
# repl-timeout 60
|
||||
|
||||
# The slave priority is an integer number published by Redis in the INFO output.
|
||||
# It is used by Redis Sentinel in order to select a slave to promote into a
|
||||
# master if the master is no longer working correctly.
|
||||
#
|
||||
# A slave with a low priority number is considered better for promotion, so
|
||||
# for instance if there are three slaves with priority 10, 100, 25 Sentinel will
|
||||
# pick the one wtih priority 10, that is the lowest.
|
||||
#
|
||||
# However a special priority of 0 marks the slave as not able to perform the
|
||||
# role of master, so a slave with priority of 0 will never be selected by
|
||||
# Redis Sentinel for promotion.
|
||||
#
|
||||
# By default the priority is 100.
|
||||
slave-priority 100
|
||||
|
||||
################################## SECURITY ###################################
|
||||
|
||||
# Require clients to issue AUTH <PASSWORD> before processing any other
|
||||
|
@ -152,7 +228,7 @@ slave-serve-stale-data yes
|
|||
|
||||
# Command renaming.
|
||||
#
|
||||
# It is possilbe to change the name of dangerous commands in a shared
|
||||
# It is possible to change the name of dangerous commands in a shared
|
||||
# environment. For instance the CONFIG command may be renamed into something
|
||||
# of hard to guess so that it will be still available for internal-use
|
||||
# tools but not available for general clients.
|
||||
|
@ -161,37 +237,46 @@ slave-serve-stale-data yes
|
|||
#
|
||||
# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
|
||||
#
|
||||
# It is also possilbe to completely kill a command renaming it into
|
||||
# It is also possible to completely kill a command renaming it into
|
||||
# an empty string:
|
||||
#
|
||||
# rename-command CONFIG ""
|
||||
|
||||
################################### LIMITS ####################################
|
||||
|
||||
# Set the max number of connected clients at the same time. By default there
|
||||
# is no limit, and it's up to the number of file descriptors the Redis process
|
||||
# is able to open. The special value '0' means no limits.
|
||||
# Set the max number of connected clients at the same time. By default
|
||||
# this limit is set to 10000 clients, however if the Redis server is not
|
||||
# able ot configure the process file limit to allow for the specified limit
|
||||
# the max number of allowed clients is set to the current file limit
|
||||
# minus 32 (as Redis reserves a few file descriptors for internal uses).
|
||||
#
|
||||
# Once the limit is reached Redis will close all the new connections sending
|
||||
# an error 'max number of clients reached'.
|
||||
#
|
||||
# maxclients 128
|
||||
# maxclients 10000
|
||||
|
||||
# Don't use more memory than the specified amount of bytes.
|
||||
# When the memory limit is reached Redis will try to remove keys with an
|
||||
# EXPIRE set. It will try to start freeing keys that are going to expire
|
||||
# in little time and preserve keys with a longer time to live.
|
||||
# Redis will also try to remove objects from free lists if possible.
|
||||
# When the memory limit is reached Redis will try to remove keys
|
||||
# accordingly to the eviction policy selected (see maxmemmory-policy).
|
||||
#
|
||||
# If all this fails, Redis will start to reply with errors to commands
|
||||
# that will use more memory, like SET, LPUSH, and so on, and will continue
|
||||
# to reply to most read-only commands like GET.
|
||||
# If Redis can't remove keys according to the policy, or if the policy is
|
||||
# set to 'noeviction', Redis will start to reply with errors to commands
|
||||
# that would use more memory, like SET, LPUSH, and so on, and will continue
|
||||
# to reply to read-only commands like GET.
|
||||
#
|
||||
# WARNING: maxmemory can be a good idea mainly if you want to use Redis as a
|
||||
# 'state' server or cache, not as a real DB. When Redis is used as a real
|
||||
# database the memory usage will grow over the weeks, it will be obvious if
|
||||
# it is going to use too much memory in the long run, and you'll have the time
|
||||
# to upgrade. With maxmemory after the limit is reached you'll start to get
|
||||
# errors for write operations, and this may even lead to DB inconsistency.
|
||||
# This option is usually useful when using Redis as an LRU cache, or to set
|
||||
# an hard memory limit for an instance (using the 'noeviction' policy).
|
||||
#
|
||||
# WARNING: If you have slaves attached to an instance with maxmemory on,
|
||||
# the size of the output buffers needed to feed the slaves are subtracted
|
||||
# from the used memory count, so that network problems / resyncs will
|
||||
# not trigger a loop where keys are evicted, and in turn the output
|
||||
# buffer of slaves is full with DELs of keys evicted triggering the deletion
|
||||
# of more keys, and so forth until the database is completely emptied.
|
||||
#
|
||||
# In short... if you have slaves attached it is suggested that you set a lower
|
||||
# limit for maxmemory so that there is some free RAM on the system for slave
|
||||
# output buffers (but this is not needed if the policy is 'noeviction').
|
||||
#
|
||||
# maxmemory <bytes>
|
||||
|
||||
|
@ -201,7 +286,7 @@ slave-serve-stale-data yes
|
|||
# volatile-lru -> remove the key with an expire set using an LRU algorithm
|
||||
# allkeys-lru -> remove any key accordingly to the LRU algorithm
|
||||
# volatile-random -> remove a random key with an expire set
|
||||
# allkeys->random -> remove a random key, any key
|
||||
# allkeys-random -> remove a random key, any key
|
||||
# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
|
||||
# noeviction -> don't expire at all, just return an error on write operations
|
||||
#
|
||||
|
@ -228,21 +313,23 @@ slave-serve-stale-data yes
|
|||
|
||||
############################## APPEND ONLY MODE ###############################
|
||||
|
||||
# By default Redis asynchronously dumps the dataset on disk. If you can live
|
||||
# with the idea that the latest records will be lost if something like a crash
|
||||
# happens this is the preferred way to run Redis. If instead you care a lot
|
||||
# about your data and don't want to that a single record can get lost you should
|
||||
# enable the append only mode: when this mode is enabled Redis will append
|
||||
# every write operation received in the file appendonly.aof. This file will
|
||||
# be read on startup in order to rebuild the full dataset in memory.
|
||||
# By default Redis asynchronously dumps the dataset on disk. This mode is
|
||||
# good enough in many applications, but an issue with the Redis process or
|
||||
# a power outage may result into a few minutes of writes lost (depending on
|
||||
# the configured save points).
|
||||
#
|
||||
# Note that you can have both the async dumps and the append only file if you
|
||||
# like (you have to comment the "save" statements above to disable the dumps).
|
||||
# Still if append only mode is enabled Redis will load the data from the
|
||||
# log file at startup ignoring the dump.rdb file.
|
||||
# The Append Only File is an alternative persistence mode that provides
|
||||
# much better durability. For instance using the default data fsync policy
|
||||
# (see later in the config file) Redis can lose just one second of writes in a
|
||||
# dramatic event like a server power outage, or a single write if something
|
||||
# wrong with the Redis process itself happens, but the operating system is
|
||||
# still running correctly.
|
||||
#
|
||||
# IMPORTANT: Check the BGREWRITEAOF to check how to rewrite the append
|
||||
# log file in background when it gets too big.
|
||||
# AOF and RDB persistence can be enabled at the same time without problems.
|
||||
# If the AOF is enabled on startup Redis will load the AOF, that is the file
|
||||
# with the better durability guarantees.
|
||||
#
|
||||
# Please check http://redis.io/topics/persistence for more information.
|
||||
|
||||
appendonly no
|
||||
|
||||
|
@ -257,16 +344,19 @@ appendonly no
|
|||
#
|
||||
# no: don't fsync, just let the OS flush the data when it wants. Faster.
|
||||
# always: fsync after every write to the append only log . Slow, Safest.
|
||||
# everysec: fsync only if one second passed since the last fsync. Compromise.
|
||||
# everysec: fsync only one time every second. Compromise.
|
||||
#
|
||||
# The default is "everysec" that's usually the right compromise between
|
||||
# speed and data safety. It's up to you to understand if you can relax this to
|
||||
# "no" that will will let the operating system flush the output buffer when
|
||||
# "no" that will let the operating system flush the output buffer when
|
||||
# it wants, for better performances (but if you can live with the idea of
|
||||
# some data loss consider the default persistence mode that's snapshotting),
|
||||
# or on the contrary, use "always" that's very slow but a bit safer than
|
||||
# everysec.
|
||||
#
|
||||
# More details please check the following article:
|
||||
# http://antirez.com/post/redis-persistence-demystified.html
|
||||
#
|
||||
# If unsure, use "everysec".
|
||||
|
||||
# appendfsync always
|
||||
|
@ -285,7 +375,7 @@ appendfsync everysec
|
|||
# BGSAVE or BGREWRITEAOF is in progress.
|
||||
#
|
||||
# This means that while another child is saving the durability of Redis is
|
||||
# the same as "appendfsync none", that in pratical terms means that it is
|
||||
# the same as "appendfsync none", that in practical terms means that it is
|
||||
# possible to lost up to 30 seconds of log in the worst scenario (with the
|
||||
# default Linux settings).
|
||||
#
|
||||
|
@ -307,12 +397,49 @@ no-appendfsync-on-rewrite no
|
|||
# is useful to avoid rewriting the AOF file even if the percentage increase
|
||||
# is reached but it is still pretty small.
|
||||
#
|
||||
# Specify a precentage of zero in order to disable the automatic AOF
|
||||
# Specify a percentage of zero in order to disable the automatic AOF
|
||||
# rewrite feature.
|
||||
|
||||
auto-aof-rewrite-percentage 100
|
||||
auto-aof-rewrite-min-size 64mb
|
||||
|
||||
################################ LUA SCRIPTING ###############################
|
||||
|
||||
# Max execution time of a Lua script in milliseconds.
|
||||
#
|
||||
# If the maximum execution time is reached Redis will log that a script is
|
||||
# still in execution after the maximum allowed time and will start to
|
||||
# reply to queries with an error.
|
||||
#
|
||||
# When a long running script exceed the maximum execution time only the
|
||||
# SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be
|
||||
# used to stop a script that did not yet called write commands. The second
|
||||
# is the only way to shut down the server in the case a write commands was
|
||||
# already issue by the script but the user don't want to wait for the natural
|
||||
# termination of the script.
|
||||
#
|
||||
# Set it to 0 or a negative value for unlimited execution without warnings.
|
||||
lua-time-limit 5000
|
||||
|
||||
################################ REDIS CLUSTER ###############################
|
||||
#
|
||||
# Normal Redis instances can't be part of a Redis Cluster, only nodes that are
|
||||
# started as cluster nodes can. In order to start a Redis instance as a
|
||||
# cluster node enable the cluster support uncommenting the following:
|
||||
#
|
||||
# cluster-enabled yes
|
||||
|
||||
# Every cluster node has a cluster configuration file. This file is not
|
||||
# intended to be edited by hand. It is created and updated by Redis nodes.
|
||||
# Every Redis Cluster node requires a different cluster configuration file.
|
||||
# Make sure that instances running in the same system does not have
|
||||
# overlapping cluster configuration file names.
|
||||
#
|
||||
# cluster-config-file nodes-6379.conf
|
||||
|
||||
# In order to setup your cluster make sure to read the documentation
|
||||
# available at http://redis.io web site.
|
||||
|
||||
################################## SLOW LOG ###################################
|
||||
|
||||
# The Redis Slow Log is a system to log queries that exceeded a specified
|
||||
|
@ -335,85 +462,15 @@ slowlog-log-slower-than 10000
|
|||
|
||||
# There is no limit to this length. Just be aware that it will consume memory.
|
||||
# You can reclaim memory used by the slow log with SLOWLOG RESET.
|
||||
slowlog-max-len 1024
|
||||
slowlog-max-len 128
|
||||
|
||||
################################ VIRTUAL MEMORY ###############################
|
||||
############################### ADVANCED CONFIG ###############################
|
||||
|
||||
### WARNING! Virtual Memory is deprecated in Redis 2.4
|
||||
### The use of Virtual Memory is strongly discouraged.
|
||||
|
||||
# Virtual Memory allows Redis to work with datasets bigger than the actual
|
||||
# amount of RAM needed to hold the whole dataset in memory.
|
||||
# In order to do so very used keys are taken in memory while the other keys
|
||||
# are swapped into a swap file, similarly to what operating systems do
|
||||
# with memory pages.
|
||||
#
|
||||
# To enable VM just set 'vm-enabled' to yes, and set the following three
|
||||
# VM parameters accordingly to your needs.
|
||||
|
||||
vm-enabled no
|
||||
# vm-enabled yes
|
||||
|
||||
# This is the path of the Redis swap file. As you can guess, swap files
|
||||
# can't be shared by different Redis instances, so make sure to use a swap
|
||||
# file for every redis process you are running. Redis will complain if the
|
||||
# swap file is already in use.
|
||||
#
|
||||
# The best kind of storage for the Redis swap file (that's accessed at random)
|
||||
# is a Solid State Disk (SSD).
|
||||
#
|
||||
# *** WARNING *** if you are using a shared hosting the default of putting
|
||||
# the swap file under /tmp is not secure. Create a dir with access granted
|
||||
# only to Redis user and configure Redis to create the swap file there.
|
||||
vm-swap-file /tmp/redis.swap
|
||||
|
||||
# vm-max-memory configures the VM to use at max the specified amount of
|
||||
# RAM. Everything that deos not fit will be swapped on disk *if* possible, that
|
||||
# is, if there is still enough contiguous space in the swap file.
|
||||
#
|
||||
# With vm-max-memory 0 the system will swap everything it can. Not a good
|
||||
# default, just specify the max amount of RAM you can in bytes, but it's
|
||||
# better to leave some margin. For instance specify an amount of RAM
|
||||
# that's more or less between 60 and 80% of your free RAM.
|
||||
vm-max-memory 0
|
||||
|
||||
# Redis swap files is split into pages. An object can be saved using multiple
|
||||
# contiguous pages, but pages can't be shared between different objects.
|
||||
# So if your page is too big, small objects swapped out on disk will waste
|
||||
# a lot of space. If you page is too small, there is less space in the swap
|
||||
# file (assuming you configured the same number of total swap file pages).
|
||||
#
|
||||
# If you use a lot of small objects, use a page size of 64 or 32 bytes.
|
||||
# If you use a lot of big objects, use a bigger page size.
|
||||
# If unsure, use the default :)
|
||||
vm-page-size 32
|
||||
|
||||
# Number of total memory pages in the swap file.
|
||||
# Given that the page table (a bitmap of free/used pages) is taken in memory,
|
||||
# every 8 pages on disk will consume 1 byte of RAM.
|
||||
#
|
||||
# The total swap size is vm-page-size * vm-pages
|
||||
#
|
||||
# With the default of 32-bytes memory pages and 134217728 pages Redis will
|
||||
# use a 4 GB swap file, that will use 16 MB of RAM for the page table.
|
||||
#
|
||||
# It's better to use the smallest acceptable value for your application,
|
||||
# but the default is large in order to work in most conditions.
|
||||
vm-pages 134217728
|
||||
|
||||
# Max number of VM I/O threads running at the same time.
|
||||
# This threads are used to read/write data from/to swap file, since they
|
||||
# also encode and decode objects from disk to memory or the reverse, a bigger
|
||||
# number of threads can help with big objects even if they can't help with
|
||||
# I/O itself as the physical device may not be able to couple with many
|
||||
# reads/writes operations at the same time.
|
||||
|
||||
# Hashes are encoded in a special way (much more memory efficient) when they
|
||||
# have at max a given numer of elements, and the biggest element does not
|
||||
# exceed a given threshold. You can configure this limits with the following
|
||||
# configuration directives.
|
||||
hash-max-zipmap-entries 512
|
||||
hash-max-zipmap-value 64
|
||||
# Hashes are encoded using a memory efficient data structure when they have a
|
||||
# small number of entries, and the biggest entry does not exceed a given
|
||||
# threshold. These thresholds can be configured using the following directives.
|
||||
hash-max-ziplist-entries 512
|
||||
hash-max-ziplist-value 64
|
||||
|
||||
# Similarly to hashes, small lists are also encoded in a special way in order
|
||||
# to save a lot of space. The special representation is only used when
|
||||
|
@ -436,9 +493,9 @@ zset-max-ziplist-value 64
|
|||
|
||||
# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
|
||||
# order to help rehashing the main Redis hash table (the one mapping top-level
|
||||
# keys to values). The hash table implementation redis uses (see dict.c)
|
||||
# keys to values). The hash table implementation Redis uses (see dict.c)
|
||||
# performs a lazy rehashing: the more operation you run into an hash table
|
||||
# that is rhashing, the more rehashing "steps" are performed, so if the
|
||||
# that is rehashing, the more rehashing "steps" are performed, so if the
|
||||
# server is idle the rehashing is never complete and some more memory is used
|
||||
# by the hash table.
|
||||
#
|
||||
|
@ -454,10 +511,47 @@ zset-max-ziplist-value 64
|
|||
# want to free memory asap when possible.
|
||||
activerehashing yes
|
||||
|
||||
# The client output buffer limits can be used to force disconnection of clients
|
||||
# that are not reading data from the server fast enough for some reason (a
|
||||
# common reason is that a Pub/Sub client can't consume messages as fast as the
|
||||
# publisher can produce them).
|
||||
#
|
||||
# The limit can be set differently for the three different classes of clients:
|
||||
#
|
||||
# normal -> normal clients
|
||||
# slave -> slave clients and MONITOR clients
|
||||
# pubsub -> clients subcribed to at least one pubsub channel or pattern
|
||||
#
|
||||
# The syntax of every client-output-buffer-limit directive is the following:
|
||||
#
|
||||
# client-output-buffer-limit <class> <hard limit> <soft limit> <soft seconds>
|
||||
#
|
||||
# A client is immediately disconnected once the hard limit is reached, or if
|
||||
# the soft limit is reached and remains reached for the specified number of
|
||||
# seconds (continuously).
|
||||
# So for instance if the hard limit is 32 megabytes and the soft limit is
|
||||
# 16 megabytes / 10 seconds, the client will get disconnected immediately
|
||||
# if the size of the output buffers reach 32 megabytes, but will also get
|
||||
# disconnected if the client reaches 16 megabytes and continuously overcomes
|
||||
# the limit for 10 seconds.
|
||||
#
|
||||
# By default normal clients are not limited because they don't receive data
|
||||
# without asking (in a push way), but just after a request, so only
|
||||
# asynchronous clients may create a scenario where data is requested faster
|
||||
# than it can read.
|
||||
#
|
||||
# Instead there is a default limit for pubsub and slave clients, since
|
||||
# subscribers and slaves receive data in a push fashion.
|
||||
#
|
||||
# Both the hard or the soft limit can be disabled just setting it to zero.
|
||||
client-output-buffer-limit normal 0 0 0
|
||||
client-output-buffer-limit slave 256mb 64mb 60
|
||||
client-output-buffer-limit pubsub 32mb 8mb 60
|
||||
|
||||
################################## INCLUDES ###################################
|
||||
|
||||
# Include one or more other config files here. This is useful if you
|
||||
# have a standard template that goes to all redis server but also need
|
||||
# have a standard template that goes to all Redis server but also need
|
||||
# to customize a few per-server settings. Include files can include
|
||||
# other files, so use this wisely.
|
||||
#
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
[program:celery]
|
||||
command=/srv/newsblur/manage.py celeryd --loglevel=INFO -Q new_feeds,work_queue,push_feeds,update_feeds
|
||||
# command=/srv/newsblur/manage.py celeryd --loglevel=INFO -Q new_feeds,work_queue,push_feeds,update_feeds
|
||||
command=/srv/newsblur/manage.py celeryd --loglevel=INFO -Q new_feeds,push_feeds,update_feeds
|
||||
directory=/srv/newsblur
|
||||
user=sclay
|
||||
numprocs=1
|
||||
|
|
109
fabfile.py
vendored
|
@ -33,7 +33,6 @@ env.roledefs ={
|
|||
'local': ['localhost'],
|
||||
'app': ['app01.newsblur.com',
|
||||
'app02.newsblur.com',
|
||||
'app03.newsblur.com',
|
||||
'app04.newsblur.com',
|
||||
],
|
||||
'dev': ['dev.newsblur.com'],
|
||||
|
@ -48,17 +47,22 @@ env.roledefs ={
|
|||
'db05.newsblur.com',
|
||||
],
|
||||
'task': ['task01.newsblur.com',
|
||||
'task02.newsblur.com',
|
||||
# 'task02.newsblur.com',
|
||||
'task03.newsblur.com',
|
||||
'task04.newsblur.com',
|
||||
'task05.newsblur.com',
|
||||
'task06.newsblur.com',
|
||||
'task07.newsblur.com',
|
||||
# 'task05.newsblur.com',
|
||||
# 'task06.newsblur.com',
|
||||
# 'task07.newsblur.com',
|
||||
'task08.newsblur.com',
|
||||
'task09.newsblur.com',
|
||||
'task10.newsblur.com',
|
||||
'task11.newsblur.com',
|
||||
],
|
||||
'ec2task': ['ec2-54-242-38-48.compute-1.amazonaws.com',
|
||||
'ec2-184-72-214-147.compute-1.amazonaws.com',
|
||||
'ec2-107-20-103-16.compute-1.amazonaws.com',
|
||||
'ec2-50-17-12-16.compute-1.amazonaws.com',
|
||||
],
|
||||
'vps': ['task01.newsblur.com',
|
||||
'task02.newsblur.com',
|
||||
'task03.newsblur.com',
|
||||
|
@ -101,6 +105,10 @@ def task():
|
|||
server()
|
||||
env.roles = ['task']
|
||||
|
||||
def ec2task():
|
||||
ec2()
|
||||
env.roles = ['ec2task']
|
||||
|
||||
def vps():
|
||||
server()
|
||||
env.roles = ['vps']
|
||||
|
@ -184,11 +192,20 @@ def staging_full():
|
|||
|
||||
@parallel
|
||||
def celery():
|
||||
celery_slow()
|
||||
|
||||
def celery_slow():
|
||||
with cd(env.NEWSBLUR_PATH):
|
||||
run('git pull')
|
||||
celery_stop()
|
||||
celery_start()
|
||||
|
||||
@parallel
|
||||
def celery_fast():
|
||||
with cd(env.NEWSBLUR_PATH):
|
||||
run('git pull')
|
||||
celery_reload()
|
||||
|
||||
@parallel
|
||||
def celery_stop():
|
||||
with cd(env.NEWSBLUR_PATH):
|
||||
|
@ -202,6 +219,12 @@ def celery_start():
|
|||
run('sudo supervisorctl start celery')
|
||||
run('tail logs/newsblur.log')
|
||||
|
||||
@parallel
|
||||
def celery_reload():
|
||||
with cd(env.NEWSBLUR_PATH):
|
||||
run('sudo supervisorctl reload celery')
|
||||
run('tail logs/newsblur.log')
|
||||
|
||||
def kill_celery():
|
||||
with cd(env.NEWSBLUR_PATH):
|
||||
run('ps aux | grep celeryd | egrep -v grep | awk \'{print $2}\' | sudo xargs kill -9')
|
||||
|
@ -228,6 +251,8 @@ def backup_mongo():
|
|||
run('python backup_mongo.py')
|
||||
|
||||
def backup_postgresql():
|
||||
# 0 4 * * * python /home/sclay/newsblur/utils/backups/backup_psql.py
|
||||
# 0 * * * * sudo find /var/lib/postgresql/9.1/archive -mtime +1 -exec rm {} \;
|
||||
with cd(os.path.join(env.NEWSBLUR_PATH, 'utils/backups')):
|
||||
# run('./postgresql_backup.sh')
|
||||
run('python backup_psql.py')
|
||||
|
@ -268,9 +293,9 @@ def setup_common():
|
|||
setup_supervisor()
|
||||
setup_hosts()
|
||||
config_pgbouncer()
|
||||
# setup_mongoengine()
|
||||
# setup_forked_mongoengine()
|
||||
# setup_pymongo_repo()
|
||||
setup_mongoengine()
|
||||
setup_forked_mongoengine()
|
||||
setup_pymongo_repo()
|
||||
setup_logrotate()
|
||||
setup_nginx()
|
||||
configure_nginx()
|
||||
|
@ -357,7 +382,7 @@ def setup_repo():
|
|||
with settings(warn_only=True):
|
||||
run('git clone https://github.com/samuelclay/NewsBlur.git newsblur')
|
||||
sudo('mkdir -p /srv')
|
||||
sudo('ln -s /home/ubuntu/newsblur /srv/newsblur')
|
||||
sudo('ln -f -s /home/%s/newsblur /srv/newsblur' % env.user)
|
||||
|
||||
def setup_repo_local_settings():
|
||||
with cd(env.NEWSBLUR_PATH):
|
||||
|
@ -394,7 +419,7 @@ def setup_psycopg():
|
|||
|
||||
def setup_python():
|
||||
# sudo('easy_install -U pip')
|
||||
sudo('easy_install -U fabric django==1.3.1 readline pyflakes iconv celery django-celery django-celery-with-redis django-compress South django-extensions pymongo==2.2.0 stripe BeautifulSoup pyyaml nltk lxml oauth2 pytz boto seacucumber django_ses mongoengine redis requests django-subdomains psutil python-gflags cssutils')
|
||||
sudo('easy_install -U fabric django==1.3.1 readline pyflakes iconv celery django-celery django-celery-with-redis django-compress South django-extensions pymongo==2.2.0 stripe BeautifulSoup pyyaml nltk lxml oauth2 pytz boto seacucumber django_ses mongoengine redis requests django-subdomains psutil python-gflags cssutils raven')
|
||||
|
||||
put('config/pystartup.py', '.pystartup')
|
||||
# with cd(os.path.join(env.NEWSBLUR_PATH, 'vendor/cjson')):
|
||||
|
@ -447,29 +472,31 @@ def setup_mongoengine():
|
|||
with cd(env.VENDOR_PATH):
|
||||
with settings(warn_only=True):
|
||||
run('rm -fr mongoengine')
|
||||
run('git clone https://github.com/mongoengine/mongoengine.git')
|
||||
sudo('rm -f /usr/local/lib/python2.7/dist-packages/mongoengine')
|
||||
run('git clone https://github.com/MongoEngine/mongoengine.git')
|
||||
sudo('rm -fr /usr/local/lib/python2.7/dist-packages/mongoengine')
|
||||
sudo('rm -fr /usr/local/lib/python2.7/dist-packages/mongoengine-*')
|
||||
sudo('ln -s %s /usr/local/lib/python2.7/dist-packages/mongoengine' %
|
||||
os.path.join(env.VENDOR_PATH, 'mongoengine/mongoengine'))
|
||||
with cd(os.path.join(env.VENDOR_PATH, 'mongoengine')):
|
||||
run('git checkout -b dev origin/dev')
|
||||
|
||||
def setup_pymongo_repo():
|
||||
with cd(env.VENDOR_PATH):
|
||||
with settings(warn_only=True):
|
||||
run('git clone git://github.com/mongodb/mongo-python-driver.git pymongo')
|
||||
with cd(os.path.join(env.VENDOR_PATH, 'pymongo')):
|
||||
sudo('python setup.py install')
|
||||
# with cd(os.path.join(env.VENDOR_PATH, 'pymongo')):
|
||||
# sudo('python setup.py install')
|
||||
sudo('rm -fr /usr/local/lib/python2.7/dist-packages/pymongo*')
|
||||
sudo('rm -fr /usr/local/lib/python2.7/dist-packages/bson*')
|
||||
sudo('rm -fr /usr/local/lib/python2.7/dist-packages/gridgs*')
|
||||
sudo('ln -s %s /usr/local/lib/python2.7/dist-packages/' %
|
||||
os.path.join(env.VENDOR_PATH, 'pymongo/{pymongo,bson,gridfs}'))
|
||||
|
||||
def setup_forked_mongoengine():
|
||||
with cd(os.path.join(env.VENDOR_PATH, 'mongoengine')):
|
||||
with settings(warn_only=True):
|
||||
run('git checkout master')
|
||||
run('git branch -D dev')
|
||||
run('git remote add %s git://github.com/samuelclay/mongoengine.git' % env.user)
|
||||
run('git fetch %s' % env.user)
|
||||
run('git checkout -b dev %s/dev' % env.user)
|
||||
run('git pull %s dev' % env.user)
|
||||
run('git remote add clay https://github.com/samuelclay/mongoengine.git')
|
||||
run('git pull')
|
||||
run('git fetch clay')
|
||||
run('git checkout -b clay_master clay/master')
|
||||
|
||||
def switch_forked_mongoengine():
|
||||
with cd(os.path.join(env.VENDOR_PATH, 'mongoengine')):
|
||||
|
@ -604,30 +631,10 @@ def setup_db_firewall():
|
|||
sudo('ufw allow from 199.15.248.0/21 to any port 11211 ') # Memcached
|
||||
|
||||
# EC2
|
||||
sudo('ufw delete allow from 23.22.0.0/16 to any port 5432 ') # PostgreSQL
|
||||
sudo('ufw delete allow from 23.22.0.0/16 to any port 27017') # MongoDB
|
||||
sudo('ufw delete allow from 23.22.0.0/16 to any port 6379 ') # Redis
|
||||
sudo('ufw delete allow from 23.22.0.0/16 to any port 11211 ') # Memcached
|
||||
sudo('ufw delete allow from 54.242.38.48/20 to any port 5432 ') # PostgreSQL
|
||||
sudo('ufw delete allow from 54.242.38.48/20 to any port 27017') # MongoDB
|
||||
sudo('ufw delete allow from 54.242.38.48/20 to any port 6379 ') # Redis
|
||||
sudo('ufw delete allow from 54.242.38.48/20 to any port 11211 ') # Memcached
|
||||
sudo('ufw delete allow from 184.73.115.5/20 to any port 5432 ') # PostgreSQL
|
||||
sudo('ufw delete allow from 184.73.115.5/20 to any port 27017') # MongoDB
|
||||
sudo('ufw delete allow from 184.73.115.5/20 to any port 6379 ') # Redis
|
||||
sudo('ufw delete allow from 184.73.115.5/20 to any port 11211 ') # Memcached
|
||||
sudo('ufw allow from 54.242.38.48 to any port 5432 ') # PostgreSQL
|
||||
sudo('ufw allow from 54.242.38.48 to any port 27017') # MongoDB
|
||||
sudo('ufw allow from 54.242.38.48 to any port 6379 ') # Redis
|
||||
sudo('ufw allow from 54.242.38.48 to any port 11211 ') # Memcached
|
||||
sudo('ufw allow from 184.73.115.5 to any port 5432 ') # PostgreSQL
|
||||
sudo('ufw allow from 184.73.115.5 to any port 27017') # MongoDB
|
||||
sudo('ufw allow from 184.73.115.5 to any port 6379 ') # Redis
|
||||
sudo('ufw allow from 184.73.115.5 to any port 11211 ') # Memcached
|
||||
sudo('ufw allow from 54.242.137.224 to any port 5432 ') # PostgreSQL
|
||||
sudo('ufw allow from 54.242.137.224 to any port 27017') # MongoDB
|
||||
sudo('ufw allow from 54.242.137.224 to any port 6379 ') # Redis
|
||||
sudo('ufw allow from 54.242.137.224 to any port 11211 ') # Memcached
|
||||
sudo('ufw allow proto tcp from 54.242.38.48 to any port 5432,27017,6379,11211')
|
||||
sudo('ufw allow proto tcp from 184.72.214.147 to any port 5432,27017,6379,11211')
|
||||
sudo('ufw allow proto tcp from 107.20.103.16 to any port 5432,27017,6379,11211')
|
||||
sudo('ufw allow proto tcp from 50.17.12.16 to any port 5432,27017,6379,11211')
|
||||
sudo('ufw --force enable')
|
||||
|
||||
def setup_db_motd():
|
||||
|
@ -668,7 +675,7 @@ def copy_postgres_to_standby():
|
|||
# Make sure you can ssh from master to slave and back.
|
||||
# Need to give postgres accounts keys in authroized_keys.
|
||||
|
||||
sudo('su postgres -c "psql -c \\"SELECT pg_start_backup(\'label\', true)\\""', pty=False)
|
||||
# sudo('su postgres -c "psql -c \\"SELECT pg_start_backup(\'label\', true)\\""', pty=False)
|
||||
sudo('su postgres -c \"rsync -a --stats --progress /var/lib/postgresql/9.1/main postgres@%s:/var/lib/postgresql/9.1/ --exclude postmaster.pid\"' % slave, pty=False)
|
||||
sudo('su postgres -c "psql -c \\"SELECT pg_stop_backup()\\""', pty=False)
|
||||
|
||||
|
@ -683,7 +690,7 @@ def setup_mongo():
|
|||
sudo('/etc/init.d/mongodb restart')
|
||||
|
||||
def setup_redis():
|
||||
redis_version = '2.4.15'
|
||||
redis_version = '2.6.2'
|
||||
with cd(env.VENDOR_PATH):
|
||||
run('wget http://redis.googlecode.com/files/redis-%s.tar.gz' % redis_version)
|
||||
run('tar -xzf redis-%s.tar.gz' % redis_version)
|
||||
|
@ -756,19 +763,21 @@ def copy_task_settings():
|
|||
def setup_ec2_task():
|
||||
AMI_NAME = 'ami-834cf1ea' # Ubuntu 64-bit 12.04 LTS
|
||||
# INSTANCE_TYPE = 'c1.medium'
|
||||
INSTANCE_TYPE = 'm1.medium'
|
||||
INSTANCE_TYPE = 'c1.medium'
|
||||
conn = EC2Connection(django_settings.AWS_ACCESS_KEY_ID, django_settings.AWS_SECRET_ACCESS_KEY)
|
||||
reservation = conn.run_instances(AMI_NAME, instance_type=INSTANCE_TYPE,
|
||||
key_name='sclay',
|
||||
security_groups=['db-mongo'])
|
||||
instance = reservation.instances[0]
|
||||
print "Booting reservation: %s/%s (size: %s)" % (reservation, instance, INSTANCE_TYPE)
|
||||
i = 0
|
||||
while True:
|
||||
if instance.state == 'pending':
|
||||
print ".",
|
||||
sys.stdout.flush()
|
||||
instance.update()
|
||||
time.sleep(1)
|
||||
i += 1
|
||||
time.sleep(i)
|
||||
elif instance.state == 'running':
|
||||
print "...booted: %s" % instance.public_dns_name
|
||||
time.sleep(5)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.newsblur"
|
||||
android:versionCode="20"
|
||||
android:versionName="0.9.65" >
|
||||
android:versionCode="26"
|
||||
android:versionName="1.0.2" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="8"
|
||||
|
|
4
media/android/NewsBlur/lint.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<lint>
|
||||
<issue id="StringFormatMatches" severity="ignore" />
|
||||
</lint>
|
|
@ -18,7 +18,8 @@
|
|||
android:layout_below="@id/dialog_message"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:inputType="textCapSentences"
|
||||
android:singleLine="false"
|
||||
android:inputType="textCapSentences|textMultiLine"
|
||||
android:hint="@string/share_comment_hint"
|
||||
android:textSize="11sp" />
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
<string name="replied">Reply posted</string>
|
||||
<string name="error_replying">There was an error replying</string>
|
||||
<string name="share" formatted="false">\"%s\" - %s (via NewsBlur)</string>
|
||||
<string name="share">\"%1$s\" - %2$s (via NewsBlur)</string>
|
||||
<string name="shared_title">Share</string>
|
||||
<string name="share_this">Share this story</string>
|
||||
<string name="share_comment_hint">Comment (Optional)</string>
|
||||
|
@ -101,8 +101,6 @@
|
|||
|
||||
<string name="logout_warning">Are you sure you want to log out?</string>
|
||||
|
||||
<string name="unsorted_folder_name">Unsorted</string>
|
||||
|
||||
<string name="feed_search_hint">Search for new feeds</string>
|
||||
<string name="empty_list_notice">Loading stories…</string>
|
||||
<string name="empty_search_notice">Type a search term to begin</string>
|
||||
|
|
|
@ -141,7 +141,7 @@ public abstract class Reading extends SherlockFragmentActivity implements OnPage
|
|||
startActivity(Intent.createChooser(intent, "Share using"));
|
||||
return true;
|
||||
case R.id.menu_textsize:
|
||||
float currentValue = getSharedPreferences(PrefConstants.PREFERENCES, 0).getFloat(PrefConstants.PREFERENCE_TEXT_SIZE, 2.0f);
|
||||
float currentValue = getSharedPreferences(PrefConstants.PREFERENCES, 0).getFloat(PrefConstants.PREFERENCE_TEXT_SIZE, 0.5f);
|
||||
TextSizeDialogFragment textSize = TextSizeDialogFragment.newInstance(currentValue);
|
||||
textSize.show(getSupportFragmentManager(), TEXT_SIZE);
|
||||
return true;
|
||||
|
|
|
@ -145,10 +145,10 @@ public class DatabaseConstants {
|
|||
|
||||
|
||||
private static String STORY_SUM_TOTAL = " CASE " +
|
||||
"WHEN MAX(" + DatabaseConstants.STORY_INTELLIGENCE_AUTHORS + "," + DatabaseConstants.STORY_INTELLIGENCE_FEED + "," + DatabaseConstants.STORY_INTELLIGENCE_TAGS + "," + DatabaseConstants.STORY_INTELLIGENCE_TITLE + ") > 0 " +
|
||||
"THEN MAX(" + DatabaseConstants.STORY_INTELLIGENCE_AUTHORS + "," + DatabaseConstants.STORY_INTELLIGENCE_FEED + "," + DatabaseConstants.STORY_INTELLIGENCE_TAGS + "," + DatabaseConstants.STORY_INTELLIGENCE_TITLE + ") " +
|
||||
"WHEN MIN(" + DatabaseConstants.STORY_INTELLIGENCE_AUTHORS + "," + DatabaseConstants.STORY_INTELLIGENCE_FEED + "," + DatabaseConstants.STORY_INTELLIGENCE_TAGS + "," + DatabaseConstants.STORY_INTELLIGENCE_TITLE + ") < 0 " +
|
||||
"THEN MIN(" + DatabaseConstants.STORY_INTELLIGENCE_AUTHORS + "," + DatabaseConstants.STORY_INTELLIGENCE_FEED + "," + DatabaseConstants.STORY_INTELLIGENCE_TAGS + "," + DatabaseConstants.STORY_INTELLIGENCE_TITLE + ") " +
|
||||
"WHEN MAX(" + DatabaseConstants.STORY_INTELLIGENCE_AUTHORS + "," + DatabaseConstants.STORY_INTELLIGENCE_TAGS + "," + DatabaseConstants.STORY_INTELLIGENCE_TITLE + ") > 0 " +
|
||||
"THEN MAX(" + DatabaseConstants.STORY_INTELLIGENCE_AUTHORS + "," + DatabaseConstants.STORY_INTELLIGENCE_TAGS + "," + DatabaseConstants.STORY_INTELLIGENCE_TITLE + ") " +
|
||||
"WHEN MIN(" + DatabaseConstants.STORY_INTELLIGENCE_AUTHORS + "," + DatabaseConstants.STORY_INTELLIGENCE_TAGS + "," + DatabaseConstants.STORY_INTELLIGENCE_TITLE + ") < 0 " +
|
||||
"THEN MIN(" + DatabaseConstants.STORY_INTELLIGENCE_AUTHORS + "," + DatabaseConstants.STORY_INTELLIGENCE_TAGS + "," + DatabaseConstants.STORY_INTELLIGENCE_TITLE + ") " +
|
||||
"ELSE " + DatabaseConstants.STORY_INTELLIGENCE_FEED + " " +
|
||||
"END AS " + DatabaseConstants.SUM_STORY_TOTAL;
|
||||
|
||||
|
|
|
@ -277,8 +277,7 @@ public class FeedProvider extends ContentProvider {
|
|||
// Query for total feed counts
|
||||
case FEED_COUNT:
|
||||
String sumQuery = "SELECT SUM(" + DatabaseConstants.FEED_POSITIVE_COUNT + ") AS " + DatabaseConstants.SUM_POS + ", " +
|
||||
"SUM(" + DatabaseConstants.FEED_NEUTRAL_COUNT + ") AS " + DatabaseConstants.SUM_NEUT + ", " +
|
||||
"SUM(" + DatabaseConstants.FEED_NEGATIVE_COUNT + ") AS " + DatabaseConstants.SUM_NEG + " FROM " + DatabaseConstants.FEED_TABLE;
|
||||
"SUM(" + DatabaseConstants.FEED_NEUTRAL_COUNT + ") AS " + DatabaseConstants.SUM_NEUT + " FROM " + DatabaseConstants.FEED_TABLE;
|
||||
return db.rawQuery(sumQuery, selectionArgs);
|
||||
|
||||
case SOCIALFEED_COUNT:
|
||||
|
@ -377,9 +376,9 @@ public class FeedProvider extends ContentProvider {
|
|||
// Querying for all folders with unread items
|
||||
case ALL_FOLDERS:
|
||||
String folderQuery = "SELECT " + TextUtils.join(",", DatabaseConstants.FOLDER_COLUMNS) + " FROM " + DatabaseConstants.FEED_FOLDER_MAP_TABLE +
|
||||
" LEFT JOIN " + DatabaseConstants.FOLDER_TABLE +
|
||||
" INNER JOIN " + DatabaseConstants.FOLDER_TABLE +
|
||||
" ON " + DatabaseConstants.FEED_FOLDER_MAP_TABLE + "." + DatabaseConstants.FEED_FOLDER_FOLDER_NAME + " = " + DatabaseConstants.FOLDER_TABLE + "." + DatabaseConstants.FOLDER_NAME +
|
||||
" LEFT JOIN " + DatabaseConstants.FEED_TABLE +
|
||||
" INNER JOIN " + DatabaseConstants.FEED_TABLE +
|
||||
" ON " + DatabaseConstants.FEED_TABLE + "." + DatabaseConstants.FEED_ID + " = " + DatabaseConstants.FEED_FOLDER_MAP_TABLE + "." + DatabaseConstants.FEED_FOLDER_FEED_ID +
|
||||
" GROUP BY " + DatabaseConstants.FOLDER_TABLE + "." + DatabaseConstants.FOLDER_NAME;
|
||||
|
||||
|
|
|
@ -11,8 +11,6 @@ import android.net.Uri;
|
|||
import android.os.Handler;
|
||||
import android.support.v4.widget.SimpleCursorAdapter.ViewBinder;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Config;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -276,7 +274,7 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
Cursor cursor = null;
|
||||
View v;
|
||||
if (groupPosition == 0) {
|
||||
cursor = allStoriesCountCursor;
|
||||
cursor = sharedStoriesCountCursor;
|
||||
v = inflater.inflate(R.layout.row_all_shared_stories, null, false);
|
||||
sharedStoriesCountCursor.moveToFirst();
|
||||
((TextView) v.findViewById(R.id.row_everythingtext)).setOnClickListener(new OnClickListener() {
|
||||
|
@ -288,7 +286,7 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
}
|
||||
});
|
||||
String neutCount = sharedStoriesCountCursor.getString(sharedStoriesCountCursor.getColumnIndex(DatabaseConstants.SUM_NEUT));
|
||||
if (TextUtils.isEmpty(neutCount) || TextUtils.equals(neutCount, "0")) {
|
||||
if (currentState == AppConstants.STATE_BEST || TextUtils.isEmpty(neutCount) || TextUtils.equals(neutCount, "0")) {
|
||||
v.findViewById(R.id.row_foldersumneu).setVisibility(View.GONE);
|
||||
} else {
|
||||
v.findViewById(R.id.row_foldersumneu).setVisibility(View.VISIBLE);
|
||||
|
@ -309,8 +307,17 @@ public class MixedExpandableListAdapter extends BaseExpandableListAdapter{
|
|||
cursor = allStoriesCountCursor;
|
||||
v = inflater.inflate(R.layout.row_all_stories, null, false);
|
||||
allStoriesCountCursor.moveToFirst();
|
||||
((TextView) v.findViewById(R.id.row_foldersumneu)).setText(allStoriesCountCursor.getString(allStoriesCountCursor.getColumnIndex(DatabaseConstants.SUM_NEUT)));
|
||||
((TextView) v.findViewById(R.id.row_foldersumpos)).setText(allStoriesCountCursor.getString(allStoriesCountCursor.getColumnIndex(DatabaseConstants.SUM_POS)));
|
||||
switch (currentState) {
|
||||
case AppConstants.STATE_BEST:
|
||||
v.findViewById(R.id.row_foldersumneu).setVisibility(View.INVISIBLE);
|
||||
((TextView) v.findViewById(R.id.row_foldersumpos)).setText(allStoriesCountCursor.getString(allStoriesCountCursor.getColumnIndex(DatabaseConstants.SUM_POS)));
|
||||
break;
|
||||
default:
|
||||
((TextView) v.findViewById(R.id.row_foldersumneu)).setText(allStoriesCountCursor.getString(allStoriesCountCursor.getColumnIndex(DatabaseConstants.SUM_NEUT)));
|
||||
((TextView) v.findViewById(R.id.row_foldersumpos)).setText(allStoriesCountCursor.getString(allStoriesCountCursor.getColumnIndex(DatabaseConstants.SUM_POS)));
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
cursor = folderCursorHelper.moveTo(groupPosition - 2);
|
||||
if (convertView == null) {
|
||||
|
|
|
@ -233,7 +233,7 @@ public class ReadingItemFragment extends Fragment implements ClassifierDialogFra
|
|||
|
||||
private void setupWebview(NewsblurWebview web) {
|
||||
final SharedPreferences preferences = getActivity().getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||
float currentSize = preferences.getFloat(PrefConstants.PREFERENCE_TEXT_SIZE, 1.0f);
|
||||
float currentSize = preferences.getFloat(PrefConstants.PREFERENCE_TEXT_SIZE, 0.5f);
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("<html><head><meta name=\"viewport\" content=\"width=device-width; initial-scale=0.75; maximum-scale=0.75; minimum-scale=0.75; user-scalable=0;\" />");
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.newsblur.network;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
|
@ -145,7 +146,12 @@ public class APIClient {
|
|||
|
||||
builder.append((String) entry.getKey());
|
||||
builder.append("=");
|
||||
builder.append((String) entry.getValue());
|
||||
try {
|
||||
builder.append(URLEncoder.encode((String) entry.getValue(), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.e(TAG, e.getLocalizedMessage());
|
||||
return new APIResponse();
|
||||
}
|
||||
parameters.add(builder.toString());
|
||||
}
|
||||
final String parameterString = TextUtils.join("&", parameters);
|
||||
|
|
|
@ -22,7 +22,6 @@ import android.webkit.CookieSyncManager;
|
|||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.newsblur.R;
|
||||
import com.newsblur.database.DatabaseConstants;
|
||||
import com.newsblur.database.FeedProvider;
|
||||
import com.newsblur.domain.Classifier;
|
||||
|
@ -462,8 +461,7 @@ public class APIManager {
|
|||
contentResolver.insert(FeedProvider.SOCIAL_FEEDS_URI, feed.getValues());
|
||||
}
|
||||
|
||||
String unsortedFolderName = context.getResources().getString(R.string.unsorted_folder_name);
|
||||
|
||||
|
||||
Cursor folderCursor = contentResolver.query(FeedProvider.FOLDERS_URI, null, null, null, null);
|
||||
folderCursor.moveToFirst();
|
||||
HashSet<String> existingFolders = new HashSet<String>();
|
||||
|
@ -474,20 +472,22 @@ public class APIManager {
|
|||
folderCursor.close();
|
||||
|
||||
for (final Entry<String, List<Long>> entry : feedUpdate.folders.entrySet()) {
|
||||
String folderName = TextUtils.isEmpty(entry.getKey()) ? unsortedFolderName : entry.getKey();
|
||||
|
||||
if (!existingFolders.contains(folderName)) {
|
||||
final ContentValues folderValues = new ContentValues();
|
||||
folderValues.put(DatabaseConstants.FOLDER_NAME, folderName);
|
||||
contentResolver.insert(FeedProvider.FOLDERS_URI, folderValues);
|
||||
}
|
||||
|
||||
for (Long feedId : entry.getValue()) {
|
||||
if (!existingFeeds.containsKey(Long.toString(feedId))) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(DatabaseConstants.FEED_FOLDER_FEED_ID, feedId);
|
||||
values.put(DatabaseConstants.FEED_FOLDER_FOLDER_NAME, folderName);
|
||||
contentResolver.insert(FeedProvider.FEED_FOLDER_MAP_URI, values);
|
||||
if (!TextUtils.isEmpty(entry.getKey())) {
|
||||
String folderName = entry.getKey().trim();
|
||||
if (!existingFolders.contains(folderName) && !TextUtils.isEmpty(folderName)) {
|
||||
final ContentValues folderValues = new ContentValues();
|
||||
folderValues.put(DatabaseConstants.FOLDER_NAME, folderName);
|
||||
Log.d("Folder", "Inserting folder: " + folderName);
|
||||
contentResolver.insert(FeedProvider.FOLDERS_URI, folderValues);
|
||||
}
|
||||
|
||||
for (Long feedId : entry.getValue()) {
|
||||
if (!existingFeeds.containsKey(Long.toString(feedId))) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(DatabaseConstants.FEED_FOLDER_FEED_ID, feedId);
|
||||
values.put(DatabaseConstants.FEED_FOLDER_FOLDER_NAME, folderName);
|
||||
contentResolver.insert(FeedProvider.FEED_FOLDER_MAP_URI, values);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,8 @@ package com.newsblur.util;
|
|||
import static android.graphics.Bitmap.Config.ARGB_8888;
|
||||
import static android.graphics.Color.WHITE;
|
||||
import static android.graphics.PorterDuff.Mode.DST_IN;
|
||||
|
||||
import com.newsblur.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package com.newsblur.view;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.support.v4.widget.SimpleCursorAdapter.ViewBinder;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -14,6 +18,7 @@ import com.newsblur.domain.Story;
|
|||
|
||||
public class FeedItemViewBinder implements ViewBinder {
|
||||
|
||||
private static final String TAG = "FeedItemViewBinder";
|
||||
private final Context context;
|
||||
private int darkGray;
|
||||
private int lightGray;
|
||||
|
@ -62,7 +67,12 @@ public class FeedItemViewBinder implements ViewBinder {
|
|||
((TextView) view).setText("");
|
||||
return true;
|
||||
} else if (TextUtils.equals(columnName, DatabaseConstants.STORY_TITLE)) {
|
||||
((TextView) view).setText(Html.fromHtml(cursor.getString(columnIndex)));
|
||||
try {
|
||||
((TextView) view).setText(Html.fromHtml(URLDecoder.decode(cursor.getString(columnIndex), "UTF-8")));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
((TextView) view).setText(Html.fromHtml(cursor.getString(columnIndex)));
|
||||
Log.e(TAG, "Error decoding from title string");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
|
||||
|
@ -53,6 +54,7 @@ public class NewsblurWebview extends WebView {
|
|||
}
|
||||
|
||||
public void setTextSize(float textSize) {
|
||||
Log.d("Reading", "Setting textsize to " + (AppConstants.FONT_SIZE_LOWER_BOUND + textSize));
|
||||
loadUrl("javascript:document.body.style.fontSize='" + (AppConstants.FONT_SIZE_LOWER_BOUND + textSize) + "em';");
|
||||
}
|
||||
|
||||
|
|
|
@ -1825,8 +1825,8 @@ background: transparent;
|
|||
}
|
||||
#story_pane .NB-feed-stories .NB-feed-story .NB-feed-story-content img {
|
||||
max-width: 100% !important;
|
||||
width: auto !important;
|
||||
height: auto !important;
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
#story_pane .NB-feed-story {
|
||||
position: relative;
|
||||
|
@ -2216,6 +2216,13 @@ background: transparent;
|
|||
float: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
#story_pane .NB-story-comment .NB-story-comment-reply-button img {
|
||||
padding-right: 6px;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
vertical-align: bottom;
|
||||
float: left;
|
||||
}
|
||||
#story_pane .NB-story-comment .NB-story-comment-reply-button .NB-story-comment-reply-button-wrapper {
|
||||
text-transform: uppercase;
|
||||
background-color: #E9AF86;
|
||||
|
@ -2231,6 +2238,12 @@ background: transparent;
|
|||
#story_pane .NB-story-comment .NB-story-comment-reply-button:active .NB-story-comment-reply-button-wrapper {
|
||||
background-color: #9F3A00;
|
||||
}
|
||||
#story_pane .NB-story-comment .NB-story-comment-error {
|
||||
float: left;
|
||||
font-size: 10px;
|
||||
color: #6A1000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#story_pane .NB-story-comment-reply {
|
||||
border-top: 1px solid #E0E0E0;
|
||||
|
@ -2426,6 +2439,7 @@ background: transparent;
|
|||
#story_pane .NB-story-comments-label {
|
||||
float: left;
|
||||
margin-right: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#story_pane .NB-story-comments-label b {
|
||||
font-size: 12px;
|
||||
|
@ -2445,10 +2459,10 @@ background: transparent;
|
|||
vertical-align: middle;
|
||||
height: 22px;
|
||||
width: 22px;
|
||||
margin: 0 4px 0 0;
|
||||
padding: 0 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#story_pane .NB-story-share-profile .NB-user-avatar img {
|
||||
#story_pane .NB-story-share-profile .NB-user-avatar img.NB-user-avatar-image {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 3px;
|
||||
|
@ -2487,6 +2501,20 @@ background: transparent;
|
|||
display: none;
|
||||
}
|
||||
|
||||
/* =============== */
|
||||
/* = User Avatar = */
|
||||
/* =============== */
|
||||
|
||||
.NB-user-avatar {
|
||||
position: relative;
|
||||
}
|
||||
.NB-user-avatar .NB-user-avatar-private {
|
||||
position: absolute;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
bottom: -2px;
|
||||
left: -1px;
|
||||
}
|
||||
/* ============================= */
|
||||
/* = Side Options in Feed view = */
|
||||
/* ============================= */
|
||||
|
@ -4614,57 +4642,12 @@ form.opml_import_form input {
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
/* ================= */
|
||||
/* = Mobile Module = */
|
||||
/* ================= */
|
||||
/* =================== */
|
||||
/* = Getting started = */
|
||||
/* =================== */
|
||||
|
||||
.NB-module-mobile .NB-module-item {
|
||||
min-height: 60px;
|
||||
}
|
||||
|
||||
.NB-module-mobile .NB-module-mobile-image {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.NB-module-mobile .NB-module-mobile-image img {
|
||||
width: 100px;
|
||||
height: 50px;
|
||||
overflow: hidden;
|
||||
margin: 0 8px 2px 12px;
|
||||
}
|
||||
|
||||
.NB-module-mobile .NB-module-content-header {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.NB-module-mobile .NB-module-mobile-title {
|
||||
float: left;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
.NB-module-mobile .NB-module-mobile-device {
|
||||
background-color: #2F4372;
|
||||
color: #F0F0F0;
|
||||
font-weight: bold;
|
||||
font-size: 8px;
|
||||
line-height: 8px;
|
||||
margin-top: 2px;
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
float: left;
|
||||
text-shadow: 1px 1px 0 #303030;
|
||||
}
|
||||
|
||||
.NB-module-mobile .NB-module-item-title {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.NB-module-mobile .NB-module-mobile-freeforpremium {
|
||||
font-size: 12px;
|
||||
color: #3D3D3D;
|
||||
font-weight: bold;
|
||||
.NB-account .NB-module-gettingstarted {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
/* ================ */
|
||||
|
@ -6935,7 +6918,7 @@ form.opml_import_form input {
|
|||
background: transparent url('/media/embed/icons/silk/images.png') no-repeat 0 0;
|
||||
}
|
||||
.NB-modal-feedchooser .NB-feedchooser-premium-bullets li.NB-4 .NB-feedchooser-premium-bullet-image {
|
||||
background: transparent url('/media/embed/icons/silk/magnifier.png') no-repeat 0 0;
|
||||
background: transparent url('/media/embed/icons/silk/lock.png') no-repeat 0 0;
|
||||
}
|
||||
.NB-modal-feedchooser .NB-feedchooser-premium-bullets li.NB-5 .NB-feedchooser-premium-bullet-image {
|
||||
background: transparent url('/media/embed/icons/silk/lorry.png') no-repeat 0 0;
|
||||
|
@ -7887,6 +7870,19 @@ form.opml_import_form input {
|
|||
border: 2px solid #39518B;
|
||||
}
|
||||
|
||||
.NB-static-android .NB-ios-features .NB-ios-feature {
|
||||
width: 138px;
|
||||
}
|
||||
.NB-static-android .NB-ios-features .NB-ios-feature img.NB-ios-ipad-screenshot {
|
||||
width: 100px;
|
||||
height: 160px;
|
||||
}
|
||||
.NB-static-android .NB-ios-features .NB-ios-feature img.NB-ios-iphone-screenshot {
|
||||
width: 60px;
|
||||
height: 106px;
|
||||
top: 68px;
|
||||
}
|
||||
|
||||
/* ========== */
|
||||
/* = Mockup = */
|
||||
/* ========== */
|
||||
|
@ -7993,6 +7989,53 @@ form.opml_import_form input {
|
|||
}
|
||||
}
|
||||
|
||||
.NB-static-android .NB-ios-mockup .NB-ios-ipad-skeleton {
|
||||
height: 729px;
|
||||
}
|
||||
.NB-static-android .NB-ios-mockup .NB-ios-iphone-skeleton {
|
||||
width: 270px;
|
||||
height: 469px;
|
||||
}
|
||||
.NB-static-android .NB-ios-mockup .NB-ios-features-ipad {
|
||||
top: 42px;
|
||||
left: 147px;
|
||||
width: 302px;
|
||||
height: 442px;
|
||||
}
|
||||
.NB-static-android .NB-ios-mockup .NB-ios-features-iphone {
|
||||
top: 279px;
|
||||
left: 50px;
|
||||
width: 172px;
|
||||
height: 268px;
|
||||
}
|
||||
.NB-static-android .NB-ios-mockup .NB-ios-feature img.NB-ios-ipad-screenshot {
|
||||
width: 302px;
|
||||
height: 484px;
|
||||
top: -13px;
|
||||
left: 0;
|
||||
border-left: none;
|
||||
border-top: none;
|
||||
border-bottom: none;
|
||||
border-right: 1px solid #505050;
|
||||
}
|
||||
.NB-static-android .NB-ios-mockup .NB-ios-feature img.NB-ios-iphone-screenshot {
|
||||
width: 172px;
|
||||
height: 300px;
|
||||
top: -10px;
|
||||
left: 0;
|
||||
border-left: none;
|
||||
border-top: none;
|
||||
border-bottom: none;
|
||||
border-right: 1px solid #505050;
|
||||
}
|
||||
@media screen and (max-width: 1100px) {
|
||||
.NB-static-android .NB-ios-mockup .NB-ios-features-ipad {
|
||||
left: 214px;
|
||||
}
|
||||
.NB-static-android .NB-ios-mockup .NB-ios-features-iphone {
|
||||
left: -13px;
|
||||
}
|
||||
}
|
||||
/* ================= */
|
||||
/* = Friends Modal = */
|
||||
/* ================= */
|
||||
|
@ -8261,11 +8304,26 @@ form.opml_import_form input {
|
|||
cursor: pointer;
|
||||
}
|
||||
.NB-modal-profile-editor .NB-friends-profile .NB-profile-username,
|
||||
.NB-modal-profile-editor input[type=text] {
|
||||
.NB-modal-profile-editor input[type=text],
|
||||
.NB-modal-profile-editor .NB-profile-privacy-option input[type=radio] {
|
||||
float: left;
|
||||
width: 200px;
|
||||
margin: 12px 8px 0 0;
|
||||
}
|
||||
.NB-modal-profile-editor .NB-profile-privacy-option input[type=radio] {
|
||||
width: auto;
|
||||
margin: 18px 0 0;
|
||||
}
|
||||
.NB-modal-profile-editor .NB-profile-privacy-options {
|
||||
float: left;
|
||||
}
|
||||
.NB-modal-profile-editor .NB-profile-privacy-option {
|
||||
float: left;
|
||||
clear: left;
|
||||
}
|
||||
.NB-modal-profile-editor .NB-profile-privacy-option b {
|
||||
padding: 0 6px 0 0;
|
||||
}
|
||||
.NB-modal-profile-editor .NB-friends-profile .NB-count {
|
||||
float: left;
|
||||
color: #404040;
|
||||
|
@ -8282,8 +8340,24 @@ form.opml_import_form input {
|
|||
.NB-modal-profile-editor .NB-friends-profile label {
|
||||
clear: both;
|
||||
float: left;
|
||||
width: 100px;
|
||||
width: 140px;
|
||||
padding: 12px 8px 0 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.NB-modal-profile-editor .NB-friends-profile .NB-profile-privacy-notpremium {
|
||||
font-size: 10px;
|
||||
margin: 12px 0;
|
||||
color: #808080;
|
||||
}
|
||||
.NB-modal-profile-editor .NB-friends-profile label img {
|
||||
padding-right: 6px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
.NB-modal-profile-editor .NB-friends-profile .NB-profile-protected-label {
|
||||
clear: none;
|
||||
width: auto;
|
||||
font-size: 13px;
|
||||
padding: 16px 0 0 8px;
|
||||
}
|
||||
.NB-modal-profile-editor .NB-account-link {
|
||||
margin-left: 12px;
|
||||
|
@ -8371,7 +8445,7 @@ form.opml_import_form input {
|
|||
width: 100%;
|
||||
}
|
||||
.NB-profile-badge td {
|
||||
vertical-align: middle;
|
||||
vertical-align: top;
|
||||
}
|
||||
.NB-profile-badge td.NB-profile-badge-info {
|
||||
width: 100%;
|
||||
|
@ -8468,7 +8542,8 @@ form.opml_import_form input {
|
|||
clear: right;
|
||||
float: right;
|
||||
}
|
||||
.NB-profile-badge-actions .NB-profile-badge-action-preview {
|
||||
.NB-profile-badge-actions .NB-profile-badge-action-preview,
|
||||
.NB-profile-badge-actions .NB-profile-badge-action-ignore {
|
||||
color: #404040;
|
||||
line-height: 1;
|
||||
font-size: 11px;
|
||||
|
@ -8483,6 +8558,10 @@ form.opml_import_form input {
|
|||
.NB-profile-badge-actions .NB-profile-badge-action-preview.NB-disabled:hover {
|
||||
background: white;
|
||||
}
|
||||
.NB-profile-badge-actions .NB-profile-badge-action-protected-follow img {
|
||||
vertical-align: top;
|
||||
margin-right: 6px;
|
||||
}
|
||||
.NB-profile-badge-actions .NB-profile-badge-action-edit {
|
||||
color: #404040;
|
||||
line-height: 1;
|
||||
|
@ -8610,10 +8689,9 @@ form.opml_import_form input {
|
|||
.NB-interaction:hover:not(.NB-disabled) {
|
||||
background-color: #F3F6FD;
|
||||
background-image: -moz-linear-gradient(top, #F5F7FB, #EBF1FE); /* FF3.6 */
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#F5F7FB), to(#EBF1FE)); /* Saf4+, Chrome */
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#F9FAFE), to(#F2F6FE)); /* Saf4+, Chrome */
|
||||
background-image: linear-gradient(top, #F5F7FB, #EBF1FE);
|
||||
border: 1px solid #C3CFE2;
|
||||
border-bottom: 1px solid #B9C5DC;
|
||||
border: 1px solid #DFE9FE;
|
||||
}
|
||||
.NB-interaction:active:not(.NB-disabled) {
|
||||
background-color: #FBE5C7;
|
||||
|
|
|
@ -686,6 +686,52 @@ header {
|
|||
.NB-story-comment .NB-story-comment-reply-button:active .NB-story-comment-reply-button-wrapper {
|
||||
background-color: #9F3A00;
|
||||
}
|
||||
.NB-story-comment .NB-story-comment-reply-button img {
|
||||
padding-right: 6px;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
vertical-align: bottom;
|
||||
float: left;
|
||||
}
|
||||
.NB-story-comment .NB-story-comment-likes {
|
||||
overflow: hidden;
|
||||
height: 14px;
|
||||
margin: 3px 2px 0;
|
||||
}
|
||||
.NB-story-comment .NB-story-comment-like {
|
||||
float: left;
|
||||
width: 16px;
|
||||
background: transparent url('/media/embed/reader/star_grey.png') no-repeat center 0;
|
||||
text-transform: uppercase;
|
||||
padding: 1px 6px 1px 2px;
|
||||
height: 11px;
|
||||
}
|
||||
.NB-story-comment .NB-story-comment-like:hover,
|
||||
.NB-story-comment .NB-story-comment-like.NB-active {
|
||||
cursor: pointer;
|
||||
background: transparent url('/media/embed/reader/star_green.png') no-repeat center 0;
|
||||
}
|
||||
.NB-story-comment .NB-story-comment-like:active {
|
||||
cursor: pointer;
|
||||
}
|
||||
.NB-story-comment .NB-story-comment-likes-users {
|
||||
display: inline-block;
|
||||
}
|
||||
.NB-story-comment .NB-story-comment-likes-users .NB-story-share-profile .NB-user-avatar {
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
.NB-story-comment .NB-story-comment-likes-users .NB-story-share-profile .NB-user-avatar img {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
.NB-story-comment .NB-story-comment-error {
|
||||
float: left;
|
||||
font-size: 10px;
|
||||
color: #6A1000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
.NB-story-comment-reply {
|
||||
border-top: 1px solid #E0E0E0;
|
||||
|
|
BIN
media/img/android/Default large.png
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
media/img/android/Default.png
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
media/img/android/Galaxy Nexus Skeleton.png
Normal file
After Width: | Height: | Size: 109 KiB |
BIN
media/img/android/Nexus 7 Skeleton.png
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
media/img/android/v1 - 1 large.png
Normal file
After Width: | Height: | Size: 138 KiB |
BIN
media/img/android/v1 - 1.png
Normal file
After Width: | Height: | Size: 149 KiB |
BIN
media/img/android/v1 - 2 large.png
Normal file
After Width: | Height: | Size: 121 KiB |
BIN
media/img/android/v1 - 2.png
Normal file
After Width: | Height: | Size: 102 KiB |
BIN
media/img/android/v1 - 3 large.png
Normal file
After Width: | Height: | Size: 661 KiB |
BIN
media/img/android/v1 - 3.png
Normal file
After Width: | Height: | Size: 465 KiB |
BIN
media/img/android/v1 - 4 large.png
Normal file
After Width: | Height: | Size: 408 KiB |
BIN
media/img/android/v1 - 4.png
Normal file
After Width: | Height: | Size: 587 KiB |
BIN
media/img/android/v1 - 5 large.png
Normal file
After Width: | Height: | Size: 151 KiB |
BIN
media/img/android/v1 - 5.png
Normal file
After Width: | Height: | Size: 179 KiB |
BIN
media/img/chrome/promo_banner.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
media/img/chrome/promo_banner_large.png
Normal file
After Width: | Height: | Size: 111 KiB |
BIN
media/img/facebook/cover.png
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
media/img/facebook/promo_banner_136.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
media/img/facebook/promo_banner_155.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
media/img/facebook/promo_banner_204.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
media/img/facebook/promo_banner_272.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
media/img/iphone/iphone_logo_1024.png
Normal file
After Width: | Height: | Size: 111 KiB |
BIN
media/img/iphone/v1.6 - iPhone 1 (tall).png
Normal file
After Width: | Height: | Size: 153 KiB |
BIN
media/img/iphone/v1.6 - iPhone 2 (tall).png
Normal file
After Width: | Height: | Size: 120 KiB |
BIN
media/img/iphone/v1.6 - iPhone 3 (tall).png
Normal file
After Width: | Height: | Size: 633 KiB |
BIN
media/img/iphone/v1.6 - iPhone 4 (tall).png
Normal file
After Width: | Height: | Size: 497 KiB |
BIN
media/img/iphone/v1.6 - iPhone 5 (tall).png
Normal file
After Width: | Height: | Size: 225 KiB |
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 513 KiB |
BIN
media/img/reader/iphone-stripe-bkg.png
Normal file
After Width: | Height: | Size: 283 B |
BIN
media/img/welcome/04-eye@2x.png
Normal file
After Width: | Height: | Size: 602 B |
BIN
media/img/welcome/09-lightning@2x.png
Normal file
After Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 2 MiB After Width: | Height: | Size: 3.1 MiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 60 KiB |
|
@ -16,5 +16,6 @@
|
|||
- (void) cancelRequests;
|
||||
|
||||
- (void)informError:(id)error;
|
||||
- (void)informMessage:(NSString *)message;
|
||||
|
||||
@end
|
||||
|
|
|
@ -82,6 +82,14 @@
|
|||
// [alertView release];
|
||||
}
|
||||
|
||||
- (void)informMessage:(NSString *)message {
|
||||
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
||||
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
||||
HUD.mode = MBProgressHUDModeText;
|
||||
HUD.labelText = message;
|
||||
[HUD hide:YES afterDelay:.75];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark UIViewController
|
||||
|
||||
|
|
|
@ -19,7 +19,15 @@ UITableViewDataSource> {
|
|||
@property (nonatomic, strong) NSArray *menuOptions;
|
||||
@property (nonatomic) IBOutlet NewsBlurAppDelegate *appDelegate;
|
||||
@property (nonatomic) IBOutlet UITableView *menuTableView;
|
||||
@property (nonatomic) IBOutlet UISegmentedControl *orderSegmentedControl;
|
||||
@property (nonatomic) IBOutlet UISegmentedControl *readFilterSegmentedControl;
|
||||
|
||||
|
||||
- (void)buildMenuOptions;
|
||||
- (UITableViewCell *)makeOrderCell;
|
||||
- (UITableViewCell *)makeReadFilterCell;
|
||||
- (IBAction)changeOrder:(id)sender;
|
||||
- (IBAction)changeReadFilter:(id)sender;
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
@ -11,12 +11,17 @@
|
|||
#import "MBProgressHUD.h"
|
||||
#import "NBContainerViewController.h"
|
||||
#import "FeedDetailViewController.h"
|
||||
#import "MenuTableViewCell.h"
|
||||
|
||||
@implementation FeedDetailMenuViewController
|
||||
|
||||
#define kMenuOptionHeight 38
|
||||
|
||||
@synthesize appDelegate;
|
||||
@synthesize menuOptions;
|
||||
@synthesize menuTableView;
|
||||
@synthesize orderSegmentedControl;
|
||||
@synthesize readFilterSegmentedControl;
|
||||
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
||||
{
|
||||
|
@ -45,7 +50,22 @@
|
|||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[self.menuTableView reloadData];
|
||||
|
||||
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
||||
NSString *orderKey = [appDelegate orderKey];
|
||||
NSString *readFilterKey = [appDelegate readFilterKey];
|
||||
|
||||
[orderSegmentedControl setSelectedSegmentIndex:0];
|
||||
if ([[userPreferences stringForKey:orderKey] isEqualToString:@"oldest"]) {
|
||||
[orderSegmentedControl setSelectedSegmentIndex:1];
|
||||
}
|
||||
|
||||
[readFilterSegmentedControl setSelectedSegmentIndex:0];
|
||||
if ([[userPreferences stringForKey:readFilterKey] isEqualToString:@"unread"]) {
|
||||
[readFilterSegmentedControl setSelectedSegmentIndex:1];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
return YES;
|
||||
}
|
||||
|
@ -86,37 +106,34 @@
|
|||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
[self buildMenuOptions];
|
||||
int filterOptions = 2;
|
||||
if (appDelegate.isRiverView || appDelegate.isSocialRiverView || appDelegate.isSocialView) {
|
||||
filterOptions = 1;
|
||||
}
|
||||
|
||||
return [self.menuOptions count];
|
||||
return [self.menuOptions count] + filterOptions;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
static NSString *CellIndentifier = @"Cell";
|
||||
|
||||
if (indexPath.row == [self.menuOptions count]) {
|
||||
return [self makeOrderCell];
|
||||
} else if (indexPath.row == [self.menuOptions count] + 1) {
|
||||
return [self makeReadFilterCell];
|
||||
}
|
||||
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIndentifier];
|
||||
|
||||
if (cell == nil) {
|
||||
cell = [[UITableViewCell alloc]
|
||||
cell = [[MenuTableViewCell alloc]
|
||||
initWithStyle:UITableViewCellStyleDefault
|
||||
reuseIdentifier:CellIndentifier];
|
||||
}
|
||||
|
||||
cell.textLabel.text = [self.menuOptions objectAtIndex:[indexPath row]];
|
||||
cell.contentView.backgroundColor = UIColorFromRGB(0xBAE3A8);
|
||||
cell.textLabel.backgroundColor = UIColorFromRGB(0xBAE3A8);
|
||||
cell.textLabel.textColor = UIColorFromRGB(0x303030);
|
||||
cell.textLabel.shadowColor = UIColorFromRGB(0xF0FFF0);
|
||||
cell.textLabel.shadowOffset = CGSizeMake(0, 1);
|
||||
cell.textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:14.0];
|
||||
|
||||
if (cell.selected) {
|
||||
cell.contentView.backgroundColor = UIColorFromRGB(0x639510);
|
||||
cell.textLabel.backgroundColor = UIColorFromRGB(0x639510);
|
||||
cell.selectedBackgroundView.backgroundColor = UIColorFromRGB(0x639510);
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
}
|
||||
|
||||
|
||||
if (indexPath.row == 0) {
|
||||
cell.imageView.image = [UIImage imageNamed:@"bin_closed"];
|
||||
} else if (indexPath.row == 1) {
|
||||
|
@ -129,7 +146,15 @@
|
|||
}
|
||||
|
||||
- (float)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return 38;
|
||||
return kMenuOptionHeight;
|
||||
}
|
||||
|
||||
|
||||
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (indexPath.row >= [menuOptions count]) {
|
||||
return nil;
|
||||
}
|
||||
return indexPath;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
|
@ -152,4 +177,71 @@
|
|||
|
||||
}
|
||||
|
||||
- (UITableViewCell *)makeOrderCell {
|
||||
UITableViewCell *cell = [[UITableViewCell alloc] init];
|
||||
cell.frame = CGRectMake(0, 0, 240, kMenuOptionHeight);
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
UIFont *font = [UIFont boldSystemFontOfSize:11.0f];
|
||||
NSDictionary *attributes = [NSDictionary dictionaryWithObject:font forKey:UITextAttributeFont];
|
||||
|
||||
orderSegmentedControl.frame = CGRectMake(8, 7, cell.frame.size.width - 8*2,
|
||||
kMenuOptionHeight - 7*2);
|
||||
[orderSegmentedControl setTitle:[@"Newest first" uppercaseString] forSegmentAtIndex:0];
|
||||
[orderSegmentedControl setTitle:[@"Oldest" uppercaseString] forSegmentAtIndex:1];
|
||||
[orderSegmentedControl setTitleTextAttributes:attributes forState:UIControlStateNormal];
|
||||
[orderSegmentedControl setTintColor:UIColorFromRGB(0x738570)];
|
||||
|
||||
[cell addSubview:orderSegmentedControl];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)makeReadFilterCell {
|
||||
UITableViewCell *cell = [[UITableViewCell alloc] init];
|
||||
cell.frame = CGRectMake(0, 0, 240, kMenuOptionHeight);
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
UIFont *font = [UIFont boldSystemFontOfSize:11.0f];
|
||||
NSDictionary *attributes = [NSDictionary dictionaryWithObject:font forKey:UITextAttributeFont];
|
||||
|
||||
readFilterSegmentedControl.frame = CGRectMake(8, 7, cell.frame.size.width - 8*2,
|
||||
kMenuOptionHeight - 7*2);
|
||||
[readFilterSegmentedControl setTitle:[@"All stories" uppercaseString] forSegmentAtIndex:0];
|
||||
[readFilterSegmentedControl setTitle:[@"Unread only" uppercaseString] forSegmentAtIndex:1];
|
||||
[readFilterSegmentedControl setTitleTextAttributes:attributes forState:UIControlStateNormal];
|
||||
[readFilterSegmentedControl setTintColor:UIColorFromRGB(0x738570)];
|
||||
|
||||
[cell addSubview:readFilterSegmentedControl];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (IBAction)changeOrder:(id)sender {
|
||||
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if ([sender selectedSegmentIndex] == 0) {
|
||||
[userPreferences setObject:@"newest" forKey:[appDelegate orderKey]];
|
||||
} else {
|
||||
[userPreferences setObject:@"oldest" forKey:[appDelegate orderKey]];
|
||||
}
|
||||
|
||||
[userPreferences synchronize];
|
||||
|
||||
[appDelegate.feedDetailViewController reloadPage];
|
||||
}
|
||||
|
||||
- (IBAction)changeReadFilter:(id)sender {
|
||||
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if ([sender selectedSegmentIndex] == 0) {
|
||||
[userPreferences setObject:@"all" forKey:[appDelegate readFilterKey]];
|
||||
} else {
|
||||
[userPreferences setObject:@"unread" forKey:[appDelegate readFilterKey]];
|
||||
}
|
||||
|
||||
[userPreferences synchronize];
|
||||
|
||||
[appDelegate.feedDetailViewController reloadPage];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -69,7 +69,7 @@ static UIFont *indicatorFont = nil;
|
|||
// set site title
|
||||
UIColor *textColor;
|
||||
UIFont *font;
|
||||
|
||||
|
||||
if (self.isRead) {
|
||||
font = [UIFont fontWithName:@"Helvetica" size:11];
|
||||
textColor = UIColorFromRGB(0xc0c0c0);
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
@property (nonatomic, readwrite) BOOL pageFinished;
|
||||
|
||||
- (void)resetFeedDetail;
|
||||
- (void)reloadPage;
|
||||
- (void)fetchNextPage:(void(^)())callback;
|
||||
- (void)fetchFeedDetail:(int)page withCallback:(void(^)())callback;
|
||||
- (void)fetchRiverPage:(int)page withCallback:(void(^)())callback;
|
||||
|
@ -66,6 +67,7 @@
|
|||
- (void)setUserAvatarLayout:(UIInterfaceOrientation)orientation;
|
||||
|
||||
- (void)fadeSelectedCell;
|
||||
- (void)redrawUnreadStory;
|
||||
- (IBAction)doOpenMarkReadActionSheet:(id)sender;
|
||||
- (IBAction)doOpenSettingsActionSheet:(id)sender;
|
||||
- (void)confirmDeleteSite;
|
||||
|
|
|
@ -128,7 +128,8 @@
|
|||
if ((appDelegate.isSocialRiverView ||
|
||||
appDelegate.isSocialView ||
|
||||
(appDelegate.isRiverView &&
|
||||
[appDelegate.activeFolder isEqualToString:@"everything"]))) {
|
||||
[appDelegate.activeFolder isEqualToString:@"everything"]) ||
|
||||
[appDelegate.activeFolder isEqualToString:@"saved_stories"])) {
|
||||
settingsButton.enabled = NO;
|
||||
} else {
|
||||
settingsButton.enabled = YES;
|
||||
|
@ -136,7 +137,8 @@
|
|||
|
||||
if (appDelegate.isSocialRiverView ||
|
||||
(appDelegate.isRiverView &&
|
||||
[appDelegate.activeFolder isEqualToString:@"everything"])) {
|
||||
[appDelegate.activeFolder isEqualToString:@"everything"]) ||
|
||||
[appDelegate.activeFolder isEqualToString:@"saved_stories"]) {
|
||||
feedMarkReadButton.enabled = NO;
|
||||
} else {
|
||||
feedMarkReadButton.enabled = YES;
|
||||
|
@ -206,15 +208,37 @@
|
|||
self.feedPage = 1;
|
||||
}
|
||||
|
||||
- (void)reloadPage {
|
||||
[self resetFeedDetail];
|
||||
|
||||
[appDelegate setStories:nil];
|
||||
appDelegate.storyCount = 0;
|
||||
|
||||
[self.storyTitlesTable reloadData];
|
||||
[storyTitlesTable scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];
|
||||
|
||||
|
||||
if (appDelegate.isRiverView) {
|
||||
[self fetchRiverPage:1 withCallback:nil];
|
||||
} else {
|
||||
[self fetchFeedDetail:1 withCallback:nil];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Regular and Social Feeds
|
||||
|
||||
- (void)fetchNextPage:(void(^)())callback {
|
||||
[self fetchFeedDetail:self.feedPage+1 withCallback:callback];
|
||||
if (appDelegate.isRiverView) {
|
||||
[self fetchRiverPage:self.feedPage+1 withCallback:callback];
|
||||
} else {
|
||||
[self fetchFeedDetail:self.feedPage+1 withCallback:callback];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)fetchFeedDetail:(int)page withCallback:(void(^)())callback {
|
||||
- (void)fetchFeedDetail:(int)page withCallback:(void(^)())callback {
|
||||
NSString *theFeedDetailURL;
|
||||
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if (!self.pageFetching && !self.pageFinished) {
|
||||
|
||||
|
@ -236,6 +260,18 @@
|
|||
[appDelegate.activeFeed objectForKey:@"id"],
|
||||
self.feedPage];
|
||||
}
|
||||
|
||||
if ([userPreferences stringForKey:[appDelegate orderKey]]) {
|
||||
theFeedDetailURL = [NSString stringWithFormat:@"%@&order=%@",
|
||||
theFeedDetailURL,
|
||||
[userPreferences stringForKey:[appDelegate orderKey]]];
|
||||
}
|
||||
if ([userPreferences stringForKey:[appDelegate readFilterKey]]) {
|
||||
theFeedDetailURL = [NSString stringWithFormat:@"%@&read_filter=%@",
|
||||
theFeedDetailURL,
|
||||
[userPreferences stringForKey:[appDelegate readFilterKey]]];
|
||||
}
|
||||
|
||||
[self cancelRequests];
|
||||
__weak ASIHTTPRequest *request = [self requestWithURL:theFeedDetailURL];
|
||||
[request setDelegate:self];
|
||||
|
@ -260,7 +296,9 @@
|
|||
#pragma mark -
|
||||
#pragma mark River of News
|
||||
|
||||
- (void)fetchRiverPage:(int)page withCallback:(void(^)())callback {
|
||||
- (void)fetchRiverPage:(int)page withCallback:(void(^)())callback {
|
||||
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if (!self.pageFetching && !self.pageFinished) {
|
||||
self.feedPage = page;
|
||||
self.pageFetching = YES;
|
||||
|
@ -274,7 +312,12 @@
|
|||
|
||||
if (appDelegate.isSocialRiverView) {
|
||||
theFeedDetailURL = [NSString stringWithFormat:
|
||||
@"http://%@/social/river_stories/?page=%d&order=newest",
|
||||
@"http://%@/social/river_stories/?page=%d",
|
||||
NEWSBLUR_URL,
|
||||
self.feedPage];
|
||||
} else if (appDelegate.activeFolder == @"saved_stories") {
|
||||
theFeedDetailURL = [NSString stringWithFormat:
|
||||
@"http://%@/reader/starred_stories/?page=%d",
|
||||
NEWSBLUR_URL,
|
||||
self.feedPage];
|
||||
} else {
|
||||
|
@ -285,6 +328,18 @@
|
|||
self.feedPage];
|
||||
}
|
||||
|
||||
|
||||
if ([userPreferences stringForKey:[appDelegate orderKey]]) {
|
||||
theFeedDetailURL = [NSString stringWithFormat:@"%@&order=%@",
|
||||
theFeedDetailURL,
|
||||
[userPreferences stringForKey:[appDelegate orderKey]]];
|
||||
}
|
||||
if ([userPreferences stringForKey:[appDelegate readFilterKey]]) {
|
||||
theFeedDetailURL = [NSString stringWithFormat:@"%@&read_filter=%@",
|
||||
theFeedDetailURL,
|
||||
[userPreferences stringForKey:[appDelegate readFilterKey]]];
|
||||
}
|
||||
|
||||
[self cancelRequests];
|
||||
__weak ASIHTTPRequest *request = [self requestWithURL:theFeedDetailURL];
|
||||
[request setDelegate:self];
|
||||
|
@ -430,7 +485,7 @@
|
|||
[self.storyTitlesTable reloadData];
|
||||
|
||||
} else if (newStoriesCount == 0 ||
|
||||
(self.feedPage > 15 &&
|
||||
(self.feedPage > 25 &&
|
||||
existingStoriesCount >= [appDelegate unreadCount])) {
|
||||
self.pageFinished = YES;
|
||||
[self.storyTitlesTable reloadData];
|
||||
|
@ -623,7 +678,7 @@
|
|||
|
||||
int score = [NewsBlurAppDelegate computeStoryScore:[story objectForKey:@"intelligence"]];
|
||||
cell.storyScore = score;
|
||||
|
||||
|
||||
cell.isRead = [[story objectForKey:@"read_status"] intValue] == 1;
|
||||
|
||||
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||
|
@ -650,11 +705,19 @@
|
|||
- (void)loadStory:(FeedDetailTableCell *)cell atRow:(int)row {
|
||||
cell.isRead = YES;
|
||||
[cell setNeedsLayout];
|
||||
[appDelegate setActiveStory:[[appDelegate activeFeedStories] objectAtIndex:row]];
|
||||
appDelegate.activeStory = [[appDelegate activeFeedStories] objectAtIndex:row];
|
||||
[appDelegate setOriginalStoryCount:[appDelegate unreadCount]];
|
||||
[appDelegate loadStoryDetailView];
|
||||
}
|
||||
|
||||
- (void)redrawUnreadStory {
|
||||
int rowIndex = [appDelegate locationOfActiveStory];
|
||||
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:0];
|
||||
FeedDetailTableCell *cell = (FeedDetailTableCell*) [self.storyTitlesTable cellForRowAtIndexPath:indexPath];
|
||||
cell.isRead = [[appDelegate.activeStory objectForKey:@"read_status"] boolValue];
|
||||
[cell setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void)changeActiveStoryTitleCellLayout {
|
||||
int rowIndex = [appDelegate locationOfActiveStory];
|
||||
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:0];
|
||||
|
@ -884,8 +947,8 @@
|
|||
NSArray *buttonTitles = nil;
|
||||
BOOL showVisible = YES;
|
||||
BOOL showEntire = YES;
|
||||
if ([appDelegate.activeFolder isEqualToString:@"Everything"]) showEntire = NO;
|
||||
if (visibleUnreadCount >= totalUnreadCount || visibleUnreadCount <= 0) showVisible = NO;
|
||||
if ([appDelegate.activeFolder isEqualToString:@"everything"]) showEntire = NO;
|
||||
if (visibleUnreadCount >= totalUnreadCount || visibleUnreadCount <= 0) showVisible = NO;
|
||||
NSString *entireText = [NSString stringWithFormat:@"Mark %@ read",
|
||||
appDelegate.isRiverView ?
|
||||
@"entire folder" :
|
||||
|
@ -976,7 +1039,7 @@
|
|||
if ([self.popoverController respondsToSelector:@selector(setContainerViewProperties:)]) {
|
||||
[self.popoverController setContainerViewProperties:[self improvedContainerViewProperties]];
|
||||
}
|
||||
[self.popoverController setPopoverContentSize:CGSizeMake(260, appDelegate.isRiverView ? 38 * 2 : 38 *3)];
|
||||
[self.popoverController setPopoverContentSize:CGSizeMake(260, appDelegate.isRiverView ? 38 * 3 : 38 * 5)];
|
||||
[self.popoverController presentPopoverFromBarButtonItem:self.settingsButton
|
||||
permittedArrowDirections:UIPopoverArrowDirectionDown
|
||||
animated:YES];
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#import "MBProgressHUD.h"
|
||||
#import "NBContainerViewController.h"
|
||||
#import "NewsBlurViewController.h"
|
||||
#import "MenuTableViewCell.h"
|
||||
|
||||
@implementation FeedsMenuViewController
|
||||
|
||||
|
@ -49,6 +50,10 @@
|
|||
self.menuTableView = nil;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[self.menuTableView reloadData];
|
||||
}
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
return YES;
|
||||
}
|
||||
|
@ -68,18 +73,12 @@
|
|||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIndentifier];
|
||||
|
||||
if (cell == nil) {
|
||||
cell = [[UITableViewCell alloc]
|
||||
cell = [[MenuTableViewCell alloc]
|
||||
initWithStyle:UITableViewCellStyleDefault
|
||||
reuseIdentifier:CellIndentifier];
|
||||
}
|
||||
|
||||
cell.textLabel.text = [self.menuOptions objectAtIndex:[indexPath row]];
|
||||
cell.contentView.backgroundColor = UIColorFromRGB(0xBAE3A8);
|
||||
cell.textLabel.backgroundColor = UIColorFromRGB(0xBAE3A8);
|
||||
cell.textLabel.textColor = UIColorFromRGB(0x303030);
|
||||
cell.textLabel.shadowColor = UIColorFromRGB(0xF0FFF0);
|
||||
cell.textLabel.shadowOffset = CGSizeMake(0, 1);
|
||||
cell.textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:14.0];
|
||||
|
||||
if (indexPath.row == 0) {
|
||||
cell.imageView.image = [UIImage imageNamed:@"rainbow.png"];
|
||||
|
|
|
@ -54,6 +54,16 @@
|
|||
[unreadCount calculateOffsets:counts.ps nt:counts.nt];
|
||||
countWidth = [unreadCount offsetWidth];
|
||||
[self addSubview:unreadCount];
|
||||
} else if (folderName == @"saved_stories") {
|
||||
unreadCount = [[UnreadCountView alloc] initWithFrame:rect];
|
||||
unreadCount.appDelegate = appDelegate;
|
||||
unreadCount.opaque = NO;
|
||||
unreadCount.psCount = appDelegate.savedStoriesCount;
|
||||
unreadCount.blueCount = appDelegate.savedStoriesCount;
|
||||
|
||||
[unreadCount calculateOffsets:appDelegate.savedStoriesCount nt:0];
|
||||
countWidth = [unreadCount offsetWidth];
|
||||
[self addSubview:unreadCount];
|
||||
}
|
||||
|
||||
// create the parent view that will hold header Label
|
||||
|
@ -87,9 +97,11 @@
|
|||
UIFont *font = [UIFont boldSystemFontOfSize:11];
|
||||
NSString *folderTitle;
|
||||
if (section == 0) {
|
||||
folderTitle = @"ALL BLURBLOG STORIES";
|
||||
folderTitle = [@"All Blurblog Stories" uppercaseString];
|
||||
} else if (section == 1) {
|
||||
folderTitle = @"ALL STORIES";
|
||||
folderTitle = [@"All Stories" uppercaseString];
|
||||
} else if (folderName == @"saved_stories") {
|
||||
folderTitle = [@"Saved Stories" uppercaseString];
|
||||
} else {
|
||||
folderTitle = [[appDelegate.dictFoldersArray objectAtIndex:section] uppercaseString];
|
||||
}
|
||||
|
@ -97,7 +109,7 @@
|
|||
CGContextSetShadowWithColor(context, CGSizeMake(0, 1), 0, [shadowColor CGColor]);
|
||||
|
||||
[folderTitle
|
||||
drawInRect:CGRectMake(36.0, 7, rect.size.width - 36 - 36 - countWidth, 14)
|
||||
drawInRect:CGRectMake(36.0, 9, rect.size.width - 36 - 36 - countWidth, 14)
|
||||
withFont:font
|
||||
lineBreakMode:UILineBreakModeTailTruncation
|
||||
alignment:UITextAlignmentLeft];
|
||||
|
@ -116,10 +128,10 @@
|
|||
UIButton *disclosureButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
UIImage *disclosureImage = [UIImage imageNamed:@"disclosure.png"];
|
||||
[disclosureButton setImage:disclosureImage forState:UIControlStateNormal];
|
||||
disclosureButton.frame = CGRectMake(customView.frame.size.width - 32, -1, 29, 29);
|
||||
disclosureButton.frame = CGRectMake(customView.frame.size.width - 32, 1, 29, 29);
|
||||
|
||||
// Add collapse button to all folders except Everything
|
||||
if (section != 1) {
|
||||
if (section != 1 && folderName != @"saved_stories") {
|
||||
if (!isFolderCollapsed) {
|
||||
disclosureButton.transform = CGAffineTransformMakeRotation(M_PI_2);
|
||||
}
|
||||
|
@ -128,9 +140,9 @@
|
|||
[disclosureButton addTarget:appDelegate.feedsViewController action:@selector(didCollapseFolder:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
UIImage *disclosureBorder = [UIImage imageNamed:@"disclosure_border.png"];
|
||||
[disclosureBorder drawInRect:CGRectMake(customView.frame.size.width - 32, -1, 29, 29)];
|
||||
[disclosureBorder drawInRect:CGRectMake(customView.frame.size.width - 32, 1, 29, 29)];
|
||||
} else {
|
||||
// Everything folder doesn't get a button
|
||||
// Everything/Saved folder doesn't get a button
|
||||
[disclosureButton setUserInteractionEnabled:NO];
|
||||
}
|
||||
[customView addSubview:disclosureButton];
|
||||
|
@ -153,6 +165,13 @@
|
|||
} else {
|
||||
folderImageViewX = 7;
|
||||
}
|
||||
} else if (folderName == @"saved_stories") {
|
||||
folderImage = [UIImage imageNamed:@"clock.png"];
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
folderImageViewX = 10;
|
||||
} else {
|
||||
folderImageViewX = 7;
|
||||
}
|
||||
} else {
|
||||
if (isFolderCollapsed) {
|
||||
folderImage = [UIImage imageNamed:@"folder_collapsed.png"];
|
||||
|
@ -164,7 +183,7 @@
|
|||
folderImageViewX = 7;
|
||||
}
|
||||
}
|
||||
[folderImage drawInRect:CGRectMake(folderImageViewX, 3, 20, 20)];
|
||||
[folderImage drawInRect:CGRectMake(folderImageViewX, 5, 20, 20)];
|
||||
|
||||
[customView setAutoresizingMask:UIViewAutoresizingNone];
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
#import "FontSettingsViewController.h"
|
||||
#import "NewsBlurAppDelegate.h"
|
||||
#import "StoryDetailViewController.h"
|
||||
#import "FeedDetailViewController.h"
|
||||
#import "MenuTableViewCell.h"
|
||||
#import "NBContainerViewController.h"
|
||||
|
||||
@implementation FontSettingsViewController
|
||||
|
||||
|
@ -62,7 +65,8 @@
|
|||
[fontSizeSegment setSelectedSegmentIndex:4];
|
||||
}
|
||||
}
|
||||
// Do any additional setup after loading the view from its nib.
|
||||
|
||||
[self.menuTableView reloadData];
|
||||
}
|
||||
|
||||
- (void)viewDidUnload
|
||||
|
@ -138,39 +142,35 @@
|
|||
}
|
||||
|
||||
if (cell == nil) {
|
||||
cell = [[UITableViewCell alloc]
|
||||
cell = [[MenuTableViewCell alloc]
|
||||
initWithStyle:UITableViewCellStyleDefault
|
||||
reuseIdentifier:CellIndentifier];
|
||||
}
|
||||
|
||||
cell.contentView.backgroundColor = UIColorFromRGB(0xBAE3A8);
|
||||
cell.textLabel.backgroundColor = UIColorFromRGB(0xBAE3A8);
|
||||
cell.textLabel.textColor = UIColorFromRGB(0x303030);
|
||||
cell.textLabel.shadowColor = UIColorFromRGB(0xF0FFF0);
|
||||
cell.textLabel.shadowOffset = CGSizeMake(0, 1);
|
||||
cell.textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:14.0];
|
||||
|
||||
if (cell.selected) {
|
||||
cell.contentView.backgroundColor = UIColorFromRGB(0x639510);
|
||||
cell.textLabel.backgroundColor = UIColorFromRGB(0x639510);
|
||||
cell.selectedBackgroundView.backgroundColor = UIColorFromRGB(0x639510);
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
}
|
||||
|
||||
|
||||
if (indexPath.row == 0) {
|
||||
cell.textLabel.text = [@"Save this story" uppercaseString];
|
||||
bool isSaved = [[appDelegate.activeStory objectForKey:@"starred"] boolValue];
|
||||
if (isSaved) {
|
||||
cell.textLabel.text = [@"Unsave this story" uppercaseString];
|
||||
} else {
|
||||
cell.textLabel.text = [@"Save this story" uppercaseString];
|
||||
}
|
||||
cell.imageView.image = [UIImage imageNamed:@"time"];
|
||||
} else if (indexPath.row == 1) {
|
||||
cell.textLabel.text = [@"Mark as unread" uppercaseString];
|
||||
bool isRead = [[appDelegate.activeStory objectForKey:@"read_status"] boolValue];
|
||||
if (isRead) {
|
||||
cell.textLabel.text = [@"Mark as unread" uppercaseString];
|
||||
} else {
|
||||
cell.textLabel.text = [@"Mark as read" uppercaseString];
|
||||
}
|
||||
cell.imageView.image = [UIImage imageNamed:@"bullet_orange"];
|
||||
} else if (indexPath.row == 2) {
|
||||
cell.textLabel.text = [@"Share this story" uppercaseString];
|
||||
cell.imageView.image = [UIImage imageNamed:@"rainbow"];
|
||||
} else if (indexPath.row == 3) {
|
||||
cell.textLabel.text = [@"Send to..." uppercaseString];
|
||||
cell.imageView.image = [UIImage imageNamed:@"email"];
|
||||
} else if (indexPath.row == 3) {
|
||||
cell.textLabel.text = [@"Share this story" uppercaseString];
|
||||
cell.imageView.image = [UIImage imageNamed:@"rainbow"];
|
||||
}
|
||||
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
@ -178,21 +178,39 @@
|
|||
return kMenuOptionHeight;
|
||||
}
|
||||
|
||||
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (indexPath.row >= 4) {
|
||||
return nil;
|
||||
}
|
||||
return indexPath;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
if (indexPath.row == 0) {
|
||||
[appDelegate.storyDetailViewController markStoryAsSaved];
|
||||
bool isSaved = [[appDelegate.activeStory objectForKey:@"starred"] boolValue];
|
||||
if (isSaved) {
|
||||
[appDelegate.storyDetailViewController markStoryAsUnsaved];
|
||||
} else {
|
||||
[appDelegate.storyDetailViewController markStoryAsSaved];
|
||||
}
|
||||
} else if (indexPath.row == 1) {
|
||||
[appDelegate.storyDetailViewController markStoryAsUnread];
|
||||
bool isRead = [[appDelegate.activeStory objectForKey:@"read_status"] boolValue];
|
||||
if (isRead) {
|
||||
[appDelegate.storyDetailViewController markStoryAsUnread];
|
||||
} else {
|
||||
[appDelegate.storyDetailViewController markStoryAsRead];
|
||||
[appDelegate.feedDetailViewController redrawUnreadStory];
|
||||
}
|
||||
} else if (indexPath.row == 2) {
|
||||
[appDelegate.storyDetailViewController openShareDialog];
|
||||
} else if (indexPath.row == 3) {
|
||||
[appDelegate.storyDetailViewController openSendToDialog];
|
||||
} else if (indexPath.row == 3) {
|
||||
[appDelegate.storyDetailViewController openShareDialog];
|
||||
}
|
||||
|
||||
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
// [appDelegate.masterContainerViewController hidePopover];
|
||||
[appDelegate.masterContainerViewController hidePopover];
|
||||
} else {
|
||||
[appDelegate.storyDetailViewController.popoverController dismissPopoverAnimated:YES];
|
||||
appDelegate.storyDetailViewController.popoverController = nil;
|
||||
|
@ -204,7 +222,8 @@
|
|||
- (UITableViewCell *)makeFontSelectionTableCell {
|
||||
UITableViewCell *cell = [[UITableViewCell alloc] init];
|
||||
cell.frame = CGRectMake(0, 0, 240, kMenuOptionHeight);
|
||||
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
|
||||
fontStyleSegment.frame = CGRectMake(8, 4, cell.frame.size.width - 8*2, kMenuOptionHeight - 4*2);
|
||||
[fontStyleSegment setTitle:@"Helvetica" forSegmentAtIndex:0];
|
||||
[fontStyleSegment setTitle:@"Georgia" forSegmentAtIndex:1];
|
||||
|
@ -218,6 +237,7 @@
|
|||
- (UITableViewCell *)makeFontSizeTableCell {
|
||||
UITableViewCell *cell = [[UITableViewCell alloc] init];
|
||||
cell.frame = CGRectMake(0, 0, 240, kMenuOptionHeight);
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
|
||||
fontSizeSegment.frame = CGRectMake(8, 4, cell.frame.size.width - 8*2, kMenuOptionHeight - 4*2);
|
||||
[fontSizeSegment setTitle:@"11pt" forSegmentAtIndex:0];
|
||||
|
|
13
media/ios/Classes/MenuTableViewCell.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
//
|
||||
// MenuTableViewCell.h
|
||||
// NewsBlur
|
||||
//
|
||||
// Created by Samuel Clay on 10/16/12.
|
||||
// Copyright (c) 2012 NewsBlur. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface MenuTableViewCell : UITableViewCell
|
||||
|
||||
@end
|
66
media/ios/Classes/MenuTableViewCell.m
Normal file
|
@ -0,0 +1,66 @@
|
|||
//
|
||||
// MenuTableViewCell.m
|
||||
// NewsBlur
|
||||
//
|
||||
// Created by Samuel Clay on 10/16/12.
|
||||
// Copyright (c) 2012 NewsBlur. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MenuTableViewCell.h"
|
||||
|
||||
@implementation MenuTableViewCell
|
||||
|
||||
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
|
||||
{
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
if (self) {
|
||||
// Initialization code
|
||||
self.textLabel.backgroundColor = [UIColor clearColor];
|
||||
self.textLabel.textColor = UIColorFromRGB(0x303030);
|
||||
self.textLabel.shadowColor = UIColorFromRGB(0xF0FFF0);
|
||||
self.textLabel.shadowOffset = CGSizeMake(0, 1);
|
||||
self.textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:14.0];
|
||||
UIView *background = [[UIView alloc] init];
|
||||
[background setBackgroundColor:UIColorFromRGB(0xBAE3A8)];
|
||||
[self setBackgroundView:background];
|
||||
|
||||
UIView *selectedBackground = [[UIView alloc] init];
|
||||
[selectedBackground setBackgroundColor:UIColorFromRGB(0x639510)];
|
||||
[self setSelectedBackgroundView:selectedBackground];
|
||||
|
||||
}
|
||||
if (self.selected) {
|
||||
self.textLabel.shadowColor = [UIColor blackColor];
|
||||
} else {
|
||||
self.textLabel.shadowColor = UIColorFromRGB(0xF0FFF0);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
if (selected) {
|
||||
self.textLabel.shadowColor = [UIColor blackColor];
|
||||
self.textLabel.textColor = UIColorFromRGB(0xF0FFF0);
|
||||
} else {
|
||||
// self.textLabel.shadowColor = UIColorFromRGB(0xF0FFF0);
|
||||
self.textLabel.textColor = UIColorFromRGB(0x303030);
|
||||
}
|
||||
|
||||
[super setSelected:selected animated:animated];
|
||||
}
|
||||
|
||||
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
|
||||
|
||||
if (highlighted) {
|
||||
self.textLabel.shadowColor = [UIColor blackColor];
|
||||
self.textLabel.textColor = UIColorFromRGB(0xF0FFF0);
|
||||
} else {
|
||||
self.textLabel.shadowColor = UIColorFromRGB(0xF0FFF0);
|
||||
self.textLabel.textColor = UIColorFromRGB(0x303030);
|
||||
}
|
||||
|
||||
[super setHighlighted:highlighted animated:animated];
|
||||
}
|
||||
|
||||
@end
|
|
@ -248,7 +248,7 @@
|
|||
popoverController.delegate = self;
|
||||
|
||||
|
||||
[popoverController setPopoverContentSize:CGSizeMake(200, 86)];
|
||||
[popoverController setPopoverContentSize:CGSizeMake(200, 76)];
|
||||
// UIBarButtonItem *settingsButton = [[UIBarButtonItem alloc]
|
||||
// initWithCustomView:sender];
|
||||
[popoverController presentPopoverFromBarButtonItem:sender
|
||||
|
@ -269,7 +269,7 @@
|
|||
popoverController.delegate = self;
|
||||
|
||||
|
||||
[popoverController setPopoverContentSize:CGSizeMake(260, 38*3)];
|
||||
[popoverController setPopoverContentSize:CGSizeMake(260, appDelegate.isRiverView ? 38*3 : 38*5)];
|
||||
[popoverController presentPopoverFromBarButtonItem:sender
|
||||
permittedArrowDirections:UIPopoverArrowDirectionAny
|
||||
animated:YES];
|
||||
|
|
|
@ -102,6 +102,7 @@
|
|||
int originalStoryCount;
|
||||
NSInteger selectedIntelligence;
|
||||
int visibleUnreadCount;
|
||||
int savedStoriesCount;
|
||||
NSMutableArray * recentlyReadStories;
|
||||
NSMutableSet * recentlyReadFeeds;
|
||||
NSMutableArray * readStories;
|
||||
|
@ -118,6 +119,7 @@
|
|||
|
||||
NSArray *categories;
|
||||
NSDictionary *categoryFeeds;
|
||||
UIImageView *splashView;
|
||||
}
|
||||
|
||||
@property (nonatomic) IBOutlet UIWindow *window;
|
||||
|
@ -178,6 +180,7 @@
|
|||
@property (readwrite) int storyCount;
|
||||
@property (readwrite) int originalStoryCount;
|
||||
@property (readwrite) int visibleUnreadCount;
|
||||
@property (readwrite) int savedStoriesCount;
|
||||
@property (readwrite) NSInteger selectedIntelligence;
|
||||
@property (readwrite) NSMutableArray * recentlyReadStories;
|
||||
@property (readwrite) NSMutableSet * recentlyReadFeeds;
|
||||
|
@ -197,6 +200,7 @@
|
|||
@property (nonatomic) NSDictionary *categoryFeeds;
|
||||
|
||||
+ (NewsBlurAppDelegate*) sharedAppDelegate;
|
||||
- (void)startupAnimationDone:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context;
|
||||
|
||||
- (void)showFirstTimeUser;
|
||||
- (void)showLogin;
|
||||
|
@ -227,6 +231,8 @@
|
|||
- (void)resetShareComments;
|
||||
- (BOOL)isSocialFeed:(NSString *)feedIdStr;
|
||||
- (BOOL)isPortrait;
|
||||
- (NSString *)orderKey;
|
||||
- (NSString *)readFilterKey;
|
||||
- (void)confirmLogout;
|
||||
|
||||
- (int)indexOfNextUnreadStory;
|
||||
|
@ -249,9 +255,13 @@
|
|||
- (UnreadCounts *)splitUnreadCountForFeed:(NSString *)feedId;
|
||||
- (UnreadCounts *)splitUnreadCountForFolder:(NSString *)folderName;
|
||||
- (void)markActiveStoryRead;
|
||||
- (void)markActiveStoryUnread;
|
||||
- (NSDictionary *)markVisibleStoriesRead;
|
||||
- (void)markStoryRead:(NSString *)storyId feedId:(id)feedId;
|
||||
- (void)markStoryRead:(NSDictionary *)story feed:(NSDictionary *)feed;
|
||||
- (void)markStoryUnread:(NSString *)storyId feedId:(id)feedId;
|
||||
- (void)markStoryUnread:(NSDictionary *)story feed:(NSDictionary *)feed;
|
||||
- (void)markActiveStorySaved:(BOOL)saved;
|
||||
- (void)markActiveFeedAllRead;
|
||||
- (void)markActiveFolderAllRead;
|
||||
- (void)markFeedAllRead:(id)feedId;
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
|
||||
@implementation NewsBlurAppDelegate
|
||||
|
||||
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
|
||||
|
||||
@synthesize window;
|
||||
|
||||
@synthesize ftuxNavigationController;
|
||||
|
@ -97,6 +99,7 @@
|
|||
@synthesize activeStory;
|
||||
@synthesize storyCount;
|
||||
@synthesize visibleUnreadCount;
|
||||
@synthesize savedStoriesCount;
|
||||
@synthesize originalStoryCount;
|
||||
@synthesize selectedIntelligence;
|
||||
@synthesize activeOriginalStoryURL;
|
||||
|
@ -144,15 +147,43 @@
|
|||
[window makeKeyAndVisible];
|
||||
[self.feedsViewController fetchFeedList:YES];
|
||||
|
||||
|
||||
splashView = [[UIImageView alloc] init];
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
splashView.frame = self.view.frame;
|
||||
splashView.image = [UIImage imageNamed:@"Default-Portrait.png"];
|
||||
} else if (IS_IPHONE_5) {
|
||||
splashView.frame = self.window.frame;
|
||||
splashView.image = [UIImage imageNamed:@"Default-568h.png"];
|
||||
} else {
|
||||
splashView.frame = self.window.frame;
|
||||
splashView.image = [UIImage imageNamed:@"Default.png"];
|
||||
}
|
||||
[window addSubview:splashView];
|
||||
[window bringSubviewToFront:splashView];
|
||||
[UIView beginAnimations:nil context:nil];
|
||||
[UIView setAnimationDuration:.5];
|
||||
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:window cache:YES];
|
||||
[UIView setAnimationDelegate:self];
|
||||
[UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)];
|
||||
splashView.alpha = 0.0;
|
||||
// splashView.frame = CGRectMake(-60, -80, 440, 728);
|
||||
[UIView commitAnimations];
|
||||
|
||||
// [self showFirstTimeUser];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
self.visibleUnreadCount = 0;
|
||||
self.savedStoriesCount = 0;
|
||||
[self setRecentlyReadStories:[NSMutableArray array]];
|
||||
}
|
||||
|
||||
- (void)startupAnimationDone:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
|
||||
[splashView removeFromSuperview];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark FeedsView
|
||||
|
@ -444,6 +475,22 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (NSString *)orderKey {
|
||||
if (self.isRiverView) {
|
||||
return [NSString stringWithFormat:@"folder:%@:order", self.activeFolder];
|
||||
} else {
|
||||
return [NSString stringWithFormat:@"%@:order", [self.activeFeed objectForKey:@"id"]];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)readFilterKey {
|
||||
if (self.isRiverView) {
|
||||
return [NSString stringWithFormat:@"folder:%@:read_filter", self.activeFolder];
|
||||
} else {
|
||||
return [NSString stringWithFormat:@"%@:read_filter", [self.activeFeed objectForKey:@"id"]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)confirmLogout {
|
||||
UIAlertView *logoutConfirm = [[UIAlertView alloc] initWithTitle:@"Positive?"
|
||||
message:nil
|
||||
|
@ -552,6 +599,8 @@
|
|||
feedTitle = @"All Shared Stories";
|
||||
} else if ([self.activeFolder isEqualToString:@"everything"]) {
|
||||
feedTitle = @"All Stories";
|
||||
} else if ([self.activeFolder isEqualToString:@"saved_stories"]) {
|
||||
feedTitle = @"Saved Stories";
|
||||
} else {
|
||||
feedTitle = self.activeFolder;
|
||||
}
|
||||
|
@ -825,7 +874,6 @@
|
|||
NSArray *folder;
|
||||
|
||||
if ([[self.folderCountCache objectForKey:folderName] boolValue]) {
|
||||
NSLog(@"In folder count cache: %@", folderName);
|
||||
counts.ps = [[self.folderCountCache objectForKey:[NSString stringWithFormat:@"%@-ps", folderName]] intValue];
|
||||
counts.nt = [[self.folderCountCache objectForKey:[NSString stringWithFormat:@"%@-nt", folderName]] intValue];
|
||||
counts.ng = [[self.folderCountCache objectForKey:[NSString stringWithFormat:@"%@-ng", folderName]] intValue];
|
||||
|
@ -857,7 +905,6 @@
|
|||
if (!self.folderCountCache) {
|
||||
self.folderCountCache = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
NSLog(@"Saving to folder cache: %@", folderName);
|
||||
[self.folderCountCache setObject:[NSNumber numberWithBool:YES] forKey:folderName];
|
||||
[self.folderCountCache setObject:[NSNumber numberWithInt:counts.ps] forKey:[NSString stringWithFormat:@"%@-ps", folderName]];
|
||||
[self.folderCountCache setObject:[NSNumber numberWithInt:counts.nt] forKey:[NSString stringWithFormat:@"%@-nt", folderName]];
|
||||
|
@ -890,7 +937,6 @@
|
|||
|
||||
- (void)markActiveStoryRead {
|
||||
int activeLocation = [self locationOfActiveStory];
|
||||
NSLog(@"activeLocation is %i", activeLocation);
|
||||
if (activeLocation == -1) {
|
||||
return;
|
||||
}
|
||||
|
@ -960,6 +1006,82 @@
|
|||
|
||||
[self.recentlyReadStories addObject:[NSNumber numberWithInt:activeLocation]];
|
||||
[self markStoryRead:story feed:feed];
|
||||
self.activeStory = [self.activeFeedStories objectAtIndex:activeIndex];
|
||||
}
|
||||
|
||||
- (void)markActiveStoryUnread {
|
||||
int activeLocation = [self locationOfActiveStory];
|
||||
if (activeLocation == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// changes the story layout in story feed detail
|
||||
[self.feedDetailViewController changeActiveStoryTitleCellLayout];
|
||||
|
||||
int activeIndex = [[activeFeedStoryLocations objectAtIndex:activeLocation] intValue];
|
||||
|
||||
NSDictionary *feed;
|
||||
NSDictionary *friendFeed;
|
||||
id feedId;
|
||||
NSString *feedIdStr;
|
||||
NSDictionary *story = [activeFeedStories objectAtIndex:activeIndex];
|
||||
NSMutableArray *otherFriendShares = [[self.activeStory objectForKey:@"shared_by_friends"] mutableCopy];
|
||||
NSMutableArray *otherFriendComments = [[self.activeStory objectForKey:@"commented_by_friends"] mutableCopy];
|
||||
|
||||
if (self.isSocialView) {
|
||||
feedId = [self.activeStory objectForKey:@"social_user_id"];
|
||||
feedIdStr = [NSString stringWithFormat:@"social:%@",feedId];
|
||||
feed = [self.dictSocialFeeds objectForKey:feedIdStr];
|
||||
|
||||
[otherFriendShares removeObject:feedId];
|
||||
NSLog(@"otherFriendFeeds is %@", otherFriendShares);
|
||||
[otherFriendComments removeObject:feedId];
|
||||
NSLog(@"otherFriendFeeds is %@", otherFriendComments);
|
||||
|
||||
// make sure we set the active feed
|
||||
self.activeFeed = feed;
|
||||
} else if (self.isSocialRiverView) {
|
||||
feedId = [[self.activeStory objectForKey:@"friend_user_ids"] objectAtIndex:0];
|
||||
feedIdStr = [NSString stringWithFormat:@"social:%@",feedId];
|
||||
feed = [self.dictSocialFeeds objectForKey:feedIdStr];
|
||||
|
||||
[otherFriendShares removeObject:feedId];
|
||||
NSLog(@"otherFriendFeeds is %@", otherFriendShares);
|
||||
[otherFriendComments removeObject:feedId];
|
||||
NSLog(@"otherFriendFeeds is %@", otherFriendComments);
|
||||
|
||||
// make sure we set the active feed
|
||||
self.activeFeed = feed;
|
||||
} else {
|
||||
feedId = [self.activeStory objectForKey:@"story_feed_id"];
|
||||
feedIdStr = [NSString stringWithFormat:@"%@",feedId];
|
||||
feed = [self.dictFeeds objectForKey:feedIdStr];
|
||||
|
||||
// make sure we set the active feed
|
||||
self.activeFeed = feed;
|
||||
}
|
||||
|
||||
// decrement all other friend feeds if they have the same story
|
||||
if (self.isSocialView || self.isSocialRiverView) {
|
||||
for (int i = 0; i < otherFriendShares.count; i++) {
|
||||
feedIdStr = [NSString stringWithFormat:@"social:%@",
|
||||
[otherFriendShares objectAtIndex:i]];
|
||||
friendFeed = [self.dictSocialFeeds objectForKey:feedIdStr];
|
||||
[self markStoryUnread:story feed:friendFeed];
|
||||
}
|
||||
|
||||
for (int i = 0; i < otherFriendComments.count; i++) {
|
||||
feedIdStr = [NSString stringWithFormat:@"social:%@",
|
||||
[otherFriendComments objectAtIndex:i]];
|
||||
friendFeed = [self.dictSocialFeeds objectForKey:feedIdStr];
|
||||
[self markStoryUnread:story feed:friendFeed];
|
||||
}
|
||||
}
|
||||
|
||||
[self.recentlyReadStories removeObject:[NSNumber numberWithInt:activeLocation]];
|
||||
[self markStoryUnread:story feed:feed];
|
||||
|
||||
self.activeStory = [self.activeFeedStories objectAtIndex:activeIndex];
|
||||
}
|
||||
|
||||
- (NSDictionary *)markVisibleStoriesRead {
|
||||
|
@ -1011,7 +1133,7 @@
|
|||
}
|
||||
}
|
||||
self.activeFeedStories = newActiveFeedStories;
|
||||
|
||||
|
||||
self.visibleUnreadCount -= 1;
|
||||
if (![self.recentlyReadFeeds containsObject:[newStory objectForKey:@"story_feed_id"]]) {
|
||||
[self.recentlyReadFeeds addObject:[newStory objectForKey:@"story_feed_id"]];
|
||||
|
@ -1039,7 +1161,93 @@
|
|||
self.activeFeed = newFeed;
|
||||
}
|
||||
|
||||
- (void)markActiveFeedAllRead {
|
||||
|
||||
- (void)markStoryUnread:(NSString *)storyId feedId:(id)feedId {
|
||||
NSString *feedIdStr = [NSString stringWithFormat:@"%@",feedId];
|
||||
NSDictionary *feed = [self.dictFeeds objectForKey:feedIdStr];
|
||||
NSDictionary *story = nil;
|
||||
for (NSDictionary *s in self.activeFeedStories) {
|
||||
if ([[s objectForKey:@"story_guid"] isEqualToString:storyId]) {
|
||||
story = s;
|
||||
break;
|
||||
}
|
||||
}
|
||||
[self markStoryUnread:story feed:feed];
|
||||
}
|
||||
|
||||
- (void)markStoryUnread:(NSDictionary *)story feed:(NSDictionary *)feed {
|
||||
NSString *feedIdStr = [NSString stringWithFormat:@"%@", [feed objectForKey:@"id"]];
|
||||
|
||||
NSMutableDictionary *newStory = [story mutableCopy];
|
||||
[newStory setValue:[NSNumber numberWithInt:0] forKey:@"read_status"];
|
||||
|
||||
// make the story as read in self.activeFeedStories
|
||||
NSString *newStoryIdStr = [NSString stringWithFormat:@"%@", [newStory valueForKey:@"id"]];
|
||||
NSMutableArray *newActiveFeedStories = [self.activeFeedStories mutableCopy];
|
||||
for (int i = 0; i < [newActiveFeedStories count]; i++) {
|
||||
NSMutableArray *thisStory = [[newActiveFeedStories objectAtIndex:i] mutableCopy];
|
||||
NSString *thisStoryIdStr = [NSString stringWithFormat:@"%@", [thisStory valueForKey:@"id"]];
|
||||
if ([newStoryIdStr isEqualToString:thisStoryIdStr]) {
|
||||
[newActiveFeedStories replaceObjectAtIndex:i withObject:newStory];
|
||||
break;
|
||||
}
|
||||
}
|
||||
self.activeFeedStories = newActiveFeedStories;
|
||||
|
||||
self.visibleUnreadCount += 1;
|
||||
// if ([self.recentlyReadFeeds containsObject:[newStory objectForKey:@"story_feed_id"]]) {
|
||||
[self.recentlyReadFeeds removeObject:[newStory objectForKey:@"story_feed_id"]];
|
||||
// }
|
||||
|
||||
NSMutableDictionary *newFeed = [feed mutableCopy];
|
||||
int score = [NewsBlurAppDelegate computeStoryScore:[story objectForKey:@"intelligence"]];
|
||||
if (score > 0) {
|
||||
int unreads = MAX(1, [[newFeed objectForKey:@"ps"] intValue] + 1);
|
||||
[newFeed setValue:[NSNumber numberWithInt:unreads] forKey:@"ps"];
|
||||
} else if (score == 0) {
|
||||
int unreads = MAX(1, [[newFeed objectForKey:@"nt"] intValue] + 1);
|
||||
[newFeed setValue:[NSNumber numberWithInt:unreads] forKey:@"nt"];
|
||||
} else if (score < 0) {
|
||||
int unreads = MAX(1, [[newFeed objectForKey:@"ng"] intValue] + 1);
|
||||
[newFeed setValue:[NSNumber numberWithInt:unreads] forKey:@"ng"];
|
||||
}
|
||||
|
||||
if (self.isSocialView || self.isSocialRiverView) {
|
||||
[self.dictSocialFeeds setValue:newFeed forKey:feedIdStr];
|
||||
} else {
|
||||
[self.dictFeeds setValue:newFeed forKey:feedIdStr];
|
||||
}
|
||||
|
||||
self.activeFeed = newFeed;
|
||||
}
|
||||
|
||||
- (void)markActiveStorySaved:(BOOL)saved {
|
||||
NSMutableDictionary *newStory = [self.activeStory mutableCopy];
|
||||
[newStory setValue:[NSNumber numberWithBool:saved] forKey:@"starred"];
|
||||
|
||||
self.activeStory = newStory;
|
||||
|
||||
// make the story as read in self.activeFeedStories
|
||||
NSString *newStoryIdStr = [NSString stringWithFormat:@"%@", [newStory valueForKey:@"id"]];
|
||||
NSMutableArray *newActiveFeedStories = [self.activeFeedStories mutableCopy];
|
||||
for (int i = 0; i < [newActiveFeedStories count]; i++) {
|
||||
NSMutableArray *thisStory = [[newActiveFeedStories objectAtIndex:i] mutableCopy];
|
||||
NSString *thisStoryIdStr = [NSString stringWithFormat:@"%@", [thisStory valueForKey:@"id"]];
|
||||
if ([newStoryIdStr isEqualToString:thisStoryIdStr]) {
|
||||
[newActiveFeedStories replaceObjectAtIndex:i withObject:newStory];
|
||||
break;
|
||||
}
|
||||
}
|
||||
self.activeFeedStories = newActiveFeedStories;
|
||||
|
||||
if (saved) {
|
||||
self.savedStoriesCount += 1;
|
||||
} else {
|
||||
self.savedStoriesCount -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)markActiveFeedAllRead {
|
||||
id feedId = [self.activeFeed objectForKey:@"id"];
|
||||
[self markFeedAllRead:feedId];
|
||||
}
|
||||
|
@ -1242,6 +1450,8 @@
|
|||
titleLabel.text = [NSString stringWithFormat:@" All Shared Stories"];
|
||||
} else if (self.isRiverView && [self.activeFolder isEqualToString:@"everything"]) {
|
||||
titleLabel.text = [NSString stringWithFormat:@" All Stories"];
|
||||
} else if (self.isRiverView && [self.activeFolder isEqualToString:@"saved_stories"]) {
|
||||
titleLabel.text = [NSString stringWithFormat:@" Saved Stories"];
|
||||
} else if (self.isRiverView) {
|
||||
titleLabel.text = [NSString stringWithFormat:@" %@", self.activeFolder];
|
||||
} else if (self.isSocialView) {
|
||||
|
@ -1266,6 +1476,10 @@
|
|||
UIImage *titleImage;
|
||||
if (self.isSocialRiverView) {
|
||||
titleImage = [UIImage imageNamed:@"group_white.png"];
|
||||
} else if (self.isRiverView && [self.activeFolder isEqualToString:@"everything"]) {
|
||||
titleImage = [UIImage imageNamed:@"archive_white.png"];
|
||||
} else if (self.isRiverView && [self.activeFolder isEqualToString:@"saved_stories"]) {
|
||||
titleImage = [UIImage imageNamed:@"clock_white.png"];
|
||||
} else if (self.isRiverView) {
|
||||
titleImage = [UIImage imageNamed:@"folder_white.png"];
|
||||
} else {
|
||||
|
|
|
@ -274,7 +274,7 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
[request setDidFailSelector:@selector(finishedWithError:)];
|
||||
[request setTimeOutSeconds:30];
|
||||
[request startAsynchronous];
|
||||
NSLog(@"urlFeedList is %@", urlFeedList);
|
||||
|
||||
self.lastUpdate = [NSDate date];
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,8 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
JSONObjectWithData:responseData
|
||||
options:kNilOptions
|
||||
error:&error];
|
||||
|
||||
appDelegate.savedStoriesCount = [[results objectForKey:@"starred_count"] intValue];
|
||||
|
||||
// NSLog(@"results are %@", results);
|
||||
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
||||
self.stillVisibleFeeds = [NSMutableDictionary dictionary];
|
||||
|
@ -394,9 +395,9 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
}
|
||||
|
||||
[allFolders setValue:socialFolder forKey:@"river_blurblogs"];
|
||||
|
||||
if (![[allFolders allKeys] containsObject:@"everything"]) {
|
||||
[allFolders setValue:[[NSArray alloc] init] forKey:@"everything"];
|
||||
|
||||
if (appDelegate.savedStoriesCount) {
|
||||
[allFolders setValue:[[NSArray alloc] init] forKey:@"saved_stories"];
|
||||
}
|
||||
|
||||
appDelegate.dictFolders = allFolders;
|
||||
|
@ -450,6 +451,12 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
[appDelegate.dictFoldersArray removeObject:@"everything"];
|
||||
[appDelegate.dictFoldersArray insertObject:@"everything" atIndex:1];
|
||||
}
|
||||
|
||||
// Add Saved Stories folder
|
||||
if (appDelegate.savedStoriesCount) {
|
||||
[appDelegate.dictFoldersArray removeObject:@"saved_stories"];
|
||||
[appDelegate.dictFoldersArray insertObject:@"saved_stories" atIndex:appDelegate.dictFoldersArray.count];
|
||||
}
|
||||
|
||||
if (self.viewShowingAllFeeds) {
|
||||
[self calculateFeedLocations:NO];
|
||||
|
@ -683,7 +690,7 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
}
|
||||
|
||||
NSString *folderName = [appDelegate.dictFoldersArray objectAtIndex:section];
|
||||
|
||||
|
||||
return [[self.activeFeedLocations objectForKey:folderName] count];
|
||||
}
|
||||
|
||||
|
@ -868,17 +875,17 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
|
||||
// NSString *folder = [appDelegate.dictFoldersArray objectAtIndex:section];
|
||||
NSString *folderName = [appDelegate.dictFoldersArray objectAtIndex:section];
|
||||
// if ([[folder stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length] == 0) {
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
if ([tableView.dataSource tableView:tableView numberOfRowsInSection:section] == 0 &&
|
||||
section != 1) {
|
||||
int rows = [tableView.dataSource tableView:tableView numberOfRowsInSection:section];
|
||||
if (rows == 0 && section != 1 && folderName != @"saved_stories") {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 28;
|
||||
return 32;
|
||||
}
|
||||
|
||||
- (void)didSelectSectionHeader:(UIButton *)button {
|
||||
|
@ -964,6 +971,20 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
[self.feedTitlesTable beginUpdates];
|
||||
[self.feedTitlesTable endUpdates];
|
||||
|
||||
// Scroll to section header if collapse causes it to scroll far off screen
|
||||
NSArray *indexPathsVisibleCells = [self.feedTitlesTable indexPathsForVisibleRows];
|
||||
BOOL firstFeedInFolderVisible = NO;
|
||||
for (NSIndexPath *indexPath in indexPathsVisibleCells) {
|
||||
if (indexPath.row == 0 && indexPath.section == button.tag) {
|
||||
firstFeedInFolderVisible = YES;
|
||||
}
|
||||
}
|
||||
if (!firstFeedInFolderVisible) {
|
||||
CGRect headerRect = [self.feedTitlesTable rectForHeaderInSection:button.tag];
|
||||
CGPoint headerPoint = CGPointMake(headerRect.origin.x, headerRect.origin.y);
|
||||
[self.feedTitlesTable setContentOffset:headerPoint animated:YES];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)changeToAllMode {
|
||||
|
|
|
@ -9,11 +9,12 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import "WEPopoverController.h"
|
||||
#import "BaseViewController.h"
|
||||
|
||||
@class NewsBlurAppDelegate;
|
||||
@class ASIHTTPRequest;
|
||||
|
||||
@interface StoryDetailViewController : UIViewController
|
||||
@interface StoryDetailViewController : BaseViewController
|
||||
<UIPopoverControllerDelegate, WEPopoverControllerDelegate,
|
||||
UIScrollViewDelegate> {
|
||||
NewsBlurAppDelegate *appDelegate;
|
||||
|
@ -78,7 +79,11 @@ UIScrollViewDelegate> {
|
|||
- (void)finishMarkAsRead:(ASIHTTPRequest *)request;
|
||||
- (void)openSendToDialog;
|
||||
- (void)markStoryAsUnread;
|
||||
- (void)finishMarkAsUnread:(ASIHTTPRequest *)request;
|
||||
- (void)markStoryAsSaved;
|
||||
- (void)finishMarkAsSaved:(ASIHTTPRequest *)request;
|
||||
- (void)markStoryAsUnsaved;
|
||||
- (void)finishMarkAsUnsaved:(ASIHTTPRequest *)request;
|
||||
- (void)openShareDialog;
|
||||
- (void)finishLikeComment:(ASIHTTPRequest *)request;
|
||||
- (void)subscribeToBlurblog;
|
||||
|
|
|
@ -889,6 +889,10 @@
|
|||
UIImage *titleImage;
|
||||
if (appDelegate.isSocialRiverView) {
|
||||
titleImage = [UIImage imageNamed:@"group_white.png"];
|
||||
} else if (appDelegate.isRiverView && [appDelegate.activeFolder isEqualToString:@"everything"]) {
|
||||
titleImage = [UIImage imageNamed:@"archive_white.png"];
|
||||
} else if (appDelegate.isRiverView && [appDelegate.activeFolder isEqualToString:@"saved_stories"]) {
|
||||
titleImage = [UIImage imageNamed:@"clock_white.png"];
|
||||
} else if (appDelegate.isRiverView) {
|
||||
titleImage = [UIImage imageNamed:@"folder_white.png"];
|
||||
} else {
|
||||
|
@ -1182,7 +1186,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
}
|
||||
|
||||
[request setDidFinishSelector:@selector(finishMarkAsRead:)];
|
||||
[request setDidFailSelector:@selector(finishedWithError:)];
|
||||
[request setDidFailSelector:@selector(requestFailed:)];
|
||||
[request setDelegate:self];
|
||||
[request startAsynchronous];
|
||||
}
|
||||
|
@ -1214,7 +1218,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
[request setPostValue:[appDelegate.activeComment objectForKey:@"user_id"] forKey:@"comment_user_id"];
|
||||
|
||||
[request setDidFinishSelector:@selector(finishLikeComment:)];
|
||||
[request setDidFailSelector:@selector(finishedWithError:)];
|
||||
[request setDidFailSelector:@selector(requestFailed:)];
|
||||
[request setDelegate:self];
|
||||
[request startAsynchronous];
|
||||
}
|
||||
|
@ -1254,14 +1258,21 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
|
||||
|
||||
- (void)requestFailed:(ASIHTTPRequest *)request {
|
||||
NSLog(@"Error in mark as read is %@", [request error]);
|
||||
NSLog(@"Error in story detail: %@", [request error]);
|
||||
NSString *error;
|
||||
if ([request error]) {
|
||||
error = [NSString stringWithFormat:@"%@", [request error]];
|
||||
} else {
|
||||
error = @"The server barfed!";
|
||||
}
|
||||
[self informError:error];
|
||||
}
|
||||
|
||||
- (void)finishMarkAsRead:(ASIHTTPRequest *)request {
|
||||
// NSString *responseString = [request responseString];
|
||||
// NSDictionary *results = [[NSDictionary alloc]
|
||||
// initWithDictionary:[responseString JSONValue]];
|
||||
// NSLog(@"results in mark as read is %@", results);
|
||||
// NSString *responseString = [request responseString];
|
||||
// NSDictionary *results = [[NSDictionary alloc]
|
||||
// initWithDictionary:[responseString JSONValue]];
|
||||
// NSLog(@"results in mark as read is %@", results);
|
||||
}
|
||||
|
||||
- (void)openSendToDialog {
|
||||
|
@ -1300,11 +1311,96 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
}
|
||||
|
||||
- (void)markStoryAsSaved {
|
||||
NSString *urlString = [NSString stringWithFormat:@"http://%@/reader/mark_story_as_starred",
|
||||
NEWSBLUR_URL];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
|
||||
[request setPostValue:[appDelegate.activeStory
|
||||
objectForKey:@"id"]
|
||||
forKey:@"story_id"];
|
||||
[request setPostValue:[appDelegate.activeStory
|
||||
objectForKey:@"story_feed_id"]
|
||||
forKey:@"feed_id"];
|
||||
|
||||
[request setDidFinishSelector:@selector(finishMarkAsSaved:)];
|
||||
[request setDidFailSelector:@selector(requestFailed:)];
|
||||
[request setDelegate:self];
|
||||
[request startAsynchronous];
|
||||
}
|
||||
|
||||
- (void)finishMarkAsSaved:(ASIHTTPRequest *)request {
|
||||
if ([request responseStatusCode] != 200) {
|
||||
return [self requestFailed:request];
|
||||
}
|
||||
|
||||
[appDelegate markActiveStorySaved:YES];
|
||||
[self informMessage:@"This story is now saved"];
|
||||
}
|
||||
|
||||
- (void)markStoryAsUnsaved {
|
||||
// [appDelegate markActiveStoryUnread];
|
||||
|
||||
NSString *urlString = [NSString stringWithFormat:@"http://%@/reader/mark_story_as_unstarred",
|
||||
NEWSBLUR_URL];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
|
||||
[request setPostValue:[appDelegate.activeStory
|
||||
objectForKey:@"id"]
|
||||
forKey:@"story_id"];
|
||||
[request setPostValue:[appDelegate.activeStory
|
||||
objectForKey:@"story_feed_id"]
|
||||
forKey:@"feed_id"];
|
||||
|
||||
[request setDidFinishSelector:@selector(finishMarkAsUnsaved:)];
|
||||
[request setDidFailSelector:@selector(requestFailed:)];
|
||||
[request setDelegate:self];
|
||||
[request startAsynchronous];
|
||||
}
|
||||
|
||||
- (void)finishMarkAsUnsaved:(ASIHTTPRequest *)request {
|
||||
if ([request responseStatusCode] != 200) {
|
||||
return [self requestFailed:request];
|
||||
}
|
||||
|
||||
// [appDelegate markActiveStoryUnread];
|
||||
// [appDelegate.feedDetailViewController redrawUnreadStory];
|
||||
|
||||
[appDelegate markActiveStorySaved:NO];
|
||||
[self informMessage:@"This story is no longer saved"];
|
||||
}
|
||||
|
||||
- (void)markStoryAsUnread {
|
||||
if ([[appDelegate.activeStory objectForKey:@"read_status"] intValue] == 1) {
|
||||
NSString *urlString = [NSString stringWithFormat:@"http://%@/reader/mark_story_as_unread",
|
||||
NEWSBLUR_URL];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
|
||||
[request setPostValue:[appDelegate.activeStory
|
||||
objectForKey:@"id"]
|
||||
forKey:@"story_id"];
|
||||
[request setPostValue:[appDelegate.activeStory
|
||||
objectForKey:@"story_feed_id"]
|
||||
forKey:@"feed_id"];
|
||||
|
||||
[request setDidFinishSelector:@selector(finishMarkAsUnread:)];
|
||||
[request setDidFailSelector:@selector(requestFailed:)];
|
||||
[request setDelegate:self];
|
||||
[request startAsynchronous];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)finishMarkAsUnread:(ASIHTTPRequest *)request {
|
||||
if ([request responseStatusCode] != 200) {
|
||||
return [self requestFailed:request];
|
||||
}
|
||||
|
||||
[appDelegate markActiveStoryUnread];
|
||||
[appDelegate.feedDetailViewController redrawUnreadStory];
|
||||
|
||||
[self informMessage:@"This story is now unread"];
|
||||
}
|
||||
|
||||
# pragma mark
|
||||
|
@ -1601,7 +1697,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
if ([self.popoverController respondsToSelector:@selector(setContainerViewProperties:)]) {
|
||||
[self.popoverController setContainerViewProperties:[self improvedContainerViewProperties]];
|
||||
}
|
||||
[self.popoverController setPopoverContentSize:CGSizeMake(240, 162)];
|
||||
[self.popoverController setPopoverContentSize:CGSizeMake(240, 154)];
|
||||
[self.popoverController presentPopoverFromBarButtonItem:self.fontSettingsButton
|
||||
permittedArrowDirections:UIPopoverArrowDirectionAny
|
||||
animated:YES];
|
||||
|
|
|
@ -26,6 +26,7 @@ typedef enum {
|
|||
@property (assign, nonatomic) int ntPadding;
|
||||
@property (assign, nonatomic) int psCount;
|
||||
@property (assign, nonatomic) int ntCount;
|
||||
@property (assign, nonatomic) int blueCount;
|
||||
@property (assign, nonatomic) CGRect rect;
|
||||
|
||||
- (void)drawInRect:(CGRect)r ps:(int)ps nt:(int)nt listType:(NBFeedListType)listType;
|
||||
|
|
|
@ -16,12 +16,13 @@ static UIColor *indicatorBlackColor = nil;
|
|||
static UIColor *positiveBackgroundColor = nil;
|
||||
static UIColor *neutralBackgroundColor = nil;
|
||||
static UIColor *negativeBackgroundColor = nil;
|
||||
static UIColor *blueBackgroundColor = nil;
|
||||
|
||||
@implementation UnreadCountView
|
||||
|
||||
@synthesize appDelegate;
|
||||
@synthesize psWidth, psPadding, ntWidth, ntPadding;
|
||||
@synthesize psCount, ntCount;
|
||||
@synthesize psCount, ntCount, blueCount;
|
||||
@synthesize rect;
|
||||
|
||||
+ (void) initialize {
|
||||
|
@ -33,9 +34,11 @@ static UIColor *negativeBackgroundColor = nil;
|
|||
UIColor *ps = UIColorFromRGB(0x3B7613);
|
||||
UIColor *nt = UIColorFromRGB(0xF9C72A);
|
||||
UIColor *ng = UIColorFromRGB(0xCC2A2E);
|
||||
UIColor *blue = UIColorFromRGB(0x11448B);
|
||||
positiveBackgroundColor = ps;
|
||||
neutralBackgroundColor = nt;
|
||||
negativeBackgroundColor = ng;
|
||||
blueBackgroundColor = blue;
|
||||
// UIColor *psGrad = UIColorFromRGB(0x559F4D);
|
||||
// UIColor *ntGrad = UIColorFromRGB(0xE4AB00);
|
||||
// UIColor *ngGrad = UIColorFromRGB(0x9B181B);
|
||||
|
@ -66,8 +69,12 @@ static UIColor *negativeBackgroundColor = nil;
|
|||
int psOffset = ps == 0 ? 0 : psWidth - 20;
|
||||
int ntOffset = nt == 0 ? 0 : ntWidth - 20;
|
||||
|
||||
if (ps > 0) {
|
||||
[positiveBackgroundColor set];
|
||||
if (ps > 0 || blueCount) {
|
||||
if (blueCount) {
|
||||
[blueBackgroundColor set];
|
||||
} else {
|
||||
[positiveBackgroundColor set];
|
||||
}
|
||||
CGRect rr;
|
||||
|
||||
if (listType == NBFeedListSocial) {
|
||||
|
@ -77,7 +84,7 @@ static UIColor *negativeBackgroundColor = nil;
|
|||
rr = CGRectMake(rect.size.width + rect.origin.x - psOffset, 10, psWidth, 17);
|
||||
}
|
||||
} else if (listType == NBFeedListFolder) {
|
||||
rr = CGRectMake(rect.size.width + rect.origin.x - psOffset - 22, 5, psWidth, 17);
|
||||
rr = CGRectMake(rect.size.width + rect.origin.x - psOffset - 22, 7, psWidth, 17);
|
||||
} else {
|
||||
rr = CGRectMake(rect.size.width + rect.origin.x - psOffset, 7, psWidth, 17);
|
||||
}
|
||||
|
@ -106,7 +113,7 @@ static UIColor *negativeBackgroundColor = nil;
|
|||
rr = CGRectMake(rect.size.width + rect.origin.x - psWidth - psPadding - ntOffset, 10, ntWidth, 17);
|
||||
}
|
||||
} else if (listType == NBFeedListFolder) {
|
||||
rr = CGRectMake(rect.size.width + rect.origin.x - psWidth - psPadding - ntOffset - 22, 5, ntWidth, 17);
|
||||
rr = CGRectMake(rect.size.width + rect.origin.x - psWidth - psPadding - ntOffset - 22, 7, ntWidth, 17);
|
||||
} else {
|
||||
rr = CGRectMake(rect.size.width + rect.origin.x - psWidth - psPadding - ntOffset, 7, ntWidth, 17);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<key>application-identifier</key>
|
||||
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
|
||||
<key>get-task-allow</key>
|
||||
<true/>
|
||||
<false/>
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
|
||||
|
|
|
@ -49,11 +49,11 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.5</string>
|
||||
<string>1.7</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.5</string>
|
||||
<string>1.7</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSMainNibFile</key>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<key>kind</key>
|
||||
<string>software-package</string>
|
||||
<key>url</key>
|
||||
<string>http://www.newsblur.com/media/ios/NewsBlur.ipa</string>
|
||||
<string>http://www.newsblur.com/ios/NewsBlur.ipa</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>kind</key>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<key>bundle-identifier</key>
|
||||
<string>com.newsblur.NewsBlur</string>
|
||||
<key>bundle-version</key>
|
||||
<string>1.5</string>
|
||||
<string>1.7</string>
|
||||
<key>kind</key>
|
||||
<string>software</string>
|
||||
<key>title</key>
|
||||
|
|
|
@ -360,6 +360,10 @@
|
|||
FF2D8CE514893BC000057B80 /* MoveSiteViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FF2D8CE314893BBF00057B80 /* MoveSiteViewController.m */; };
|
||||
FF41309D162CEC7100DDB6A7 /* time.png in Resources */ = {isa = PBXBuildFile; fileRef = FF41309C162CEC7100DDB6A7 /* time.png */; };
|
||||
FF4130A0162CECAE00DDB6A7 /* email.png in Resources */ = {isa = PBXBuildFile; fileRef = FF41309F162CECAE00DDB6A7 /* email.png */; };
|
||||
FF4130A3162E10CF00DDB6A7 /* MenuTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = FF4130A2162E10CF00DDB6A7 /* MenuTableViewCell.m */; };
|
||||
FF4130A5162F3AA900DDB6A7 /* clock.png in Resources */ = {isa = PBXBuildFile; fileRef = FF4130A4162F3AA900DDB6A7 /* clock.png */; };
|
||||
FF4130A9162F3BD300DDB6A7 /* clock_white.png in Resources */ = {isa = PBXBuildFile; fileRef = FF4130A8162F3BD300DDB6A7 /* clock_white.png */; };
|
||||
FF4130AB162F3C2F00DDB6A7 /* archive_white.png in Resources */ = {isa = PBXBuildFile; fileRef = FF4130AA162F3C2F00DDB6A7 /* archive_white.png */; };
|
||||
FF546DF71602930100948020 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FF546DF61602930100948020 /* Default-568h@2x.png */; };
|
||||
FF546DF9160298E500948020 /* fleuron@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FF546DF8160298E500948020 /* fleuron@2x.png */; };
|
||||
FF5EA47F143B691000B7563D /* AddSiteViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FF5EA47D143B691000B7563D /* AddSiteViewController.m */; };
|
||||
|
@ -520,7 +524,6 @@
|
|||
43A4C3CF15B00966008787B5 /* PullToRefreshView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PullToRefreshView.m; path = "Other Sources/PullToRefreshView.m"; sourceTree = "<group>"; };
|
||||
43A4C3D015B00966008787B5 /* StringHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringHelper.h; path = "Other Sources/StringHelper.h"; sourceTree = "<group>"; };
|
||||
43A4C3D115B00966008787B5 /* StringHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = StringHelper.m; path = "Other Sources/StringHelper.m"; sourceTree = "<group>"; };
|
||||
43A4C3D215B00966008787B5 /* TestFlight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestFlight.h; path = "Other Sources/TestFlight.h"; sourceTree = "<group>"; };
|
||||
43A4C3D315B00966008787B5 /* TransparentToolbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TransparentToolbar.h; path = "Other Sources/TransparentToolbar.h"; sourceTree = "<group>"; };
|
||||
43A4C3D415B00966008787B5 /* TransparentToolbar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TransparentToolbar.m; path = "Other Sources/TransparentToolbar.m"; sourceTree = "<group>"; };
|
||||
43A4C3D515B00966008787B5 /* UIView+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIView+TKCategory.h"; path = "Other Sources/UIView+TKCategory.h"; sourceTree = "<group>"; };
|
||||
|
@ -883,6 +886,11 @@
|
|||
FF2D8CE314893BBF00057B80 /* MoveSiteViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MoveSiteViewController.m; sourceTree = "<group>"; };
|
||||
FF41309C162CEC7100DDB6A7 /* time.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = time.png; sourceTree = "<group>"; };
|
||||
FF41309F162CECAE00DDB6A7 /* email.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = email.png; sourceTree = "<group>"; };
|
||||
FF4130A1162E10CF00DDB6A7 /* MenuTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuTableViewCell.h; sourceTree = "<group>"; };
|
||||
FF4130A2162E10CF00DDB6A7 /* MenuTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuTableViewCell.m; sourceTree = "<group>"; };
|
||||
FF4130A4162F3AA900DDB6A7 /* clock.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = clock.png; sourceTree = "<group>"; };
|
||||
FF4130A8162F3BD300DDB6A7 /* clock_white.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = clock_white.png; sourceTree = "<group>"; };
|
||||
FF4130AA162F3C2F00DDB6A7 /* archive_white.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = archive_white.png; sourceTree = "<group>"; };
|
||||
FF546DF61602930100948020 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
|
||||
FF546DF8160298E500948020 /* fleuron@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "fleuron@2x.png"; sourceTree = "<group>"; };
|
||||
FF5EA47C143B691000B7563D /* AddSiteViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddSiteViewController.h; sourceTree = "<group>"; };
|
||||
|
@ -1012,7 +1020,6 @@
|
|||
43A4C3CF15B00966008787B5 /* PullToRefreshView.m */,
|
||||
43A4C3D015B00966008787B5 /* StringHelper.h */,
|
||||
43A4C3D115B00966008787B5 /* StringHelper.m */,
|
||||
43A4C3D215B00966008787B5 /* TestFlight.h */,
|
||||
43A4C3D315B00966008787B5 /* TransparentToolbar.h */,
|
||||
43A4C3D415B00966008787B5 /* TransparentToolbar.m */,
|
||||
43A4C3D515B00966008787B5 /* UIView+TKCategory.h */,
|
||||
|
@ -1172,6 +1179,9 @@
|
|||
431B857615A132B600DCE497 /* Images */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FF4130AA162F3C2F00DDB6A7 /* archive_white.png */,
|
||||
FF4130A8162F3BD300DDB6A7 /* clock_white.png */,
|
||||
FF4130A4162F3AA900DDB6A7 /* clock.png */,
|
||||
FF41309F162CECAE00DDB6A7 /* email.png */,
|
||||
FF41309C162CEC7100DDB6A7 /* time.png */,
|
||||
FF5F3A8A162B8390008DBE3E /* car.png */,
|
||||
|
@ -1484,6 +1494,8 @@
|
|||
43D8189F15B9404D00733444 /* Models */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FF4130A1162E10CF00DDB6A7 /* MenuTableViewCell.h */,
|
||||
FF4130A2162E10CF00DDB6A7 /* MenuTableViewCell.m */,
|
||||
);
|
||||
name = Models;
|
||||
sourceTree = "<group>";
|
||||
|
@ -2163,6 +2175,9 @@
|
|||
FF5F3A8B162B8390008DBE3E /* car.png in Resources */,
|
||||
FF41309D162CEC7100DDB6A7 /* time.png in Resources */,
|
||||
FF4130A0162CECAE00DDB6A7 /* email.png in Resources */,
|
||||
FF4130A5162F3AA900DDB6A7 /* clock.png in Resources */,
|
||||
FF4130A9162F3BD300DDB6A7 /* clock_white.png in Resources */,
|
||||
FF4130AB162F3C2F00DDB6A7 /* archive_white.png in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -2311,6 +2326,7 @@
|
|||
FFDE35CC161B8F870034BFDE /* FolderTitleView.m in Sources */,
|
||||
FFDE35DA161D12250034BFDE /* UnreadCountView.m in Sources */,
|
||||
FFDE35EA162799B90034BFDE /* FeedDetailMenuViewController.m in Sources */,
|
||||
FF4130A3162E10CF00DDB6A7 /* MenuTableViewCell.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -2321,14 +2337,11 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ARCHS = (
|
||||
armv6,
|
||||
"$(ARCHS_STANDARD_32_BIT)",
|
||||
);
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Entitlements.entitlements;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer: Samuel Clay (G9HFWP68T7)";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_IDENTITY = "iPhone Distribution: NewsBlur, Inc.";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: NewsBlur, Inc.";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
|
@ -2350,9 +2363,10 @@
|
|||
"-ObjC",
|
||||
);
|
||||
PRODUCT_NAME = NewsBlur;
|
||||
PROVISIONING_PROFILE = "";
|
||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
|
||||
PROVISIONING_PROFILE = "EE8BC292-FFF2-41A0-AE29-C4B39D6A2C5A";
|
||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "EE8BC292-FFF2-41A0-AE29-C4B39D6A2C5A";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALID_ARCHS = armv7;
|
||||
"WARNING_CFLAGS[arch=*]" = "-Wall";
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -2361,13 +2375,10 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = (
|
||||
armv6,
|
||||
"$(ARCHS_STANDARD_32_BIT)",
|
||||
);
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Entitlements.entitlements;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer: Samuel Clay (G9HFWP68T7)";
|
||||
CODE_SIGN_IDENTITY = "iPhone Distribution: NewsBlur, Inc.";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: NewsBlur, Inc.";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
|
@ -2387,10 +2398,11 @@
|
|||
"-all_load",
|
||||
);
|
||||
PRODUCT_NAME = NewsBlur;
|
||||
PROVISIONING_PROFILE = "";
|
||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "3674B4BA-9006-4099-A608-673EC3103906";
|
||||
PROVISIONING_PROFILE = "EE8BC292-FFF2-41A0-AE29-C4B39D6A2C5A";
|
||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "EE8BC292-FFF2-41A0-AE29-C4B39D6A2C5A";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VALID_ARCHS = armv7;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -2398,8 +2410,8 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
CODE_SIGN_IDENTITY = "iPhone Distribution: Samuel Clay";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Samuel Clay";
|
||||
CODE_SIGN_IDENTITY = "iPhone Distribution";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = "compiler-default";
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
|
@ -2407,11 +2419,12 @@
|
|||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/**";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PROVISIONING_PROFILE = "382118CB-42EB-4479-93DB-9963EFFA6DDD";
|
||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "382118CB-42EB-4479-93DB-9963EFFA6DDD";
|
||||
PROVISIONING_PROFILE = "";
|
||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
SDKROOT = iphoneos;
|
||||
STRIP_INSTALLED_PRODUCT = NO;
|
||||
VALID_ARCHS = armv7;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -2419,8 +2432,8 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
CODE_SIGN_IDENTITY = "iPhone Distribution: Samuel Clay";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Samuel Clay";
|
||||
CODE_SIGN_IDENTITY = "iPhone Distribution";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = "compiler-default";
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
|
@ -2429,10 +2442,11 @@
|
|||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PROVISIONING_PROFILE = "382118CB-42EB-4479-93DB-9963EFFA6DDD";
|
||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "382118CB-42EB-4479-93DB-9963EFFA6DDD";
|
||||
PROVISIONING_PROFILE = "";
|
||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
|
||||
SDKROOT = iphoneos;
|
||||
STRIP_INSTALLED_PRODUCT = NO;
|
||||
VALID_ARCHS = armv7;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
|
|
@ -2,21 +2,6 @@
|
|||
<Bucket
|
||||
type = "1"
|
||||
version = "1.0">
|
||||
<FileBreakpoints>
|
||||
<FileBreakpoint
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Classes/NewsBlurViewController.m"
|
||||
timestampString = "371953230.901928"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "600"
|
||||
endingLineNumber = "600"
|
||||
landmarkName = "-switchSitesUnread"
|
||||
landmarkType = "5">
|
||||
</FileBreakpoint>
|
||||
</FileBreakpoints>
|
||||
<SymbolicBreakpoints>
|
||||
<SymbolicBreakpoint
|
||||
shouldBeEnabled = "Yes"
|
||||
|
|