Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion WordPress/Classes/Services/AccountService.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#import <Foundation/Foundation.h>
#import "LocalCoreDataService.h"

NS_ASSUME_NONNULL_BEGIN

@class WPAccount, Blog;

extern NSString *const WPAccountDefaultWordPressComAccountChangedNotification;
Expand All @@ -21,7 +23,7 @@ extern NSString *const WPAccountEmailAndDefaultBlogUpdatedNotification;
@see setDefaultWordPressComAccount:
@see removeDefaultWordPressComAccount
*/
- (WPAccount *)defaultWordPressComAccount;
- (nullable WPAccount *)defaultWordPressComAccount;

/**
Sets the default WordPress.com account
Expand Down Expand Up @@ -93,3 +95,5 @@ extern NSString *const WPAccountEmailAndDefaultBlogUpdatedNotification;
- (void)setVisibility:(BOOL)visible forBlogs:(NSArray *)blogs;

@end

NS_ASSUME_NONNULL_END
10 changes: 6 additions & 4 deletions WordPress/Classes/ViewRelated/Reader/ReaderPostCardCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,14 @@ import Foundation
requestURL = NSURL(string: sslURL)!
}

let request = NSMutableURLRequest(URL: requestURL)

let acctServ = AccountService(managedObjectContext: ContextManager.sharedInstance().mainContext)
let token = acctServ.defaultWordPressComAccount().authToken
let request = NSMutableURLRequest(URL: requestURL)
let headerValue = String(format: "Bearer %@", token)
request.addValue(headerValue, forHTTPHeaderField: "Authorization")
if let account = acctServ.defaultWordPressComAccount() {
let token = account.authToken
let headerValue = String(format: "Bearer %@", token)
request.addValue(headerValue, forHTTPHeaderField: "Authorization")
}

return request
}
Expand Down