mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
iOS: tweaked #755 (sharing extension)
Just needed a tweak to the request URL. Seems to be working now.
This commit is contained in:
parent
4a9d604293
commit
3670f88acf
2 changed files with 8 additions and 6 deletions
|
@ -2669,7 +2669,7 @@
|
|||
29B97313FDCFA39411CA2CEA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0910;
|
||||
LastUpgradeCheck = 0940;
|
||||
ORGANIZATIONNAME = NewsBlur;
|
||||
TargetAttributes = {
|
||||
1749390F1C251BFE003D98AA = {
|
||||
|
@ -3574,7 +3574,6 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
|
@ -3620,7 +3619,6 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
- (void)didSelectPost {
|
||||
NSItemProvider *itemProvider = [self providerWithURL];
|
||||
|
||||
NSLog(@"ShareExt: didSelectPost");
|
||||
|
||||
if (itemProvider) {
|
||||
[itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeURL options:nil completionHandler:^(NSURL *item, NSError * _Null_unspecified error) {
|
||||
if (item) {
|
||||
|
@ -76,7 +78,7 @@
|
|||
- (void)sendURL:(NSURL *)url orText:(NSString *)text {
|
||||
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.newsblur.NewsBlur-Group"];
|
||||
NSString *host = [defaults objectForKey:@"share:host"];
|
||||
// NSString *token = [defaults objectForKey:@"share:token"];
|
||||
NSString *token = [defaults objectForKey:@"share:token"];
|
||||
NSString *comments = self.contentText;
|
||||
|
||||
if (text && [comments isEqualToString:text]) {
|
||||
|
@ -91,13 +93,15 @@
|
|||
NSURLSession *mySession = [self configureMySession];
|
||||
// NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://%@/api/add_site_load_script/%@/?url=%@&time=%@&comments=%@", host, token, encodedURL, @(time), encodedComments]];
|
||||
// NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://%@/api/share_story/%@", host, token]];
|
||||
NSURL *requestURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://%@/api/share_story", host]];
|
||||
NSURL *requestURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/api/share_story/%@", host, token]];
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:requestURL];
|
||||
request.HTTPMethod = @"POST";
|
||||
NSString *postBody = [NSString stringWithFormat:@"story_url=%@&title=&content=%@&comments=%@", encodedURL, encodedContent, encodedComments];
|
||||
request.HTTPBody = [postBody dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSURLSessionTask *myTask = [mySession dataTaskWithRequest:request];
|
||||
[myTask resume];
|
||||
|
||||
NSLog(@"ShareExt: sendURL %@ or text %@ to %@ with body %@", url, text, requestURL, postBody);
|
||||
}
|
||||
|
||||
- (NSURLSession *)configureMySession {
|
||||
|
@ -115,7 +119,7 @@
|
|||
//}
|
||||
|
||||
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(nullable NSError *)error {
|
||||
|
||||
NSLog(@"URLSession completed with error: %@", error); // log
|
||||
}
|
||||
|
||||
- (NSArray *)configurationItems {
|
||||
|
|
Loading…
Add table
Reference in a new issue