From d0b70a547eb3ae6a996d1951568ef3669c8d79b5 Mon Sep 17 00:00:00 2001 From: David Sinclair Date: Sat, 28 Mar 2020 20:05:55 -0700 Subject: [PATCH] #1270 (replacing UIWebView with WKWebView) - Disabled unused web views in AFNetworking and InAppSettingsKit. --- .../ios/NewsBlur.xcodeproj/project.pbxproj | 12 -- .../AFNetworking/UIKit+AFNetworking.h | 3 +- .../AFNetworking/UIWebView+AFNetworking.h | 80 --------- .../AFNetworking/UIWebView+AFNetworking.m | 157 ------------------ .../IASKAppSettingsWebViewController.h | 29 ---- .../IASKAppSettingsWebViewController.m | 147 ---------------- .../InAppSettingsKit/Models/IASKSpecifier.m | 6 +- 7 files changed, 6 insertions(+), 428 deletions(-) delete mode 100755 clients/ios/Other Sources/AFNetworking/UIWebView+AFNetworking.h delete mode 100755 clients/ios/Other Sources/AFNetworking/UIWebView+AFNetworking.m delete mode 100755 clients/ios/Other Sources/InAppSettingsKit/Controllers/IASKAppSettingsWebViewController.h delete mode 100755 clients/ios/Other Sources/InAppSettingsKit/Controllers/IASKAppSettingsWebViewController.m diff --git a/clients/ios/NewsBlur.xcodeproj/project.pbxproj b/clients/ios/NewsBlur.xcodeproj/project.pbxproj index 58a2b57712..dea12a3cb7 100755 --- a/clients/ios/NewsBlur.xcodeproj/project.pbxproj +++ b/clients/ios/NewsBlur.xcodeproj/project.pbxproj @@ -335,7 +335,6 @@ FF322235185BC1AA004078AA /* logo_58.png in Resources */ = {isa = PBXBuildFile; fileRef = FF322234185BC1AA004078AA /* logo_58.png */; }; FF322237185BC1CE004078AA /* logo_80.png in Resources */ = {isa = PBXBuildFile; fileRef = FF322236185BC1CE004078AA /* logo_80.png */; }; FF34FD601E9D93CB0062F8ED /* IASKAppSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FF34FD2D1E9D93CB0062F8ED /* IASKAppSettingsViewController.m */; }; - FF34FD611E9D93CB0062F8ED /* IASKAppSettingsWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FF34FD2F1E9D93CB0062F8ED /* IASKAppSettingsWebViewController.m */; }; FF34FD621E9D93CB0062F8ED /* IASKMultipleValueSelection.m in Sources */ = {isa = PBXBuildFile; fileRef = FF34FD311E9D93CB0062F8ED /* IASKMultipleValueSelection.m */; }; FF34FD631E9D93CB0062F8ED /* IASKSpecifierValuesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FF34FD331E9D93CB0062F8ED /* IASKSpecifierValuesViewController.m */; }; FF34FD641E9D93CB0062F8ED /* IASKSettingsReader.m in Sources */ = {isa = PBXBuildFile; fileRef = FF34FD371E9D93CB0062F8ED /* IASKSettingsReader.m */; }; @@ -514,7 +513,6 @@ FFC0E5C01F7AC00A0023B9D9 /* UIImageView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = FFC0E59F1F7ABF4B0023B9D9 /* UIImageView+AFNetworking.m */; }; FFC0E5C31F7AC00A0023B9D9 /* UIProgressView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = FFC0E5A21F7ABF4B0023B9D9 /* UIProgressView+AFNetworking.m */; }; FFC0E5C51F7AC00A0023B9D9 /* UIRefreshControl+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = FFC0E5A41F7ABF4B0023B9D9 /* UIRefreshControl+AFNetworking.m */; }; - FFC0E5C71F7AC00A0023B9D9 /* UIWebView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = FFC0E5A61F7ABF4B0023B9D9 /* UIWebView+AFNetworking.m */; }; FFC486A719CA40B700F4758F /* logo_144.png in Resources */ = {isa = PBXBuildFile; fileRef = FFC486A619CA40B700F4758F /* logo_144.png */; }; FFC486A919CA40DA00F4758F /* logo_72.png in Resources */ = {isa = PBXBuildFile; fileRef = FFC486A819CA40DA00F4758F /* logo_72.png */; }; FFC486AC19CA410000F4758F /* logo_50.png in Resources */ = {isa = PBXBuildFile; fileRef = FFC486AA19CA410000F4758F /* logo_50.png */; }; @@ -1071,8 +1069,6 @@ FF322236185BC1CE004078AA /* logo_80.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo_80.png; sourceTree = ""; }; FF34FD2C1E9D93CB0062F8ED /* IASKAppSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IASKAppSettingsViewController.h; sourceTree = ""; }; FF34FD2D1E9D93CB0062F8ED /* IASKAppSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IASKAppSettingsViewController.m; sourceTree = ""; }; - FF34FD2E1E9D93CB0062F8ED /* IASKAppSettingsWebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IASKAppSettingsWebViewController.h; sourceTree = ""; }; - FF34FD2F1E9D93CB0062F8ED /* IASKAppSettingsWebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IASKAppSettingsWebViewController.m; sourceTree = ""; }; FF34FD301E9D93CB0062F8ED /* IASKMultipleValueSelection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IASKMultipleValueSelection.h; sourceTree = ""; }; FF34FD311E9D93CB0062F8ED /* IASKMultipleValueSelection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IASKMultipleValueSelection.m; sourceTree = ""; }; FF34FD321E9D93CB0062F8ED /* IASKSpecifierValuesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IASKSpecifierValuesViewController.h; sourceTree = ""; }; @@ -1355,8 +1351,6 @@ FFC0E5A21F7ABF4B0023B9D9 /* UIProgressView+AFNetworking.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIProgressView+AFNetworking.m"; sourceTree = ""; }; FFC0E5A31F7ABF4B0023B9D9 /* UIRefreshControl+AFNetworking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIRefreshControl+AFNetworking.h"; sourceTree = ""; }; FFC0E5A41F7ABF4B0023B9D9 /* UIRefreshControl+AFNetworking.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIRefreshControl+AFNetworking.m"; sourceTree = ""; }; - FFC0E5A51F7ABF4B0023B9D9 /* UIWebView+AFNetworking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIWebView+AFNetworking.h"; sourceTree = ""; }; - FFC0E5A61F7ABF4B0023B9D9 /* UIWebView+AFNetworking.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIWebView+AFNetworking.m"; sourceTree = ""; }; FFC486A619CA40B700F4758F /* logo_144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo_144.png; sourceTree = ""; }; FFC486A819CA40DA00F4758F /* logo_72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo_72.png; sourceTree = ""; }; FFC486AA19CA410000F4758F /* logo_50.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo_50.png; sourceTree = ""; }; @@ -2438,8 +2432,6 @@ children = ( FF34FD2C1E9D93CB0062F8ED /* IASKAppSettingsViewController.h */, FF34FD2D1E9D93CB0062F8ED /* IASKAppSettingsViewController.m */, - FF34FD2E1E9D93CB0062F8ED /* IASKAppSettingsWebViewController.h */, - FF34FD2F1E9D93CB0062F8ED /* IASKAppSettingsWebViewController.m */, FF34FD301E9D93CB0062F8ED /* IASKMultipleValueSelection.h */, FF34FD311E9D93CB0062F8ED /* IASKMultipleValueSelection.m */, FF34FD321E9D93CB0062F8ED /* IASKSpecifierValuesViewController.h */, @@ -2664,8 +2656,6 @@ FFC0E5A21F7ABF4B0023B9D9 /* UIProgressView+AFNetworking.m */, FFC0E5A31F7ABF4B0023B9D9 /* UIRefreshControl+AFNetworking.h */, FFC0E5A41F7ABF4B0023B9D9 /* UIRefreshControl+AFNetworking.m */, - FFC0E5A51F7ABF4B0023B9D9 /* UIWebView+AFNetworking.h */, - FFC0E5A61F7ABF4B0023B9D9 /* UIWebView+AFNetworking.m */, ); name = AFNetworking; path = "Other Sources/AFNetworking"; @@ -3375,7 +3365,6 @@ FFC0E5C01F7AC00A0023B9D9 /* UIImageView+AFNetworking.m in Sources */, FFC0E5C31F7AC00A0023B9D9 /* UIProgressView+AFNetworking.m in Sources */, FFC0E5C51F7AC00A0023B9D9 /* UIRefreshControl+AFNetworking.m in Sources */, - FFC0E5C71F7AC00A0023B9D9 /* UIWebView+AFNetworking.m in Sources */, 17EB50601BE46A900021358B /* FontListViewController.m in Sources */, FF0FAEB117B084D2008651F9 /* OfflineCleanImages.m in Sources */, 43F44B1C159D8DBC00F48F8A /* FeedTableCell.m in Sources */, @@ -3444,7 +3433,6 @@ 17432C831C53438D003F8FD6 /* FeedChooserViewController.m in Sources */, 010EDEFA1B2386B7003B79DE /* OnePasswordExtension.m in Sources */, 43ABBCAA15B53A1400EA3111 /* InteractionCell.m in Sources */, - FF34FD611E9D93CB0062F8ED /* IASKAppSettingsWebViewController.m in Sources */, FF8D1ECF1BAA311000725D8A /* SBJson4StreamTokeniser.m in Sources */, FF8D1ED81BAA33BA00725D8A /* NSObject+SBJSON.m in Sources */, FF34FD651E9D93CB0062F8ED /* IASKSettingsStore.m in Sources */, diff --git a/clients/ios/Other Sources/AFNetworking/UIKit+AFNetworking.h b/clients/ios/Other Sources/AFNetworking/UIKit+AFNetworking.h index febacfc755..0839c7e4ed 100755 --- a/clients/ios/Other Sources/AFNetworking/UIKit+AFNetworking.h +++ b/clients/ios/Other Sources/AFNetworking/UIKit+AFNetworking.h @@ -31,7 +31,8 @@ #import "AFImageDownloader.h" #import "AFNetworkActivityIndicatorManager.h" #import "UIRefreshControl+AFNetworking.h" - #import "UIWebView+AFNetworking.h" +// DJS: just disabling this, since it isn't used, rather than updating AFNetworking, to avoid potential incompatibilties. +// #import "UIWebView+AFNetworking.h" #endif #import "UIActivityIndicatorView+AFNetworking.h" diff --git a/clients/ios/Other Sources/AFNetworking/UIWebView+AFNetworking.h b/clients/ios/Other Sources/AFNetworking/UIWebView+AFNetworking.h deleted file mode 100755 index b9a56af4bf..0000000000 --- a/clients/ios/Other Sources/AFNetworking/UIWebView+AFNetworking.h +++ /dev/null @@ -1,80 +0,0 @@ -// UIWebView+AFNetworking.h -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import - -#import - -#if TARGET_OS_IOS - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class AFHTTPSessionManager; - -/** - This category adds methods to the UIKit framework's `UIWebView` class. The methods in this category provide increased control over the request cycle, including progress monitoring and success / failure handling. - - @discussion When using these category methods, make sure to assign `delegate` for the web view, which implements `–webView:shouldStartLoadWithRequest:navigationType:` appropriately. This allows for tapped links to be loaded through AFNetworking, and can ensure that `canGoBack` & `canGoForward` update their values correctly. - */ -@interface UIWebView (AFNetworking) - -/** - The session manager used to download all requests. - */ -@property (nonatomic, strong) AFHTTPSessionManager *sessionManager; - -/** - Asynchronously loads the specified request. - - @param request A URL request identifying the location of the content to load. This must not be `nil`. - @param progress A progress object monitoring the current download progress. - @param success A block object to be executed when the request finishes loading successfully. This block returns the HTML string to be loaded by the web view, and takes two arguments: the response, and the response string. - @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred. - */ -- (void)loadRequest:(NSURLRequest *)request - progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress - success:(nullable NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success - failure:(nullable void (^)(NSError *error))failure; - -/** - Asynchronously loads the data associated with a particular request with a specified MIME type and text encoding. - - @param request A URL request identifying the location of the content to load. This must not be `nil`. - @param MIMEType The MIME type of the content. Defaults to the content type of the response if not specified. - @param textEncodingName The IANA encoding name, as in `utf-8` or `utf-16`. Defaults to the response text encoding if not specified. -@param progress A progress object monitoring the current download progress. - @param success A block object to be executed when the request finishes loading successfully. This block returns the data to be loaded by the web view and takes two arguments: the response, and the downloaded data. - @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred. - */ -- (void)loadRequest:(NSURLRequest *)request - MIMEType:(nullable NSString *)MIMEType - textEncodingName:(nullable NSString *)textEncodingName - progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress - success:(nullable NSData * (^)(NSHTTPURLResponse *response, NSData *data))success - failure:(nullable void (^)(NSError *error))failure; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/clients/ios/Other Sources/AFNetworking/UIWebView+AFNetworking.m b/clients/ios/Other Sources/AFNetworking/UIWebView+AFNetworking.m deleted file mode 100755 index 030c3e9453..0000000000 --- a/clients/ios/Other Sources/AFNetworking/UIWebView+AFNetworking.m +++ /dev/null @@ -1,157 +0,0 @@ -// UIWebView+AFNetworking.m -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import "UIWebView+AFNetworking.h" - -#import - -#if TARGET_OS_IOS - -#import "AFHTTPSessionManager.h" -#import "AFURLResponseSerialization.h" -#import "AFURLRequestSerialization.h" - -@interface UIWebView (_AFNetworking) -@property (readwrite, nonatomic, strong, setter = af_setURLSessionTask:) NSURLSessionDataTask *af_URLSessionTask; -@end - -@implementation UIWebView (_AFNetworking) - -- (NSURLSessionDataTask *)af_URLSessionTask { - return (NSURLSessionDataTask *)objc_getAssociatedObject(self, @selector(af_URLSessionTask)); -} - -- (void)af_setURLSessionTask:(NSURLSessionDataTask *)af_URLSessionTask { - objc_setAssociatedObject(self, @selector(af_URLSessionTask), af_URLSessionTask, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -@end - -#pragma mark - - -@implementation UIWebView (AFNetworking) - -- (AFHTTPSessionManager *)sessionManager { - static AFHTTPSessionManager *_af_defaultHTTPSessionManager = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - _af_defaultHTTPSessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]]; - _af_defaultHTTPSessionManager.requestSerializer = [AFHTTPRequestSerializer serializer]; - _af_defaultHTTPSessionManager.responseSerializer = [AFHTTPResponseSerializer serializer]; - }); - - return objc_getAssociatedObject(self, @selector(sessionManager)) ?: _af_defaultHTTPSessionManager; -} - -- (void)setSessionManager:(AFHTTPSessionManager *)sessionManager { - objc_setAssociatedObject(self, @selector(sessionManager), sessionManager, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -- (AFHTTPResponseSerializer *)responseSerializer { - static AFHTTPResponseSerializer *_af_defaultResponseSerializer = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - _af_defaultResponseSerializer = [AFHTTPResponseSerializer serializer]; - }); - - return objc_getAssociatedObject(self, @selector(responseSerializer)) ?: _af_defaultResponseSerializer; -} - -- (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer { - objc_setAssociatedObject(self, @selector(responseSerializer), responseSerializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -#pragma mark - - -- (void)loadRequest:(NSURLRequest *)request - progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress - success:(NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success - failure:(void (^)(NSError *error))failure -{ - [self loadRequest:request MIMEType:nil textEncodingName:nil progress:progress success:^NSData *(NSHTTPURLResponse *response, NSData *data) { - NSStringEncoding stringEncoding = NSUTF8StringEncoding; - if (response.textEncodingName) { - CFStringEncoding encoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)response.textEncodingName); - if (encoding != kCFStringEncodingInvalidId) { - stringEncoding = CFStringConvertEncodingToNSStringEncoding(encoding); - } - } - - NSString *string = [[NSString alloc] initWithData:data encoding:stringEncoding]; - if (success) { - string = success(response, string); - } - - return [string dataUsingEncoding:stringEncoding]; - } failure:failure]; -} - -- (void)loadRequest:(NSURLRequest *)request - MIMEType:(NSString *)MIMEType - textEncodingName:(NSString *)textEncodingName - progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress - success:(NSData * (^)(NSHTTPURLResponse *response, NSData *data))success - failure:(void (^)(NSError *error))failure -{ - NSParameterAssert(request); - - if (self.af_URLSessionTask.state == NSURLSessionTaskStateRunning || self.af_URLSessionTask.state == NSURLSessionTaskStateSuspended) { - [self.af_URLSessionTask cancel]; - } - self.af_URLSessionTask = nil; - - __weak __typeof(self)weakSelf = self; - __block NSURLSessionDataTask *dataTask; - dataTask = [self.sessionManager - dataTaskWithRequest:request - uploadProgress:nil - downloadProgress:nil - completionHandler:^(NSURLResponse * _Nonnull response, id _Nonnull responseObject, NSError * _Nullable error) { - __strong __typeof(weakSelf) strongSelf = weakSelf; - if (error) { - if (failure) { - failure(error); - } - } else { - if (success) { - success((NSHTTPURLResponse *)response, responseObject); - } - [strongSelf loadData:responseObject MIMEType:MIMEType textEncodingName:textEncodingName baseURL:[dataTask.currentRequest URL]]; - - if ([strongSelf.delegate respondsToSelector:@selector(webViewDidFinishLoad:)]) { - [strongSelf.delegate webViewDidFinishLoad:strongSelf]; - } - } - }]; - self.af_URLSessionTask = dataTask; - if (progress != nil) { - *progress = [self.sessionManager downloadProgressForTask:dataTask]; - } - [self.af_URLSessionTask resume]; - - if ([self.delegate respondsToSelector:@selector(webViewDidStartLoad:)]) { - [self.delegate webViewDidStartLoad:self]; - } -} - -@end - -#endif diff --git a/clients/ios/Other Sources/InAppSettingsKit/Controllers/IASKAppSettingsWebViewController.h b/clients/ios/Other Sources/InAppSettingsKit/Controllers/IASKAppSettingsWebViewController.h deleted file mode 100755 index 84d610a182..0000000000 --- a/clients/ios/Other Sources/InAppSettingsKit/Controllers/IASKAppSettingsWebViewController.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// IASKAppSettingsWebViewController.h -// http://www.inappsettingskit.com -// -// Copyright (c) 2009: -// Luc Vandal, Edovia Inc., http://www.edovia.com -// Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com -// All rights reserved. -// -// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, -// as the original authors of this code. You can give credit in a blog post, a tweet or on -// a info page of your app. Also, the original authors appreciate letting them know if you use this code. -// -// This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php -// - -#import -#import -#import "IASKSpecifier.h" - -@interface IASKAppSettingsWebViewController : UIViewController - -- (id)initWithFile:(NSString*)htmlFileName specifier:(IASKSpecifier*)specifier; - -@property (nonatomic, strong) UIWebView *webView; -@property (nonatomic, strong) NSURL *url; -@property (nonatomic, strong) NSString *customTitle; - -@end diff --git a/clients/ios/Other Sources/InAppSettingsKit/Controllers/IASKAppSettingsWebViewController.m b/clients/ios/Other Sources/InAppSettingsKit/Controllers/IASKAppSettingsWebViewController.m deleted file mode 100755 index c7aefa8962..0000000000 --- a/clients/ios/Other Sources/InAppSettingsKit/Controllers/IASKAppSettingsWebViewController.m +++ /dev/null @@ -1,147 +0,0 @@ -// -// IASKAppSettingsWebViewController.h -// http://www.inappsettingskit.com -// -// Copyright (c) 2010: -// Luc Vandal, Edovia Inc., http://www.edovia.com -// Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com -// All rights reserved. -// -// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, -// as the original authors of this code. You can give credit in a blog post, a tweet or on -// a info page of your app. Also, the original authors appreciate letting them know if you use this code. -// -// This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php -// - -#import "IASKAppSettingsWebViewController.h" -#import "IASKSettingsReader.h" - -@implementation IASKAppSettingsWebViewController - -- (id)initWithFile:(NSString*)urlString specifier:(IASKSpecifier*)specifier { - self = [super init]; - if (self) { - self.url = [NSURL URLWithString:urlString]; - if (!self.url || ![self.url scheme]) { - NSString *path = [[NSBundle mainBundle] pathForResource:[urlString stringByDeletingPathExtension] ofType:[urlString pathExtension]]; - if(path) - self.url = [NSURL fileURLWithPath:path]; - else - self.url = nil; - } - self.customTitle = [specifier localizedObjectForKey:kIASKChildTitle]; - self.title = self.customTitle ? : specifier.title; - } - return self; -} - -- (void)loadView { - self.webView = [[UIWebView alloc] init]; - self.webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - self.webView.delegate = self; - - self.view = self.webView; -} - -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - - UIActivityIndicatorView *activityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 40, 20)]; - activityIndicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite; - [activityIndicatorView startAnimating]; - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:activityIndicatorView]; - [self.webView loadRequest:[NSURLRequest requestWithURL:self.url]]; -} - -- (void)webViewDidFinishLoad:(UIWebView *)webView { - self.navigationItem.rightBarButtonItem = nil; - self.title = self.customTitle.length ? self.customTitle : [self.webView stringByEvaluatingJavaScriptFromString:@"document.title"]; -} - -- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { - NSURL *newURL = [request URL]; - - // intercept mailto URL and send it to an in-app Mail compose view instead - if ([[newURL scheme] isEqualToString:@"mailto"]) { - - NSArray *rawURLparts = [[newURL resourceSpecifier] componentsSeparatedByString:@"?"]; - if (rawURLparts.count > 2) { - return NO; // invalid URL - } - - MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init]; - mailViewController.mailComposeDelegate = self; - - NSMutableArray *toRecipients = [NSMutableArray array]; - NSString *defaultRecipient = [rawURLparts objectAtIndex:0]; - if (defaultRecipient.length) { - [toRecipients addObject:defaultRecipient]; - } - - if (rawURLparts.count == 2) { - NSString *queryString = [rawURLparts objectAtIndex:1]; - - NSArray *params = [queryString componentsSeparatedByString:@"&"]; - for (NSString *param in params) { - NSArray *keyValue = [param componentsSeparatedByString:@"="]; - if (keyValue.count != 2) { - continue; - } - NSString *key = [[keyValue objectAtIndex:0] lowercaseString]; - NSString *value = [keyValue objectAtIndex:1]; - - value = CFBridgingRelease(CFURLCreateStringByReplacingPercentEscapes(kCFAllocatorDefault, - (CFStringRef)value, - CFSTR(""))); - - if ([key isEqualToString:@"subject"]) { - [mailViewController setSubject:value]; - } - - if ([key isEqualToString:@"body"]) { - [mailViewController setMessageBody:value isHTML:NO]; - } - - if ([key isEqualToString:@"to"]) { - [toRecipients addObjectsFromArray:[value componentsSeparatedByString:@","]]; - } - - if ([key isEqualToString:@"cc"]) { - NSArray *recipients = [value componentsSeparatedByString:@","]; - [mailViewController setCcRecipients:recipients]; - } - - if ([key isEqualToString:@"bcc"]) { - NSArray *recipients = [value componentsSeparatedByString:@","]; - [mailViewController setBccRecipients:recipients]; - } - } - } - - [mailViewController setToRecipients:toRecipients]; - - mailViewController.navigationBar.barStyle = self.navigationController.navigationBar.barStyle; - IASK_IF_IOS7_OR_GREATER(mailViewController.navigationBar.tintColor = self.navigationController.navigationBar.tintColor;); - mailViewController.navigationBar.titleTextAttributes = self.navigationController.navigationBar.titleTextAttributes; - - UIStatusBarStyle savedStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; - [self presentViewController:mailViewController animated:YES completion:^{ - [UIApplication sharedApplication].statusBarStyle = savedStatusBarStyle; - }]; - return NO; - } - - // open inline if host is the same, otherwise, pass to the system - if (![newURL host] || [[newURL host] isEqualToString:[self.url host]]) { - return YES; - } - [[UIApplication sharedApplication] openURL:newURL options:@{} completionHandler:nil]; - return NO; -} - -- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { - [self dismissViewControllerAnimated:YES completion:nil]; -} - -@end diff --git a/clients/ios/Other Sources/InAppSettingsKit/Models/IASKSpecifier.m b/clients/ios/Other Sources/InAppSettingsKit/Models/IASKSpecifier.m index 1ca76dc57e..e8b69e038e 100755 --- a/clients/ios/Other Sources/InAppSettingsKit/Models/IASKSpecifier.m +++ b/clients/ios/Other Sources/InAppSettingsKit/Models/IASKSpecifier.m @@ -16,7 +16,8 @@ #import "IASKSpecifier.h" #import "IASKSettingsReader.h" -#import "IASKAppSettingsWebViewController.h" +// DJS: Commented out this to avoid UIWebView. Not used by NewsBlur. +//#import "IASKAppSettingsWebViewController.h" @interface IASKSpecifier () @@ -172,7 +173,8 @@ - (NSString*)footerText { } - (Class)viewControllerClass { - [IASKAppSettingsWebViewController class]; // make sure this is linked into the binary/library + // DJS: Commented out this to avoid UIWebView. Not used by NewsBlur. + // [IASKAppSettingsWebViewController class]; // make sure this is linked into the binary/library NSString *classString = [_specifierDict objectForKey:kIASKViewControllerClass]; return classString ? ([self classFromString:classString] ?: [NSNull class]) : nil; }