diff --git a/Modules/Sources/WordPressShared/Analytics/AnalyticsEvent.swift b/Modules/Sources/WordPressShared/Analytics/AnalyticsEvent.swift index dc409ae3637c..75618fac1fe2 100644 --- a/Modules/Sources/WordPressShared/Analytics/AnalyticsEvent.swift +++ b/Modules/Sources/WordPressShared/Analytics/AnalyticsEvent.swift @@ -1,8 +1,5 @@ import Foundation - -#if SWIFT_PACKAGE import WordPressSharedObjC -#endif /// This struct represents an analytics event. /// Declaring this class as final is a design choice to promote a simpler usage and implement events diff --git a/Modules/Sources/WordPressShared/Utility/CollectionType+Helpers.swift b/Modules/Sources/WordPressShared/Utility/CollectionType+Helpers.swift index 9672c268181a..945323db53da 100644 --- a/Modules/Sources/WordPressShared/Utility/CollectionType+Helpers.swift +++ b/Modules/Sources/WordPressShared/Utility/CollectionType+Helpers.swift @@ -1,20 +1,9 @@ import Foundation -// MARK: - Collection Type Helpers -// -extension BidirectionalCollection { - public func lastIndex(where predicate: (Self.Iterator.Element) throws -> Bool) rethrows -> Self.Index? { - if let idx = try reversed().firstIndex(where: predicate) { - return self.index(before: idx.base) - } - return nil - } -} - extension Collection { /// Returns the element at the specified index if it is within bounds, otherwise nil. /// - public subscript (safe index: Index) -> Element? { + public subscript(safe index: Index) -> Element? { return indices.contains(index) ? self[index] : nil } } diff --git a/Modules/Sources/WordPressShared/Utility/ConsoleLogger.swift b/Modules/Sources/WordPressShared/Utility/ConsoleLogger.swift deleted file mode 100644 index c9aaaaf282b2..000000000000 --- a/Modules/Sources/WordPressShared/Utility/ConsoleLogger.swift +++ /dev/null @@ -1,24 +0,0 @@ -/// A `WordPressLoggingDelegate` implementation that logs to the Xcode console via `print`. -/// Useful for development or debugging. Not recommended in release builds. -public class ConsoleLogger: NSObject, WordPressLoggingDelegate { - - public func logError(_ str: String) { - NSLog("❌ – Error: \(str)") - } - - public func logWarning(_ str: String) { - NSLog("⚠️ – Warning: \(str)") - } - - public func logInfo(_ str: String) { - NSLog("ℹ️ – Info: \(str)") - } - - public func logDebug(_ str: String) { - NSLog("🔎 – Debug: \(str)") - } - - public func logVerbose(_ str: String) { - NSLog("📃 – Verbose: \(str)") - } -} diff --git a/Modules/Sources/WordPressShared/Utility/NSBundle+WordPressShared.swift b/Modules/Sources/WordPressShared/Utility/NSBundle+WordPressShared.swift index 0c7ca6571477..6b8e03a44624 100644 --- a/Modules/Sources/WordPressShared/Utility/NSBundle+WordPressShared.swift +++ b/Modules/Sources/WordPressShared/Utility/NSBundle+WordPressShared.swift @@ -9,7 +9,6 @@ extension Bundle { /// otherwise it will be the framework bundle. /// @objc public class var wordPressSharedBundle: Bundle { -#if SWIFT_PACKAGE #if DEBUG // Workaround for https://forums.swift.org/t/swift-5-3-swiftpm-resources-in-tests-uses-wrong-bundle-path/37051 if let testBundlePath = ProcessInfo.processInfo.environment["XCTestBundlePath"], @@ -18,15 +17,5 @@ extension Bundle { } #endif return Bundle.module -#else - let defaultBundle = Bundle(for: BundleFinder.self) - // If installed with CocoaPods, resources will be in WordPressShared.bundle - if let bundleURL = defaultBundle.resourceURL, - let resourceBundle = Bundle(url: bundleURL.appendingPathComponent("WordPressShared.bundle")) { - return resourceBundle - } - // Otherwise, the default bundle is used for resources - return defaultBundle -#endif - } + } } diff --git a/Modules/Sources/WordPressShared/Utility/NSDate+Helpers.swift b/Modules/Sources/WordPressShared/Utility/NSDate+Helpers.swift index 7e1726021b83..bcf3f5041767 100644 --- a/Modules/Sources/WordPressShared/Utility/NSDate+Helpers.swift +++ b/Modules/Sources/WordPressShared/Utility/NSDate+Helpers.swift @@ -179,21 +179,6 @@ extension Date { return DateFormatters.shortDateTime.string(from: self) } - @available(*, deprecated, message: "Not used, as far as I can tell – @jkmassel, Jan 2021") - fileprivate func toStringForPageSections() -> String { - let interval = timeIntervalSinceNow - - if interval > 0 && interval < 86400 { - return NSLocalizedString("later today", comment: "Later today") - } else { - let formatter = RelativeDateTimeFormatter() - formatter.unitsStyle = .short - formatter.dateTimeStyle = .named - - return formatter.localizedString(fromTimeInterval: interval) - } - } - /// Returns the date components object. /// public func dateAndTimeComponents() -> DateComponents { @@ -244,11 +229,6 @@ extension NSDate { return (self as Date).shortStringWithTime() } - @available(*, deprecated, message: "Scheduled for removal with FormatterKit – if it's still used, we'll rewrite it with modern APIs") - @objc public func toStringForPageSections() -> String { - return (self as Date).toStringForPageSections() - } - /// Returns the date components object. /// @objc public func dateAndTimeComponents() -> NSDateComponents { diff --git a/Modules/Sources/WordPressShared/Utility/NSMutableData+Helpers.swift b/Modules/Sources/WordPressShared/Utility/NSMutableData+Helpers.swift deleted file mode 100644 index d71b4955481b..000000000000 --- a/Modules/Sources/WordPressShared/Utility/NSMutableData+Helpers.swift +++ /dev/null @@ -1,16 +0,0 @@ -import Foundation - -/// Encapsulates all of the NSMutableData Helper Methods. -/// -extension NSMutableData { - - /// Encodes a raw String into UTF8, and appends it to the current instance. - /// - /// - Parameter string: The raw String to be UTF8-Encoded, and appended - /// - @objc public func appendString(_ string: String) { - if let data = string.data(using: String.Encoding.utf8) { - append(data) - } - } -} diff --git a/Modules/Sources/WordPressShared/Utility/RichContentFormatter.swift b/Modules/Sources/WordPressShared/Utility/RichContentFormatter.swift index 60aed27a2fd7..17e097ce3faf 100644 --- a/Modules/Sources/WordPressShared/Utility/RichContentFormatter.swift +++ b/Modules/Sources/WordPressShared/Utility/RichContentFormatter.swift @@ -1,9 +1,6 @@ import Foundation import UIKit - -#if SWIFT_PACKAGE import WordPressSharedObjC -#endif /// Contains methods for formatting post or comment content for display. /// diff --git a/Modules/Sources/WordPressShared/Utility/Secret.swift b/Modules/Sources/WordPressShared/Utility/Secret.swift deleted file mode 100644 index 66b5a8f03390..000000000000 --- a/Modules/Sources/WordPressShared/Utility/Secret.swift +++ /dev/null @@ -1,49 +0,0 @@ -import Foundation - -/// Wraps a value that contains sensitive information to prevent accidental logging -/// -/// Usage example -/// -/// ``` -/// let password = Secret("my secret password") -/// print(password) // Prints "--redacted--" -/// print(password.secretValue) // Prints "my secret password" -/// ``` -/// -public struct Secret { - public let secretValue: T - - public init(_ secretValue: T) { - self.secretValue = secretValue - } -} - -extension Secret: RawRepresentable { - public typealias RawValue = T - - public init?(rawValue: Self.RawValue) { - self.init(rawValue) - } - - public var rawValue: T { - return secretValue - } -} - -extension Secret: CustomStringConvertible, CustomDebugStringConvertible, CustomReflectable { - private static var redacted: String { - return "--redacted--" - } - - public var description: String { - return Secret.redacted - } - - public var debugDescription: String { - return Secret.redacted - } - - public var customMirror: Mirror { - return Mirror(reflecting: Secret.redacted) - } -} diff --git a/Modules/Sources/WordPressShared/Utility/String+Helpers.swift b/Modules/Sources/WordPressShared/Utility/String+Helpers.swift index d97de183b327..15dec9a5ec88 100644 --- a/Modules/Sources/WordPressShared/Utility/String+Helpers.swift +++ b/Modules/Sources/WordPressShared/Utility/String+Helpers.swift @@ -1,8 +1,5 @@ import Foundation - -#if SWIFT_PACKAGE import WordPressSharedObjC -#endif extension String { public func stringByDecodingXMLCharacters() -> String { diff --git a/Modules/Sources/WordPressShared/Utility/String+RemovingMatches.swift b/Modules/Sources/WordPressShared/Utility/String+RemovingMatches.swift index 53fc800db8bd..4bf6094ebf90 100644 --- a/Modules/Sources/WordPressShared/Utility/String+RemovingMatches.swift +++ b/Modules/Sources/WordPressShared/Utility/String+RemovingMatches.swift @@ -1,8 +1,5 @@ import Foundation - -#if SWIFT_PACKAGE import WordPressSharedObjC -#endif extension String { @@ -15,7 +12,7 @@ extension String { do { regex = try NSRegularExpression(pattern: pattern, options: options) } catch { - WPSharedLogError("Error parsing regex: \(error)") + assertionFailure("Failed to create regex: \(error)") return self } diff --git a/Modules/Sources/WordPressShared/Views/WPStyleGuide+DynamicType.swift b/Modules/Sources/WordPressShared/Views/WPStyleGuide+DynamicType.swift index 65cd2dbb3d9c..55b3d6f469fe 100644 --- a/Modules/Sources/WordPressShared/Views/WPStyleGuide+DynamicType.swift +++ b/Modules/Sources/WordPressShared/Views/WPStyleGuide+DynamicType.swift @@ -1,9 +1,6 @@ import Foundation import UIKit - -#if SWIFT_PACKAGE import WordPressSharedObjC -#endif /// Extension on WPStyleGuide to use Dynamic Type fonts. /// diff --git a/Modules/Sources/WordPressShared/Views/WPStyleGuide+SerifFonts.swift b/Modules/Sources/WordPressShared/Views/WPStyleGuide+SerifFonts.swift index 7960f9091192..97afe5a6e933 100644 --- a/Modules/Sources/WordPressShared/Views/WPStyleGuide+SerifFonts.swift +++ b/Modules/Sources/WordPressShared/Views/WPStyleGuide+SerifFonts.swift @@ -1,9 +1,6 @@ import Foundation import UIKit - -#if SWIFT_PACKAGE import WordPressSharedObjC -#endif /// WPStyleGuide Extension to use serif fonts. /// diff --git a/Modules/Sources/WordPressShared/WordPressShared.swift b/Modules/Sources/WordPressShared/WordPressShared.swift index 7ab536566549..e91caee2a49e 100644 --- a/Modules/Sources/WordPressShared/WordPressShared.swift +++ b/Modules/Sources/WordPressShared/WordPressShared.swift @@ -1,25 +1 @@ -#if SWIFT_PACKAGE - @_exported import WordPressSharedObjC - -#endif - -func WPSharedLogError(_ format: String, _ arguments: CVarArg...) { - withVaList(arguments) { WPSharedLogvError(format, $0) } -} - -func WPSharedLogWarning(_ format: String, _ arguments: CVarArg...) { - withVaList(arguments) { WPSharedLogvWarning(format, $0) } -} - -func WPSharedLogInfo(_ format: String, _ arguments: CVarArg...) { - withVaList(arguments) { WPSharedLogvInfo(format, $0) } -} - -func WPSharedLogDebug(_ format: String, _ arguments: CVarArg...) { - withVaList(arguments) { WPSharedLogvDebug(format, $0) } -} - -func WPSharedLogVerbose(_ format: String, _ arguments: CVarArg...) { - withVaList(arguments) { WPSharedLogvVerbose(format, $0) } -} diff --git a/Modules/Sources/WordPressSharedObjC/Logging/WPSharedLogging.m b/Modules/Sources/WordPressSharedObjC/Logging/WPSharedLogging.m deleted file mode 100644 index f62869302d1a..000000000000 --- a/Modules/Sources/WordPressSharedObjC/Logging/WPSharedLogging.m +++ /dev/null @@ -1,49 +0,0 @@ -#import "WPSharedLogging.h" - -static id wordPressSharedLogger = nil; - -id _Nullable WPSharedGetLoggingDelegate(void) -{ - return wordPressSharedLogger; -} - -void WPSharedSetLoggingDelegate(id _Nullable logger) -{ - wordPressSharedLogger = logger; -} - -#define WPSharedLogv(logFunc) \ - ({ \ - id logger = WPSharedGetLoggingDelegate(); \ - if (logger == NULL) { \ - NSLog(@"[WordPress-Shared] Warning: please call `WPSharedSetLoggingDelegate` to set a error logger."); \ - return; \ - } \ - if (![logger respondsToSelector:@selector(logFunc)]) { \ - NSLog(@"[WordPress-Shared] Warning: %@ does not implement " #logFunc, logger); \ - return; \ - } \ - /* Originally `performSelector:withObject:` was used to call the logging function, but for unknown reason */ \ - /* it causes a crash on `objc_retain`. So I have to switch to this strange "syntax" to call the logging function directly. */ \ - [logger logFunc [[NSString alloc] initWithFormat:str arguments:args]]; \ - }) - -#define WPSharedLog(logFunc) \ - ({ \ - va_list args; \ - va_start(args, str); \ - WPSharedLogv(logFunc); \ - va_end(args); \ - }) - -void WPSharedLogError(NSString *str, ...) { WPSharedLog(logError:); } -void WPSharedLogWarning(NSString *str, ...) { WPSharedLog(logWarning:); } -void WPSharedLogInfo(NSString *str, ...) { WPSharedLog(logInfo:); } -void WPSharedLogDebug(NSString *str, ...) { WPSharedLog(logDebug:); } -void WPSharedLogVerbose(NSString *str, ...) { WPSharedLog(logVerbose:); } - -void WPSharedLogvError(NSString *str, va_list args) { WPSharedLogv(logError:); } -void WPSharedLogvWarning(NSString *str, va_list args) { WPSharedLogv(logWarning:); } -void WPSharedLogvInfo(NSString *str, va_list args) { WPSharedLogv(logInfo:); } -void WPSharedLogvDebug(NSString *str, va_list args) { WPSharedLogv(logDebug:); } -void WPSharedLogvVerbose(NSString *str, va_list args) { WPSharedLogv(logVerbose:); } diff --git a/Modules/Sources/WordPressSharedObjC/Private/WPShared-Swift.h b/Modules/Sources/WordPressSharedObjC/Private/WPShared-Swift.h deleted file mode 100644 index 92ad295e0594..000000000000 --- a/Modules/Sources/WordPressSharedObjC/Private/WPShared-Swift.h +++ /dev/null @@ -1,13 +0,0 @@ -// This header is not needed for SPM. -#if !defined(SWIFT_PACKAGE) - -// Import this header instead of -// This allows the pod to be built as a static or dynamic framework -// See https://github.com/CocoaPods/CocoaPods/issues/7594 -#if __has_include("WordPressShared-Swift.h") - #import "WordPressShared-Swift.h" -#else - #import -#endif - -#endif /* !defined(SWIFT_PACKAGE) */ diff --git a/Modules/Sources/WordPressSharedObjC/Utility/DateUtils.m b/Modules/Sources/WordPressSharedObjC/Utility/DateUtils.m deleted file mode 100644 index a4dbef454a15..000000000000 --- a/Modules/Sources/WordPressSharedObjC/Utility/DateUtils.m +++ /dev/null @@ -1,37 +0,0 @@ -#import "DateUtils.h" - -@implementation DateUtils - -+ (NSDate *)dateFromISOString:(NSString *)dateString -{ - NSArray *formats = @[@"yyyy-MM-dd'T'HH:mm:ssZZZZZ", @"yyyy-MM-dd HH:mm:ss"]; - NSDate *date = nil; - if ([dateString length] == 25) { - NSRange rng = [dateString rangeOfString:@":" options:NSBackwardsSearch range:NSMakeRange(20, 5)]; - if (rng.location != NSNotFound) { - dateString = [dateString stringByReplacingCharactersInRange:rng withString:@""]; - } - } - NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; - dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]; - dateFormatter.timeZone = [NSTimeZone timeZoneWithName:@"GMT"]; - for (NSString *dateFormat in formats) { - [dateFormatter setDateFormat:dateFormat]; - date = [dateFormatter dateFromString:dateString]; - if (date){ - return date; - } - } - return date; -} - -+ (NSString *)isoStringFromDate:(NSDate *)date -{ - NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; - dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]; - dateFormatter.timeZone = [NSTimeZone timeZoneWithName:@"GMT"]; - [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ"]; - return [dateFormatter stringFromDate:date]; -} - -@end diff --git a/Modules/Sources/WordPressSharedObjC/Utility/NSString+Helpers.m b/Modules/Sources/WordPressSharedObjC/Utility/NSString+Helpers.m index 47be02f89289..964f683b5273 100644 --- a/Modules/Sources/WordPressSharedObjC/Utility/NSString+Helpers.m +++ b/Modules/Sources/WordPressSharedObjC/Utility/NSString+Helpers.m @@ -1,7 +1,6 @@ #import "NSString+Helpers.h" #import #import "NSString+XMLExtensions.h" -#import "WPSharedLogging.h" static NSString *const Ellipsis = @"\u2026"; @@ -15,7 +14,6 @@ @implementation NSString (Helpers) + (NSString *)emojiFromCoreEmojiImageTag:(NSString *)tag { if ([tag rangeOfString:@" -#endif - @implementation NSString (Util) diff --git a/Modules/Sources/WordPressSharedObjC/Utility/UIDevice+Helpers.m b/Modules/Sources/WordPressSharedObjC/Utility/UIDevice+Helpers.m deleted file mode 100644 index 3c7d682e7d1f..000000000000 --- a/Modules/Sources/WordPressSharedObjC/Utility/UIDevice+Helpers.m +++ /dev/null @@ -1,32 +0,0 @@ -#import "UIDevice+Helpers.h" - -static NSString * const WordPressIdentifierDefaultsKey = @"WordPressIdentifier"; - -@implementation UIDevice (Helpers) - -- (NSString *)wordPressIdentifier -{ - NSString *uuid; - if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) { - uuid = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; - } else { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - uuid = [defaults objectForKey:WordPressIdentifierDefaultsKey]; - if (!uuid) { - uuid = [self generateUUID]; - [defaults setObject:uuid forKey:WordPressIdentifierDefaultsKey]; - [defaults synchronize]; - } - } - return uuid; -} - -- (NSString *)generateUUID -{ - CFUUIDRef theUUID = CFUUIDCreate(NULL); - CFStringRef string = CFUUIDCreateString(NULL, theUUID); - CFRelease(theUUID); - return (__bridge_transfer NSString *)string; -} - -@end diff --git a/Modules/Sources/WordPressSharedObjC/Utility/WPDeviceIdentification.m b/Modules/Sources/WordPressSharedObjC/Utility/WPDeviceIdentification.m index 2569f5b6e4ae..8407ddac3ee0 100644 --- a/Modules/Sources/WordPressSharedObjC/Utility/WPDeviceIdentification.m +++ b/Modules/Sources/WordPressSharedObjC/Utility/WPDeviceIdentification.m @@ -1,94 +1,7 @@ #import "WPDeviceIdentification.h" -#include - -static NSString* const WPDeviceModelNameiPhone6 = @"iPhone 6"; -static NSString* const WPDeviceModelNameiPhone6Plus = @"iPhone 6 Plus"; -static NSString* const WPDeviceModelNameiPadSimulator = @"iPad Simulator"; -static NSString* const WPDeviceModelNameiPhoneSimulator = @"iPhone Simulator"; - -// Device Names -static NSString* const WPDeviceNameiPad1 = @"iPad 1"; -static NSString* const WPDeviceNameiPad2 = @"iPad 2"; -static NSString* const WPDeviceNameiPad3 = @"iPad 3"; -static NSString* const WPDeviceNameiPad4 = @"iPad 4"; -static NSString* const WPDeviceNameiPadAir1 = @"iPad Air 1"; -static NSString* const WPDeviceNameiPadAir2 = @"iPad Air 2"; -static NSString* const WPDeviceNameiPadMini1 = @"iPad Mini 1"; -static NSString* const WPDeviceNameiPadMini2 = @"iPad Mini 2"; -static NSString* const WPDeviceNameiPhone1 = @"iPhone 1"; -static NSString* const WPDeviceNameiPhone3 = @"iPhone 3"; -static NSString* const WPDeviceNameiPhone3gs = @"iPhone 3GS"; -static NSString* const WPDeviceNameiPhone4 = @"iPhone 4"; -static NSString* const WPDeviceNameiPhone4s = @"iPhone 4S"; -static NSString* const WPDeviceNameiPhone5 = @"iPhone 5"; -static NSString* const WPDeviceNameiPhone5c = @"iPhone 5C"; -static NSString* const WPDeviceNameiPhone5s = @"iPhone 5S"; -static NSString* const WPDeviceNameiPhone6 = @"iPhone 6"; -static NSString* const WPDeviceNameiPhone6Plus = @"iPhone 6 Plus"; -static NSString* const WPDeviceNameiPodTouch1 = @"iPod Touch 1"; -static NSString* const WPDeviceNameiPodTouch2 = @"iPod Touch 2"; -static NSString* const WPDeviceNameiPodTouch3 = @"iPod Touch 3"; -static NSString* const WPDeviceNameiPodTouch4 = @"iPod Touch 4"; -static NSString* const WPDeviceNameSimulator = @"Simulator"; @implementation WPDeviceIdentification -#pragma mark - System info - -+ (struct utsname)systemInfo -{ - struct utsname systemInfo; - - uname(&systemInfo); - - return systemInfo; -} - -+ (NSString*)deviceName -{ - // Credits: original list taken from this URL - // http://stackoverflow.com/questions/26028918/ios-how-to-determine-iphone-model-in-swift - // - NSDictionary* devices = @{@"i386": WPDeviceNameSimulator, - @"x86_64": WPDeviceNameSimulator, - @"iPod1,1": WPDeviceNameiPodTouch1, // (Original) - @"iPod2,1": WPDeviceNameiPodTouch2, // (Second Generation) - @"iPod3,1": WPDeviceNameiPodTouch3, // (Third Generation) - @"iPod4,1": WPDeviceNameiPodTouch4, // (Fourth Generation) - @"iPhone1,1": WPDeviceNameiPhone1, // (Original) - @"iPhone1,2": WPDeviceNameiPhone3, // (3G) - @"iPhone2,1": WPDeviceNameiPhone3gs, // (3GS) - @"iPad1,1": WPDeviceNameiPad1, // (Original) - @"iPad2,1": WPDeviceNameiPad2, // - @"iPad3,1": WPDeviceNameiPad3, // (3rd Generation) - @"iPhone3,1": WPDeviceNameiPhone4, // - @"iPhone3,2": WPDeviceNameiPhone4, // - @"iPhone4,1": WPDeviceNameiPhone4s, // - @"iPhone5,1": WPDeviceNameiPhone5, // (model A1428, AT&T/Canada) - @"iPhone5,2": WPDeviceNameiPhone5, // (model A1429, everything else) - @"iPad3,4": WPDeviceNameiPad4, // (4th Generation) - @"iPad2,5": WPDeviceNameiPadMini1, // (Original) - @"iPhone5,3": WPDeviceNameiPhone5c, // (model A1456, A1532 | GSM) - @"iPhone5,4": WPDeviceNameiPhone5c, // (model A1507, A1516, A1526 (China), A1529 | Global) - @"iPhone6,1": WPDeviceNameiPhone5s, // (model A1433, A1533 | GSM) - @"iPhone6,2": WPDeviceNameiPhone5s, // (model A1457, A1518, A1528 (China), A1530 | Global) - @"iPad4,1": WPDeviceNameiPadAir1, // 5th Generation iPad (iPad Air) - Wifi - @"iPad4,2": WPDeviceNameiPadAir2, // 5th Generation iPad (iPad Air) - Cellular - @"iPad4,4": WPDeviceNameiPadMini2, // (2nd Generation iPad Mini - Wifi) - @"iPad4,5": WPDeviceNameiPadMini2, // (2nd Generation iPad Mini - Cellular) - @"iPhone7,1": WPDeviceNameiPhone6Plus, // All iPhone 6 Plus's - @"iPhone7,2": WPDeviceNameiPhone6 // All iPhone 6's - }; - - struct utsname systemInfo = [self systemInfo]; - - NSString* deviceIdentifier = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]; - - return devices[deviceIdentifier]; -} - -#pragma mark - Device identification - + (BOOL)isiPhone { return ![self isiPad]; } @@ -101,51 +14,6 @@ + (BOOL)isRetina { return ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] > 1); } - -+ (BOOL)isiPhoneSix -{ - NSString* deviceName = [self deviceName]; - BOOL result = NO; - - if ([deviceName isEqualToString:WPDeviceNameSimulator]) { - // IMPORTANT: this aproximation is only used when testing using the simulator. It's - // basically our best bet at identifying the device in lack of a better method. This - // aproximation may need adjusting when new devices come out. - // - result = ([self isiPhone] - && [[UIScreen mainScreen] respondsToSelector:@selector(nativeScale)] - && [[UIScreen mainScreen] respondsToSelector:@selector(nativeBounds)] - && [[UIScreen mainScreen] nativeScale] == 2 - && CGRectGetHeight([[UIScreen mainScreen] nativeBounds]) == 1334); - } else { - result = [deviceName isEqualToString:WPDeviceNameiPhone6]; - } - - return result; -} - -+ (BOOL)isiPhoneSixPlus -{ - NSString* deviceName = [self deviceName]; - BOOL result = NO; - - if ([deviceName isEqualToString:WPDeviceNameSimulator]) { - // IMPORTANT: this aproximation is only used when testing using the simulator. It's - // basically our best bet at identifying the device in lack of a better method. This - // aproximation may need adjusting when new devices come out. - // - result = ([self isiPhone] - && [[UIScreen mainScreen] respondsToSelector:@selector(nativeScale)] - && [[UIScreen mainScreen] respondsToSelector:@selector(nativeBounds)] - && [[UIScreen mainScreen] nativeScale] > 2.5 - && CGRectGetHeight([[UIScreen mainScreen] nativeBounds]) == 2208); - } else { - result = [deviceName isEqualToString:WPDeviceNameiPhone6Plus]; - } - - return result; -} - + (BOOL)isUnzoomediPhonePlus { CGRect bounds = UIScreen.mainScreen.fixedCoordinateSpace.bounds; @@ -154,14 +22,4 @@ + (BOOL)isUnzoomediPhonePlus return UIScreen.mainScreen.scale == 3.0 && bounds.size.height == unzoomediPhonePlusHeight; } -+ (BOOL)isiOSVersionEarlierThan9 -{ - return [[[UIDevice currentDevice] systemVersion] floatValue] < 9.0; -} - -+ (BOOL)isiOSVersionEarlierThan10 -{ - return [[[UIDevice currentDevice] systemVersion] floatValue] < 10.0; -} - @end diff --git a/Modules/Sources/WordPressSharedObjC/Utility/WPFontManager.m b/Modules/Sources/WordPressSharedObjC/Utility/WPFontManager.m index fb91282e123b..829880d2fd2d 100644 --- a/Modules/Sources/WordPressSharedObjC/Utility/WPFontManager.m +++ b/Modules/Sources/WordPressSharedObjC/Utility/WPFontManager.m @@ -121,19 +121,7 @@ + (void)loadFontResourceNamed:(NSString *)name withExtension:(NSString *)extensi } + (NSBundle *)resourceBundle { -#if SWIFT_PACKAGE return SWIFTPM_MODULE_BUNDLE; -#else - // When installed via CocoaPods, the resources will be bundled under `WordPressShared.bundle`. - // This follows the implementation from `NSBundle+WordPressShared`. - NSBundle *defaultBundle = [NSBundle bundleForClass:[self class]]; - NSURL *sharedBundleURL = [defaultBundle.resourceURL URLByAppendingPathComponent:@"WordPressShared.bundle"]; - NSBundle *sharedBundle = [NSBundle bundleWithURL:sharedBundleURL]; - if (sharedBundle) { - return sharedBundle; - } - return defaultBundle; -#endif } @end diff --git a/Modules/Sources/WordPressSharedObjC/Utility/WPMapFilterReduce.m b/Modules/Sources/WordPressSharedObjC/Utility/WPMapFilterReduce.m index 9244e7222953..d993525f6c3a 100644 --- a/Modules/Sources/WordPressSharedObjC/Utility/WPMapFilterReduce.m +++ b/Modules/Sources/WordPressSharedObjC/Utility/WPMapFilterReduce.m @@ -25,13 +25,4 @@ - (NSArray *)wp_filter:(WPFilterBlock)filterBlock return [NSArray arrayWithArray:results]; } -- (id)wp_reduce:(WPReduceBlock)reduceBlock withInitialValue:(id)initial -{ - id accumulator = initial; - for (id obj in self) { - accumulator = reduceBlock(accumulator, obj); - } - return accumulator; -} - @end diff --git a/Modules/Sources/WordPressSharedObjC/Views/WPNUXUtility.m b/Modules/Sources/WordPressSharedObjC/Views/WPNUXUtility.m deleted file mode 100644 index 52d506d3f3a8..000000000000 --- a/Modules/Sources/WordPressSharedObjC/Views/WPNUXUtility.m +++ /dev/null @@ -1,119 +0,0 @@ -#import "WPNUXUtility.h" -#import "WPFontManager.h" - - -@implementation WPNUXUtility - -#pragma mark - Fonts - -+ (UIFont *)textFieldFont -{ - return [WPFontManager systemRegularFontOfSize:16.0]; -} - -+ (UIFont *)descriptionTextFont -{ - return [WPFontManager systemRegularFontOfSize:15.0]; -} - -+ (UIFont *)titleFont -{ - return [WPFontManager systemLightFontOfSize:24.0]; -} - -+ (UIFont *)swipeToContinueFont -{ - return [WPFontManager systemRegularFontOfSize:10.0]; -} - -+ (UIFont *)tosLabelFont -{ - return [WPFontManager systemRegularFontOfSize:12.0]; -} - -+ (UIFont *)tosLabelSmallerFont -{ - return [WPFontManager systemRegularFontOfSize:9.0]; -} - -+ (UIFont *)confirmationLabelFont -{ - return [WPFontManager systemRegularFontOfSize:14.0]; -} - -#pragma mark - Colors - -+ (UIColor *)bottomPanelLineColor -{ - return [UIColor colorWithRed:43/255.0f green:153/255.0f blue:193/255.0f alpha:1.0f]; -} - -+ (UIColor *)descriptionTextColor -{ - return [UIColor colorWithRed:187.0/255.0 green:221.0/255.0 blue:237.0/255.0 alpha:1.0]; -} - -+ (UIColor *)bottomPanelBackgroundColor -{ - return [self backgroundColor]; -} - -+ (UIColor *)swipeToContinueTextColor -{ - return [UIColor colorWithRed:255.0 green:255.0 blue:255.0 alpha:0.3]; -} - -+ (UIColor *)confirmationLabelColor -{ - return [UIColor colorWithRed:188.0/255.0 green:221.0/255.0 blue:236.0/255.0 alpha:1.0]; -} - -+ (UIColor *)backgroundColor -{ - return [UIColor colorWithRed:46.0/255.0 green:162.0/255.0 blue:204.0/255.0 alpha:1.0]; -} - -+ (UIColor *)tosLabelColor -{ - return [self descriptionTextColor]; -} - -#pragma mark - Helper Methods - -+ (void)centerViews:(NSArray *)controls withStartingView:(UIView *)startingView andEndingView:(UIView *)endingView forHeight:(CGFloat)viewHeight -{ - CGFloat heightOfControls = CGRectGetMaxY(endingView.frame) - CGRectGetMinY(startingView.frame); - CGFloat startingYForCenteredControls = floorf((viewHeight - heightOfControls)/2.0); - CGFloat offsetToCenter = CGRectGetMinY(startingView.frame) - startingYForCenteredControls; - - for (UIControl *control in controls) { - CGRect frame = control.frame; - frame.origin.y -= offsetToCenter; - control.frame = frame; - } -} - -+ (void)configurePageControlTintColors:(UIPageControl *)pageControl -{ - // This only works on iOS6+ - if ([pageControl respondsToSelector:@selector(pageIndicatorTintColor)]) { - UIColor *currentPageTintColor = [UIColor colorWithRed:187.0/255.0 green:221.0/255.0 blue:237.0/255.0 alpha:1.0]; - UIColor *pageIndicatorTintColor = [UIColor colorWithRed:38.0/255.0 green:151.0/255.0 blue:197.0/255.0 alpha:1.0]; - pageControl.pageIndicatorTintColor = pageIndicatorTintColor; - pageControl.currentPageIndicatorTintColor = currentPageTintColor; - } -} - -+ (NSDictionary *)titleAttributesWithColor:(UIColor *)color { - - NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; - paragraphStyle.lineHeightMultiple = 0.9; - paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping; - paragraphStyle.alignment = NSTextAlignmentCenter; - NSDictionary *attributes = @{NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleTitle2], - NSForegroundColorAttributeName: color, - NSParagraphStyleAttributeName: paragraphStyle}; - return attributes; -} - -@end diff --git a/Modules/Sources/WordPressSharedObjC/Views/WPStyleGuide.m b/Modules/Sources/WordPressSharedObjC/Views/WPStyleGuide.m index 691de09315f2..7c76e7a48d88 100644 --- a/Modules/Sources/WordPressSharedObjC/Views/WPStyleGuide.m +++ b/Modules/Sources/WordPressSharedObjC/Views/WPStyleGuide.m @@ -3,8 +3,6 @@ #import "WPFontManager.h" #import "WPDeviceIdentification.h" -#if SWIFT_PACKAGE - // A workaround to make the Swift extension defined in WordPressSharedView target visible to this file here. @interface WPStyleGuide (SwiftExtension) @@ -13,10 +11,6 @@ + (UIFont *)fontForTextStyle:(UIFontTextStyle)style maximumPointSize:(CGFloat)po @end -#else -#import "WPShared-Swift.h" -#endif - @implementation WPStyleGuide #pragma mark - Fonts and Text @@ -205,92 +199,13 @@ + (UIColor *)jazzyOrange return [self colorWithR:240 G:130 B:30 alpha:1.0]; } -+ (UIColor *)fireOrange -{ - return [self colorWithR:213 G:78 B:33 alpha:1.0]; -} - - #pragma mark - Validations / Alerts -+ (UIColor *)validGreen -{ - return [self colorWithR:74 G:184 B:102 alpha:1.0]; -} - -+ (UIColor *)warningYellow -{ - return [self colorWithR:240 G:184 B:73 alpha:1.0]; -} - + (UIColor *)errorRed { return [self colorWithR:217 G:79 B:79 alpha:1.0]; } -+ (UIColor *)alertYellowDark -{ - return [self colorWithR:0xF0 G:0xB8 B:0x49 alpha:0xFF]; -} - -+ (UIColor *)alertYellowLighter -{ - return [self colorWithR:0xFE G:0xF8 B:0xEE alpha:0xFF]; -} - -+ (UIColor *)alertRedDarker -{ - return [self colorWithR:0x6D G:0x18 B:0x18 alpha:0xFF]; -} - - -#pragma mark - Misc Colors - -+ (UIColor *)keyboardColor { - // Pre iOS 7.1 uses a the lighter keyboard background. - // There doesn't seem to be a good way to get the keyboard background color - // programatically so we'll rely on checking the OS version. - // Approach based on http://stackoverflow.com/a/5337804 - NSString *versionStr = [[UIDevice currentDevice] systemVersion]; - BOOL hasLighterKeyboard = [versionStr compare:@"7.1" options:NSNumericSearch] == NSOrderedAscending; - - if (hasLighterKeyboard) { - if ([WPDeviceIdentification isiPad]) { - return [UIColor colorWithRed:207.0f/255.0f green:210.0f/255.0f blue:213.0f/255.0f alpha:1.0]; - } else { - return [UIColor colorWithRed:220.0f/255.0f green:223.0f/255.0f blue:226.0f/255.0f alpha:1.0]; - } - } - - if ([WPDeviceIdentification isiPad]) { - return [UIColor colorWithRed:217.0f/255.0f green:220.0f/255.0f blue:223.0f/255.0f alpha:1.0]; - } else { - return [UIColor colorWithRed:204.0f/255.0f green:208.0f/255.0f blue:214.0f/255.0f alpha:1.0]; - } -} - -+ (UIColor *)textFieldPlaceholderGrey -{ - return [self grey]; -} - -// TODO: Move to feature category -+ (UIColor *)buttonActionColor -{ - return [self wordPressBlue]; -} - -// TODO: Move to feature category -+ (UIColor *)nuxFormText { - return [self darkGrey]; -} - -// TODO: Move to feature category -+ (UIColor *)nuxFormPlaceholderText { - return [self grey]; -} - - #pragma mark - Bar styles + (UIBarButtonItemStyle)barButtonStyleForDone @@ -303,11 +218,6 @@ + (UIBarButtonItemStyle)barButtonStyleForBordered return UIBarButtonItemStylePlain; } -+ (void)setLeftBarButtonItemWithCorrectSpacing:(UIBarButtonItem *)barButtonItem forNavigationItem:(UINavigationItem *)navigationItem -{ - navigationItem.leftBarButtonItems = @[[self spacerForNavigationBarButtonItems], barButtonItem]; -} - + (void)setRightBarButtonItemWithCorrectSpacing:(UIBarButtonItem *)barButtonItem forNavigationItem:(UINavigationItem *)navigationItem { navigationItem.rightBarButtonItems = @[[self spacerForNavigationBarButtonItems], barButtonItem]; @@ -320,38 +230,8 @@ + (UIBarButtonItem *)spacerForNavigationBarButtonItems return spacerButton; } -+ (void)configureNavigationBarAppearance -{ - [[UINavigationBar appearance] setBarTintColor:[WPStyleGuide wordPressBlue]]; - [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]]; - - [[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]]; - [[UIBarButtonItem appearance] setTitleTextAttributes:@{NSFontAttributeName: [WPFontManager systemRegularFontOfSize:17.0], NSForegroundColorAttributeName: [UIColor whiteColor]} forState:UIControlStateNormal]; - [[UIBarButtonItem appearance] setTitleTextAttributes:@{NSFontAttributeName: [WPFontManager systemRegularFontOfSize:17.0], NSForegroundColorAttributeName: [UIColor colorWithWhite:1.0 alpha:0.25]} forState:UIControlStateDisabled]; -} - -// The app's appearance settings override the doc picker color scheme. -// This method sets the nav colors so the doc picker has the correct appearance. -// The app colors can be restored with configureNavigationBarAppearance(). -+ (void)configureDocumentPickerNavBarAppearance -{ - [[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]]; - [[UINavigationBar appearance] setTintColor:[WPStyleGuide mediumBlue]]; - [[UIBarButtonItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [WPStyleGuide mediumBlue]} forState:UIControlStateNormal]; -} - #pragma mark - Deprecated Colors -+ (UIColor *)baseLighterBlue __deprecated -{ - return [self wordPressBlue]; -} - -+ (UIColor *)baseDarkerBlue __deprecated -{ - return [self wordPressBlue]; -} - + (UIColor *)newKidOnTheBlockBlue __deprecated { return [self mediumBlue]; @@ -362,44 +242,4 @@ + (UIColor *)midnightBlue __deprecated return [self darkBlue]; } -+ (UIColor *)bigEddieGrey __deprecated -{ - return [self darkGrey]; -} - -+ (UIColor *)littleEddieGrey __deprecated -{ - return [self darkGrey]; -} - -+ (UIColor *)whisperGrey __deprecated -{ - return [self greyDarken20]; -} - -+ (UIColor *)allTAllShadeGrey __deprecated -{ - return [self grey]; -} - -+ (UIColor *)readGrey __deprecated -{ - return [self greyLighten20]; -} - -+ (UIColor *)itsEverywhereGrey __deprecated -{ - return [self greyLighten30]; -} - -+ (UIColor *)darkAsNightGrey __deprecated -{ - return [self darkBlue]; -} - -+ (UIColor *)validationErrorRed __deprecated -{ - return [self errorRed]; -} - @end diff --git a/Modules/Sources/WordPressSharedObjC/Views/WPTableViewCell.m b/Modules/Sources/WordPressSharedObjC/Views/WPTableViewCell.m index 716ed3bb8c31..fd5dadd1ea2b 100644 --- a/Modules/Sources/WordPressSharedObjC/Views/WPTableViewCell.m +++ b/Modules/Sources/WordPressSharedObjC/Views/WPTableViewCell.m @@ -1,49 +1,5 @@ #import "WPTableViewCell.h" -#import "WPDeviceIdentification.h" - -CGFloat const WPTableViewFixedWidth = 600; @implementation WPTableViewCell -- (void)setForceCustomCellMargins:(BOOL)forceCustomCellMargins -{ - if (_forceCustomCellMargins != forceCustomCellMargins) { - _forceCustomCellMargins = forceCustomCellMargins; - [self setClipsToBounds:forceCustomCellMargins]; - } -} - -- (void)setFrame:(CGRect)frame { - if (self.forceCustomCellMargins) { - CGFloat width = self.superview.frame.size.width; - // On iPad, add a margin around tables - if ([WPDeviceIdentification isiPad] && width > WPTableViewFixedWidth) { - CGFloat x = (width - WPTableViewFixedWidth) / 2; - // If origin.x is not equal to x we add the value. - // This is a semi-fix / work around for an issue positioning cells on - // iOS 8 when editing a table view and the delete button is visible. - if (x != frame.origin.x) { - frame.origin.x += x; - } else { - frame.origin.x = x; - } - frame.size.width = WPTableViewFixedWidth; - } - } - [super setFrame:frame]; -} - -- (void)layoutSubviews { - [super layoutSubviews]; - if (self.forceCustomCellMargins) { - // Need to set the origin again on iPad (for margins) - CGFloat width = self.superview.frame.size.width; - if ([WPDeviceIdentification isiPad] && width > WPTableViewFixedWidth) { - CGRect frame = self.frame; - frame.origin.x = (width - WPTableViewFixedWidth) / 2; - self.frame = frame; - } - } -} - @end diff --git a/Modules/Sources/WordPressSharedObjC/WordPressShared.h b/Modules/Sources/WordPressSharedObjC/WordPressShared.h index cfab25fa8c85..09065ccbfa72 100644 --- a/Modules/Sources/WordPressSharedObjC/WordPressShared.h +++ b/Modules/Sources/WordPressSharedObjC/WordPressShared.h @@ -14,14 +14,10 @@ FOUNDATION_EXPORT const unsigned char WordPressSharedVersionString[]; #import #import #import -#import #import #import -#import -#import #import #import #import -#import #import #import diff --git a/Modules/Sources/WordPressSharedObjC/include/DateUtils.h b/Modules/Sources/WordPressSharedObjC/include/DateUtils.h deleted file mode 100644 index 87755c6a62da..000000000000 --- a/Modules/Sources/WordPressSharedObjC/include/DateUtils.h +++ /dev/null @@ -1,8 +0,0 @@ -#import - -@interface DateUtils : NSObject - -+ (NSDate *)dateFromISOString:(NSString *)isoString; -+ (NSString *)isoStringFromDate:(NSDate *)date; - -@end diff --git a/Modules/Sources/WordPressSharedObjC/include/NSString+Helpers.h b/Modules/Sources/WordPressSharedObjC/include/NSString+Helpers.h index 6a02d51b4c8f..1e77fe9077c5 100644 --- a/Modules/Sources/WordPressSharedObjC/include/NSString+Helpers.h +++ b/Modules/Sources/WordPressSharedObjC/include/NSString+Helpers.h @@ -2,15 +2,6 @@ @interface NSString (Helpers) -/** - Removes shortcodes from the passed string. - - @param string The string to remove shortcodes from. - @return The modified string. - */ -+ (NSString *)stripShortcodesFromString:(NSString *)string; - -- (NSString *)stringByUrlEncoding; - (NSMutableDictionary *)dictionaryFromQueryString; - (NSString *)stringByReplacingHTMLEmoticonsWithEmoji; - (NSString *)stringByStrippingHTML; @@ -19,13 +10,11 @@ /** * Counts the number of words in a string - * + * * @discussion This word counting algorithm is from : http://stackoverflow.com/a/13367063 * @return the number of words in a string */ - (NSUInteger)wordCount; - - (NSString *)stringByNormalizingWhitespace; - @end diff --git a/Modules/Sources/WordPressSharedObjC/include/UIDevice+Helpers.h b/Modules/Sources/WordPressSharedObjC/include/UIDevice+Helpers.h deleted file mode 100644 index 46e21350656e..000000000000 --- a/Modules/Sources/WordPressSharedObjC/include/UIDevice+Helpers.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@interface UIDevice (Helpers) -- (NSString *)wordPressIdentifier; -@end diff --git a/Modules/Sources/WordPressSharedObjC/include/WPDeviceIdentification.h b/Modules/Sources/WordPressSharedObjC/include/WPDeviceIdentification.h index 726ee712aea7..4c4463d0b602 100644 --- a/Modules/Sources/WordPressSharedObjC/include/WPDeviceIdentification.h +++ b/Modules/Sources/WordPressSharedObjC/include/WPDeviceIdentification.h @@ -28,20 +28,6 @@ */ + (BOOL)isRetina; -/** - * @brief Call this method to know if the current device is an iPhone6. - * - * @returns YES if the device is an iPhone6. NO otherwise. - */ -+ (BOOL)isiPhoneSix; - -/** - * @brief Call this method to know if the current device is an iPhone6+. - * - * @returns YES if the device is an iPhone6+. NO otherwise. - */ -+ (BOOL)isiPhoneSixPlus; - /** * @brief Call this method to know if the current device is a Plus sized * phone (6+, 6s+, 7+) , at its native scale. @@ -50,18 +36,4 @@ */ + (BOOL)isUnzoomediPhonePlus; -/** - * @brief Call this method to know if the current device is running iOS version older than 9. - * - * @returns YES if the device is running iOS version older than 9. NO otherwise. - */ -+ (BOOL)isiOSVersionEarlierThan9; - -/** - * @brief Call this method to know if the current device is running iOS version older than 10. - * - * @returns YES if the device is running iOS version older than 10. NO otherwise. - */ -+ (BOOL)isiOSVersionEarlierThan10; - @end diff --git a/Modules/Sources/WordPressSharedObjC/include/WPMapFilterReduce.h b/Modules/Sources/WordPressSharedObjC/include/WPMapFilterReduce.h index 762930b0b263..283247050301 100644 --- a/Modules/Sources/WordPressSharedObjC/include/WPMapFilterReduce.h +++ b/Modules/Sources/WordPressSharedObjC/include/WPMapFilterReduce.h @@ -2,7 +2,6 @@ typedef id (^WPMapBlock)(id obj); typedef BOOL (^WPFilterBlock)(id obj); -typedef id (^WPReduceBlock)(id accumulator, id obj); @interface NSArray (WPMapFilterReduce) @@ -20,18 +19,4 @@ typedef id (^WPReduceBlock)(id accumulator, id obj); */ - (NSArray *)wp_filter:(WPFilterBlock)filterBlock; -/** - Combines the array values into a single value - - The reduce block is called for each value. The first time it's sent the initial - value, and subsequent calls will use the result of the previous call as the - accumulator. - - For instance, to calculate the sum of all items: - [array wp_reduce:^id(id accumulator, id obj) { - return @([accumulator longLongValue] + [obj longLongValue]); - } withInitialValue:@0]; - */ -- (id)wp_reduce:(WPReduceBlock)reduceBlock withInitialValue:(id)initial; - @end diff --git a/Modules/Sources/WordPressSharedObjC/include/WPNUXUtility.h b/Modules/Sources/WordPressSharedObjC/include/WPNUXUtility.h deleted file mode 100644 index 1f17ec24e74b..000000000000 --- a/Modules/Sources/WordPressSharedObjC/include/WPNUXUtility.h +++ /dev/null @@ -1,25 +0,0 @@ -#import - -@interface WPNUXUtility : NSObject - -+ (UIFont *)textFieldFont; -+ (UIFont *)descriptionTextFont; -+ (UIFont *)titleFont; -+ (UIFont *)swipeToContinueFont; -+ (UIFont *)tosLabelFont; -+ (UIFont *)confirmationLabelFont; -+ (UIFont *)tosLabelSmallerFont; - -+ (UIColor *)bottomPanelLineColor; -+ (UIColor *)descriptionTextColor; -+ (UIColor *)bottomPanelBackgroundColor; -+ (UIColor *)swipeToContinueTextColor; -+ (UIColor *)confirmationLabelColor; -+ (UIColor *)backgroundColor; -+ (UIColor *)tosLabelColor; - -+ (void)centerViews:(NSArray *)controls withStartingView:(UIView *)startingView andEndingView:(UIView *)endingView forHeight:(CGFloat)viewHeight; -+ (void)configurePageControlTintColors:(UIPageControl *)pageControl; -+ (NSDictionary *)titleAttributesWithColor:(UIColor *)color; - -@end diff --git a/Modules/Sources/WordPressSharedObjC/include/WPSharedLogging.h b/Modules/Sources/WordPressSharedObjC/include/WPSharedLogging.h deleted file mode 100644 index 5d7c53c2499f..000000000000 --- a/Modules/Sources/WordPressSharedObjC/include/WPSharedLogging.h +++ /dev/null @@ -1,21 +0,0 @@ -#import -#import "WordPressLoggingDelegate.h" - -NS_ASSUME_NONNULL_BEGIN - -FOUNDATION_EXTERN id _Nullable WPSharedGetLoggingDelegate(void); -FOUNDATION_EXTERN void WPSharedSetLoggingDelegate(id _Nullable logger); - -FOUNDATION_EXTERN void WPSharedLogError(NSString *str, ...) NS_FORMAT_FUNCTION(1, 2); -FOUNDATION_EXTERN void WPSharedLogWarning(NSString *str, ...) NS_FORMAT_FUNCTION(1, 2); -FOUNDATION_EXTERN void WPSharedLogInfo(NSString *str, ...) NS_FORMAT_FUNCTION(1, 2); -FOUNDATION_EXTERN void WPSharedLogDebug(NSString *str, ...) NS_FORMAT_FUNCTION(1, 2); -FOUNDATION_EXTERN void WPSharedLogVerbose(NSString *str, ...) NS_FORMAT_FUNCTION(1, 2); - -FOUNDATION_EXTERN void WPSharedLogvError(NSString *str, va_list args) NS_FORMAT_FUNCTION(1, 0); -FOUNDATION_EXTERN void WPSharedLogvWarning(NSString *str, va_list args) NS_FORMAT_FUNCTION(1, 0); -FOUNDATION_EXTERN void WPSharedLogvInfo(NSString *str, va_list args) NS_FORMAT_FUNCTION(1, 0); -FOUNDATION_EXTERN void WPSharedLogvDebug(NSString *str, va_list args) NS_FORMAT_FUNCTION(1, 0); -FOUNDATION_EXTERN void WPSharedLogvVerbose(NSString *str, va_list args) NS_FORMAT_FUNCTION(1, 0); - -NS_ASSUME_NONNULL_END diff --git a/Modules/Sources/WordPressSharedObjC/include/WPStyleGuide.h b/Modules/Sources/WordPressSharedObjC/include/WPStyleGuide.h index bfba822450d2..7bbda43a086e 100644 --- a/Modules/Sources/WordPressSharedObjC/include/WPStyleGuide.h +++ b/Modules/Sources/WordPressSharedObjC/include/WPStyleGuide.h @@ -39,45 +39,17 @@ NS_ASSUME_NONNULL_BEGIN + (UIColor *)greyDarken30; + (UIColor *)darkGrey; + (UIColor *)jazzyOrange; -+ (UIColor *)fireOrange; -+ (UIColor *)validGreen; -+ (UIColor *)warningYellow; + (UIColor *)errorRed; -+ (UIColor *)alertYellowDark; -+ (UIColor *)alertYellowLighter; -+ (UIColor *)alertRedDarker; - -// Misc -+ (UIColor *)keyboardColor; -+ (UIColor *)textFieldPlaceholderGrey; // Bar Button Styles + (UIBarButtonItemStyle)barButtonStyleForDone; + (UIBarButtonItemStyle)barButtonStyleForBordered; -+ (void)setLeftBarButtonItemWithCorrectSpacing:(UIBarButtonItem *)barButtonItem forNavigationItem:(UINavigationItem *)navigationItem; -+ (void)setRightBarButtonItemWithCorrectSpacing:(UIBarButtonItem *)barButtonItem forNavigationItem:(UINavigationItem *)navigationItem; -+ (void)configureNavigationBarAppearance; -+ (void)configureDocumentPickerNavBarAppearance; -// Move to a feature category -+ (UIColor *)buttonActionColor; -+ (UIColor *)nuxFormText; -+ (UIColor *)nuxFormPlaceholderText; ++ (void)setRightBarButtonItemWithCorrectSpacing:(UIBarButtonItem *)barButtonItem forNavigationItem:(UINavigationItem *)navigationItem; // Deprecated Colors -+ (UIColor *)baseLighterBlue; -+ (UIColor *)baseDarkerBlue; + (UIColor *)newKidOnTheBlockBlue; + (UIColor *)midnightBlue; -+ (UIColor *)bigEddieGrey; -+ (UIColor *)littleEddieGrey; -+ (UIColor *)whisperGrey; -+ (UIColor *)allTAllShadeGrey; -+ (UIColor *)readGrey; -+ (UIColor *)itsEverywhereGrey; -+ (UIColor *)darkAsNightGrey; -+ (UIColor *)validationErrorRed; - @end NS_ASSUME_NONNULL_END diff --git a/Modules/Sources/WordPressSharedObjC/include/WPTableViewCell.h b/Modules/Sources/WordPressSharedObjC/include/WPTableViewCell.h index 18b822078386..d1728c9f6364 100644 --- a/Modules/Sources/WordPressSharedObjC/include/WPTableViewCell.h +++ b/Modules/Sources/WordPressSharedObjC/include/WPTableViewCell.h @@ -1,13 +1,6 @@ #import -extern CGFloat const WPTableViewFixedWidth; - +// TODO: remove @interface WPTableViewCell : UITableViewCell -/** - Temporary flag for enabling the margins hack on cells, while views adopt readable margins. - Note: Defaults to NO. - */ -@property (nonatomic, assign) BOOL forceCustomCellMargins; - @end diff --git a/Modules/Sources/WordPressUI/Extensions/NSBundle+ResourceBundle.swift b/Modules/Sources/WordPressUI/Extensions/NSBundle+ResourceBundle.swift index a784f7f5e154..ae09a04f8d19 100644 --- a/Modules/Sources/WordPressUI/Extensions/NSBundle+ResourceBundle.swift +++ b/Modules/Sources/WordPressUI/Extensions/NSBundle+ResourceBundle.swift @@ -2,7 +2,6 @@ import Foundation extension Bundle { @objc public class var wordPressUIBundle: Bundle { -#if SWIFT_PACKAGE #if DEBUG // Workaround for https://forums.swift.org/t/swift-5-3-swiftpm-resources-in-tests-uses-wrong-bundle-path/37051 if let testBundlePath = ProcessInfo.processInfo.environment["XCTestBundlePath"], @@ -11,15 +10,5 @@ extension Bundle { } #endif return Bundle.module -#else - let defaultBundle = Bundle(for: FancyAlertViewController.self) - // If installed with CocoaPods, resources will be in WordPressUIResources.bundle - if let bundleUrl = defaultBundle.url(forResource: "WordPressUIResources", withExtension: "bundle"), - let resourceBundle = Bundle(url: bundleUrl) { - return resourceBundle - } - // Otherwise, the default bundle is used for resources - return defaultBundle -#endif } } diff --git a/Modules/Tests/WordPressSharedObjCTests/LoggingTests.m b/Modules/Tests/WordPressSharedObjCTests/LoggingTests.m deleted file mode 100644 index a61a50fad789..000000000000 --- a/Modules/Tests/WordPressSharedObjCTests/LoggingTests.m +++ /dev/null @@ -1,78 +0,0 @@ -#import - -@import WordPressSharedObjC; - -@interface CaptureLogs : NSObject - -@property (nonatomic, strong) NSMutableArray *infoLogs; -@property (nonatomic, strong) NSMutableArray *errorLogs; - -@end - -@implementation CaptureLogs - -- (instancetype)init -{ - if ((self = [super init])) { - self.infoLogs = [NSMutableArray new]; - self.errorLogs = [NSMutableArray new]; - } - return self; -} - -- (void)logInfo:(NSString *)str -{ - [self.infoLogs addObject:str]; -} - -- (void)logError:(NSString *)str -{ - [self.errorLogs addObject:str]; -} - -- (void)logDebug:(nonnull NSString *)str {} - -- (void)logVerbose:(nonnull NSString *)str {} - -- (void)logWarning:(nonnull NSString *)str {} - -@end - -@interface LoggingTest : XCTestCase - -@property (nonatomic, strong) CaptureLogs *logger; - -@end - -@implementation LoggingTest - -- (void)setUp -{ - self.logger = [CaptureLogs new]; - WPSharedSetLoggingDelegate(self.logger); -} - -- (void)testLogging -{ - WPSharedLogInfo(@"This is an info log"); - WPSharedLogInfo(@"This is an info log %@", @"with an argument"); - XCTAssertEqualObjects(self.logger.infoLogs, (@[@"This is an info log", @"This is an info log with an argument"])); - - WPSharedLogError(@"This is an error log"); - WPSharedLogError(@"This is an error log %@", @"with an argument"); - XCTAssertEqualObjects(self.logger.errorLogs, (@[@"This is an error log", @"This is an error log with an argument"])); -} - -- (void)testUnimplementedLoggingMethod -{ - XCTAssertNoThrow(WPSharedLogVerbose(@"verbose logging is not implemented")); -} - -- (void)testNoLogging -{ - WPSharedSetLoggingDelegate(nil); - XCTAssertNoThrow(WPSharedLogInfo(@"this log should not be printed")); - XCTAssertEqual(self.logger.infoLogs.count, 0); -} - -@end diff --git a/Modules/Tests/WordPressSharedObjCTests/WPMapFilterReduceTest.m b/Modules/Tests/WordPressSharedObjCTests/WPMapFilterReduceTest.m index 63b577bc43da..a6eb913c5dd9 100644 --- a/Modules/Tests/WordPressSharedObjCTests/WPMapFilterReduceTest.m +++ b/Modules/Tests/WordPressSharedObjCTests/WPMapFilterReduceTest.m @@ -65,14 +65,4 @@ - (void)testFilterPerformance { }]; } -- (void)testReduce -{ - NSArray *test = @[ @1, @2, @3, @4, @5, @6, @7, @8, @9, @10 ]; - NSNumber *result = [test wp_reduce:^id(id accumulator, id obj) { - return @([accumulator longLongValue] + [obj longLongValue]); - } withInitialValue:@0]; - NSNumber *expected = @55; - XCTAssertEqualObjects(expected, result); -} - @end diff --git a/Modules/Tests/WordPressSharedTests/LoggingTests.swift b/Modules/Tests/WordPressSharedTests/LoggingTests.swift deleted file mode 100644 index f2b2ab0c6264..000000000000 --- a/Modules/Tests/WordPressSharedTests/LoggingTests.swift +++ /dev/null @@ -1,70 +0,0 @@ -import XCTest - -@testable import WordPressShared - -private class CaptureLogs: NSObject, WordPressLoggingDelegate { - var verboseLogs = [String]() - var debugLogs = [String]() - var infoLogs = [String]() - var warningLogs = [String]() - var errorLogs = [String]() - - func logError(_ str: String) { - errorLogs.append(str) - } - - func logWarning(_ str: String) { - warningLogs.append(str) - } - - func logInfo(_ str: String) { - infoLogs.append(str) - } - - func logDebug(_ str: String) { - debugLogs.append(str) - } - - func logVerbose(_ str: String) { - verboseLogs.append(str) - } - -} - -class LoggingTest: XCTestCase { - - private let logger = CaptureLogs() - - override func setUp() { - WPSharedSetLoggingDelegate(logger) - } - - func testLogging() { - WPSharedLogVerbose("This is a verbose log") - WPSharedLogVerbose("This is a verbose log %@", "with an argument") - XCTAssertEqual(self.logger.verboseLogs, ["This is a verbose log", "This is a verbose log with an argument"]) - - WPSharedLogDebug("This is a debug log") - WPSharedLogDebug("This is a debug log %@", "with an argument") - XCTAssertEqual(self.logger.debugLogs, ["This is a debug log", "This is a debug log with an argument"]) - - WPSharedLogInfo("This is an info log") - WPSharedLogInfo("This is an info log %@", "with an argument") - XCTAssertEqual(self.logger.infoLogs, ["This is an info log", "This is an info log with an argument"]) - - WPSharedLogWarning("This is a warning log") - WPSharedLogWarning("This is a warning log %@", "with an argument") - XCTAssertEqual(self.logger.warningLogs, ["This is a warning log", "This is a warning log with an argument"]) - - WPSharedLogError("This is an error log") - WPSharedLogError("This is an error log %@", "with an argument") - XCTAssertEqual(self.logger.errorLogs, ["This is an error log", "This is an error log with an argument"]) - } - - func testNoLogging() { - WPSharedSetLoggingDelegate(nil) - XCTAssertNoThrow(WPSharedLogInfo("this log should not be printed")) - XCTAssertEqual(self.logger.infoLogs.count, 0) - } - -} diff --git a/WordPress/Classes/Extensions/JSONDecoderExtension.swift b/WordPress/Classes/Extensions/JSONDecoderExtension.swift index 0b3802ecf131..c82b77292331 100644 --- a/WordPress/Classes/Extensions/JSONDecoderExtension.swift +++ b/WordPress/Classes/Extensions/JSONDecoderExtension.swift @@ -1,35 +1,12 @@ import Foundation extension JSONDecoder.DateDecodingStrategy { - - enum DateFormat: String, CaseIterable { - case noTime = "yyyy-mm-dd" - case dateWithTime = "yyyy-MM-dd HH:mm:ss" - case iso8601 = "yyyy-MM-dd'T'HH:mm:ssZ" - case iso8601WithMilliseconds = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" - - var formatter: DateFormatter { - let dateFormatter = DateFormatter() - dateFormatter.dateFormat = rawValue - return dateFormatter - } - } - static var supportMultipleDateFormats: JSONDecoder.DateDecodingStrategy { return JSONDecoder.DateDecodingStrategy.custom({ (decoder) -> Date in let container = try decoder.singleValueContainer() let dateStr = try container.decode(String.self) - var date: Date? - - for format in DateFormat.allCases { - date = format.formatter.date(from: dateStr) - if date != nil { - break - } - } - - guard let calculatedDate = date else { + guard let calculatedDate = Date.dateFromServerDate(dateStr) else { throw DecodingError.dataCorruptedError( in: container, debugDescription: "Cannot decode date string \(dateStr)" @@ -40,3 +17,35 @@ extension JSONDecoder.DateDecodingStrategy { }) } } + +private enum DateFormat: String, CaseIterable { + case noTime = "yyyy-mm-dd" + case dateWithTime = "yyyy-MM-dd HH:mm:ss" + case iso8601 = "yyyy-MM-dd'T'HH:mm:ssZ" + case iso8601WithMilliseconds = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" + + var formatter: DateFormatter { + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = rawValue + return dateFormatter + } +} + +extension Date { + public static func dateFromServerDate(_ string: String) -> Date? { + var date: Date? + for format in DateFormat.allCases { + date = format.formatter.date(from: string) + if date != nil { + break + } + } + return date + } +} + +extension NSDate { + @objc public static func dateFromServerDate(_ string: String) -> Date? { + Date.dateFromServerDate(string) + } +} diff --git a/WordPress/Classes/Models/ReaderPost.m b/WordPress/Classes/Models/ReaderPost.m index 687ad00f7112..9edd2897b04a 100644 --- a/WordPress/Classes/Models/ReaderPost.m +++ b/WordPress/Classes/Models/ReaderPost.m @@ -106,7 +106,7 @@ + (instancetype)createOrReplaceFromRemotePost:(RemoteReaderPost *)remotePost post.blogURL = remotePost.blogURL; post.commentCount = remotePost.commentCount; post.commentsOpen = remotePost.commentsOpen; - post.date_created_gmt = [DateUtils dateFromISOString:remotePost.date_created_gmt]; + post.date_created_gmt = [NSDate dateFromServerDate:remotePost.date_created_gmt]; post.featuredImage = remotePost.featuredImage; post.feedID = remotePost.feedID; post.feedItemID = remotePost.feedItemID; diff --git a/WordPress/Classes/Services/LikeUserHelpers.swift b/WordPress/Classes/Services/LikeUserHelpers.swift index 8c3f0b21ba92..0799ac83f945 100644 --- a/WordPress/Classes/Services/LikeUserHelpers.swift +++ b/WordPress/Classes/Services/LikeUserHelpers.swift @@ -16,7 +16,7 @@ import CoreData liker.avatarUrl = remoteUser.avatarURL liker.bio = remoteUser.bio ?? "" liker.dateLikedString = remoteUser.dateLiked ?? "" - liker.dateLiked = DateUtils.date(fromISOString: liker.dateLikedString) + liker.dateLiked = Date.dateFromServerDate(liker.dateLikedString) ?? .now liker.likedSiteID = remoteUser.likedSiteID?.int64Value ?? 0 liker.likedPostID = remoteUser.likedPostID?.int64Value ?? 0 liker.likedCommentID = remoteUser.likedCommentID?.int64Value ?? 0 diff --git a/WordPress/Classes/System/WordPressAppDelegate.swift b/WordPress/Classes/System/WordPressAppDelegate.swift index 43df8547dc22..0cef65a30556 100644 --- a/WordPress/Classes/System/WordPressAppDelegate.swift +++ b/WordPress/Classes/System/WordPressAppDelegate.swift @@ -234,7 +234,6 @@ class WordPressAppDelegate: UIResponder, UIApplicationDelegate { let libraryLogger = WordPressLibraryLogger() TracksLogging.delegate = libraryLogger - WPSharedSetLoggingDelegate(libraryLogger) WPKitSetLoggingDelegate(libraryLogger) WPAuthenticatorSetLoggingDelegate(libraryLogger) @@ -646,7 +645,7 @@ extension WordPressAppDelegate { let architecture = UIDeviceHardware.platform() let languages = UserPersistentStoreFactory.instance().array(forKey: "AppleLanguages") let currentLanguage = languages?.first ?? unknown - let udid = device.wordPressIdentifier() ?? unknown + let udid = device.identifierForVendor?.uuidString ?? unknown DDLogInfo("Device model: \(devicePlatform) (\(architecture))") DDLogInfo("OS: \(device.systemName), \(device.systemVersion)") diff --git a/WordPress/Classes/Utility/Logging/WPLogger.m b/WordPress/Classes/Utility/Logging/WPLogger.m index d56012c728f2..2087813708d2 100644 --- a/WordPress/Classes/Utility/Logging/WPLogger.m +++ b/WordPress/Classes/Utility/Logging/WPLogger.m @@ -96,7 +96,7 @@ - (NSString *)getLogFilesContentWithMaxSize:(NSInteger)maxSize NSString *result = [[NSString alloc] initWithBytes:[logData bytes] length:[logData length] encoding: NSUTF8StringEncoding]; - + [description appendString:result]; } } diff --git a/WordPress/WordPress.xcodeproj/project.pbxproj b/WordPress/WordPress.xcodeproj/project.pbxproj index e766de58ede8..769b1947b39a 100644 --- a/WordPress/WordPress.xcodeproj/project.pbxproj +++ b/WordPress/WordPress.xcodeproj/project.pbxproj @@ -1467,12 +1467,8 @@ 4AD954F22C2145CB00D0EEFA /* WPHelpIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AD9542B2C2145CB00D0EEFA /* WPHelpIndicatorView.swift */; }; 4AD954F32C2145CB00D0EEFA /* WPNUXMainButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AD9542C2C2145CB00D0EEFA /* WPNUXMainButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4AD954F42C2145CB00D0EEFA /* WPNUXMainButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AD9542D2C2145CB00D0EEFA /* WPNUXMainButton.m */; }; - 4AD954F52C2145CB00D0EEFA /* WPNUXPrimaryButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AD9542E2C2145CB00D0EEFA /* WPNUXPrimaryButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4AD954F62C2145CB00D0EEFA /* WPNUXPrimaryButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AD9542F2C2145CB00D0EEFA /* WPNUXPrimaryButton.m */; }; 4AD954F72C2145CB00D0EEFA /* WPNUXSecondaryButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AD954302C2145CB00D0EEFA /* WPNUXSecondaryButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4AD954F82C2145CB00D0EEFA /* WPNUXSecondaryButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AD954312C2145CB00D0EEFA /* WPNUXSecondaryButton.m */; }; - 4AD954F92C2145CB00D0EEFA /* WPWalkthroughOverlayView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AD954322C2145CB00D0EEFA /* WPWalkthroughOverlayView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4AD954FA2C2145CB00D0EEFA /* WPWalkthroughOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AD954332C2145CB00D0EEFA /* WPWalkthroughOverlayView.m */; }; 4AD954FB2C2145CB00D0EEFA /* WPWalkthroughTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AD954342C2145CB00D0EEFA /* WPWalkthroughTextField.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4AD954FC2C2145CB00D0EEFA /* WPWalkthroughTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AD954352C2145CB00D0EEFA /* WPWalkthroughTextField.m */; }; 4AD955052C2145CB00D0EEFA /* LoginFacade.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AD954432C2145CB00D0EEFA /* LoginFacade.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -7443,12 +7439,8 @@ 4AD9542B2C2145CB00D0EEFA /* WPHelpIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WPHelpIndicatorView.swift; sourceTree = ""; }; 4AD9542C2C2145CB00D0EEFA /* WPNUXMainButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPNUXMainButton.h; sourceTree = ""; }; 4AD9542D2C2145CB00D0EEFA /* WPNUXMainButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPNUXMainButton.m; sourceTree = ""; }; - 4AD9542E2C2145CB00D0EEFA /* WPNUXPrimaryButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPNUXPrimaryButton.h; sourceTree = ""; }; - 4AD9542F2C2145CB00D0EEFA /* WPNUXPrimaryButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPNUXPrimaryButton.m; sourceTree = ""; }; 4AD954302C2145CB00D0EEFA /* WPNUXSecondaryButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPNUXSecondaryButton.h; sourceTree = ""; }; 4AD954312C2145CB00D0EEFA /* WPNUXSecondaryButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPNUXSecondaryButton.m; sourceTree = ""; }; - 4AD954322C2145CB00D0EEFA /* WPWalkthroughOverlayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPWalkthroughOverlayView.h; sourceTree = ""; }; - 4AD954332C2145CB00D0EEFA /* WPWalkthroughOverlayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPWalkthroughOverlayView.m; sourceTree = ""; }; 4AD954342C2145CB00D0EEFA /* WPWalkthroughTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPWalkthroughTextField.h; sourceTree = ""; }; 4AD954352C2145CB00D0EEFA /* WPWalkthroughTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPWalkthroughTextField.m; sourceTree = ""; }; 4AD954372C2145CB00D0EEFA /* WPAuthenticator-Swift.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "WPAuthenticator-Swift.h"; sourceTree = ""; }; @@ -12967,12 +12959,8 @@ 4AD9542B2C2145CB00D0EEFA /* WPHelpIndicatorView.swift */, 4AD9542C2C2145CB00D0EEFA /* WPNUXMainButton.h */, 4AD9542D2C2145CB00D0EEFA /* WPNUXMainButton.m */, - 4AD9542E2C2145CB00D0EEFA /* WPNUXPrimaryButton.h */, - 4AD9542F2C2145CB00D0EEFA /* WPNUXPrimaryButton.m */, 4AD954302C2145CB00D0EEFA /* WPNUXSecondaryButton.h */, 4AD954312C2145CB00D0EEFA /* WPNUXSecondaryButton.m */, - 4AD954322C2145CB00D0EEFA /* WPWalkthroughOverlayView.h */, - 4AD954332C2145CB00D0EEFA /* WPWalkthroughOverlayView.m */, 4AD954342C2145CB00D0EEFA /* WPWalkthroughTextField.h */, 4AD954352C2145CB00D0EEFA /* WPWalkthroughTextField.m */, ); @@ -19602,11 +19590,9 @@ 4AD955052C2145CB00D0EEFA /* LoginFacade.h in Headers */, 4AD955102C2145CB00D0EEFA /* WordPressXMLRPCAPIFacade.h in Headers */, 4AD954F32C2145CB00D0EEFA /* WPNUXMainButton.h in Headers */, - 4AD954F92C2145CB00D0EEFA /* WPWalkthroughOverlayView.h in Headers */, 4AD954FB2C2145CB00D0EEFA /* WPWalkthroughTextField.h in Headers */, 4AD954D82C2145CB00D0EEFA /* WPAuthenticatorLogging.h in Headers */, 4AD954F72C2145CB00D0EEFA /* WPNUXSecondaryButton.h in Headers */, - 4AD954F52C2145CB00D0EEFA /* WPNUXPrimaryButton.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -23684,7 +23670,6 @@ 4AD955512C2145CB00D0EEFA /* VerifyEmailViewController.swift in Sources */, 4AD954A52C2145CB00D0EEFA /* AuthenticatorAnalyticsTracker.swift in Sources */, 4AD954DB2C2145CB00D0EEFA /* LoginFields.swift in Sources */, - 4AD954FA2C2145CB00D0EEFA /* WPWalkthroughOverlayView.m in Sources */, 4AD9550D2C2145CB00D0EEFA /* WordPressComBlogService.swift in Sources */, 4AD954DA2C2145CB00D0EEFA /* WPAuthenticatorLogging.swift in Sources */, 4AD955122C2145CB00D0EEFA /* AppleAuthenticator.swift in Sources */, @@ -23713,7 +23698,6 @@ 4AD954D92C2145CB00D0EEFA /* WPAuthenticatorLogging.m in Sources */, 4AD954B02C2145CB00D0EEFA /* WordPressSupportSourceTag.swift in Sources */, 4AD955362C2145CB00D0EEFA /* GoogleSignupConfirmationViewController.swift in Sources */, - 4AD954F62C2145CB00D0EEFA /* WPNUXPrimaryButton.m in Sources */, 4AD954FC2C2145CB00D0EEFA /* WPWalkthroughTextField.m in Sources */, 4AD954BD2C2145CB00D0EEFA /* UIStoryboard+Helpers.swift in Sources */, 4AD954CB2C2145CB00D0EEFA /* GoogleOAuthTokenGetting.swift in Sources */, diff --git a/WordPressAuthenticator/Sources/Extensions/FancyAlertViewController+LoginError.swift b/WordPressAuthenticator/Sources/Extensions/FancyAlertViewController+LoginError.swift index b420e8f4bbd5..3c0db3fe54b1 100644 --- a/WordPressAuthenticator/Sources/Extensions/FancyAlertViewController+LoginError.swift +++ b/WordPressAuthenticator/Sources/Extensions/FancyAlertViewController+LoginError.swift @@ -184,10 +184,6 @@ extension FancyAlertViewController { return FancyAlertViewController.controllerWithConfiguration(configuration: config) } - /// Shows a WPWalkthroughOverlayView for a bad url error message. - /// - /// - Parameter message: The error message to show. - /// private static func alertForBadURL(with message: String) -> FancyAlertViewController { let moreHelpButton = ButtonConfig(Strings.moreHelp) { controller, _ in controller.dismiss(animated: true) { diff --git a/WordPressAuthenticator/Sources/NUX/WPNUXPrimaryButton.h b/WordPressAuthenticator/Sources/NUX/WPNUXPrimaryButton.h deleted file mode 100644 index e9fb2a4ca43d..000000000000 --- a/WordPressAuthenticator/Sources/NUX/WPNUXPrimaryButton.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@interface WPNUXPrimaryButton : UIButton - -@end diff --git a/WordPressAuthenticator/Sources/NUX/WPNUXPrimaryButton.m b/WordPressAuthenticator/Sources/NUX/WPNUXPrimaryButton.m deleted file mode 100644 index 9d3dc6f24f3e..000000000000 --- a/WordPressAuthenticator/Sources/NUX/WPNUXPrimaryButton.m +++ /dev/null @@ -1,59 +0,0 @@ -#import "WPNUXPrimaryButton.h" - -@import WordPressShared; - -@implementation WPNUXPrimaryButton - -- (id)initWithFrame:(CGRect)frame -{ - self = [super initWithFrame:frame]; - if (self) { - [self configureButton]; - } - return self; -} - -- (id)initWithCoder:(NSCoder *)aDecoder -{ - self = [super initWithCoder:aDecoder]; - if (self) { - [self configureButton]; - } - return self; -} - -- (void)sizeToFit -{ - [super sizeToFit]; - - // Adjust frame to account for the edge insets - CGRect frame = self.frame; - frame.size.width += self.titleEdgeInsets.left + self.titleEdgeInsets.right; - self.frame = frame; -} - -- (CGSize)intrinsicContentSize -{ - CGSize size = [self sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)]; - size.width += self.titleEdgeInsets.left + self.titleEdgeInsets.right; - return size; -} - -#pragma mark - Private Methods - -- (void)configureButton -{ - UIImage *mainImage = [[UIImage imageNamed:@"btn-primary"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 4, 0, 4)]; - UIImage *tappedImage = [[UIImage imageNamed:@"btn-primary-tap"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 4, 0, 4)]; - self.titleLabel.font = [WPFontManager systemRegularFontOfSize:15.0]; - self.titleLabel.minimumScaleFactor = 10.0/15.0; - [self setTitleEdgeInsets:UIEdgeInsetsMake(0, 15.0, 0, 15.0)]; - [self setBackgroundImage:mainImage forState:UIControlStateNormal]; - [self setBackgroundImage:tappedImage forState:UIControlStateHighlighted]; - [self setTitleColor:[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.9] forState:UIControlStateNormal]; - [self setTitleColor:[UIColor colorWithRed:25.0/255.0 green:135.0/255.0 blue:179.0/255.0 alpha:1.0] forState:UIControlStateHighlighted]; - [self setTitleColor:[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.6] forState:UIControlStateDisabled]; - -} - -@end diff --git a/WordPressAuthenticator/Sources/NUX/WPWalkthroughOverlayView.h b/WordPressAuthenticator/Sources/NUX/WPWalkthroughOverlayView.h deleted file mode 100644 index cca69b6ec626..000000000000 --- a/WordPressAuthenticator/Sources/NUX/WPWalkthroughOverlayView.h +++ /dev/null @@ -1,31 +0,0 @@ -#import - -typedef NS_ENUM(NSUInteger, WPWalkthroughOverlayViewOverlayMode) { - WPWalkthroughGrayOverlayViewOverlayModeTapToDismiss, - WPWalkthroughGrayOverlayViewOverlayModeTwoButtonMode, - WPWalkthroughGrayOverlayViewOverlayModePrimaryButton -}; - -typedef NS_ENUM(NSUInteger, WPWalkthroughOverlayViewIcon) { - WPWalkthroughGrayOverlayViewWarningIcon, - WPWalkthroughGrayOverlayViewBlueCheckmarkIcon, -}; - -@interface WPWalkthroughOverlayView : UIView - -@property (nonatomic, assign) WPWalkthroughOverlayViewOverlayMode overlayMode; -@property (nonatomic, assign) WPWalkthroughOverlayViewIcon icon; -@property (nonatomic, strong) NSString *overlayTitle; -@property (nonatomic, strong) NSString *overlayDescription; -@property (nonatomic, strong) NSString *footerDescription; -@property (nonatomic, strong) NSString *secondaryButtonText; -@property (nonatomic, strong) NSString *primaryButtonText; -@property (nonatomic, assign) BOOL hideBackgroundView; - -@property (nonatomic, copy) void (^dismissCompletionBlock)(WPWalkthroughOverlayView *); -@property (nonatomic, copy) void (^secondaryButtonCompletionBlock)(WPWalkthroughOverlayView *); -@property (nonatomic, copy) void (^primaryButtonCompletionBlock)(WPWalkthroughOverlayView *); - -- (void)dismiss; - -@end diff --git a/WordPressAuthenticator/Sources/NUX/WPWalkthroughOverlayView.m b/WordPressAuthenticator/Sources/NUX/WPWalkthroughOverlayView.m deleted file mode 100644 index c0cf101d0c71..000000000000 --- a/WordPressAuthenticator/Sources/NUX/WPWalkthroughOverlayView.m +++ /dev/null @@ -1,331 +0,0 @@ -#import "WPWalkthroughOverlayView.h" -#import "WPNUXPrimaryButton.h" -#import "WPNUXSecondaryButton.h" - -@import WordPressUI; -@import WordPressUIObjC; -@import WordPressShared; -@import WordPressSharedObjC; - -@interface WPWalkthroughOverlayView() { - UIImageView *_logo; - UILabel *_title; - UILabel *_description; - UILabel *_bottomLabel; - WPNUXSecondaryButton *_secondaryButton; - WPNUXPrimaryButton *_primaryButton; - - CGFloat _viewWidth; - CGFloat _viewHeight; - - UITapGestureRecognizer *_gestureRecognizer; -} - -@end - -@implementation WPWalkthroughOverlayView - -CGFloat const WPWalkthroughGrayOverlayIconVerticalOffset = 75.0; -CGFloat const WPWalkthroughGrayOverlayStandardOffset = 16.0; -CGFloat const WPWalkthroughGrayOverlayBottomLabelOffset = 91.0; -CGFloat const WPWalkthroughGrayOverlayBottomPanelHeight = 64.0; -CGFloat const WPWalkthroughGrayOverlayMaxLabelWidth = 289.0; - -- (id)initWithFrame:(CGRect)frame -{ - self = [super initWithFrame:frame]; - if (self) { - _overlayMode = WPWalkthroughGrayOverlayViewOverlayModePrimaryButton; - - self.accessibilityViewIsModal = YES; - - [self configureBackgroundColor]; - [self addViewElements]; - [self addGestureRecognizer]; - [self setPrimaryButtonText:NSLocalizedString(@"OK", nil)]; - } - return self; -} - -- (void)setOverlayMode:(WPWalkthroughOverlayViewOverlayMode)overlayMode -{ - if (_overlayMode != overlayMode) { - _overlayMode = overlayMode; - [self adjustOverlayDismissal]; - [self setNeedsLayout]; - } -} - -- (void)setOverlayTitle:(NSString *)overlayTitle -{ - if (_overlayTitle != overlayTitle) { - _overlayTitle = overlayTitle; - _title.text = _overlayTitle; - [self setNeedsLayout]; - } -} - -- (void)setOverlayDescription:(NSString *)overlayDescription -{ - if (_overlayDescription != overlayDescription) { - _overlayDescription = overlayDescription; - _description.text = _overlayDescription; - [self setNeedsLayout]; - } -} - -- (void)setFooterDescription:(NSString *)footerDescription -{ - if (_footerDescription != footerDescription) { - _footerDescription = footerDescription; - _bottomLabel.text = _footerDescription; - [self setNeedsLayout]; - } -} - -- (void)setSecondaryButtonText:(NSString *)leftButtonText -{ - if (_secondaryButtonText != leftButtonText) { - _secondaryButtonText = leftButtonText; - [_secondaryButton setTitle:_secondaryButtonText forState:UIControlStateNormal]; - [_secondaryButton sizeToFit]; - [self setNeedsLayout]; - } -} - -- (void)setPrimaryButtonText:(NSString *)rightButtonText -{ - if (_primaryButtonText != rightButtonText) { - _primaryButtonText = rightButtonText; - [_primaryButton setTitle:_primaryButtonText forState:UIControlStateNormal]; - [_primaryButton sizeToFit]; - [self setNeedsLayout]; - } -} - -- (void)setIcon:(WPWalkthroughOverlayViewIcon)icon -{ - if (_icon != icon) { - _icon = icon; - [self configureIcon]; - [self setNeedsLayout]; - } -} - -- (void)setHideBackgroundView:(BOOL)hideBackgroundView -{ - if (_hideBackgroundView != hideBackgroundView) { - _hideBackgroundView = hideBackgroundView; - [self configureBackgroundColor]; - [self setNeedsLayout]; - } -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - - _viewWidth = CGRectGetWidth(self.bounds); - _viewHeight = CGRectGetHeight(self.bounds); - - CGFloat x, y; - - // Layout Logo - [self configureIcon]; - x = (_viewWidth - CGRectGetWidth(_logo.frame))/2.0; - y = WPWalkthroughGrayOverlayIconVerticalOffset; - _logo.frame = CGRectIntegral(CGRectMake(x, y, CGRectGetWidth(_logo.frame), CGRectGetHeight(_logo.frame))); - - // Layout Title - CGSize titleSize = [_title suggestedSizeForWidth:WPWalkthroughGrayOverlayMaxLabelWidth]; - x = (_viewWidth - titleSize.width)/2.0; - y = CGRectGetMaxY(_logo.frame) + 0.5*WPWalkthroughGrayOverlayStandardOffset; - _title.frame = CGRectIntegral(CGRectMake(x, y, titleSize.width, titleSize.height)); - - // Layout Description - CGSize labelSize = [_description suggestedSizeForWidth:WPWalkthroughGrayOverlayMaxLabelWidth]; - x = (_viewWidth - labelSize.width)/2.0; - y = CGRectGetMaxY(_title.frame) + 0.5*WPWalkthroughGrayOverlayStandardOffset; - _description.frame = CGRectIntegral(CGRectMake(x, y, labelSize.width, labelSize.height)); - - // Layout Bottom Label - CGSize bottomLabelSize = [_bottomLabel.text sizeWithAttributes:@{NSFontAttributeName:_bottomLabel.font}]; - x = (_viewWidth - bottomLabelSize.width)/2.0; - y = _viewHeight - WPWalkthroughGrayOverlayBottomLabelOffset; - _bottomLabel.frame = CGRectIntegral(CGRectMake(x, y, bottomLabelSize.width, bottomLabelSize.height)); - - // Layout Bottom Buttons - if (self.overlayMode == WPWalkthroughGrayOverlayViewOverlayModePrimaryButton || - self.overlayMode == WPWalkthroughGrayOverlayViewOverlayModeTwoButtonMode) { - - x = _viewWidth - CGRectGetWidth(_primaryButton.frame) - WPWalkthroughGrayOverlayStandardOffset; - y = (_viewHeight - WPWalkthroughGrayOverlayBottomPanelHeight + WPWalkthroughGrayOverlayStandardOffset); - _primaryButton.frame = CGRectIntegral(CGRectMake(x, y, CGRectGetWidth(_primaryButton.frame), CGRectGetHeight(_primaryButton.frame))); - } else { - _primaryButton.frame = CGRectZero; - } - - if (self.overlayMode == WPWalkthroughGrayOverlayViewOverlayModeTwoButtonMode) { - - x = WPWalkthroughGrayOverlayStandardOffset; - y = (_viewHeight - WPWalkthroughGrayOverlayBottomPanelHeight + WPWalkthroughGrayOverlayStandardOffset); - _secondaryButton.frame = CGRectIntegral(CGRectMake(x, y, CGRectGetWidth(_secondaryButton.frame), CGRectGetHeight(_secondaryButton.frame))); - } else { - _secondaryButton.frame = CGRectZero; - } - - CGFloat heightFromBottomLabel = _viewHeight - CGRectGetMinY(_bottomLabel.frame) - CGRectGetHeight(_bottomLabel.frame); - NSArray *viewsToCenter = @[_logo, _title, _description]; - [WPNUXUtility centerViews:viewsToCenter withStartingView:_logo andEndingView:_description forHeight:(_viewHeight-heightFromBottomLabel)]; -} - -- (void)didMoveToSuperview -{ - [super didMoveToSuperview]; - - if (UIAccessibilityIsVoiceOverRunning()) { - UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, _title); - } -} - -- (void)dismiss -{ - [self removeFromSuperview]; -} - -#pragma mark - Private Methods - -- (void)configureBackgroundColor -{ - CGFloat alpha = 0.95; - if (self.hideBackgroundView) { - alpha = 1.0; - } - self.backgroundColor = [UIColor colorWithRed:17.0/255.0 green:17.0/255.0 blue:17.0/255.0 alpha:alpha]; -} - -- (void)addGestureRecognizer -{ - _gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tappedOnView:)]; - _gestureRecognizer.numberOfTapsRequired = 1; - _gestureRecognizer.cancelsTouchesInView = NO; - [self addGestureRecognizer:_gestureRecognizer]; -} - -- (void)addViewElements -{ - // Add Icon - _logo = [[UIImageView alloc] init]; - [self configureIcon]; - [self addSubview:_logo]; - - // Add Title - _title = [[UILabel alloc] init]; - _title.backgroundColor = [UIColor clearColor]; - _title.textAlignment = NSTextAlignmentCenter; - _title.numberOfLines = 0; - _title.lineBreakMode = NSLineBreakByWordWrapping; - _title.font = [WPFontManager systemLightFontOfSize:25.0]; - _title.text = self.overlayTitle; - _title.shadowColor = [UIColor blackColor]; - _title.shadowOffset = CGSizeMake(1.0, 1.0); - _title.textColor = [UIColor whiteColor]; - [self addSubview:_title]; - - // Add Description - _description = [[UILabel alloc] init]; - _description.backgroundColor = [UIColor clearColor]; - _description.textAlignment = NSTextAlignmentCenter; - _description.numberOfLines = 0; - _description.lineBreakMode = NSLineBreakByWordWrapping; - _description.font = [WPNUXUtility descriptionTextFont]; - _description.text = self.overlayDescription; - _description.shadowColor = [UIColor blackColor]; - _description.textColor = [UIColor whiteColor]; - [self addSubview:_description]; - - // Add Bottom Label - _bottomLabel = [[UILabel alloc] init]; - _bottomLabel.backgroundColor = [UIColor clearColor]; - _bottomLabel.textAlignment = NSTextAlignmentCenter; - _bottomLabel.numberOfLines = 1; - _bottomLabel.font = [WPFontManager systemRegularFontOfSize:10.0]; - _bottomLabel.text = self.footerDescription; - _bottomLabel.textColor = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.4]; - [self addSubview:_bottomLabel]; - - // Add Button 1 - _secondaryButton = [[WPNUXSecondaryButton alloc] init]; - [_secondaryButton setTitle:self.secondaryButtonText forState:UIControlStateNormal]; - [_secondaryButton sizeToFit]; - [_secondaryButton addTarget:self action:@selector(secondaryButtonAction) forControlEvents:UIControlEventTouchUpInside]; - [self addSubview:_secondaryButton]; - - // Add Button 2 - _primaryButton = [[WPNUXPrimaryButton alloc] init]; - [_primaryButton setTitle:self.primaryButtonText forState:UIControlStateNormal]; - [_primaryButton sizeToFit]; - [_primaryButton addTarget:self action:@selector(primaryButtonAction) forControlEvents:UIControlEventTouchUpInside]; - [self addSubview:_primaryButton]; -} - -- (void)configureIcon -{ - UIImage *image; - if (self.icon == WPWalkthroughGrayOverlayViewWarningIcon) { - image = [UIImage imageNamed:@"icon-alert"]; - } else { - image = [UIImage imageNamed:@"icon-check-blue"]; - } - [_logo setImage:image]; - [_logo sizeToFit]; -} - -- (void)adjustOverlayDismissal -{ - // We always want a tap on the view to dismiss - _gestureRecognizer.numberOfTapsRequired = 1; -} - -- (void)tappedOnView:(UITapGestureRecognizer *)gestureRecognizer -{ - CGPoint touchPoint = [gestureRecognizer locationInView:self]; - - // To avoid accidentally dismissing the view when the user was trying to tap one of the buttons, - // add some padding around the button frames. - CGRect button1Frame = CGRectInset(_secondaryButton.frame, -2 * WPWalkthroughGrayOverlayStandardOffset, -WPWalkthroughGrayOverlayStandardOffset); - CGRect button2Frame = CGRectInset(_primaryButton.frame, -2 * WPWalkthroughGrayOverlayStandardOffset, -WPWalkthroughGrayOverlayStandardOffset); - - BOOL touchedButton1 = CGRectContainsPoint(button1Frame, touchPoint); - BOOL touchedButton2 = CGRectContainsPoint(button2Frame, touchPoint); - - if (touchedButton1 || touchedButton2) { - return; - } - - if (gestureRecognizer.numberOfTapsRequired == 1) { - if (self.dismissCompletionBlock) { - self.dismissCompletionBlock(self); - } - } -} - -- (void)secondaryButtonAction -{ - if (self.secondaryButtonCompletionBlock) { - self.secondaryButtonCompletionBlock(self); - } else if (self.dismissCompletionBlock) { - self.dismissCompletionBlock(self); - } -} - -- (void)primaryButtonAction -{ - if (self.primaryButtonCompletionBlock) { - self.primaryButtonCompletionBlock(self); - } else if (self.dismissCompletionBlock) { - self.dismissCompletionBlock(self); - } -} - -@end diff --git a/WordPressAuthenticator/Sources/NUX/WPWalkthroughTextField.m b/WordPressAuthenticator/Sources/NUX/WPWalkthroughTextField.m index 1ba9f01ae842..5a1d2afa039a 100644 --- a/WordPressAuthenticator/Sources/NUX/WPWalkthroughTextField.m +++ b/WordPressAuthenticator/Sources/NUX/WPWalkthroughTextField.m @@ -256,7 +256,7 @@ - (void)setSecureTextEntry:(BOOL)secureTextEntry // This is a fix for a bug where the text field reverts to a system // serif font if you disable secure text entry while it contains text. self.font = nil; - self.font = [WPNUXUtility textFieldFont]; + self.font = [WPFontManager systemRegularFontOfSize:16.0]; [super setSecureTextEntry:secureTextEntry]; [self updateSecureTextEntryToggleImage]; diff --git a/WordPressAuthenticator/Sources/WordPressAuthenticator.h b/WordPressAuthenticator/Sources/WordPressAuthenticator.h index cdc1ac7b1b87..3b2074531a3b 100644 --- a/WordPressAuthenticator/Sources/WordPressAuthenticator.h +++ b/WordPressAuthenticator/Sources/WordPressAuthenticator.h @@ -14,7 +14,5 @@ FOUNDATION_EXPORT const unsigned char WordPressAuthenticatorVersionString[]; #import #import -#import #import -#import #import