mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
iOS: done #813 (custom domain)
This commit is contained in:
parent
b7d6611e05
commit
c8d22f4594
27 changed files with 170 additions and 82 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#import "ActivityCell.h"
|
||||
#import "UIImageView+AFNetworking.h"
|
||||
#import "NewsBlurAppDelegate.h"
|
||||
|
||||
@implementation ActivityCell
|
||||
|
||||
|
@ -108,8 +109,16 @@
|
|||
feedId = [activity objectForKey:@"story_feed_id"];
|
||||
}
|
||||
if (feedId && [feedId class] != [NSNull class]) {
|
||||
NSString *url = [NewsBlurAppDelegate sharedAppDelegate].url;
|
||||
|
||||
if ([url isEqualToString:DEFAULT_NEWSBLUR_URL]) {
|
||||
url = DEFAULT_ICONS_HOST;
|
||||
} else {
|
||||
url = [url stringByAppendingPathComponent:@"rss_feeds/icon"];
|
||||
}
|
||||
|
||||
NSString *faviconUrl = [NSString stringWithFormat:@"%@/%i",
|
||||
ICONS_HOST,
|
||||
url,
|
||||
[feedId intValue]];
|
||||
[self.faviconView setImageWithURL:[NSURL URLWithString:faviconUrl]
|
||||
placeholderImage:nil];
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
NSString *urlString = [NSString stringWithFormat:@
|
||||
"%@/social/activities?user_id=%@&page=%i&limit=10"
|
||||
"&category=signup&category=star&category=feedsub&category=follow&category=comment_reply&category=comment_like&category=sharedstory",
|
||||
NEWSBLUR_URL,
|
||||
self.appDelegate.url,
|
||||
[appDelegate.dictSocialProfile objectForKey:@"user_id"],
|
||||
page];
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@
|
|||
|
||||
[self.siteActivityIndicator startAnimating];
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/rss_feeds/feed_autocomplete?term=%@&v=2",
|
||||
NEWSBLUR_URL, [phrase stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
||||
self.appDelegate.url, [phrase stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIHTTPRequest requestWithURL:url];
|
||||
[request setDelegate:self];
|
||||
|
@ -275,7 +275,7 @@
|
|||
[self.errorLabel setHidden:YES];
|
||||
[self.activityIndicator startAnimating];
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/add_url",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
NSString *parent_folder = [self extractParentFolder];
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
} else if ([type isEqualToString:@"appdotnet"]) {
|
||||
self.navigationItem.title = @"App.net";
|
||||
}
|
||||
NSString *urlAddress = [NSString stringWithFormat:@"%@%@", NEWSBLUR_URL, url];
|
||||
NSString *urlAddress = [NSString stringWithFormat:@"%@%@", self.appDelegate.url, url];
|
||||
NSURL *fullUrl = [NSURL URLWithString:urlAddress];
|
||||
NSURLRequest *requestObj = [NSURLRequest requestWithURL:fullUrl];
|
||||
[self.webView loadRequest:requestObj];
|
||||
|
@ -86,7 +86,7 @@
|
|||
NSLog(@"URL STRING IS %@", URLString);
|
||||
|
||||
// Look at the host & path to cope with http:// or https:// schemes
|
||||
if ([request.URL.host isEqualToString:NEWSBLUR_HOST] && [request.URL.path isEqualToString:@"/"]) {
|
||||
if ([request.URL.host isEqualToString:self.appDelegate.host] && [request.URL.path isEqualToString:@"/"]) {
|
||||
NSString *error = [self.webView stringByEvaluatingJavaScriptFromString:@"NEWSBLUR.error"];
|
||||
|
||||
if (self.fromStory) {
|
||||
|
@ -124,7 +124,7 @@
|
|||
}
|
||||
|
||||
// // for failed google reader authorization
|
||||
// if ([URLString hasPrefix:[NSString stringWithFormat:@"%@/import/callback", NEWSBLUR_URL]]) {
|
||||
// if ([URLString hasPrefix:[NSString stringWithFormat:@"%@/import/callback", self.appDelegate.url]]) {
|
||||
// [self.navigationController popViewControllerAnimated:YES];
|
||||
// [appDelegate.firstTimeUserAddSitesViewController importFromGoogleReaderFailed];
|
||||
// return NO;
|
||||
|
|
|
@ -668,23 +668,23 @@
|
|||
|
||||
if (storiesCollection.isSocialView) {
|
||||
theFeedDetailURL = [NSString stringWithFormat:@"%@/social/stories/%@/?page=%d",
|
||||
NEWSBLUR_URL,
|
||||
self.appDelegate.url,
|
||||
[storiesCollection.activeFeed objectForKey:@"user_id"],
|
||||
storiesCollection.feedPage];
|
||||
} else if (storiesCollection.isSavedView) {
|
||||
theFeedDetailURL = [NSString stringWithFormat:
|
||||
@"%@/reader/starred_stories/?page=%d&v=2&tag=%@",
|
||||
NEWSBLUR_URL,
|
||||
self.appDelegate.url,
|
||||
storiesCollection.feedPage,
|
||||
[storiesCollection.activeSavedStoryTag urlEncode]];
|
||||
} else if (storiesCollection.isReadView) {
|
||||
theFeedDetailURL = [NSString stringWithFormat:
|
||||
@"%@/reader/read_stories/?page=%d&v=2",
|
||||
NEWSBLUR_URL,
|
||||
self.appDelegate.url,
|
||||
storiesCollection.feedPage];
|
||||
} else {
|
||||
theFeedDetailURL = [NSString stringWithFormat:@"%@/reader/feed/%@/?include_hidden=true&page=%d",
|
||||
NEWSBLUR_URL,
|
||||
self.appDelegate.url,
|
||||
[storiesCollection.activeFeed objectForKey:@"id"],
|
||||
storiesCollection.feedPage];
|
||||
}
|
||||
|
@ -874,24 +874,24 @@
|
|||
if ([storiesCollection.activeFolder isEqualToString:@"river_global"]) {
|
||||
theFeedDetailURL = [NSString stringWithFormat:
|
||||
@"%@/social/river_stories/?global_feed=true&page=%d",
|
||||
NEWSBLUR_URL,
|
||||
self.appDelegate.url,
|
||||
storiesCollection.feedPage];
|
||||
|
||||
} else {
|
||||
theFeedDetailURL = [NSString stringWithFormat:
|
||||
@"%@/social/river_stories/?page=%d",
|
||||
NEWSBLUR_URL,
|
||||
self.appDelegate.url,
|
||||
storiesCollection.feedPage];
|
||||
}
|
||||
} else if (storiesCollection.isSavedView) {
|
||||
theFeedDetailURL = [NSString stringWithFormat:
|
||||
@"%@/reader/starred_stories/?page=%d&v=2",
|
||||
NEWSBLUR_URL,
|
||||
self.appDelegate.url,
|
||||
storiesCollection.feedPage];
|
||||
} else if (storiesCollection.isReadView) {
|
||||
theFeedDetailURL = [NSString stringWithFormat:
|
||||
@"%@/reader/read_stories/?page=%d&v=2",
|
||||
NEWSBLUR_URL,
|
||||
self.appDelegate.url,
|
||||
storiesCollection.feedPage];
|
||||
} else {
|
||||
NSString *feeds = @"";
|
||||
|
@ -902,7 +902,7 @@
|
|||
}
|
||||
theFeedDetailURL = [NSString stringWithFormat:
|
||||
@"%@/reader/river_stories/?include_hidden=true&f=%@&page=%d",
|
||||
NEWSBLUR_URL,
|
||||
self.appDelegate.url,
|
||||
feeds,
|
||||
storiesCollection.feedPage];
|
||||
}
|
||||
|
@ -956,7 +956,7 @@
|
|||
if (request.isCancelled) {
|
||||
NSLog(@"Cancelled");
|
||||
return;
|
||||
} else if ([request responseStatusCode] >= 500) {
|
||||
} else if ([request responseStatusCode] >= 500 || [request responseStatusCode] == 404) {
|
||||
self.isOnline = NO;
|
||||
self.isShowingFetching = NO;
|
||||
// storiesCollection.feedPage = 1;
|
||||
|
@ -1780,7 +1780,7 @@ didEndSwipingSwipingWithState:(MCSwipeTableViewCellState)state
|
|||
|
||||
- (void)markFeedsReadFromTimestamp:(NSInteger)cutoffTimestamp andOlder:(BOOL)older {
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/mark_feed_as_read",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
NSMutableArray *feedIds = [NSMutableArray array];
|
||||
|
@ -1923,9 +1923,9 @@ didEndSwipingSwipingWithState:(MCSwipeTableViewCellState)state
|
|||
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
||||
HUD.labelText = @"Renaming...";
|
||||
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/rename_feed", NEWSBLUR_URL];
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/rename_feed", self.appDelegate.url];
|
||||
if (storiesCollection.isRiverView) {
|
||||
urlString = [NSString stringWithFormat:@"%@/reader/rename_folder", NEWSBLUR_URL];
|
||||
urlString = [NSString stringWithFormat:@"%@/reader/rename_folder", self.appDelegate.url];
|
||||
}
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
|
||||
|
@ -1968,7 +1968,7 @@ didEndSwipingSwipingWithState:(MCSwipeTableViewCellState)state
|
|||
HUD.labelText = @"Deleting...";
|
||||
|
||||
NSString *theFeedDetailURL = [NSString stringWithFormat:@"%@/reader/delete_feed",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *urlFeedDetail = [NSURL URLWithString:theFeedDetailURL];
|
||||
|
||||
__block ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:urlFeedDetail];
|
||||
|
@ -1995,7 +1995,7 @@ didEndSwipingSwipingWithState:(MCSwipeTableViewCellState)state
|
|||
HUD.labelText = @"Deleting...";
|
||||
|
||||
NSString *theFeedDetailURL = [NSString stringWithFormat:@"%@/reader/delete_folder",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *urlFeedDetail = [NSURL URLWithString:theFeedDetailURL];
|
||||
|
||||
__block ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:urlFeedDetail];
|
||||
|
@ -2145,7 +2145,7 @@ didEndSwipingSwipingWithState:(MCSwipeTableViewCellState)state
|
|||
- (void)instafetchFeed {
|
||||
NSString *urlString = [NSString
|
||||
stringWithFormat:@"%@/reader/refresh_feed/%@",
|
||||
NEWSBLUR_URL,
|
||||
self.appDelegate.url,
|
||||
[storiesCollection.activeFeed objectForKey:@"id"]];
|
||||
[self cancelRequests];
|
||||
ASIHTTPRequest *request = [self requestWithURL:urlString];
|
||||
|
@ -2197,7 +2197,7 @@ didEndSwipingSwipingWithState:(MCSwipeTableViewCellState)state
|
|||
NSString *feedIdsQuery = [NSString stringWithFormat:@"?feed_ids=%@",
|
||||
[[keys valueForKey:@"description"] componentsJoinedByString:@"&feed_ids="]];
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/favicons%@",
|
||||
NEWSBLUR_URL,
|
||||
self.appDelegate.url,
|
||||
feedIdsQuery];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
}
|
||||
if (buttonIndex == 1) {
|
||||
NSString *urlS = [NSString stringWithFormat:@"%@/reader/login_as?user=%@",
|
||||
NEWSBLUR_URL, alertTextField.text];
|
||||
self.appDelegate.url, alertTextField.text];
|
||||
NSURL *url = [NSURL URLWithString:urlS];
|
||||
|
||||
__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
|
||||
- (void)connectToSocial {
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/social/load_user_friends",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
|
||||
[request setValidatesSecureCertificate:NO];
|
||||
|
@ -199,7 +199,7 @@
|
|||
|
||||
NSURL *preferenceURL = [NSURL URLWithString:
|
||||
[NSString stringWithFormat:@"%@/profile/set_preference",
|
||||
NEWSBLUR_URL]];
|
||||
self.appDelegate.url]];
|
||||
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:preferenceURL];
|
||||
[[NSHTTPCookieStorage sharedHTTPCookieStorage]
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
|
||||
- (void)addPopular {
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/social/follow/",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
|
||||
|
@ -124,7 +124,7 @@
|
|||
|
||||
- (void)addSite:(NSString *)siteUrl {
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/add_url/",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
|
||||
if (self.selectedCategories_.count) {
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/categories/subscribe",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
|
||||
|
@ -162,7 +162,7 @@
|
|||
[self.googleReaderButton addSubview:self.activityIndicator];
|
||||
[self.activityIndicator startAnimating];
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/import/import_from_google_reader/",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
[request setPostValue:@"true" forKey:@"auto_active"];
|
||||
|
@ -257,7 +257,7 @@
|
|||
|
||||
- (void)addSite:(NSString *)siteUrl {
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/add_url",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
|
||||
- (void)loadFriendsList:(NSString *)query {
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/social/find_friends?query=%@&limit=10",
|
||||
NEWSBLUR_URL,
|
||||
self.appDelegate.url,
|
||||
query];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
|
||||
|
@ -131,7 +131,7 @@
|
|||
|
||||
- (void)loadSuggestedFriendsList {
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/social/load_user_friends",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
|
||||
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
NSString *urlString = [NSString stringWithFormat:@
|
||||
"%@/social/interactions?user_id=%@&page=%i&limit=10"
|
||||
"&category=follow&category=comment_reply&category=comment_like&category=reply_reply&category=story_reshare",
|
||||
NEWSBLUR_URL,
|
||||
self.appDelegate.url,
|
||||
[appDelegate.dictSocialProfile objectForKey:@"user_id"],
|
||||
page];
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@
|
|||
HUD.labelText = @"Authenticating";
|
||||
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/api/login",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
[[NSHTTPCookieStorage sharedHTTPCookieStorage]
|
||||
setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
|
||||
|
@ -234,7 +234,7 @@
|
|||
HUD.labelText = @"Registering...";
|
||||
[self.errorLabel setHidden:YES];
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/api/signup",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
[[NSHTTPCookieStorage sharedHTTPCookieStorage]
|
||||
setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
|
||||
|
|
|
@ -140,7 +140,7 @@
|
|||
[self.errorLabel setHidden:YES];
|
||||
[self.activityIndicator startAnimating];
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/move_feed_to_folder",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
NSString *fromFolder = [appDelegate extractFolderName:[fromFolderInput text]];
|
||||
|
@ -189,7 +189,7 @@
|
|||
[self.errorLabel setHidden:YES];
|
||||
[self.activityIndicator startAnimating];
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/move_folder_to_folder",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
NSString *folderName = [appDelegate extractFolderName:appDelegate.storiesCollection.activeFolder];
|
||||
|
|
|
@ -184,6 +184,9 @@ SFSafariViewControllerDelegate> {
|
|||
@property (nonatomic, readwrite) TMCache *cachedFavicons;
|
||||
@property (nonatomic, readwrite) TMCache *cachedStoryImages;
|
||||
|
||||
@property (nonatomic, readonly) NSString *url;
|
||||
@property (nonatomic, readonly) NSString *host;
|
||||
|
||||
@property (readwrite) NSString * activeUsername;
|
||||
@property (readwrite) NSString * activeUserProfileId;
|
||||
@property (readwrite) NSString * activeUserProfileName;
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
|
||||
@interface NewsBlurAppDelegate () <UIViewControllerTransitioningDelegate>
|
||||
|
||||
@property (nonatomic, strong) NSString *cachedURL;
|
||||
@property (nonatomic, strong) UIApplicationShortcutItem *launchedShortcutItem;
|
||||
@property (nonatomic, strong) SFSafariViewController *safariViewController;
|
||||
|
||||
|
@ -345,7 +346,7 @@
|
|||
}
|
||||
|
||||
- (void)setupReachability {
|
||||
Reachability* reach = [Reachability reachabilityWithHostname:NEWSBLUR_HOST];
|
||||
Reachability* reach = [Reachability reachabilityWithHostname:self.host];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(reachabilityChanged:)
|
||||
name:kReachabilityChangedNotification
|
||||
|
@ -362,7 +363,7 @@
|
|||
|
||||
- (void)reachabilityChanged:(id)something {
|
||||
NSLog(@"Reachability changed: %@", something);
|
||||
// Reachability* reach = [Reachability reachabilityWithHostname:NEWSBLUR_HOST];
|
||||
// Reachability* reach = [Reachability reachabilityWithHostname:self.host];
|
||||
|
||||
// if (reach.isReachable && feedsViewController.isOffline) {
|
||||
// [feedsViewController loadOfflineFeeds:NO];
|
||||
|
@ -371,6 +372,36 @@
|
|||
// }
|
||||
}
|
||||
|
||||
- (NSString *)url {
|
||||
if (!self.cachedURL) {
|
||||
NSString *url = [[NSUserDefaults standardUserDefaults] objectForKey:@"custom_domain"];
|
||||
|
||||
if (url.length) {
|
||||
if ([url rangeOfString:@"://"].location == NSNotFound) {
|
||||
url = [@"http://" stringByAppendingString:url];
|
||||
}
|
||||
} else {
|
||||
url = DEFAULT_NEWSBLUR_URL;
|
||||
}
|
||||
|
||||
self.cachedURL = url;
|
||||
}
|
||||
|
||||
return self.cachedURL;
|
||||
}
|
||||
|
||||
- (NSString *)host {
|
||||
NSString *url = self.url;
|
||||
NSString *host = nil;
|
||||
NSRange range = [url rangeOfString:@"://"];
|
||||
|
||||
if (url.length && range.location != NSNotFound) {
|
||||
host = [url substringFromIndex:range.location + range.length];
|
||||
}
|
||||
|
||||
return host;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Social Views
|
||||
|
||||
|
@ -1027,7 +1058,7 @@
|
|||
|
||||
- (void)refreshUserProfile:(void(^)())callback {
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/social/load_user_profile",
|
||||
NEWSBLUR_URL]];
|
||||
self.url]];
|
||||
ASIHTTPRequest *_request = [ASIHTTPRequest requestWithURL:url];
|
||||
__weak ASIHTTPRequest *request = _request;
|
||||
[request setValidatesSecureCertificate:NO];
|
||||
|
@ -1065,7 +1096,7 @@
|
|||
} else {
|
||||
NSLog(@"Logging out...");
|
||||
NSString *urlS = [NSString stringWithFormat:@"%@/reader/logout?api=1",
|
||||
NEWSBLUR_URL];
|
||||
self.url];
|
||||
NSURL *url = [NSURL URLWithString:urlS];
|
||||
|
||||
__block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
|
||||
|
@ -2513,7 +2544,7 @@
|
|||
[self.trainerViewController refresh];
|
||||
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/classifier/save",
|
||||
NEWSBLUR_URL];
|
||||
self.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
__block ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
__weak ASIFormDataRequest *_request = request;
|
||||
|
@ -2561,7 +2592,7 @@
|
|||
[self.trainerViewController refresh];
|
||||
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/classifier/save",
|
||||
NEWSBLUR_URL];
|
||||
self.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
__block ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
__weak ASIFormDataRequest *_request = request;
|
||||
|
@ -2613,7 +2644,7 @@
|
|||
[self.trainerViewController refresh];
|
||||
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/classifier/save",
|
||||
NEWSBLUR_URL];
|
||||
self.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
__block ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
__weak ASIFormDataRequest *_request = request;
|
||||
|
@ -2659,7 +2690,7 @@
|
|||
[self.trainerViewController refresh];
|
||||
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/classifier/save",
|
||||
NEWSBLUR_URL];
|
||||
self.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
__block ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
__weak ASIFormDataRequest *_request = request;
|
||||
|
@ -2750,7 +2781,7 @@
|
|||
|
||||
NSArray *cachePaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
||||
NSString *dbPath = [cachePaths objectAtIndex:0];
|
||||
NSString *dbName = [NSString stringWithFormat:@"%@.sqlite", NEWSBLUR_HOST];
|
||||
NSString *dbName = [NSString stringWithFormat:@"%@.sqlite", self.host];
|
||||
NSString *path = [dbPath stringByAppendingPathComponent:dbName];
|
||||
[self applicationDocumentsDirectory];
|
||||
|
||||
|
@ -3057,7 +3088,7 @@
|
|||
|
||||
- (void)syncQueuedReadStories:(FMDatabase *)db withStories:(NSDictionary *)hashes withCallback:(void(^)())callback {
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/mark_feed_stories_as_read",
|
||||
NEWSBLUR_URL];
|
||||
self.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
NSMutableArray *completedHashes = [NSMutableArray array];
|
||||
for (NSArray *storyHashes in [hashes allValues]) {
|
||||
|
|
|
@ -394,11 +394,11 @@ static UIFont *userLabelFont;
|
|||
if (self.inPullToRefresh_) {
|
||||
urlFeedList = [NSURL URLWithString:
|
||||
[NSString stringWithFormat:@"%@/reader/feeds?flat=true&update_counts=true",
|
||||
NEWSBLUR_URL]];
|
||||
self.appDelegate.url]];
|
||||
} else {
|
||||
urlFeedList = [NSURL URLWithString:
|
||||
[NSString stringWithFormat:@"%@/reader/feeds?flat=true&update_counts=false",
|
||||
NEWSBLUR_URL]];
|
||||
self.appDelegate.url]];
|
||||
}
|
||||
|
||||
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:urlFeedList];
|
||||
|
@ -1356,7 +1356,7 @@ heightForHeaderInSection:(NSInteger)section {
|
|||
cutoffTimestamp -= (days * 60*60*24);
|
||||
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/mark_feed_as_read",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
for (NSString *feedId in feedIds) {
|
||||
|
@ -1388,7 +1388,7 @@ heightForHeaderInSection:(NSInteger)section {
|
|||
NSArray *feedIds = [appDelegate allFeedIds];
|
||||
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/mark_all_as_read",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
[request setPostValue:[NSNumber numberWithInteger:days]
|
||||
|
@ -1412,7 +1412,7 @@ heightForHeaderInSection:(NSInteger)section {
|
|||
- (void)markVisibleStoriesRead {
|
||||
NSDictionary *feedsStories = [appDelegate markVisibleStoriesRead];
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/mark_feed_stories_as_read",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
[request setPostValue:[feedsStories JSONRepresentation] forKey:@"feeds_stories"];
|
||||
|
@ -1687,7 +1687,7 @@ heightForHeaderInSection:(NSInteger)section {
|
|||
|
||||
- (void)loadFavicons {
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/favicons",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
|
||||
|
||||
|
@ -1778,10 +1778,10 @@ heightForHeaderInSection:(NSInteger)section {
|
|||
NSString *urlString;
|
||||
if (feedId) {
|
||||
urlString = [NSString stringWithFormat:@"%@/reader/feed_unread_count?feed_id=%@",
|
||||
NEWSBLUR_URL, feedId];
|
||||
self.appDelegate.url, feedId];
|
||||
} else {
|
||||
urlString = [NSString stringWithFormat:@"%@/reader/refresh_feeds",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
}
|
||||
NSURL *urlFeedList = [NSURL URLWithString:urlString];
|
||||
|
||||
|
|
|
@ -319,10 +319,10 @@
|
|||
|
||||
if ([self.followButton.currentTitle isEqualToString:@"Follow"]) {
|
||||
urlString = [NSString stringWithFormat:@"%@/social/follow",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
} else {
|
||||
urlString = [NSString stringWithFormat:@"%@/social/unfollow",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
}
|
||||
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
|
|
|
@ -348,7 +348,7 @@
|
|||
- (IBAction)doShareThisStory:(id)sender {
|
||||
[appDelegate.storyPageControl showShareHUD:@"Sharing"];
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/social/share_story",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
|
@ -427,7 +427,7 @@
|
|||
|
||||
// NSLog(@"REPLY TO COMMENT, %@", appDelegate.activeComment);
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/social/save_comment_reply",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
|
||||
NSString *feedIdStr = [NSString stringWithFormat:@"%@", [appDelegate.activeStory objectForKey:@"story_feed_id"]];
|
||||
NSString *storyIdStr = [NSString stringWithFormat:@"%@", [appDelegate.activeStory objectForKey:@"id"]];
|
||||
|
|
|
@ -330,7 +330,7 @@
|
|||
|
||||
- (void)syncStoryAsRead:(NSDictionary *)story {
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/mark_story_hashes_as_read",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
|
||||
|
@ -359,7 +359,7 @@
|
|||
|
||||
- (void)syncStoryAsUnread:(NSDictionary *)story {
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/mark_story_as_unread",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
|
||||
|
@ -710,7 +710,7 @@
|
|||
|
||||
- (void)syncStoryAsSaved:(NSDictionary *)story {
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/mark_story_as_starred",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
|
||||
|
@ -765,7 +765,7 @@
|
|||
|
||||
- (void)syncStoryAsUnsaved:(NSDictionary *)story {
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/reader/mark_story_as_unstarred",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
|
||||
|
|
|
@ -1663,10 +1663,10 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
NSString *urlString;
|
||||
if (likeComment) {
|
||||
urlString = [NSString stringWithFormat:@"%@/social/like_comment",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
} else {
|
||||
urlString = [NSString stringWithFormat:@"%@/social/remove_like_comment",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
}
|
||||
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
|
@ -1985,7 +1985,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
- (void)subscribeToBlurblog {
|
||||
[appDelegate.storyPageControl showShareHUD:@"Following"];
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/social/follow",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
|
@ -2232,7 +2232,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
}
|
||||
|
||||
NSString *urlString = [NSString stringWithFormat:@"%@/rss_feeds/original_text",
|
||||
NEWSBLUR_URL];
|
||||
self.appDelegate.url];
|
||||
ASIFormDataRequest *request = [self formRequestWithURL:urlString];
|
||||
[request addPostValue:[self.activeStory objectForKey:@"id"] forKey:@"story_id"];
|
||||
[request addPostValue:[self.activeStory objectForKey:@"story_feed_id"] forKey:@"feed_id"];
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
NSString *feedId = [self feedId];
|
||||
NSURL *url = [NSURL URLWithString:[NSString
|
||||
stringWithFormat:@"%@/reader/feeds_trainer?feed_id=%@",
|
||||
NEWSBLUR_URL, feedId]];
|
||||
self.appDelegate.url, feedId]];
|
||||
|
||||
__weak __typeof(&*self)weakSelf = self;
|
||||
AFHTTPRequestOperation *request = [[AFHTTPRequestOperation alloc] initWithRequest:[NSURLRequest requestWithURL:url]];
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
NSString *urlString = [NSString stringWithFormat:@
|
||||
"%@/social/profile?user_id=%@"
|
||||
"&category=follow&category=comment_reply&category=comment_like&category=sharedstory",
|
||||
NEWSBLUR_URL,
|
||||
self.appDelegate.url,
|
||||
appDelegate.activeUserProfileId];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
|
||||
[lock lock];
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/reader/river_stories?include_hidden=true&page=0&h=%@",
|
||||
NEWSBLUR_URL, [hashes componentsJoinedByString:@"&h="]]];
|
||||
self.appDelegate.url, [hashes componentsJoinedByString:@"&h="]]];
|
||||
if (request) request = nil;
|
||||
|
||||
request = [[AFHTTPRequestOperation alloc] initWithRequest:[NSURLRequest requestWithURL:url]];
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
NSURL *url = [NSURL URLWithString:[NSString
|
||||
stringWithFormat:@"%@/reader/unread_story_hashes?include_timestamps=true",
|
||||
NEWSBLUR_URL]];
|
||||
self.appDelegate.url]];
|
||||
request = [[AFHTTPRequestOperation alloc] initWithRequest:[NSURLRequest requestWithURL:url]];
|
||||
[request setResponseSerializer:[AFJSONResponseSerializer serializer]];
|
||||
[request setCompletionBlockWithSuccess:^(AFHTTPRequestOperation * _Nonnull operation, id _Nonnull responseObject) {
|
||||
|
|
|
@ -12,19 +12,16 @@
|
|||
|
||||
#ifdef DEBUG
|
||||
#define BACKGROUND_REFRESH_SECONDS -5
|
||||
#define NEWSBLUR_URL [NSString stringWithFormat:@"http://nb.local.com"]
|
||||
#define NEWSBLUR_HOST [NSString stringWithFormat:@"nb.local.com"]
|
||||
#define ICONS_HOST [NSString stringWithFormat:@"http://nb.local.com/rss_feeds/icon"]
|
||||
#define DEFAULT_NEWSBLUR_URL [NSString stringWithFormat:@"http://nb.local.com"]
|
||||
#define DEFAULT_ICONS_HOST [NSString stringWithFormat:@"http://nb.local.com/rss_feeds/icon"]
|
||||
#elif PROD_DEBUG
|
||||
#define BACKGROUND_REFRESH_SECONDS -5
|
||||
#define NEWSBLUR_URL [NSString stringWithFormat:@"http://debug.newsblur.com"]
|
||||
#define NEWSBLUR_HOST [NSString stringWithFormat:@"debug.newsblur.com"]
|
||||
#define ICONS_HOST [NSString stringWithFormat:@"https://s3.amazonaws.com/icons.newsblur.com"]
|
||||
#define DEFAULT_NEWSBLUR_URL [NSString stringWithFormat:@"http://debug.newsblur.com"]
|
||||
#define DEFAULT_ICONS_HOST [NSString stringWithFormat:@"https://s3.amazonaws.com/icons.newsblur.com"]
|
||||
#else
|
||||
#define BACKGROUND_REFRESH_SECONDS -10*60
|
||||
#define NEWSBLUR_URL [NSString stringWithFormat:@"https://www.newsblur.com"]
|
||||
#define NEWSBLUR_HOST [NSString stringWithFormat:@"www.newsblur.com"]
|
||||
#define ICONS_HOST [NSString stringWithFormat:@"https://s3.amazonaws.com/icons.newsblur.com"]
|
||||
#define DEFAULT_NEWSBLUR_URL [NSString stringWithFormat:@"https://www.newsblur.com"]
|
||||
#define DEFAULT_ICONS_HOST [NSString stringWithFormat:@"https://s3.amazonaws.com/icons.newsblur.com"]
|
||||
#endif
|
||||
|
||||
#define _ Underscore
|
||||
|
|
|
@ -600,6 +600,30 @@
|
|||
<key>DefaultValue</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Title</key>
|
||||
<string>Custom Domain</string>
|
||||
<key>FooterText</key>
|
||||
<string>Leave blank to use the NewsBlur site, or enter the URL of your self-hosted NewsBlur installation, e.g. "https://www.domain.com".</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSTextFieldSpecifier</string>
|
||||
<key>KeyboardType</key>
|
||||
<string>URL</string>
|
||||
<key>AutocorrectionType</key>
|
||||
<string>No</string>
|
||||
<key>DefaultValue</key>
|
||||
<string></string>
|
||||
<key>AutocapitalizationType</key>
|
||||
<string>None</string>
|
||||
<key>Title</key>
|
||||
<string>URL</string>
|
||||
<key>Key</key>
|
||||
<string>custom_domain</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>StringsTable</key>
|
||||
<string>Root</string>
|
||||
|
|
|
@ -620,6 +620,30 @@
|
|||
<key>DefaultValue</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Title</key>
|
||||
<string>Custom Domain</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
<key>FooterText</key>
|
||||
<string>Leave blank to use the NewsBlur site, or enter the URL of your self-hosted NewsBlur installation, e.g. "https://www.domain.com".</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSTextFieldSpecifier</string>
|
||||
<key>KeyboardType</key>
|
||||
<string>URL</string>
|
||||
<key>AutocorrectionType</key>
|
||||
<string>No</string>
|
||||
<key>DefaultValue</key>
|
||||
<string></string>
|
||||
<key>AutocapitalizationType</key>
|
||||
<string>None</string>
|
||||
<key>Title</key>
|
||||
<string>URL</string>
|
||||
<key>Key</key>
|
||||
<string>custom_domain</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>StringsTable</key>
|
||||
<string>Root</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue