diff --git a/.swift-version b/.swift-version index 819e07a224..8ae03c1190 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -5.0 +5.4.2 diff --git a/Podfile b/Podfile index a04a6fcb72..8c88b33919 100644 --- a/Podfile +++ b/Podfile @@ -39,17 +39,15 @@ def all_pods pod 'DownloadButton', '0.1.0' pod 'SVProgressHUD', '2.2.5' - # TSMessages is no longer being maintained/updated, remove or migrate to RMessage/SwiftMessages - pod 'TSMessages', :git => 'https://github.com/KrauseFx/TSMessages.git' pod 'SnapKit', '5.0.1' # Firebase - pod 'Firebase/Core', '8.5.0' - pod 'Firebase/Messaging', '8.5.0' - pod 'Firebase/Analytics', '8.5.0' - pod 'Firebase/Crashlytics', '8.5.0' - pod 'Firebase/RemoteConfig', '8.5.0' + pod 'Firebase/Core', '8.6.0' + pod 'Firebase/Messaging', '8.6.0' + pod 'Firebase/Analytics', '8.6.0' + pod 'Firebase/Crashlytics', '8.6.0' + pod 'Firebase/RemoteConfig', '8.6.0' pod 'YandexMobileMetrica/Dynamic', '3.15.1' pod 'Amplitude', '8.3.0' diff --git a/Podfile.lock b/Podfile.lock index 460b157876..8faa413419 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -31,26 +31,26 @@ PODS: - FBSDKLoginKit/Login (= 8.2.0) - FBSDKLoginKit/Login (8.2.0): - FBSDKCoreKit (~> 8.2.0) - - Firebase/Analytics (8.5.0): + - Firebase/Analytics (8.6.0): - Firebase/Core - - Firebase/Core (8.5.0): + - Firebase/Core (8.6.0): - Firebase/CoreOnly - - FirebaseAnalytics (~> 8.5.0) - - Firebase/CoreOnly (8.5.0): - - FirebaseCore (= 8.5.0) - - Firebase/Crashlytics (8.5.0): + - FirebaseAnalytics (~> 8.6.0) + - Firebase/CoreOnly (8.6.0): + - FirebaseCore (= 8.6.0) + - Firebase/Crashlytics (8.6.0): - Firebase/CoreOnly - - FirebaseCrashlytics (~> 8.5.0) - - Firebase/Messaging (8.5.0): + - FirebaseCrashlytics (~> 8.6.0) + - Firebase/Messaging (8.6.0): - Firebase/CoreOnly - - FirebaseMessaging (~> 8.5.0) - - Firebase/RemoteConfig (8.5.0): + - FirebaseMessaging (~> 8.6.0) + - Firebase/RemoteConfig (8.6.0): - Firebase/CoreOnly - - FirebaseRemoteConfig (~> 8.5.0) - - FirebaseABTesting (8.5.0): + - FirebaseRemoteConfig (~> 8.6.0) + - FirebaseABTesting (8.6.0): - FirebaseCore (~> 8.0) - - FirebaseAnalytics (8.5.0): - - FirebaseAnalytics/AdIdSupport (= 8.5.0) + - FirebaseAnalytics (8.6.0): + - FirebaseAnalytics/AdIdSupport (= 8.6.0) - FirebaseCore (~> 8.0) - FirebaseInstallations (~> 8.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.4) @@ -58,58 +58,60 @@ PODS: - GoogleUtilities/Network (~> 7.4) - "GoogleUtilities/NSData+zlib (~> 7.4)" - nanopb (~> 2.30908.0) - - FirebaseAnalytics/AdIdSupport (8.5.0): + - FirebaseAnalytics/AdIdSupport (8.6.0): - FirebaseCore (~> 8.0) - FirebaseInstallations (~> 8.0) - - GoogleAppMeasurement (= 8.5.0) + - GoogleAppMeasurement (= 8.6.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.4) - GoogleUtilities/MethodSwizzler (~> 7.4) - GoogleUtilities/Network (~> 7.4) - "GoogleUtilities/NSData+zlib (~> 7.4)" - nanopb (~> 2.30908.0) - - FirebaseCore (8.5.0): + - FirebaseCore (8.6.0): - FirebaseCoreDiagnostics (~> 8.0) - GoogleUtilities/Environment (~> 7.4) - GoogleUtilities/Logger (~> 7.4) - - FirebaseCoreDiagnostics (8.5.0): + - FirebaseCoreDiagnostics (8.6.0): - GoogleDataTransport (~> 9.0) - GoogleUtilities/Environment (~> 7.4) - GoogleUtilities/Logger (~> 7.4) - nanopb (~> 2.30908.0) - - FirebaseCrashlytics (8.5.0): + - FirebaseCrashlytics (8.6.0): - FirebaseCore (~> 8.0) - FirebaseInstallations (~> 8.0) - GoogleDataTransport (~> 9.0) - GoogleUtilities/Environment (~> 7.4) - nanopb (~> 2.30908.0) - PromisesObjC (< 3.0, >= 1.2) - - FirebaseInstallations (8.5.0): + - FirebaseInstallations (8.6.0): - FirebaseCore (~> 8.0) - GoogleUtilities/Environment (~> 7.4) - GoogleUtilities/UserDefaults (~> 7.4) - PromisesObjC (< 3.0, >= 1.2) - - FirebaseMessaging (8.5.0): + - FirebaseMessaging (8.6.0): - FirebaseCore (~> 8.0) - FirebaseInstallations (~> 8.0) + - GoogleDataTransport (~> 9.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.4) - GoogleUtilities/Environment (~> 7.4) - GoogleUtilities/Reachability (~> 7.4) - GoogleUtilities/UserDefaults (~> 7.4) - - FirebaseRemoteConfig (8.5.0): + - nanopb (~> 2.30908.0) + - FirebaseRemoteConfig (8.6.0): - FirebaseABTesting (~> 8.0) - FirebaseCore (~> 8.0) - FirebaseInstallations (~> 8.0) - GoogleUtilities/Environment (~> 7.4) - "GoogleUtilities/NSData+zlib (~> 7.4)" - FLEX (4.4.1) - - GoogleAppMeasurement (8.5.0): - - GoogleAppMeasurement/AdIdSupport (= 8.5.0) + - GoogleAppMeasurement (8.6.0): + - GoogleAppMeasurement/AdIdSupport (= 8.6.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.4) - GoogleUtilities/MethodSwizzler (~> 7.4) - GoogleUtilities/Network (~> 7.4) - "GoogleUtilities/NSData+zlib (~> 7.4)" - nanopb (~> 2.30908.0) - - GoogleAppMeasurement/AdIdSupport (8.5.0): + - GoogleAppMeasurement/AdIdSupport (8.6.0): - GoogleUtilities/AppDelegateSwizzler (~> 7.4) - GoogleUtilities/MethodSwizzler (~> 7.4) - GoogleUtilities/Network (~> 7.4) @@ -123,30 +125,29 @@ PODS: - AppAuth (~> 1.2) - GTMAppAuth (~> 1.0) - GTMSessionFetcher/Core (~> 1.1) - - GoogleUtilities/AppDelegateSwizzler (7.5.0): + - GoogleUtilities/AppDelegateSwizzler (7.5.1): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - - GoogleUtilities/Environment (7.5.0): + - GoogleUtilities/Environment (7.5.1): - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/Logger (7.5.0): + - GoogleUtilities/Logger (7.5.1): - GoogleUtilities/Environment - - GoogleUtilities/MethodSwizzler (7.5.0): + - GoogleUtilities/MethodSwizzler (7.5.1): - GoogleUtilities/Logger - - GoogleUtilities/Network (7.5.0): + - GoogleUtilities/Network (7.5.1): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (7.5.0)" - - GoogleUtilities/Reachability (7.5.0): + - "GoogleUtilities/NSData+zlib (7.5.1)" + - GoogleUtilities/Reachability (7.5.1): - GoogleUtilities/Logger - - GoogleUtilities/UserDefaults (7.5.0): + - GoogleUtilities/UserDefaults (7.5.1): - GoogleUtilities/Logger - GTMAppAuth (1.2.2): - AppAuth/Core (~> 1.4) - GTMSessionFetcher/Core (~> 1.5) - GTMSessionFetcher/Core (1.5.0) - - HexColors (2.3.0) - Highlightr (2.1.0) - IQKeyboardManagerSwift (6.5.6) - Kanna (5.2.7) @@ -196,8 +197,6 @@ PODS: - SwiftyJSON (5.0.0) - Tabman (2.10.0): - Pageboy (~> 3.6.0) - - TSMessages (0.9.13): - - HexColors (~> 2.3.0) - TTTAttributedLabel (2.0.0) - TUSafariActivity (1.0.4) - URITemplate (3.0.0) @@ -223,11 +222,11 @@ DEPENDENCIES: - EasyTipView (= 2.1.0) - FBSDKCoreKit (= 8.2.0) - FBSDKLoginKit (= 8.2.0) - - Firebase/Analytics (= 8.5.0) - - Firebase/Core (= 8.5.0) - - Firebase/Crashlytics (= 8.5.0) - - Firebase/Messaging (= 8.5.0) - - Firebase/RemoteConfig (= 8.5.0) + - Firebase/Analytics (= 8.6.0) + - Firebase/Core (= 8.6.0) + - Firebase/Crashlytics (= 8.6.0) + - Firebase/Messaging (= 8.6.0) + - Firebase/RemoteConfig (= 8.6.0) - FLEX (from `https://github.com/ivan-magda/FLEX.git`, branch `master`) - GoogleSignIn (= 5.0.2) - Highlightr (from `https://github.com/raspu/Highlightr.git`, tag `2.1.2`) @@ -251,7 +250,6 @@ DEPENDENCIES: - SwiftLint (= 0.43.1) - SwiftyJSON (= 5.0.0) - Tabman (= 2.10.0) - - TSMessages (from `https://github.com/KrauseFx/TSMessages.git`) - TTTAttributedLabel (= 2.0.0) - TUSafariActivity (= 1.0.4) - VK-ios-sdk (= 1.6.2) @@ -289,7 +287,6 @@ SPEC REPOS: - GoogleUtilities - GTMAppAuth - GTMSessionFetcher - - HexColors - IQKeyboardManagerSwift - Kanna - Koloda @@ -332,8 +329,6 @@ EXTERNAL SOURCES: SVGKit: :branch: 2.x :git: https://github.com/SVGKit/SVGKit.git - TSMessages: - :git: https://github.com/KrauseFx/TSMessages.git CHECKOUT OPTIONS: FLEX: @@ -348,9 +343,6 @@ CHECKOUT OPTIONS: SVGKit: :commit: c40671b9a264f8f71831c4e0452736debfae2164 :git: https://github.com/SVGKit/SVGKit.git - TSMessages: - :commit: e4802d290362c87ba8a35c1afae88668dba8ab9a - :git: https://github.com/KrauseFx/TSMessages.git SPEC CHECKSUMS: ActionSheetPicker-3.0: 36da254b97a09ff89679ecb8b8510bd3e5bdc773 @@ -368,23 +360,22 @@ SPEC CHECKSUMS: EasyTipView: a92b6edc377b81c5ac18e9fd35d5ee78e9409488 FBSDKCoreKit: 4afd6ff53d8133a433dbcda44451c9498f8c6ce4 FBSDKLoginKit: 7181765f2524d7ebf82d9629066c8e6caafc99d0 - Firebase: ff8c73105b90e33e1dc6c8e5445d7adc2ccdc7c1 - FirebaseABTesting: f7cb3fbed1c5bd3e733a79d9955447be3f3b06a5 - FirebaseAnalytics: 96325c1e0acbd2bb805c6a613028b1fe599d6a37 - FirebaseCore: 1c1ca72483b59b17050f5b4cec4fb748425a3901 - FirebaseCoreDiagnostics: 7bf55d386f9fc690d971b70a582142321a390eb8 - FirebaseCrashlytics: 8e7cf678cb149d421198388c6fc3d3acfd266539 - FirebaseInstallations: f2bc590b291d25fb40a9a05b8281c02a881b5117 - FirebaseMessaging: 0705ec705c21705efc51c071fba924c8e25c63e7 - FirebaseRemoteConfig: 693c1f150408e9a727daf4d8c55c7f9c29ef9ad5 + Firebase: 21ac9f28b09a8bdfc005f34c984fca84e7e8786d + FirebaseABTesting: c3e48ebf5e7e5c674c5a131c68e941d7921d83dc + FirebaseAnalytics: 8f32ae54ad42754f503354782575c4ddfc1425c3 + FirebaseCore: 620b677f70f5470a8e59cb77f3ddc666f6f09785 + FirebaseCoreDiagnostics: 3721920bde3a9a6d5aa093c1d25e9d3e47f694af + FirebaseCrashlytics: 58f8ecea7c799c61c50e8111d2e438424a8a1d2e + FirebaseInstallations: 0ede6ffcd215b8f93c19d9b06c1c54e2d4107e98 + FirebaseMessaging: ce0a5ee974f7bfe83b6cc5acce88c2d969e37c41 + FirebaseRemoteConfig: 9ee4672d4eacf646256e26cfac61021b3a390ea4 FLEX: 75ca95cff4bd57592c6e75adee7651ace29f9c25 - GoogleAppMeasurement: 8d10c1c470fcb0e5143ed74fddd164f0a0384800 + GoogleAppMeasurement: 2c0c6e2a7ab3fe730ade6379f732bdefb46f50b0 GoogleDataTransport: 85fd18ff3019bb85d3f2c551d04c481dedf71fc9 GoogleSignIn: 7137d297ddc022a7e0aa4619c86d72c909fa7213 - GoogleUtilities: eea970f4a389963963bffe8d8fabe43540678b9c + GoogleUtilities: 3df19e3c24f7bbc291d8b5809aa6b0d41e642437 GTMAppAuth: ad5c2b70b9a8689e1a04033c9369c4915bfcbe89 GTMSessionFetcher: b3503b20a988c4e20cc189aa798fd18220133f52 - HexColors: 6ad3947c3447a055a3aa8efa859def096351fe5f Highlightr: 683f05d5223cade533a78528a35c9f06e4caddf8 IQKeyboardManagerSwift: c7df9d2deb356c04522f5c4b7b6e4ce4d8ed94fe Kanna: 01cfbddc127f5ff0963692f285fcbc8a9d62d234 @@ -411,13 +402,12 @@ SPEC CHECKSUMS: SwiftyGif: 5d4af95df24caf1c570dbbcb32a3b8a0763bc6d7 SwiftyJSON: 36413e04c44ee145039d332b4f4e2d3e8d6c4db7 Tabman: d8d6ab0b483c7db375a71ac227d3ef791b56a049 - TSMessages: eb3cf27b6900684a21bad4fe9ea426e287b8c839 TTTAttributedLabel: 8cffe8e127e4e82ff3af1e5386d4cd0ad000b656 TUSafariActivity: afc55a00965377939107ce4fdc7f951f62454546 URITemplate: 58e0d47f967006c5d59888af5356c4a8ed3b197d VK-ios-sdk: 5bcf00a2014a7323f98db9328b603d4f96635caa YandexMobileMetrica: fb4b3c20a0c0237b03b34cc07b6d575332f43097 -PODFILE CHECKSUM: a5b2d5637f36f4f5ca81ca6338715f2f39d87b92 +PODFILE CHECKSUM: abe8b05f5133311fa6297feedc8821232d8b5598 COCOAPODS: 1.10.2 diff --git a/Reachability.h b/Reachability.h deleted file mode 100644 index e0e6e63675..0000000000 --- a/Reachability.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - Copyright (c) 2011, Tony Million. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#import -#import - -//! Project version number for MacOSReachability. -FOUNDATION_EXPORT double ReachabilityVersionNumber; - -//! Project version string for MacOSReachability. -FOUNDATION_EXPORT const unsigned char ReachabilityVersionString[]; - -/** - * Create NS_ENUM macro if it does not exist on the targeted version of iOS or OS X. - * - * @see http://nshipster.com/ns_enum-ns_options/ - **/ -#ifndef NS_ENUM -#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type -#endif - -extern NSString *const kReachabilityChangedNotification; - -typedef NS_ENUM(NSInteger, NetworkStatus) { - // Apple NetworkStatus Compatible Names. - NotReachable = 0, - ReachableViaWiFi = 2, - ReachableViaWWAN = 1 -}; - -@class Reachability; - -typedef void (^NetworkReachable)(Reachability * reachability); -typedef void (^NetworkUnreachable)(Reachability * reachability); -typedef void (^NetworkReachability)(Reachability * reachability, SCNetworkConnectionFlags flags); - - -@interface Reachability : NSObject - -@property (nonatomic, copy) NetworkReachable reachableBlock; -@property (nonatomic, copy) NetworkUnreachable unreachableBlock; -@property (nonatomic, copy) NetworkReachability reachabilityBlock; - -@property (nonatomic, assign) BOOL reachableOnWWAN; - - -+(instancetype)reachabilityWithHostname:(NSString*)hostname; -// This is identical to the function above, but is here to maintain -//compatibility with Apples original code. (see .m) -+(instancetype)reachabilityWithHostName:(NSString*)hostname; -+(instancetype)reachabilityForInternetConnection; -+(instancetype)reachabilityWithAddress:(void *)hostAddress; -+(instancetype)reachabilityForLocalWiFi; - --(instancetype)initWithReachabilityRef:(SCNetworkReachabilityRef)ref; - --(BOOL)startNotifier; --(void)stopNotifier; - --(BOOL)isReachable; --(BOOL)isReachableViaWWAN; --(BOOL)isReachableViaWiFi; - -// WWAN may be available, but not active until a connection has been established. -// WiFi may require a connection for VPN on Demand. --(BOOL)isConnectionRequired; // Identical DDG variant. --(BOOL)connectionRequired; // Apple's routine. -// Dynamic, on demand connection? --(BOOL)isConnectionOnDemand; -// Is user intervention required? --(BOOL)isInterventionRequired; - --(NetworkStatus)currentReachabilityStatus; --(SCNetworkReachabilityFlags)reachabilityFlags; --(NSString*)currentReachabilityString; --(NSString*)currentReachabilityFlags; - -@end \ No newline at end of file diff --git a/Reachability.m b/Reachability.m deleted file mode 100644 index 3dbf0a4dc0..0000000000 --- a/Reachability.m +++ /dev/null @@ -1,475 +0,0 @@ -/* - Copyright (c) 2011, Tony Million. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#import "Reachability.h" - -#import -#import -#import -#import -#import -#import - - -NSString *const kReachabilityChangedNotification = @"kReachabilityChangedNotification"; - - -@interface Reachability () - -@property (nonatomic, assign) SCNetworkReachabilityRef reachabilityRef; -@property (nonatomic, strong) dispatch_queue_t reachabilitySerialQueue; -@property (nonatomic, strong) id reachabilityObject; - --(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags; --(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags; - -@end - - -static NSString *reachabilityFlags(SCNetworkReachabilityFlags flags) -{ - return [NSString stringWithFormat:@"%c%c %c%c%c%c%c%c%c", -#if TARGET_OS_IPHONE - (flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-', -#else - 'X', -#endif - (flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-', - (flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-', - (flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-', - (flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-', - (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-', - (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-', - (flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-', - (flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-']; -} - -// Start listening for reachability notifications on the current run loop -static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info) -{ -#pragma unused (target) - - Reachability *reachability = ((__bridge Reachability*)info); - - // We probably don't need an autoreleasepool here, as GCD docs state each queue has its own autorelease pool, - // but what the heck eh? - @autoreleasepool - { - [reachability reachabilityChanged:flags]; - } -} - - -@implementation Reachability - -#pragma mark - Class Constructor Methods - -+(instancetype)reachabilityWithHostName:(NSString*)hostname -{ - return [Reachability reachabilityWithHostname:hostname]; -} - -+(instancetype)reachabilityWithHostname:(NSString*)hostname -{ - SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithName(NULL, [hostname UTF8String]); - if (ref) - { - id reachability = [[self alloc] initWithReachabilityRef:ref]; - - return reachability; - } - - return nil; -} - -+(instancetype)reachabilityWithAddress:(void *)hostAddress -{ - SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress); - if (ref) - { - id reachability = [[self alloc] initWithReachabilityRef:ref]; - - return reachability; - } - - return nil; -} - -+(instancetype)reachabilityForInternetConnection -{ - struct sockaddr_in zeroAddress; - bzero(&zeroAddress, sizeof(zeroAddress)); - zeroAddress.sin_len = sizeof(zeroAddress); - zeroAddress.sin_family = AF_INET; - - return [self reachabilityWithAddress:&zeroAddress]; -} - -+(instancetype)reachabilityForLocalWiFi -{ - struct sockaddr_in localWifiAddress; - bzero(&localWifiAddress, sizeof(localWifiAddress)); - localWifiAddress.sin_len = sizeof(localWifiAddress); - localWifiAddress.sin_family = AF_INET; - // IN_LINKLOCALNETNUM is defined in as 169.254.0.0 - localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM); - - return [self reachabilityWithAddress:&localWifiAddress]; -} - - -// Initialization methods - --(instancetype)initWithReachabilityRef:(SCNetworkReachabilityRef)ref -{ - self = [super init]; - if (self != nil) - { - self.reachableOnWWAN = YES; - self.reachabilityRef = ref; - - // We need to create a serial queue. - // We allocate this once for the lifetime of the notifier. - - self.reachabilitySerialQueue = dispatch_queue_create("com.tonymillion.reachability", NULL); - } - - return self; -} - --(void)dealloc -{ - [self stopNotifier]; - - if(self.reachabilityRef) - { - CFRelease(self.reachabilityRef); - self.reachabilityRef = nil; - } - - self.reachableBlock = nil; - self.unreachableBlock = nil; - self.reachabilityBlock = nil; - self.reachabilitySerialQueue = nil; -} - -#pragma mark - Notifier Methods - -// Notifier -// NOTE: This uses GCD to trigger the blocks - they *WILL NOT* be called on THE MAIN THREAD -// - In other words DO NOT DO ANY UI UPDATES IN THE BLOCKS. -// INSTEAD USE dispatch_async(dispatch_get_main_queue(), ^{UISTUFF}) (or dispatch_sync if you want) - --(BOOL)startNotifier -{ - // allow start notifier to be called multiple times - if(self.reachabilityObject && (self.reachabilityObject == self)) - { - return YES; - } - - - SCNetworkReachabilityContext context = { 0, NULL, NULL, NULL, NULL }; - context.info = (__bridge void *)self; - - if(SCNetworkReachabilitySetCallback(self.reachabilityRef, TMReachabilityCallback, &context)) - { - // Set it as our reachability queue, which will retain the queue - if(SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, self.reachabilitySerialQueue)) - { - // this should do a retain on ourself, so as long as we're in notifier mode we shouldn't disappear out from under ourselves - // woah - self.reachabilityObject = self; - return YES; - } - else - { -#ifdef DEBUG - NSLog(@"SCNetworkReachabilitySetDispatchQueue() failed: %s", SCErrorString(SCError())); -#endif - - // UH OH - FAILURE - stop any callbacks! - SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL); - } - } - else - { -#ifdef DEBUG - NSLog(@"SCNetworkReachabilitySetCallback() failed: %s", SCErrorString(SCError())); -#endif - } - - // if we get here we fail at the internet - self.reachabilityObject = nil; - return NO; -} - --(void)stopNotifier -{ - // First stop, any callbacks! - SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL); - - // Unregister target from the GCD serial dispatch queue. - SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, NULL); - - self.reachabilityObject = nil; -} - -#pragma mark - reachability tests - -// This is for the case where you flick the airplane mode; -// you end up getting something like this: -//Reachability: WR ct----- -//Reachability: -- ------- -//Reachability: WR ct----- -//Reachability: -- ------- -// We treat this as 4 UNREACHABLE triggers - really apple should do better than this - -#define testcase (kSCNetworkReachabilityFlagsConnectionRequired | kSCNetworkReachabilityFlagsTransientConnection) - --(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags -{ - BOOL connectionUP = YES; - - if(!(flags & kSCNetworkReachabilityFlagsReachable)) - connectionUP = NO; - - if( (flags & testcase) == testcase ) - connectionUP = NO; - -#if TARGET_OS_IPHONE - if(flags & kSCNetworkReachabilityFlagsIsWWAN) - { - // We're on 3G. - if(!self.reachableOnWWAN) - { - // We don't want to connect when on 3G. - connectionUP = NO; - } - } -#endif - - return connectionUP; -} - --(BOOL)isReachable -{ - SCNetworkReachabilityFlags flags; - - if(!SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags)) - return NO; - - return [self isReachableWithFlags:flags]; -} - --(BOOL)isReachableViaWWAN -{ -#if TARGET_OS_IPHONE - - SCNetworkReachabilityFlags flags = 0; - - if(SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags)) - { - // Check we're REACHABLE - if(flags & kSCNetworkReachabilityFlagsReachable) - { - // Now, check we're on WWAN - if(flags & kSCNetworkReachabilityFlagsIsWWAN) - { - return YES; - } - } - } -#endif - - return NO; -} - --(BOOL)isReachableViaWiFi -{ - SCNetworkReachabilityFlags flags = 0; - - if(SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags)) - { - // Check we're reachable - if((flags & kSCNetworkReachabilityFlagsReachable)) - { -#if TARGET_OS_IPHONE - // Check we're NOT on WWAN - if((flags & kSCNetworkReachabilityFlagsIsWWAN)) - { - return NO; - } -#endif - return YES; - } - } - - return NO; -} - - -// WWAN may be available, but not active until a connection has been established. -// WiFi may require a connection for VPN on Demand. --(BOOL)isConnectionRequired -{ - return [self connectionRequired]; -} - --(BOOL)connectionRequired -{ - SCNetworkReachabilityFlags flags; - - if(SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags)) - { - return (flags & kSCNetworkReachabilityFlagsConnectionRequired); - } - - return NO; -} - -// Dynamic, on demand connection? --(BOOL)isConnectionOnDemand -{ - SCNetworkReachabilityFlags flags; - - if (SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags)) - { - return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) && - (flags & (kSCNetworkReachabilityFlagsConnectionOnTraffic | kSCNetworkReachabilityFlagsConnectionOnDemand))); - } - - return NO; -} - -// Is user intervention required? --(BOOL)isInterventionRequired -{ - SCNetworkReachabilityFlags flags; - - if (SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags)) - { - return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) && - (flags & kSCNetworkReachabilityFlagsInterventionRequired)); - } - - return NO; -} - - -#pragma mark - reachability status stuff - --(NetworkStatus)currentReachabilityStatus -{ - if([self isReachable]) - { - if([self isReachableViaWiFi]) - return ReachableViaWiFi; - -#if TARGET_OS_IPHONE - return ReachableViaWWAN; -#endif - } - - return NotReachable; -} - --(SCNetworkReachabilityFlags)reachabilityFlags -{ - SCNetworkReachabilityFlags flags = 0; - - if(SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags)) - { - return flags; - } - - return 0; -} - --(NSString*)currentReachabilityString -{ - NetworkStatus temp = [self currentReachabilityStatus]; - - if(temp == ReachableViaWWAN) - { - // Updated for the fact that we have CDMA phones now! - return NSLocalizedString(@"Cellular", @""); - } - if (temp == ReachableViaWiFi) - { - return NSLocalizedString(@"WiFi", @""); - } - - return NSLocalizedString(@"No Connection", @""); -} - --(NSString*)currentReachabilityFlags -{ - return reachabilityFlags([self reachabilityFlags]); -} - -#pragma mark - Callback function calls this method - --(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags -{ - if([self isReachableWithFlags:flags]) - { - if(self.reachableBlock) - { - self.reachableBlock(self); - } - } - else - { - if(self.unreachableBlock) - { - self.unreachableBlock(self); - } - } - - if(self.reachabilityBlock) - { - self.reachabilityBlock(self, flags); - } - - // this makes sure the change notification happens on the MAIN THREAD - dispatch_async(dispatch_get_main_queue(), ^{ - [[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification - object:self]; - }); -} - -#pragma mark - Debug Description - -- (NSString *) description -{ - NSString *description = [NSString stringWithFormat:@"<%@: %#x (%@)>", - NSStringFromClass([self class]), (unsigned int) self, [self currentReachabilityFlags]]; - return description; -} - -@end \ No newline at end of file diff --git a/Stepic.xcodeproj/project.pbxproj b/Stepic.xcodeproj/project.pbxproj index 7a4d93e222..c6d6fd7865 100644 --- a/Stepic.xcodeproj/project.pbxproj +++ b/Stepic.xcodeproj/project.pbxproj @@ -63,7 +63,7 @@ 081D7418211DB4720086F6F8 /* OpenedStoriesPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 081D7417211DB4720086F6F8 /* OpenedStoriesPageViewController.swift */; }; 081D741A211DB4930086F6F8 /* OpenedStoriesPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 081D7419211DB4930086F6F8 /* OpenedStoriesPresenter.swift */; }; 081D741E211DCDD50086F6F8 /* OpenedStoriesAssembly.swift in Sources */ = {isa = PBXBuildFile; fileRef = 081D741D211DCDD50086F6F8 /* OpenedStoriesAssembly.swift */; }; - 0824289C1BB0104700C98185 /* Alamofire-SwiftyJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0824289B1BB0104700C98185 /* Alamofire-SwiftyJSON.swift */; }; + 0824289C1BB0104700C98185 /* DataRequest+ResponseSwiftyJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0824289B1BB0104700C98185 /* DataRequest+ResponseSwiftyJSON.swift */; }; 08263D701DE5F230002E5B7F /* NotificationTimePickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08263D6E1DE5F230002E5B7F /* NotificationTimePickerViewController.swift */; }; 08263D721DE5F230002E5B7F /* PickerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 08263D6F1DE5F230002E5B7F /* PickerViewController.xib */; }; 082799481E9B81AF008A3786 /* RateAppAlertManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 082799471E9B81AF008A3786 /* RateAppAlertManager.swift */; }; @@ -160,7 +160,6 @@ 085D5CE41D007F6500092060 /* HTMLParsingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 085D5CE31D007F6500092060 /* HTMLParsingTests.swift */; }; 085DF8D51C99B9FB006809D9 /* Player.swift in Sources */ = {isa = PBXBuildFile; fileRef = 085DF8D41C99B9FB006809D9 /* Player.swift */; }; 085DF8D81C99C49E006809D9 /* VideoRate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 085DF8D71C99C49E006809D9 /* VideoRate.swift */; }; - 085DF8DB1C9AB94B006809D9 /* TimeFormatHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 085DF8DA1C9AB94B006809D9 /* TimeFormatHelper.swift */; }; 0860D9121F10C5480087D61B /* CodeSnippetSymbols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0860D9111F10C5480087D61B /* CodeSnippetSymbols.swift */; }; 0860D9151F10EA690087D61B /* InputAccessoryBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0860D9141F10EA690087D61B /* InputAccessoryBuilder.swift */; }; 0860D9191F115D830087D61B /* CodeSuggestionsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0860D9171F115D830087D61B /* CodeSuggestionsTableViewController.swift */; }; @@ -251,8 +250,6 @@ 08BC47061CD9F424009A1D25 /* DeleteDeviceExecutableTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08BC47051CD9F424009A1D25 /* DeleteDeviceExecutableTask.swift */; }; 08BC47091CD9FE10009A1D25 /* PersistentTaskManagerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08BC47081CD9FE10009A1D25 /* PersistentTaskManagerProtocol.swift */; }; 08BC47141CDA3E99009A1D25 /* ExecutableTaskTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08BC47131CDA3E99009A1D25 /* ExecutableTaskTypes.swift */; }; - 08C0A4341BF1276C0010F049 /* Messages.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C0A4331BF1276C0010F049 /* Messages.swift */; }; - 08C0A4361BF12CDF0010F049 /* CustomMessagesDesign.json in Resources */ = {isa = PBXBuildFile; fileRef = 08C0A4351BF12CDF0010F049 /* CustomMessagesDesign.json */; }; 08C194401ED0A05D00A41B72 /* PagerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C1943F1ED0A05D00A41B72 /* PagerController.swift */; }; 08C1FC331F41E74500E14B46 /* QuizPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C1FC321F41E74500E14B46 /* QuizPresenter.swift */; }; 08C5E4FD1C315272004AA626 /* AudioManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C5E4FC1C315272004AA626 /* AudioManager.swift */; }; @@ -294,9 +291,7 @@ 08DF78B91F5E0C9000AEEA85 /* StringHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C03B2A31F0CD87600005383 /* StringHelper.swift */; }; 08DF78BC1F5EEFFE00AEEA85 /* MenuBlockTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08DF78BB1F5EEFFE00AEEA85 /* MenuBlockTableViewCell.swift */; }; 08DF78D21F64059900AEEA85 /* StepikLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08DF78D11F64059900AEEA85 /* StepikLabel.swift */; }; - 08E16F231BDBA4AF004822E1 /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 08E16F221BDBA4AF004822E1 /* Reachability.m */; }; 08E16F251BDBA539004822E1 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08E16F241BDBA539004822E1 /* SystemConfiguration.framework */; }; - 08E16F291BDBA731004822E1 /* ConnectionHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E16F281BDBA731004822E1 /* ConnectionHelper.swift */; }; 08E3B9671EEA16DC0072995B /* CodeReply.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E3B9661EEA16DC0072995B /* CodeReply.swift */; }; 08E43E9421495FD500E3CB50 /* DeepLinkRoutingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E43E9321495FD500E3CB50 /* DeepLinkRoutingService.swift */; }; 08E43E98214C279700E3CB50 /* PushRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E43E96214C279600E3CB50 /* PushRouter.swift */; }; @@ -1892,7 +1887,7 @@ 081D7417211DB4720086F6F8 /* OpenedStoriesPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenedStoriesPageViewController.swift; sourceTree = ""; }; 081D7419211DB4930086F6F8 /* OpenedStoriesPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenedStoriesPresenter.swift; sourceTree = ""; }; 081D741D211DCDD50086F6F8 /* OpenedStoriesAssembly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenedStoriesAssembly.swift; sourceTree = ""; }; - 0824289B1BB0104700C98185 /* Alamofire-SwiftyJSON.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Alamofire-SwiftyJSON.swift"; sourceTree = ""; }; + 0824289B1BB0104700C98185 /* DataRequest+ResponseSwiftyJSON.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DataRequest+ResponseSwiftyJSON.swift"; sourceTree = ""; }; 08263D6E1DE5F230002E5B7F /* NotificationTimePickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationTimePickerViewController.swift; sourceTree = ""; }; 08263D6F1DE5F230002E5B7F /* PickerViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PickerViewController.xib; sourceTree = ""; }; 082799471E9B81AF008A3786 /* RateAppAlertManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RateAppAlertManager.swift; sourceTree = ""; }; @@ -2005,7 +2000,6 @@ 085D5CE31D007F6500092060 /* HTMLParsingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTMLParsingTests.swift; sourceTree = ""; }; 085DF8D41C99B9FB006809D9 /* Player.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Player.swift; sourceTree = ""; }; 085DF8D71C99C49E006809D9 /* VideoRate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoRate.swift; sourceTree = ""; }; - 085DF8DA1C9AB94B006809D9 /* TimeFormatHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimeFormatHelper.swift; sourceTree = ""; }; 0860D9111F10C5480087D61B /* CodeSnippetSymbols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeSnippetSymbols.swift; sourceTree = ""; }; 0860D9141F10EA690087D61B /* InputAccessoryBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InputAccessoryBuilder.swift; sourceTree = ""; }; 0860D9171F115D830087D61B /* CodeSuggestionsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeSuggestionsTableViewController.swift; sourceTree = ""; }; @@ -2103,8 +2097,6 @@ 08BC47051CD9F424009A1D25 /* DeleteDeviceExecutableTask.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = DeleteDeviceExecutableTask.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 08BC47081CD9FE10009A1D25 /* PersistentTaskManagerProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersistentTaskManagerProtocol.swift; sourceTree = ""; }; 08BC47131CDA3E99009A1D25 /* ExecutableTaskTypes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExecutableTaskTypes.swift; sourceTree = ""; }; - 08C0A4331BF1276C0010F049 /* Messages.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Messages.swift; sourceTree = ""; }; - 08C0A4351BF12CDF0010F049 /* CustomMessagesDesign.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = CustomMessagesDesign.json; sourceTree = ""; }; 08C1943F1ED0A05D00A41B72 /* PagerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PagerController.swift; sourceTree = ""; }; 08C1BF271FB9ED01008F342F /* SearchResultsPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResultsPresenter.swift; sourceTree = ""; }; 08C1BF301FBA0CA1008F342F /* SearchResultsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResultsViewController.swift; sourceTree = ""; }; @@ -2156,10 +2148,7 @@ 08DF788C1F5D6A7600AEEA85 /* HeaderMenuBlockTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HeaderMenuBlockTableViewCell.xib; sourceTree = ""; }; 08DF78BB1F5EEFFE00AEEA85 /* MenuBlockTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuBlockTableViewCell.swift; sourceTree = ""; }; 08DF78D11F64059900AEEA85 /* StepikLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StepikLabel.swift; sourceTree = ""; }; - 08E16F211BDBA4AF004822E1 /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reachability.h; sourceTree = ""; }; - 08E16F221BDBA4AF004822E1 /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = ""; }; 08E16F241BDBA539004822E1 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; - 08E16F281BDBA731004822E1 /* ConnectionHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectionHelper.swift; sourceTree = ""; }; 08E3B9661EEA16DC0072995B /* CodeReply.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeReply.swift; sourceTree = ""; }; 08E43E9321495FD500E3CB50 /* DeepLinkRoutingService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeepLinkRoutingService.swift; sourceTree = ""; }; 08E43E96214C279600E3CB50 /* PushRouter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushRouter.swift; sourceTree = ""; }; @@ -3838,15 +3827,6 @@ path = Stepic; sourceTree = ""; }; - 08E16F201BDBA495004822E1 /* Reachability */ = { - isa = PBXGroup; - children = ( - 08E16F211BDBA4AF004822E1 /* Reachability.h */, - 08E16F221BDBA4AF004822E1 /* Reachability.m */, - ); - name = Reachability; - sourceTree = ""; - }; 0E839B9EC258A7A3342CE5FA /* Certificates */ = { isa = PBXGroup; children = ( @@ -3895,11 +3875,7 @@ 9F98579F526E5A4D162C3356 /* Pods_Stepic.framework */, 938533EAAD61D57EF139C60C /* Pods_StepicTests.framework */, 08E16F241BDBA539004822E1 /* SystemConfiguration.framework */, - 0824289B1BB0104700C98185 /* Alamofire-SwiftyJSON.swift */, - 083B164C1C2AF27700250B37 /* JSQWebViewController.swift */, - 08C1943F1ED0A05D00A41B72 /* PagerController.swift */, 2C4BBF0B203DC5C9000A4250 /* Plyr */, - 08E16F201BDBA495004822E1 /* Reachability */, 2CF6E62625ADB92A00B5A703 /* WidgetKit.framework */, 2CF6E62825ADB92A00B5A703 /* SwiftUI.framework */, ); @@ -4496,7 +4472,6 @@ 2CDE82E1221D5CCB00C41887 /* highlight.js */, 2C4F3B082432693D002ADB53 /* jquery-3.4.1.min.js */, 2C4F3B072432693D002ADB53 /* kotlin-playground-1.21.1.min.js */, - 08C0A4351BF12CDF0010F049 /* CustomMessagesDesign.json */, 2C104B672069064D0026FEB9 /* autocomplete_suggestions.plist */, 2CADE6172487B4BC00F523FA /* GoogleService-Info.plist */, 2C1A4D92244F8A1500D0F2DF /* ARKit-Badge-Glyph-Only.png */, @@ -4731,6 +4706,15 @@ path = ReviewSession; sourceTree = ""; }; + 2C7DFC4426C3F16800B243D7 /* ThirdParty */ = { + isa = PBXGroup; + children = ( + 083B164C1C2AF27700250B37 /* JSQWebViewController.swift */, + 08C1943F1ED0A05D00A41B72 /* PagerController.swift */, + ); + path = ThirdParty; + sourceTree = ""; + }; 2C7EFCF024D08D8E003A4E93 /* SocialProfiles */ = { isa = PBXGroup; children = ( @@ -6623,6 +6607,7 @@ 2CF9BD372538504D00C2AFD2 /* Alamofire */ = { isa = PBXGroup; children = ( + 0824289B1BB0104700C98185 /* DataRequest+ResponseSwiftyJSON.swift */, 2C4DDADE242FD1A400A0B4C8 /* HTTPHeader+Stepik.swift */, ); path = Alamofire; @@ -6652,18 +6637,15 @@ isa = PBXGroup; children = ( 08D2AE491C05127500BD8C3D /* AnalyticsHelper.swift */, - 08E16F281BDBA731004822E1 /* ConnectionHelper.swift */, 083D64AE1C19BDB2003222F0 /* ControllerHelper.swift */, 087387D71BB9A4BD003CFAD1 /* CoreDataHelper.swift */, 08CE16DF1BFA5A80008511B7 /* DeviceInfo.swift */, 087F6B951CE9E2C8002649AB /* HTMLParsingUtil.swift */, 08B3B80520F3909400F64D20 /* HTMLProcessor.swift */, - 08C0A4331BF1276C0010F049 /* Messages.swift */, 0840707F1D64847000308FC1 /* SharingHelper.swift */, 08A1256E1BDE8E460066B2B2 /* Sorter.swift */, 2C03B2A31F0CD87600005383 /* StringHelper.swift */, 0858B7081CFF271200459A6A /* TagDetectionUtil.swift */, - 085DF8DA1C9AB94B006809D9 /* TimeFormatHelper.swift */, 2CFF8FF5242A1E9800FD7311 /* Containers */, ); path = Helpers; @@ -8870,6 +8852,7 @@ 2C284DBC2474907C00669736 /* InAppPurchases */, 2CBE8A9C2625C58400AF7C86 /* Notifications */, 62E98FF5466CDBE04D83471C /* SettingsTable */, + 2C7DFC4426C3F16800B243D7 /* ThirdParty */, ); path = Frameworks; sourceTree = ""; @@ -9773,7 +9756,6 @@ 2CB62BE72019FD8500B5E336 /* step2.html in Resources */, 2C4BBF15203DC668000A4250 /* plyr.css in Resources */, 082B54D920AA342D00144817 /* PersonalDeadlineModeCollectionViewCell.xib in Resources */, - 08C0A4361BF12CDF0010F049 /* CustomMessagesDesign.json in Resources */, 86BB7C09201953AF00063538 /* CongratulationViewController.xib in Resources */, 2C97E010215E5246005684A1 /* Explore.storyboard in Resources */, 2CD99DD622DCE4D500628224 /* overlay_hard.png in Resources */, @@ -10061,7 +10043,6 @@ "${BUILT_PRODUCTS_DIR}/GTMSessionFetcher/GTMSessionFetcher.framework", "${BUILT_PRODUCTS_DIR}/GoogleDataTransport/GoogleDataTransport.framework", "${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework", - "${BUILT_PRODUCTS_DIR}/HexColors/HexColors.framework", "${BUILT_PRODUCTS_DIR}/Highlightr/Highlightr.framework", "${BUILT_PRODUCTS_DIR}/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework", "${BUILT_PRODUCTS_DIR}/Kanna/Kanna.framework", @@ -10080,7 +10061,6 @@ "${BUILT_PRODUCTS_DIR}/SwiftDate/SwiftDate.framework", "${BUILT_PRODUCTS_DIR}/SwiftyGif/SwiftyGif.framework", "${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework", - "${BUILT_PRODUCTS_DIR}/TSMessages/TSMessages.framework", "${BUILT_PRODUCTS_DIR}/TTTAttributedLabel/TTTAttributedLabel.framework", "${BUILT_PRODUCTS_DIR}/TUSafariActivity/TUSafariActivity.framework", "${BUILT_PRODUCTS_DIR}/Tabman/Tabman.framework", @@ -10124,7 +10104,6 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMSessionFetcher.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleDataTransport.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HexColors.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Highlightr.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQKeyboardManagerSwift.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Kanna.framework", @@ -10143,7 +10122,6 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftDate.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyGif.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyJSON.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TSMessages.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TTTAttributedLabel.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TUSafariActivity.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Tabman.framework", @@ -10197,7 +10175,6 @@ "${BUILT_PRODUCTS_DIR}/GTMSessionFetcher/GTMSessionFetcher.framework", "${BUILT_PRODUCTS_DIR}/GoogleDataTransport/GoogleDataTransport.framework", "${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework", - "${BUILT_PRODUCTS_DIR}/HexColors/HexColors.framework", "${BUILT_PRODUCTS_DIR}/Highlightr/Highlightr.framework", "${BUILT_PRODUCTS_DIR}/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework", "${BUILT_PRODUCTS_DIR}/Kanna/Kanna.framework", @@ -10216,7 +10193,6 @@ "${BUILT_PRODUCTS_DIR}/SwiftDate/SwiftDate.framework", "${BUILT_PRODUCTS_DIR}/SwiftyGif/SwiftyGif.framework", "${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework", - "${BUILT_PRODUCTS_DIR}/TSMessages/TSMessages.framework", "${BUILT_PRODUCTS_DIR}/TTTAttributedLabel/TTTAttributedLabel.framework", "${BUILT_PRODUCTS_DIR}/TUSafariActivity/TUSafariActivity.framework", "${BUILT_PRODUCTS_DIR}/Tabman/Tabman.framework", @@ -10256,7 +10232,6 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMSessionFetcher.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleDataTransport.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HexColors.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Highlightr.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IQKeyboardManagerSwift.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Kanna.framework", @@ -10275,7 +10250,6 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftDate.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyGif.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyJSON.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TSMessages.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TTTAttributedLabel.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TUSafariActivity.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Tabman.framework", @@ -10415,7 +10389,6 @@ 2CD80A80269C648E0047AE3C /* CourseRevenueTabMonthlyViewModel.swift in Sources */, 2CE0CAD8255A8D36009C6574 /* CatalogBlockContentItemParser.swift in Sources */, 2CE02A772176649F009C633C /* UserNotificationsCenterDelegate.swift in Sources */, - 08E16F291BDBA731004822E1 /* ConnectionHelper.swift in Sources */, 089700961F6B2A830041C24E /* NibInitializableView.swift in Sources */, 2C04846224C663B700B3DAC8 /* NewProfileCertificatesCertificateWidgetProgressView.swift in Sources */, 2C50364024C5A0E9001FAE04 /* NewProfileCertificatesCertificateCollectionViewCell.swift in Sources */, @@ -10613,7 +10586,6 @@ 2C453398204D46E90061342A /* PinsMap.swift in Sources */, 2C71F10B256D9C9400A1D40B /* DefaultSimpleCourseListCollectionViewDataSource.swift in Sources */, 2C0B42C1234CD17C00B03EA1 /* CustomMenuBlockTableViewCell.swift in Sources */, - 085DF8DB1C9AB94B006809D9 /* TimeFormatHelper.swift in Sources */, 2C5DF1391FEBDC8C003B1177 /* CardsStepsPresenter.swift in Sources */, 08F485A01C579319000165AA /* NumberReply.swift in Sources */, 2CD846471F25FB6C00E8153C /* Profile+CoreDataProperties.swift in Sources */, @@ -10678,7 +10650,6 @@ 2C2E44D524FE5FEA006B7303 /* VisitedCoursesCleaner.swift in Sources */, 2C2C4D91246B485400CF759D /* UIModalPresentationStyle+Fallback.swift in Sources */, 2C3DAB91233D735E00453B1C /* StepFontSize.swift in Sources */, - 08C0A4341BF1276C0010F049 /* Messages.swift in Sources */, 2CA255371F8CD62C00C58048 /* NotificationStatusButton.swift in Sources */, 08E6BB681DC8DF59006622EC /* UserActivitiesAPI.swift in Sources */, 2C619A7B24CFFB95007D3529 /* SocialProfile.swift in Sources */, @@ -10808,7 +10779,7 @@ 08484F0C211AF4320006266F /* StoryViewController.swift in Sources */, 084472061D05918E00197166 /* ChoiceQuizTableViewCell.swift in Sources */, 083B164D1C2AF27700250B37 /* JSQWebViewController.swift in Sources */, - 0824289C1BB0104700C98185 /* Alamofire-SwiftyJSON.swift in Sources */, + 0824289C1BB0104700C98185 /* DataRequest+ResponseSwiftyJSON.swift in Sources */, 0869F6D21CE216B600F8A6DB /* PersistentQueueRecoveryManager.swift in Sources */, 08CA59F11BBFD65E008DC44D /* User+CoreDataProperties.swift in Sources */, 2C53B4752588D63000E53779 /* GridSimpleCourseListCollectionViewDataSource.swift in Sources */, @@ -10908,7 +10879,6 @@ 2CBD855C201799B700E14F83 /* AdaptiveRatingsViewController.swift in Sources */, 2C20C86822F903D10052E9BF /* CodeEditorThemeService.swift in Sources */, 085DF8D51C99B9FB006809D9 /* Player.swift in Sources */, - 08E16F231BDBA4AF004822E1 /* Reachability.m in Sources */, 2C5DF13F1FED26AC003B1177 /* CardStepViewController.swift in Sources */, 2C5DF1411FED26B7003B1177 /* CardStepPresenter.swift in Sources */, 2CED386326710EFE00854DA3 /* AutoplayNavigationDirection.swift in Sources */, @@ -12169,7 +12139,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 358; + CURRENT_PROJECT_VERSION = 359; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = UJ4KC2QN7B; INFOPLIST_FILE = "StickerPackExtension/Info-Production.plist"; @@ -12194,7 +12164,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 358; + CURRENT_PROJECT_VERSION = 359; DEVELOPMENT_TEAM = UJ4KC2QN7B; INFOPLIST_FILE = "StickerPackExtension/Info-Production.plist"; IPHONEOS_DEPLOYMENT_TARGET = 11.0; @@ -12336,7 +12306,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 358; + CURRENT_PROJECT_VERSION = 359; DEVELOPMENT_TEAM = UJ4KC2QN7B; ENABLE_BITCODE = YES; INFOPLIST_FILE = "Stepic/Info-Production.plist"; @@ -12366,7 +12336,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 358; + CURRENT_PROJECT_VERSION = 359; DEVELOPMENT_TEAM = UJ4KC2QN7B; ENABLE_BITCODE = YES; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; @@ -12457,7 +12427,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 358; + CURRENT_PROJECT_VERSION = 359; DEVELOPMENT_TEAM = UJ4KC2QN7B; ENABLE_BITCODE = YES; INFOPLIST_FILE = "Stepic/Info-Develop.plist"; @@ -12509,7 +12479,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 358; + CURRENT_PROJECT_VERSION = 359; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = UJ4KC2QN7B; INFOPLIST_FILE = "StickerPackExtension/Info-Develop.plist"; @@ -12590,7 +12560,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 358; + CURRENT_PROJECT_VERSION = 359; DEVELOPMENT_TEAM = UJ4KC2QN7B; ENABLE_BITCODE = YES; INFOPLIST_FILE = "Stepic/Info-Develop.plist"; @@ -12638,7 +12608,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 358; + CURRENT_PROJECT_VERSION = 359; DEVELOPMENT_TEAM = UJ4KC2QN7B; INFOPLIST_FILE = "StickerPackExtension/Info-Develop.plist"; IPHONEOS_DEPLOYMENT_TARGET = 11.0; @@ -13159,7 +13129,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 358; + CURRENT_PROJECT_VERSION = 359; DEVELOPMENT_TEAM = UJ4KC2QN7B; ENABLE_BITCODE = YES; INFOPLIST_FILE = "Stepic/Info-Release.plist"; @@ -13213,7 +13183,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 358; + CURRENT_PROJECT_VERSION = 359; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = UJ4KC2QN7B; INFOPLIST_FILE = "StickerPackExtension/Info-Release.plist"; @@ -13295,7 +13265,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 358; + CURRENT_PROJECT_VERSION = 359; DEVELOPMENT_TEAM = UJ4KC2QN7B; ENABLE_BITCODE = YES; INFOPLIST_FILE = "Stepic/Info-Release.plist"; @@ -13343,7 +13313,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 358; + CURRENT_PROJECT_VERSION = 359; DEVELOPMENT_TEAM = UJ4KC2QN7B; INFOPLIST_FILE = "StickerPackExtension/Info-Release.plist"; IPHONEOS_DEPLOYMENT_TARGET = 11.0; diff --git a/Stepic/CustomMessagesDesign.json b/Stepic/CustomMessagesDesign.json deleted file mode 100644 index 639180a548..0000000000 --- a/Stepic/CustomMessagesDesign.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "success": { - "backgroundImageName": "NotificationBackgroundSuccess.png", - "borderColor": "#005700", - "borderHeight": 1, - "buttonBackgroundImageName": "NotificationButtonBackground.png", - "buttonTitleTextColor": "#FFFFFF", - "buttonTitleShadowColor": "#67B759", - "buttonTitleShadowOffsetX": 0, - "buttonTitleShadowOffsetY": -1, - "contentFontSize": 12, - "contentTextColor": "#FFFFFF", - "imageName": "NotificationBackgroundSuccessIcon.png", - "shadowColor": "#67B759", - "shadowOffsetX": 0, - "shadowOffsetY": -1, - "textColor": "#FFFFFF", - "titleFontSize": 25 - }, - "message": { - "backgroundImageName": "NotificationBackgroundMessage.png", - "borderColor": "#727C83", - "borderHeight": 1, - "buttonBackgroundImageName": "NotificationButtonBackground.png", - "buttonTitleTextColor": "#727C83", - "buttonTitleShadowColor": "#EBEEF1", - "buttonTitleShadowOffsetX": 0, - "buttonTitleShadowOffsetY": 1, - "contentFontSize": 12, - "contentTextColor": "#727C83", - "imageName": "", - "shadowColor": "#EBEEF1", - "shadowOffsetX": 0, - "shadowOffsetY": 1, - "textColor": "#727C83", - "titleFontSize": 14 - }, - "warning": { - "backgroundImageName": "NotificationBackgroundWarning.png", - "borderColor": "#A28918", - "borderHeight": 1, - "buttonBackgroundImageName": "NotificationButtonBackground.png", - "buttonTitleTextColor": "#484638", - "buttonTitleShadowColor": "#E5D87C", - "buttonTitleShadowOffsetX": 0, - "buttonTitleShadowOffsetY": 1, - "contentFontSize": 12, - "contentTextColor": "#484638", - "imageName": "NotificationBackgroundWarningIcon.png", - "shadowColor": "#E5D87C", - "shadowOffsetX": 0, - "shadowOffsetY": 1, - "textColor": "#484638", - "titleFontSize": 14 - }, - "error": { - "backgroundImageName": null , - "borderColor": "#700000", - "borderHeight": 1, - "buttonBackgroundImageName": "NotificationButtonBackground.png", - "buttonTitleTextColor": "#FFFFFF", - "buttonTitleShadowColor": "#812929", - "buttonTitleShadowOffsetX": 0, - "buttonTitleShadowOffsetY": 0, - "contentFontSize": 12, - "contentTextColor": "#FFFFFF", - "imageName": "NotificationBackgroundErrorIcon.png", - "shadowColor": "#812929", - "shadowOffsetX": 0, - "shadowOffsetY": 0, - "textColor": "#FFFFFF", - "titleFontSize": 14, - "backgroundColor" : "#ff0033" - } -} \ No newline at end of file diff --git a/Stepic/Images.xcassets/Online-white.imageset/Contents.json b/Stepic/Images.xcassets/Online-white.imageset/Contents.json deleted file mode 100644 index 052bb32015..0000000000 --- a/Stepic/Images.xcassets/Online-white.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Online-white.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "Online-white@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Stepic/Images.xcassets/Online-white.imageset/Online-white.png b/Stepic/Images.xcassets/Online-white.imageset/Online-white.png deleted file mode 100644 index 7c2f672765..0000000000 Binary files a/Stepic/Images.xcassets/Online-white.imageset/Online-white.png and /dev/null differ diff --git a/Stepic/Images.xcassets/Online-white.imageset/Online-white@2x.png b/Stepic/Images.xcassets/Online-white.imageset/Online-white@2x.png deleted file mode 100644 index d0348fdf1f..0000000000 Binary files a/Stepic/Images.xcassets/Online-white.imageset/Online-white@2x.png and /dev/null differ diff --git a/Stepic/Info-Develop.plist b/Stepic/Info-Develop.plist index c14e3a0e74..055df62a83 100644 --- a/Stepic/Info-Develop.plist +++ b/Stepic/Info-Develop.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.185-develop + 1.186-develop CFBundleSignature ???? CFBundleURLTypes @@ -62,7 +62,7 @@ CFBundleVersion - 358 + 359 FacebookAppID 171127739724012 FacebookDisplayName diff --git a/Stepic/Info-Production.plist b/Stepic/Info-Production.plist index 7a383037e3..b61968d91b 100644 --- a/Stepic/Info-Production.plist +++ b/Stepic/Info-Production.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.185 + 1.186 CFBundleSignature ???? CFBundleURLTypes @@ -62,7 +62,7 @@ CFBundleVersion - 358 + 359 FacebookAppID 171127739724012 FacebookDisplayName diff --git a/Stepic/Info-Release.plist b/Stepic/Info-Release.plist index a2dcf5c7cc..2f94fdf172 100644 --- a/Stepic/Info-Release.plist +++ b/Stepic/Info-Release.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.185-release + 1.186-release CFBundleSignature ???? CFBundleURLTypes @@ -62,7 +62,7 @@ CFBundleVersion - 358 + 359 FacebookAppID 171127739724012 FacebookDisplayName diff --git a/Stepic/Legacy/Analytics/Events/AnalyticsEvents.swift b/Stepic/Legacy/Analytics/Events/AnalyticsEvents.swift index a4485a85c9..6d4e284c11 100644 --- a/Stepic/Legacy/Analytics/Events/AnalyticsEvents.swift +++ b/Stepic/Legacy/Analytics/Events/AnalyticsEvents.swift @@ -130,7 +130,6 @@ extension AnalyticsEvent { // MARK: Video static let courseDetailVideoTapped = AnalyticsEvent(name: "course_detail_video_clicked") - static let courseDetailVideoShown = AnalyticsEvent(name: "course_detail_video_shown") // MARK: - SignIn - diff --git a/Stepic/Legacy/Analytics/SplitTests/ActiveTests/ActiveSplitTestsContainer.swift b/Stepic/Legacy/Analytics/SplitTests/ActiveTests/ActiveSplitTestsContainer.swift index 595aa62eef..0dfc972b0c 100644 --- a/Stepic/Legacy/Analytics/SplitTests/ActiveTests/ActiveSplitTestsContainer.swift +++ b/Stepic/Legacy/Analytics/SplitTests/ActiveTests/ActiveSplitTestsContainer.swift @@ -1,7 +1,7 @@ import Foundation final class ActiveSplitTestsContainer { - private static let splitTestingService = SplitTestingService( + private static let splitTestingService: SplitTestingServiceProtocol = SplitTestingService( analyticsService: AnalyticsUserProperties(), storage: UserDefaults.standard ) diff --git a/Stepic/Legacy/Analytics/SplitTests/SplitTestingService.swift b/Stepic/Legacy/Analytics/SplitTests/SplitTestingService.swift index 748311bc94..608dd9d1c5 100755 --- a/Stepic/Legacy/Analytics/SplitTests/SplitTestingService.swift +++ b/Stepic/Legacy/Analytics/SplitTests/SplitTestingService.swift @@ -4,7 +4,7 @@ protocol SplitTestingServiceProtocol { func fetchSplitTest(_ splitTestType: Value.Type) -> Value } -class SplitTestingService: SplitTestingServiceProtocol { +final class SplitTestingService: SplitTestingServiceProtocol { private let analyticsService: ABAnalyticsServiceProtocol private let storage: StringStorageServiceProtocol diff --git a/Stepic/Legacy/AppDelegate.swift b/Stepic/Legacy/AppDelegate.swift index 64def61784..8d77c9ce87 100644 --- a/Stepic/Legacy/AppDelegate.swift +++ b/Stepic/Legacy/AppDelegate.swift @@ -70,8 +70,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { SVProgressHUD.setDefaultStyle(SVProgressHUDStyle.light) SVProgressHUD.setHapticsEnabled(true) - ConnectionHelper.shared.instantiate() - if !AudioManager.shared.initAudioSession() { print("Could not initialize audio session") } diff --git a/Stepic/Legacy/Controllers/AdaptiveSteps/CardStep/CardStepPresenter.swift b/Stepic/Legacy/Controllers/AdaptiveSteps/CardStep/CardStepPresenter.swift index a6ac711952..f815c96c1c 100644 --- a/Stepic/Legacy/Controllers/AdaptiveSteps/CardStep/CardStepPresenter.swift +++ b/Stepic/Legacy/Controllers/AdaptiveSteps/CardStep/CardStepPresenter.swift @@ -37,7 +37,6 @@ final class CardStepPresenter { var step: Step! var state: CardStepState = .unsolved - var lesson: Lesson? { self.step.lesson } var quizViewController: QuizViewController? diff --git a/Stepic/Legacy/Controllers/AdaptiveSteps/CardsSteps/BaseCardsStepsViewController.swift b/Stepic/Legacy/Controllers/AdaptiveSteps/CardsSteps/BaseCardsStepsViewController.swift index a070740a41..a5b1cc647b 100644 --- a/Stepic/Legacy/Controllers/AdaptiveSteps/CardsSteps/BaseCardsStepsViewController.swift +++ b/Stepic/Legacy/Controllers/AdaptiveSteps/CardsSteps/BaseCardsStepsViewController.swift @@ -125,7 +125,7 @@ final class BaseCardsStepsViewController: CardsStepsViewController { ), ratingManager: AdaptiveRatingManager(courseID: self.course.id), statsManager: AdaptiveStatsManager(courseId: self.course.id), - storageManager: AdaptiveStorageManager(), + adaptiveStorageManager: AdaptiveStorageManager(), lastViewedUpdater: LocalProgressLastViewedUpdater(), notificationSuggestionManager: NotificationSuggestionManager(), notificationsRegistrationService: NotificationsRegistrationService( diff --git a/Stepic/Legacy/Controllers/AdaptiveSteps/CardsSteps/CardsStepsPresenter.swift b/Stepic/Legacy/Controllers/AdaptiveSteps/CardsSteps/CardsStepsPresenter.swift index c74fe3e328..e539db3911 100644 --- a/Stepic/Legacy/Controllers/AdaptiveSteps/CardsSteps/CardsStepsPresenter.swift +++ b/Stepic/Legacy/Controllers/AdaptiveSteps/CardsSteps/CardsStepsPresenter.swift @@ -66,7 +66,7 @@ final class BaseCardsStepsPresenter: CardsStepsPresenter, StepCardViewDelegate { private let viewsAPI: ViewsAPI private let ratingManager: AdaptiveRatingManager private let statsManager: AdaptiveStatsManager - private let storageManager: AdaptiveStorageManager + private let adaptiveStorageManager: AdaptiveStorageManagerProtocol private let adaptiveRatingsNetworkService: AdaptiveRatingsNetworkServiceProtocol private let adaptiveRatingsRestoreNetworkService: AdaptiveRatingsRestoreNetworkServiceProtocol private let lastViewedUpdater: LocalProgressLastViewedUpdater @@ -124,7 +124,7 @@ final class BaseCardsStepsPresenter: CardsStepsPresenter, StepCardViewDelegate { adaptiveRatingsRestoreNetworkService: AdaptiveRatingsRestoreNetworkServiceProtocol, ratingManager: AdaptiveRatingManager, statsManager: AdaptiveStatsManager, - storageManager: AdaptiveStorageManager, + adaptiveStorageManager: AdaptiveStorageManagerProtocol, lastViewedUpdater: LocalProgressLastViewedUpdater, notificationSuggestionManager: NotificationSuggestionManager, notificationsRegistrationService: NotificationsRegistrationServiceProtocol, @@ -142,7 +142,7 @@ final class BaseCardsStepsPresenter: CardsStepsPresenter, StepCardViewDelegate { self.adaptiveRatingsRestoreNetworkService = adaptiveRatingsRestoreNetworkService self.ratingManager = ratingManager self.statsManager = statsManager - self.storageManager = storageManager + self.adaptiveStorageManager = adaptiveStorageManager self.lastViewedUpdater = lastViewedUpdater self.notificationSuggestionManager = notificationSuggestionManager self.notificationsRegistrationService = notificationsRegistrationService @@ -210,7 +210,7 @@ final class BaseCardsStepsPresenter: CardsStepsPresenter, StepCardViewDelegate { } func refreshTopCard() { - if !storageManager.isAdaptiveOnboardingPassed { + if !adaptiveStorageManager.isAdaptiveOnboardingPassed { let stepIndex = lastOnboardingStep ?? onboardingFirstStepIndex if stepIndex <= onboardingLastStepIndex { @@ -219,7 +219,7 @@ final class BaseCardsStepsPresenter: CardsStepsPresenter, StepCardViewDelegate { return } else { self.analytics.send(.adaptiveOnboardingFinished) - storageManager.isAdaptiveOnboardingPassed = true + adaptiveStorageManager.isAdaptiveOnboardingPassed = true } } @@ -527,7 +527,7 @@ final class BaseCardsStepsPresenter: CardsStepsPresenter, StepCardViewDelegate { func onControlButtonClick() { // Onboarding -> just skip card - if !storageManager.isAdaptiveOnboardingPassed { + if !adaptiveStorageManager.isAdaptiveOnboardingPassed { view?.swipeCardUp() return } @@ -588,14 +588,7 @@ enum CardsStepsError: Error { case noStepsInLesson case recommendationsNotLoaded case stepNotLoaded - case unknown case reactionNotSent case viewNotSent - case registrationFailed - case notLoggedIn - case noProfile - case notUnsubscribed - case noCourse - case notEnrolled case coursePassed } diff --git a/Stepic/Legacy/Controllers/AdaptiveSteps/RatingStats/AdaptiveStatsManager.swift b/Stepic/Legacy/Controllers/AdaptiveSteps/RatingStats/AdaptiveStatsManager.swift index 1c81d02624..bdf1b7e275 100644 --- a/Stepic/Legacy/Controllers/AdaptiveSteps/RatingStats/AdaptiveStatsManager.swift +++ b/Stepic/Legacy/Controllers/AdaptiveSteps/RatingStats/AdaptiveStatsManager.swift @@ -27,12 +27,6 @@ final class AdaptiveStatsManager { self.courseId = courseId } - var lastSolvedDayNum: Int { - self.getLastDays(count: 1)[0] > 0 - ? self.dayByDate(Date()) - : 0 - } - var stats: [Int: Int]? { get { guard let savedStats = defaults.value(forKey: statsKey) as? [String: String] else { @@ -55,22 +49,6 @@ final class AdaptiveStatsManager { } } - var currentDayStreak: Int { - get { - let _stats = stats - var curDay = dayByDate(Date()) - while curDay > 0 { - if let todayXP = _stats?[curDay], todayXP != 0 { - curDay -= 1 - } else { - break - } - } - - return dayByDate(Date()) - curDay - } - } - func dayByDate(_ date: Date) -> Int { // Day num (01.01.1970 - 0, 02.01.1970 - 1, ...) let dayNum = Int(date.timeIntervalSince1970 / secondsInDay) diff --git a/Stepic/Legacy/Controllers/AdaptiveSteps/Stats/AdaptiveRatings/AdaptiveRatingsPresenter.swift b/Stepic/Legacy/Controllers/AdaptiveSteps/Stats/AdaptiveRatings/AdaptiveRatingsPresenter.swift index 48b9548e0b..45137efad2 100644 --- a/Stepic/Legacy/Controllers/AdaptiveSteps/Stats/AdaptiveRatings/AdaptiveRatingsPresenter.swift +++ b/Stepic/Legacy/Controllers/AdaptiveSteps/Stats/AdaptiveRatings/AdaptiveRatingsPresenter.swift @@ -65,7 +65,7 @@ final class AdaptiveRatingsPresenter { print("adaptive ratings: remote rating updated -> reload rating") let downloadedScoreboard = self.scoreboard[days ?? 0] // 0 when 'days' == nil if downloadedScoreboard == nil || force { - return self.reloadRating(days: days, force: force) + return self.reloadRating(days: days) } else { return .value(downloadedScoreboard!) } @@ -89,7 +89,7 @@ final class AdaptiveRatingsPresenter { self.analytics.send(.adaptiveRatingOpened(courseID: self.ratingManager.courseID)) } - private func reloadRating(days: Int? = nil, force: Bool = false) -> Promise { + private func reloadRating(days: Int? = nil) -> Promise { Promise { seal in let currentUser = AuthInfo.shared.userId var usersForDeanonIds = [Int]() diff --git a/Stepic/Legacy/Controllers/AdaptiveSteps/Stats/Views/CongratsView.swift b/Stepic/Legacy/Controllers/AdaptiveSteps/Stats/Views/CongratsView.swift index f29ea95776..cd4ec7afaf 100644 --- a/Stepic/Legacy/Controllers/AdaptiveSteps/Stats/Views/CongratsView.swift +++ b/Stepic/Legacy/Controllers/AdaptiveSteps/Stats/Views/CongratsView.swift @@ -14,7 +14,6 @@ final class CongratsView: UIView { let padOpacity: CGFloat = 0.15 enum AnimationDuration { - static let hiding: TimeInterval = 0.5 static let backgroundRotate: TimeInterval = 30.0 } diff --git a/Stepic/Legacy/Controllers/CodeEditorSettings/CodeEditorPreview/CodeEditorPreviewView.swift b/Stepic/Legacy/Controllers/CodeEditorSettings/CodeEditorPreview/CodeEditorPreviewView.swift index 464c6c1e74..3d52a0f1ad 100644 --- a/Stepic/Legacy/Controllers/CodeEditorSettings/CodeEditorPreview/CodeEditorPreviewView.swift +++ b/Stepic/Legacy/Controllers/CodeEditorSettings/CodeEditorPreview/CodeEditorPreviewView.swift @@ -28,8 +28,6 @@ final class CodeEditorPreviewView: NibInitializableView { var highlightr: Highlightr? { self.textStorage?.highlightr } private var theme: String? - private var fontSize: Int? - private var language: CodeLanguage? override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { super.traitCollectionDidChange(previousTraitCollection) @@ -73,10 +71,7 @@ final class CodeEditorPreviewView: NibInitializableView { self.theme = theme self.updateFontSize(with: fontSize) - self.fontSize = fontSize - self.updateLanguage(with: language) - self.language = language } func updateTheme(with newTheme: String) { diff --git a/Stepic/Legacy/Controllers/CodeEditorSettings/CodeEditorSettingsPresenter.swift b/Stepic/Legacy/Controllers/CodeEditorSettings/CodeEditorSettingsPresenter.swift index c404205762..f96938d95d 100644 --- a/Stepic/Legacy/Controllers/CodeEditorSettings/CodeEditorSettingsPresenter.swift +++ b/Stepic/Legacy/Controllers/CodeEditorSettings/CodeEditorSettingsPresenter.swift @@ -66,8 +66,6 @@ final class CodeEditorSettingsPresenter { private let colorsHeaderBlockId = "colors_header" private let themeBlockId = "theme_block" - private let fontsHeaderBlockId = "fonts_header" - private let fontSizeBlockId = "font_size_block" private func buildTitleMenuBlock(id: String, title: String) -> HeaderMenuBlock { .init(id: id, title: title) } diff --git a/Stepic/Legacy/Controllers/Notifications/Helpers/NotificationDataExtractor.swift b/Stepic/Legacy/Controllers/Notifications/Helpers/NotificationDataExtractor.swift index fcb06b99ae..b048c43770 100644 --- a/Stepic/Legacy/Controllers/Notifications/Helpers/NotificationDataExtractor.swift +++ b/Stepic/Legacy/Controllers/Notifications/Helpers/NotificationDataExtractor.swift @@ -13,7 +13,7 @@ final class NotificationDataExtractor { private var type: NotificationType // Extract id from strings: "/users/100000" -> 100000 - lazy var userId: Int? = { + lazy var userID: Int? = { guard self.type == .comments else { return nil } @@ -28,37 +28,6 @@ final class NotificationDataExtractor { return nil }() - // Extract course id - lazy var courseId: Int? = { - guard self.type == .learn else { - return nil - } - - if let courseLink = HTMLParsingUtil.getLink(self.text, index: 0) { - if let courseIdStartIndex = courseLink.lastIndexOf("-") { - let start = courseLink.index(courseLink.startIndex, offsetBy: courseIdStartIndex + 1) - let end = courseLink.index(courseLink.startIndex, offsetBy: courseLink.count - 1) - let courseIdString = courseLink.substring(with: start.. (date: Date, notifications: [NotificationViewData]) in let (date, notifications) = arg return (date: date, notifications: self.updateNotificationsViewData(notifications: notifications, newStatus: .read)) @@ -245,7 +270,7 @@ final class NotificationsPresenter { var notificationsWExtractor: [(Notification, NotificationDataExtractor)] = [] for notification in new { let extractor = NotificationDataExtractor(text: notification.htmlText ?? "", type: notification.type) - if let userId = extractor.userId { + if let userId = extractor.userID { usersQuery.insert(userId) } notificationsWExtractor.append((notification, extractor)) @@ -259,7 +284,7 @@ final class NotificationsPresenter { // Add avatator URL to view data notificationsWExtractor.forEach { notification, extractor in let notificationVD: NotificationViewData! - if let userId = extractor.userId, let userAvatar = userAvatars[userId] { + if let userId = extractor.userID, let userAvatar = userAvatars[userId] { notificationVD = NotificationViewData(id: notification.id, type: notification.type, status: notification.status, time: notification.time ?? Date(), text: extractor.preparedText ?? "", avatarURL: userAvatar) } else { notificationVD = NotificationViewData(id: notification.id, type: notification.type, status: notification.status, time: notification.time ?? Date(), text: extractor.preparedText ?? "", avatarURL: nil) diff --git a/Stepic/Legacy/Controllers/Placeholders/StepikPlaceholderStyle+Placeholders.swift b/Stepic/Legacy/Controllers/Placeholders/StepikPlaceholderStyle+Placeholders.swift index a5bdb72369..8a39706df1 100644 --- a/Stepic/Legacy/Controllers/Placeholders/StepikPlaceholderStyle+Placeholders.swift +++ b/Stepic/Legacy/Controllers/Placeholders/StepikPlaceholderStyle+Placeholders.swift @@ -90,12 +90,6 @@ extension StepikPlaceholder.Style { text: NSLocalizedString("PlaceholderEmptyNotificationsText", comment: ""), buttonTitle: nil ) - static let emptyNotificationsLoading = StepikPlaceholderStyle( - id: "emptyNotificationsLoading", - image: PlaceholderImage(image: UIImage(named: "new-empty-notifications"), scale: 0.48), - text: NSLocalizedString("Refreshing", comment: ""), - buttonTitle: nil - ) static let emptySearch = StepikPlaceholderStyle( id: "emptySearch", image: PlaceholderImage(image: UIImage(named: "new-empty-search"), scale: 0.49), @@ -126,12 +120,6 @@ extension StepikPlaceholder.Style { text: NSLocalizedString("PlaceholderNoDiscussionsTitle", comment: ""), buttonTitle: NSLocalizedString("PlaceholderNoDiscussionsButtonTitle", comment: "") ) - static let emptyDiscussionsLoading = StepikPlaceholderStyle( - id: "emptyDiscussionsLoading", - image: PlaceholderImage(image: UIImage(named: "new-empty-empty"), scale: 0.99), - text: NSLocalizedString("Refreshing", comment: ""), - buttonTitle: nil - ) static let emptySolutions = StepikPlaceholderStyle( id: "emptySolutions", image: PlaceholderImage(image: UIImage(named: "new-empty-empty"), scale: 0.99), @@ -162,24 +150,12 @@ extension StepikPlaceholder.Style { text: NSLocalizedString("EmptyTitle", comment: ""), buttonTitle: nil ) - static let emptySectionsLoading = StepikPlaceholderStyle( - id: "emptySectionsLoading", - image: PlaceholderImage(image: UIImage(named: "new-empty-empty"), scale: 0.99), - text: NSLocalizedString("Refreshing", comment: ""), - buttonTitle: nil - ) static let emptyUnits = StepikPlaceholderStyle( id: "emptyUnits", image: PlaceholderImage(image: UIImage(named: "new-empty-empty"), scale: 0.99), text: NSLocalizedString("PullToRefreshUnitsTitle", comment: ""), buttonTitle: nil ) - static let emptyUnitsLoading = StepikPlaceholderStyle( - id: "emptyUnitsLoading", - image: PlaceholderImage(image: UIImage(named: "new-empty-empty"), scale: 0.99), - text: NSLocalizedString("Refreshing", comment: ""), - buttonTitle: nil - ) static let emptyCourseBenefits = StepikPlaceholderStyle( id: "emptyCourseBenefits", image: PlaceholderImage(image: UIImage(named: "new-empty-course-benefits"), scale: 0.99), diff --git a/Stepic/Legacy/Controllers/Profile/Achievements/AchievementAlert/AchievementPopupViewController.swift b/Stepic/Legacy/Controllers/Profile/Achievements/AchievementAlert/AchievementPopupViewController.swift index b5c623afbf..ff5f2343c0 100644 --- a/Stepic/Legacy/Controllers/Profile/Achievements/AchievementAlert/AchievementPopupViewController.swift +++ b/Stepic/Legacy/Controllers/Profile/Achievements/AchievementAlert/AchievementPopupViewController.swift @@ -25,8 +25,6 @@ final class AchievementPopupViewController: UIViewController { @IBOutlet weak var closeButton: UIButton! @IBOutlet weak var separatorView: UIView! - var widthConstraint: NSLayoutConstraint? - var data: AchievementViewData? var canShare = true var source: Source = .notification diff --git a/Stepic/Legacy/Controllers/Quizzes/BaseQuiz/QuizViewController/QuizViewController.swift b/Stepic/Legacy/Controllers/Quizzes/BaseQuiz/QuizViewController/QuizViewController.swift index 291e69a0e2..6bb1dc2eb8 100644 --- a/Stepic/Legacy/Controllers/Quizzes/BaseQuiz/QuizViewController/QuizViewController.swift +++ b/Stepic/Legacy/Controllers/Quizzes/BaseQuiz/QuizViewController/QuizViewController.swift @@ -361,7 +361,15 @@ class QuizViewController: UIViewController, QuizView, QuizControllerDataSource, func showError(message: String) { self.doesPresentActivityIndicatorView = false - Messages.sharedManager.show(with: message) + + let alert = UIAlertController( + title: NSLocalizedString("Error", comment: ""), + message: message, + preferredStyle: .alert + ) + alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default)) + + self.present(alert, animated: true) } func showLoading(visible: Bool) { @@ -374,9 +382,13 @@ class QuizViewController: UIViewController, QuizView, QuizControllerDataSource, } func showConnectionError() { - if let vc = navigationController { - Messages.sharedManager.showConnectionErrorMessage(inController: vc) - } + let alert = UIAlertController( + title: NSLocalizedString("ConnectionErrorTitle", comment: ""), + message: NSLocalizedString("ConnectionErrorSubtitle", comment: ""), + preferredStyle: .alert + ) + alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default)) + self.present(alert, animated: true) } func suggestStreak(streak: Int) { diff --git a/Stepic/Legacy/Controllers/VideoPlayer/StepikVideoPlayerViewController/StepikVideoPlayerViewController.swift b/Stepic/Legacy/Controllers/VideoPlayer/StepikVideoPlayerViewController/StepikVideoPlayerViewController.swift index 9de955ac28..332c3f9637 100644 --- a/Stepic/Legacy/Controllers/VideoPlayer/StepikVideoPlayerViewController/StepikVideoPlayerViewController.swift +++ b/Stepic/Legacy/Controllers/VideoPlayer/StepikVideoPlayerViewController/StepikVideoPlayerViewController.swift @@ -1147,13 +1147,19 @@ extension StepikVideoPlayerViewController: PlayerDelegate { // MARK: Private helpers private func setTimeParametersAfterPlayerIsReady() { - self.fullTimeTopLabel.text = TimeFormatHelper.sharedHelper.getTimeStringFrom(self.player.maximumDuration) + func stringFromTimeInterval(_ ti: TimeInterval) -> String { + let formatter = DateComponentsFormatter() + let additionalFormat = ti >= 60 ? "" : (ti < 10 ? "0:0" : "0:") + return "\(additionalFormat)\(ti >= 60 ? formatter.string(from: ti)! : "\(Int(ti))")" + } + + self.fullTimeTopLabel.text = stringFromTimeInterval(self.player.maximumDuration) self.player.setPeriodicTimeObserver { [weak self] time, bufferedTime in guard let strongSelf = self else { return } - strongSelf.currentTimeTopLabel.text = TimeFormatHelper.sharedHelper.getTimeStringFrom(time) + strongSelf.currentTimeTopLabel.text = stringFromTimeInterval(time) strongSelf.topTimeSlider.value = Float(time / Double(strongSelf.player.maximumDuration)) if let bufferedTime = bufferedTime { diff --git a/Stepic/Legacy/Helpers/ConnectionHelper.swift b/Stepic/Legacy/Helpers/ConnectionHelper.swift deleted file mode 100644 index b8d669e47d..0000000000 --- a/Stepic/Legacy/Helpers/ConnectionHelper.swift +++ /dev/null @@ -1,76 +0,0 @@ -// -// ConnectionHelper.swift -// Stepic -// -// Created by Alexander Karpov on 24.10.15. -// Copyright © 2015 Alex Karpov. All rights reserved. -// - -import UIKit - -@available(*, deprecated, message: "Legacy class, use `NetworkReachabilityService`") -final class ConnectionHelper: NSObject { - override private init() { - super.init() - reachability = Reachability.forInternetConnection() - reachability.reachableOnWWAN = reachableOnWWAN - -// reachability.reachableOnWWAN = defaults.objectForKey(reachableOnWWANKey) as? Bool ?? false - - NotificationCenter.default.addObserver(self, selector: #selector(ConnectionHelper.reachabilityChanged(_:)), name: NSNotification.Name.reachabilityChanged, object: nil) - reachability.startNotifier() - } - - private var reachabilityChangedHandlers: [(Bool) -> Void] = [] - - func instantiate() {} - - func addReachabilityChangedHandler(handler: @escaping (Bool) -> Void) { - reachabilityChangedHandlers.append(handler) - } - - private func callReachabilityhandlers(_ result: Bool) { - for handler in reachabilityChangedHandlers { - handler(result) - } - } - - var isReachable: Bool { - self.reachability.isReachableViaWiFi() - || (self.reachability.isReachableViaWWAN() && self.reachability.reachableOnWWAN) - } - - var reachableOnWWAN: Bool { - get { - if let r = defaults.object(forKey: reachableOnWWANKey) as? Bool { - return r - } else { - self.reachableOnWWAN = false - return false - } - } - - set(value) { - defaults.set(value, forKey: reachableOnWWANKey) - defaults.synchronize() - reachability.reachableOnWWAN = value - } - } - - @objc func reachabilityChanged(_ notification: Foundation.Notification) { - if isReachable { - print("Service avalaible!!!") - callReachabilityhandlers(true) - } else { - callReachabilityhandlers(false) - print("Service unavaliable!!!") - } - } - - static let shared = ConnectionHelper() - - var reachability: Reachability! - - private let defaults = UserDefaults.standard - private let reachableOnWWANKey = "reachableOnWWAN" -} diff --git a/Stepic/Legacy/Helpers/ControllerHelper.swift b/Stepic/Legacy/Helpers/ControllerHelper.swift index 5fbf2a4100..7da7cb54b8 100644 --- a/Stepic/Legacy/Helpers/ControllerHelper.swift +++ b/Stepic/Legacy/Helpers/ControllerHelper.swift @@ -8,7 +8,7 @@ import UIKit -struct ControllerHelper { +enum ControllerHelper { static func getTopViewController() -> UIViewController? { var topViewController = UIApplication.shared.keyWindow?.rootViewController diff --git a/Stepic/Legacy/Helpers/Messages.swift b/Stepic/Legacy/Helpers/Messages.swift deleted file mode 100644 index 1842d98136..0000000000 --- a/Stepic/Legacy/Helpers/Messages.swift +++ /dev/null @@ -1,77 +0,0 @@ -// -// Messages.swift -// Stepic -// -// Created by Alexander Karpov on 09.11.15. -// Copyright © 2015 Alex Karpov. All rights reserved. -// - -import TSMessages -import UIKit - -final class Messages: NSObject { - static let sharedManager = Messages() - - override private init() { - super.init() - TSMessage.setDelegate(self) - TSMessage.addCustomDesignFromFile(withName: "CustomMessagesDesign.json") - } - - func showConnectionErrorMessage(inController vc: UIViewController) { - TSMessage.showNotification( - in: vc, - title: NSLocalizedString("ConnectionErrorTitle", comment: ""), - subtitle: NSLocalizedString("ConnectionErrorSubtitle", comment: ""), - image: UIImage(named: "Online-white")!, - type: .error, - duration: 3, - callback: nil, - buttonTitle: nil, - buttonCallback: nil, - at: TSMessageNotificationPosition.navBarOverlay, - canBeDismissedByUser: true - ) - } - - func show3GDownloadErrorMessage(inController vc: UIViewController) { - TSMessage.showNotification( - withTitle: NSLocalizedString("DownloadReachabilityErrorTitle", comment: ""), - type: .error - ) - } - - func showSomethingGotWrong(inController vc: UIViewController) { - TSMessage.showNotification( - withTitle: NSLocalizedString("SomethingWrongTitle", comment: ""), - subtitle: NSLocalizedString("SomethingWrongSubtitle", comment: ""), - type: .error - ) - } - - func showReloginPlease(inController vc: UIViewController) { - TSMessage.showNotification( - withTitle: NSLocalizedString("ReloginTitle", comment: ""), - subtitle: NSLocalizedString("ReloginSubtitle", comment: ""), - type: .error - ) - } - - func showCancelledDownloadMessage(count: Int) { - TSMessage.showNotification( - withTitle: NSLocalizedString("ConnectionLost", comment: ""), - subtitle: "\(NSLocalizedString("CancelledDownload", comment: "")) \(count) \(NSLocalizedString((count % 10 == 1 && count != 11) ? "Video" : "Videos", comment: ""))", - type: .error - ) - } - - func show(with title: String, andType type: TSMessageNotificationType = .error) { - TSMessage.showNotification(withTitle: title, type: type) - } -} - -extension Messages: TSMessageViewProtocol { - func customize(_ messageView: TSMessageView!) { - messageView.alpha = 0.85 - } -} diff --git a/Stepic/Legacy/Helpers/SharingHelper.swift b/Stepic/Legacy/Helpers/SharingHelper.swift index 1797ded260..f948aeb1c7 100644 --- a/Stepic/Legacy/Helpers/SharingHelper.swift +++ b/Stepic/Legacy/Helpers/SharingHelper.swift @@ -9,12 +9,13 @@ import TUSafariActivity import UIKit -final class SharingHelper { +enum SharingHelper { static func getSharingController(_ link: String) -> UIActivityViewController { - let activityItemSource = CyrillicURLActivityItemSource(link: link) - let objectsToShare = [activityItemSource] - let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: [TUSafariActivity()]) - activityVC.excludedActivityTypes = [UIActivity.ActivityType.airDrop] - return activityVC + let activityViewController = UIActivityViewController( + activityItems: [CyrillicURLActivityItemSource(link: link)], + applicationActivities: [TUSafariActivity()] + ) + activityViewController.excludedActivityTypes = [.airDrop] + return activityViewController } } diff --git a/Stepic/Legacy/Helpers/TimeFormatHelper.swift b/Stepic/Legacy/Helpers/TimeFormatHelper.swift deleted file mode 100644 index c14e9759c3..0000000000 --- a/Stepic/Legacy/Helpers/TimeFormatHelper.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// TimeFormatHelper.swift -// Stepic -// -// Created by Alexander Karpov on 17.03.16. -// Copyright © 2016 Alex Karpov. All rights reserved. -// - -import UIKit - -final class TimeFormatHelper: NSObject { - override private init() { - super.init() - } - - static let sharedHelper = TimeFormatHelper() - - func getTimeStringFrom(_ time: TimeInterval) -> String { - let dateComponentsFormatter = DateComponentsFormatter() -// print("formatting time -> \(dateComponentsFormatter.stringFromTimeInterval(time))") - let additionalFormat = time >= 60 ? "" : (time < 10 ? "0:0" : "0:") - return "\(additionalFormat)\(time >= 60 ? dateComponentsFormatter.string(from: time)! : "\(Int(time))")" - } -} diff --git a/Stepic/Legacy/Model/ExecutionQueue/ExecutionQueues.swift b/Stepic/Legacy/Model/ExecutionQueue/ExecutionQueues.swift index f2281297c5..19d1958368 100644 --- a/Stepic/Legacy/Model/ExecutionQueue/ExecutionQueues.swift +++ b/Stepic/Legacy/Model/ExecutionQueue/ExecutionQueues.swift @@ -12,39 +12,45 @@ import Foundation Contains all ExecutionQueues */ final class ExecutionQueues { - private init() {} + private static let networkReachabilityService: NetworkReachabilityServiceProtocol = NetworkReachabilityService() static let sharedQueues = ExecutionQueues() - var connectionAvailableExecutionQueue = ExecutionQueue() - var connectionAvailableExecutionQueueKey = "connectionAvailableExecutionQueueKey" + private init() {} - func setUpQueueObservers() { - NotificationCenter.default.addObserver(self, selector: #selector(ExecutionQueues.reachabilityChanged(_:)), name: NSNotification.Name.reachabilityChanged, object: nil) - } + private(set) var connectionAvailableExecutionQueue = ExecutionQueue() + static let connectionAvailableExecutionQueueKey = "connectionAvailableExecutionQueueKey" - @objc func reachabilityChanged(_ notification: Foundation.Notification) { - if ConnectionHelper.shared.isReachable { - executeConnectionAvailableQueue() + func setUpQueueObservers() { + Self.networkReachabilityService.startListening { status in + if status == .reachable { + self.executeConnectionAvailableQueue() + } } } func executeConnectionAvailableQueue() { - connectionAvailableExecutionQueue.executeAll { - newQueue in + self.connectionAvailableExecutionQueue.executeAll { newQueue in print("could not execute \(newQueue.count) tasks, rewriting the queue") self.connectionAvailableExecutionQueue = newQueue + let queuePersistencyManager = PersistentQueueRecoveryManager(baseName: "Queues") - queuePersistencyManager.writeQueue(ExecutionQueues.sharedQueues.connectionAvailableExecutionQueue, key: ExecutionQueues.sharedQueues.connectionAvailableExecutionQueueKey) + queuePersistencyManager.writeQueue( + Self.sharedQueues.connectionAvailableExecutionQueue, + key: Self.connectionAvailableExecutionQueueKey + ) } } func recoverQueuesFromPersistentStore() { let queueRecoveryManager = PersistentQueueRecoveryManager(baseName: "Queues") - if let recoveredConnectionAvailableExecutionQueue = queueRecoveryManager.recoverQueue(connectionAvailableExecutionQueueKey) { - connectionAvailableExecutionQueue = recoveredConnectionAvailableExecutionQueue - } else { - print("failed to recover connection available queue from persistent store") + + guard let recoveredConnectionAvailableExecutionQueue = queueRecoveryManager.recoverQueue( + Self.connectionAvailableExecutionQueueKey + ) else { + return print("failed to recover connection available queue from persistent store") } + + self.connectionAvailableExecutionQueue = recoveredConnectionAvailableExecutionQueue } } diff --git a/Alamofire-SwiftyJSON.swift b/Stepic/Sources/Extensions/ThirdParty/Alamofire/DataRequest+ResponseSwiftyJSON.swift similarity index 90% rename from Alamofire-SwiftyJSON.swift rename to Stepic/Sources/Extensions/ThirdParty/Alamofire/DataRequest+ResponseSwiftyJSON.swift index 19768d44ad..7623fd1dd6 100644 --- a/Alamofire-SwiftyJSON.swift +++ b/Stepic/Sources/Extensions/ThirdParty/Alamofire/DataRequest+ResponseSwiftyJSON.swift @@ -2,12 +2,10 @@ import Alamofire import Foundation import SwiftyJSON -// MARK: SwiftyJSON Response Serializer - - -public final class SwiftyJSONResponseSerializer: ResponseSerializer { +final class SwiftyJSONResponseSerializer: ResponseSerializer { private let jsonResponseSerializer: JSONResponseSerializer - public init( + init( dataPreprocessor: DataPreprocessor = JSONResponseSerializer.defaultDataPreprocessor, emptyResponseCodes: Set = JSONResponseSerializer.defaultEmptyResponseCodes, emptyRequestMethods: Set = JSONResponseSerializer.defaultEmptyRequestMethods, @@ -21,7 +19,7 @@ public final class SwiftyJSONResponseSerializer: ResponseSerializer { ) } - public func serialize( + func serialize( request: URLRequest?, response: HTTPURLResponse?, data: Data?, @@ -49,7 +47,7 @@ extension DataRequest { /// /// - returns: The request. @discardableResult - public func responseSwiftyJSON( + func responseSwiftyJSON( queue: DispatchQueue = .main, options: JSONSerialization.ReadingOptions = .allowFragments, _ completionHandler: @escaping (AFDataResponse) -> Void diff --git a/Stepic/Sources/Frameworks/Notifications/Registration/NotificationsRegistrationService.swift b/Stepic/Sources/Frameworks/Notifications/Registration/NotificationsRegistrationService.swift index 3cecdbaa3a..141ffdd84b 100644 --- a/Stepic/Sources/Frameworks/Notifications/Registration/NotificationsRegistrationService.swift +++ b/Stepic/Sources/Frameworks/Notifications/Registration/NotificationsRegistrationService.swift @@ -285,7 +285,7 @@ final class NotificationsRegistrationService: NotificationsRegistrationServicePr let queuePersistenceManager = PersistentQueueRecoveryManager(baseName: "Queues") queuePersistenceManager.writeQueue( ExecutionQueues.sharedQueues.connectionAvailableExecutionQueue, - key: ExecutionQueues.sharedQueues.connectionAvailableExecutionQueueKey + key: ExecutionQueues.connectionAvailableExecutionQueueKey ) } else { print( diff --git a/JSQWebViewController.swift b/Stepic/Sources/Frameworks/ThirdParty/JSQWebViewController.swift similarity index 93% rename from JSQWebViewController.swift rename to Stepic/Sources/Frameworks/ThirdParty/JSQWebViewController.swift index a462e62219..f2a43d4b6b 100644 --- a/JSQWebViewController.swift +++ b/Stepic/Sources/Frameworks/ThirdParty/JSQWebViewController.swift @@ -1,3 +1,4 @@ +// swiftlint:disable all // // Created by Jesse Squires // http://www.jessesquires.com @@ -25,7 +26,6 @@ private let EstimatedProgressKeyPath = "estimatedProgress" /// An instance of `WebViewController` displays interactive web content. class WebViewController: UIViewController { - // MARK: Properties var allowsToOpenInSafari = true @@ -50,14 +50,14 @@ class WebViewController: UIViewController { Specifies whether or not to display the web view title as the navigation bar title. The default is `false`, which sets the navigation bar title to the URL host name of the URL request. */ - final var displaysWebViewTitle: Bool = false + final var displaysWebViewTitle = false // MARK: Private properties fileprivate lazy final var _webView: WKWebView = { [unowned self] in // FIXME: prevent Swift bug, lazy property initialized twice from `init(coder:)` // return existing webView if webView already added - let views = self.view.subviews.filter {$0 is WKWebView } as! [WKWebView] + let views = self.view.subviews.filter { $0 is WKWebView } as! [WKWebView] if views.count != 0 { return views.first! } @@ -70,7 +70,7 @@ class WebViewController: UIViewController { webView.allowsLinkPreview = true webView.customUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Mobile/12A4345d Safari/600.1.4" return webView - }() + }() fileprivate lazy final var _progressBar: UIProgressView = { [unowned self] in let progressBar = UIProgressView(progressViewStyle: .bar) @@ -78,7 +78,7 @@ class WebViewController: UIViewController { progressBar.trackTintColor = UIColor.clear self.view.addSubview(progressBar) return progressBar - }() + }() fileprivate final let configuration: WKWebViewConfiguration @@ -88,14 +88,18 @@ class WebViewController: UIViewController { /** Constructs a new `WebViewController`. - + - parameter urlRequest: The URL request for the web view to load. - parameter configuration: The configuration for the web view. - parameter activities: The custom activities to display in the `UIActivityViewController` that is presented when the action button is tapped. - + - returns: A new `WebViewController` instance. */ - init(urlRequest: URLRequest, configuration: WKWebViewConfiguration = WKWebViewConfiguration(), activities: [UIActivity]? = nil) { + init( + urlRequest: URLRequest, + configuration: WKWebViewConfiguration = WKWebViewConfiguration(), + activities: [UIActivity]? = nil + ) { self.configuration = configuration self.urlRequest = urlRequest self.activities = activities @@ -213,7 +217,12 @@ class WebViewController: UIViewController { // MARK: KVO /// :nodoc: - override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { + override func observeValue( + forKeyPath keyPath: String?, + of object: Any?, + change: [NSKeyValueChangeKey: Any]?, + context: UnsafeMutableRawPointer? + ) { guard let theKeyPath = keyPath, object as? WKWebView == webView else { super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context) return @@ -235,5 +244,4 @@ class WebViewController: UIViewController { progressBar.setProgress(completed ? 0.0 : Float(webView.estimatedProgress), animated: !completed) UIApplication.shared.isNetworkActivityIndicatorVisible = !completed } - } diff --git a/PagerController.swift b/Stepic/Sources/Frameworks/ThirdParty/PagerController.swift similarity index 96% rename from PagerController.swift rename to Stepic/Sources/Frameworks/ThirdParty/PagerController.swift index 687e6711a7..e7bee83395 100644 --- a/PagerController.swift +++ b/Stepic/Sources/Frameworks/ThirdParty/PagerController.swift @@ -1,3 +1,4 @@ +// swiftlint:disable all // // ViewPager.swift // Pager @@ -6,8 +7,8 @@ // Copyright (c) 2015 Cheesecake. All rights reserved. // import Foundation -import UIKit.UITableView import SnapKit +import UIKit.UITableView // MARK: - Pager Enums //Enum for the location of the tab bar @@ -39,12 +40,11 @@ public enum PagerAnimation: Int { } open class PagerController: UIViewController, UIPageViewControllerDataSource, UIPageViewControllerDelegate, UIScrollViewDelegate { - // MARK: - public properties - open var contentViewBackgroundColor: UIColor = UIColor.white - open var indicatorColor: UIColor = UIColor.red - open var tabsViewBackgroundColor: UIColor = UIColor.gray - open var tabsTextColor: UIColor = UIColor.white + open var contentViewBackgroundColor = UIColor.white + open var indicatorColor = UIColor.red + open var tabsViewBackgroundColor = UIColor.gray + open var tabsTextColor = UIColor.white open var selectedTabTextColor = UIColor.white open var tabsImageViewContentMode = UIView.ContentMode.scaleAspectFit open weak var dataSource: PagerDataSource? @@ -53,22 +53,22 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI open var tabTopOffset: CGFloat = 0.0 open var tabOffset: CGFloat = 56.0 open var tabWidth: CGFloat = 128.0 - open var tabsTextFont: UIFont = UIFont.boldSystemFont(ofSize: 16.0) + open var tabsTextFont = UIFont.boldSystemFont(ofSize: 16.0) open var indicatorHeight: CGFloat = 5.0 - open var tabLocation: PagerTabLocation = PagerTabLocation.top - open var animation: PagerAnimation = PagerAnimation.during + open var tabLocation = PagerTabLocation.top + open var animation = PagerAnimation.during open var startTabIndex: Int = 0 - open var centerCurrentTab: Bool = false - open var fixFormerTabsPositions: Bool = false - open var fixLaterTabsPosition: Bool = false - open var ignoreTopBarHeight: Bool = false - open var ignoreBottomBarHeight: Bool = false + open var centerCurrentTab = false + open var fixFormerTabsPositions = false + open var fixLaterTabsPosition = false + open var ignoreTopBarHeight = false + open var ignoreBottomBarHeight = false fileprivate var tabViews: [UIView] = [] fileprivate var tabControllers: [UIViewController] = [] // MARK: - Tab and content stuff internal var tabsView: UIScrollView? - open var pageViewController: UIPageViewController = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal, options: nil) + open var pageViewController = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal, options: nil) internal weak var actualDelegate: UIScrollViewDelegate? internal var contentView: UIView { let contentView = self.pageViewController.view @@ -80,15 +80,15 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI } // MARK: - Tab and content cache - internal var underlineStroke: UIView = UIView() + internal var underlineStroke = UIView() internal var tabs: [UIView?] = [] internal var contents: [UIViewController?] = [] internal var tabCount: Int = 0 internal var activeTabIndex: Int = 0 internal var activeContentIndex: Int = 0 - internal var animatingToTab: Bool = false - internal var defaultSetupDone: Bool = false - internal var didTapOnTabView: Bool = false + internal var animatingToTab = false + internal var defaultSetupDone = false + internal var didTapOnTabView = false // MARK: - Important Methods // Initializing PagerController with Name of the Tabs and their respective ViewControllers @@ -146,7 +146,7 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI super.viewWillLayoutSubviews() } - open override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { + override open func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { super.viewWillTransition(to: size, with: coordinator) self.changeActiveTabIndex(self.activeTabIndex) } @@ -201,7 +201,6 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI // Add tabsView if self.tabsView == nil { - self.tabsView = UIScrollView(frame: CGRect(x: 0.0, y: 0.0, width: self.view.frame.width, height: self.tabHeight)) self.tabsView?.autoresizingMask = .flexibleWidth self.tabsView?.backgroundColor = self.tabsViewBackgroundColor @@ -347,7 +346,6 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI } func updateSelectedTab(_ index: Int) { - let selectedTab = self.tabViewAtIndex(index) // Resetting all tab colors to white @@ -361,7 +359,6 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI tab?.alpha = 0.566 // } } - } // Setting current selected tab to red @@ -374,7 +371,6 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI } func changeActiveTabIndex(_ newIndex: Int) { - if newIndex == self.activeTabIndex { return } @@ -389,20 +385,16 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI var frame: CGRect = tabView.frame if self.centerCurrentTab { - if (frame.origin.x + frame.width + (tabsView.frame.width / 2)) >= tabsView.contentSize.width { frame.origin.x = (tabsView.contentSize.width - tabsView.frame.width) } else { - frame.origin.x += (frame.width / 2) frame.origin.x -= (tabsView.frame.width / 2) if frame.origin.x < 0 { frame.origin.x = 0 } - } - } else { frame.origin.x -= self.tabOffset frame.size.width = tabsView.frame.width @@ -422,7 +414,6 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI } if (self.tabs[index] as UIView?) == nil { - var tabViewContent = UIView() if let tab = dataSource.tabViewForIndex?(index, pager: self) { tabViewContent = tab @@ -431,7 +422,7 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI } tabViewContent.autoresizingMask = [.flexibleHeight, .flexibleWidth] - let tabView: TabView = TabView(frame: CGRect(x: 0.0, y: 0.0, width: self.tabWidth, height: self.tabHeight)) + let tabView = TabView(frame: CGRect(x: 0.0, y: 0.0, width: self.tabWidth, height: self.tabHeight)) tabView.addSubview(tabViewContent) tabView.clipsToBounds = true tabViewContent.center = tabView.center @@ -474,7 +465,6 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI // Extend contentSizeWidth if fixLatterTabsPositions is provided YES if self.fixLaterTabsPosition { - // And if the centerCurrentTab is provided as YES fine tune the content size according to it if self.centerCurrentTab { contentSizeWidth += (tabsView.frame.width - self.tabWidth) / 2.0 @@ -575,7 +565,6 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI }) } } else if !(activeContentIndex + 1 == self.activeContentIndex || activeContentIndex - 1 == self.activeContentIndex) { - let direction: UIPageViewController.NavigationDirection = (activeContentIndex < self.activeContentIndex) ? .reverse : .forward DispatchQueue.main.async { self.pageViewController.setViewControllers([vc], direction: direction, animated: true, completion: { @@ -632,14 +621,12 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI } if !self.animatingToTab { - // Get the related tab view position var frame: CGRect = tabView.frame let movedRatio: CGFloat = (scrollView.contentOffset.x / scrollView.frame.width) - 1 frame.origin.x += movedRatio * frame.width if self.centerCurrentTab { - frame.origin.x += (frame.size.width / 2) frame.origin.x -= tabsView.frame.width / 2 frame.size.width = tabsView.frame.width @@ -652,7 +639,6 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI frame.origin.x = (tabsView.contentSize.width - tabsView.frame.width) } } else { - frame.origin.x -= self.tabOffset frame.size.width = tabsView.frame.width } @@ -801,7 +787,6 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI // MARK: - TabView class TabView: UIView { - override init(frame: CGRect) { super.init(frame: frame) self.backgroundColor = UIColor.clear diff --git a/Stepic/Sources/Modules/CourseInfo/Views/CourseInfoHeaderView.swift b/Stepic/Sources/Modules/CourseInfo/Views/CourseInfoHeaderView.swift index 0fab7e05f1..e7e53feca0 100644 --- a/Stepic/Sources/Modules/CourseInfo/Views/CourseInfoHeaderView.swift +++ b/Stepic/Sources/Modules/CourseInfo/Views/CourseInfoHeaderView.swift @@ -37,7 +37,7 @@ extension CourseInfoHeaderView { final class CourseInfoHeaderView: UIView { let appearance: Appearance - private let splitTestingService = SplitTestingService( + private let splitTestingService: SplitTestingServiceProtocol = SplitTestingService( analyticsService: AnalyticsUserProperties(), storage: UserDefaults.standard ) diff --git a/Stepic/Sources/Modules/Step/StepAssembly.swift b/Stepic/Sources/Modules/Step/StepAssembly.swift index d9e5f726b4..2bb8b879f9 100644 --- a/Stepic/Sources/Modules/Step/StepAssembly.swift +++ b/Stepic/Sources/Modules/Step/StepAssembly.swift @@ -33,7 +33,10 @@ final class StepAssembly: Assembly { analytics: StepikAnalytics.shared, remoteConfig: RemoteConfig.shared ) - let viewController = StepViewController(interactor: interactor) + let viewController = StepViewController( + interactor: interactor, + networkReachabilityService: NetworkReachabilityService() + ) presenter.viewController = viewController self.moduleInput = interactor diff --git a/Stepic/Sources/Modules/Step/StepViewController.swift b/Stepic/Sources/Modules/Step/StepViewController.swift index 0c9cde39c2..8930dd8874 100644 --- a/Stepic/Sources/Modules/Step/StepViewController.swift +++ b/Stepic/Sources/Modules/Step/StepViewController.swift @@ -37,6 +37,7 @@ final class StepViewController: UIViewController, ControllerWithStepikPlaceholde var placeholderContainer = StepikPlaceholderControllerContainer() private let interactor: StepInteractorProtocol + private let networkReachabilityService: NetworkReachabilityServiceProtocol private var state: StepDataFlow.ViewControllerState { didSet { @@ -57,9 +58,14 @@ final class StepViewController: UIViewController, ControllerWithStepikPlaceholde private var arQuickLookPreviewDataSource: StepARQuickLookPreviewDataSource? - init(interactor: StepInteractorProtocol) { + init( + interactor: StepInteractorProtocol, + networkReachabilityService: NetworkReachabilityServiceProtocol, + initialState: StepDataFlow.ViewControllerState = .loading + ) { self.interactor = interactor - self.state = .loading + self.networkReachabilityService = networkReachabilityService + self.state = initialState super.init(nibName: nil, bundle: nil) } @@ -497,8 +503,7 @@ extension StepViewController: StepViewDelegate { return } - let isVideoPlayingReachable = ConnectionHelper.shared.reachability.isReachableViaWiFi() - || ConnectionHelper.shared.reachability.isReachableViaWWAN() + let isVideoPlayingReachable = self.networkReachabilityService.isReachable let isVideoCached = video.state == .cached if !isVideoCached && !isVideoPlayingReachable { diff --git a/Stepic/Sources/Services/PersistenceQueuesService.swift b/Stepic/Sources/Services/PersistenceQueuesService.swift index b0cd351c03..fae84032c4 100644 --- a/Stepic/Sources/Services/PersistenceQueuesService.swift +++ b/Stepic/Sources/Services/PersistenceQueuesService.swift @@ -24,7 +24,7 @@ final class PersistenceQueuesService: PersistenceQueuesServiceProtocol { queuePersistencyManager.writeQueue( ExecutionQueues.sharedQueues.connectionAvailableExecutionQueue, - key: ExecutionQueues.sharedQueues.connectionAvailableExecutionQueueKey + key: ExecutionQueues.connectionAvailableExecutionQueueKey ) } } diff --git a/Stepic/Sources/Services/PersonalOffersService.swift b/Stepic/Sources/Services/PersonalOffersService.swift index 70f292064e..2a86be48a7 100644 --- a/Stepic/Sources/Services/PersonalOffersService.swift +++ b/Stepic/Sources/Services/PersonalOffersService.swift @@ -42,8 +42,4 @@ final class PersonalOffersService: PersonalOffersServiceProtocol { .fetchWithSortingByUpdateDateDesc(userID: userID, kindPrefixType: .personalOffers) .map { $0.0 } } - - enum Error: Swift.Error { - case fetchFailed - } } diff --git a/Stepic/Stepic-Bridging-Header.h b/Stepic/Stepic-Bridging-Header.h index 43a49a0abb..416f15b764 100644 --- a/Stepic/Stepic-Bridging-Header.h +++ b/Stepic/Stepic-Bridging-Header.h @@ -4,8 +4,5 @@ #import #import -#import "Reachability.h" - -#import #import "WKWebViewPanelManager.h" diff --git a/Stepic/en.lproj/Localizable.strings b/Stepic/en.lproj/Localizable.strings index 4db21cf19c..b53c4b5b9e 100644 --- a/Stepic/en.lproj/Localizable.strings +++ b/Stepic/en.lproj/Localizable.strings @@ -21,11 +21,6 @@ Copy = "Copy"; Reload = "Reload"; ConnectionErrorTitle = "Connection error"; ConnectionErrorSubtitle = "Enable internet connection and retry"; -DownloadReachabilityErrorTitle = "Only Wi-Fi download enabled"; -SomethingWrongTitle = "Ooops"; -SomethingWrongSubtitle = "Something just got wrong"; -ReloginTitle = "Authorization problems"; -ReloginSubtitle = "Log in, please"; Studying = "Studying"; JoinCourse = "Join course"; FailedToRemoveMessage = "Failed to remove"; @@ -54,8 +49,6 @@ Format = "Format"; Requirements = "Requirements"; Video = "Video"; Videos = "videos"; -ConnectionLost = "Connection lost"; -CancelledDownload = "Cancelled downloading"; UnenrollAlertTitle = "Stop studying"; UnenrollAlertMessage = "Don't you want to study on this course?"; Unenroll = "Stop studying"; diff --git a/Stepic/ru.lproj/Localizable.strings b/Stepic/ru.lproj/Localizable.strings index 98f3ca31d6..5b0b11ebb0 100644 --- a/Stepic/ru.lproj/Localizable.strings +++ b/Stepic/ru.lproj/Localizable.strings @@ -21,11 +21,6 @@ Copy = "Скопировать"; Reload = "Обновить"; ConnectionErrorTitle = "Ошибка соединения"; ConnectionErrorSubtitle = "Подключитесь к интернету и повторите попытку"; -DownloadReachabilityErrorTitle = "Разрешена только загрузка по Wi-Fi"; -SomethingWrongTitle = "Упс"; -SomethingWrongSubtitle = "Что-то пошло не так"; -ReloginTitle = "Ошибка авторизации"; -ReloginSubtitle = "Войдите, пожалуйста"; Studying = "Записан на курс"; JoinCourse = "Поступить на курс"; FailedToRemoveMessage = "Ошибка при удалении"; @@ -54,8 +49,6 @@ Format = "Формат курса"; Requirements = "Требования"; Video = "Видео"; Videos = "видео"; -ConnectionLost = "Соединение потеряно"; -CancelledDownload = "Прекращена загрузка"; UnenrollAlertTitle = "Прекратить обучение"; UnenrollAlertMessage = "Вы действительно хотите перестать учиться на этом курсе?"; Unenroll = "Прекратить обучение"; diff --git a/StepicTests/Info-Develop.plist b/StepicTests/Info-Develop.plist index 2ef3ef6d0b..a01a0d3a08 100644 --- a/StepicTests/Info-Develop.plist +++ b/StepicTests/Info-Develop.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.185-develop + 1.186-develop CFBundleSignature ???? CFBundleVersion - 358 + 359 diff --git a/StepicTests/Info-Production.plist b/StepicTests/Info-Production.plist index 05e8a95820..85b7c39f4b 100644 --- a/StepicTests/Info-Production.plist +++ b/StepicTests/Info-Production.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.185 + 1.186 CFBundleSignature ???? CFBundleVersion - 358 + 359 diff --git a/StepicTests/Info-Release.plist b/StepicTests/Info-Release.plist index 3695d76af6..8a651af0d1 100644 --- a/StepicTests/Info-Release.plist +++ b/StepicTests/Info-Release.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.185-release + 1.186-release CFBundleSignature ???? CFBundleVersion - 358 + 359 diff --git a/StepicUITests/Info-Develop.plist b/StepicUITests/Info-Develop.plist index db3c140810..609f27a2fb 100644 --- a/StepicUITests/Info-Develop.plist +++ b/StepicUITests/Info-Develop.plist @@ -15,8 +15,8 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 1.185-develop + 1.186-develop CFBundleVersion - 358 + 359 diff --git a/StepicUITests/Info-Production.plist b/StepicUITests/Info-Production.plist index 4182f22b6f..e0dbbe4c24 100644 --- a/StepicUITests/Info-Production.plist +++ b/StepicUITests/Info-Production.plist @@ -15,8 +15,8 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 1.185 + 1.186 CFBundleVersion - 358 + 359 diff --git a/StepicUITests/Info-Release.plist b/StepicUITests/Info-Release.plist index 746c172418..150f505012 100644 --- a/StepicUITests/Info-Release.plist +++ b/StepicUITests/Info-Release.plist @@ -15,8 +15,8 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 1.185-release + 1.186-release CFBundleVersion - 358 + 359 diff --git a/StepicWidget/Info-Develop.plist b/StepicWidget/Info-Develop.plist index dd5f00f2e6..3cd5647696 100644 --- a/StepicWidget/Info-Develop.plist +++ b/StepicWidget/Info-Develop.plist @@ -17,9 +17,9 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 1.185-develop + 1.186-develop CFBundleVersion - 358 + 359 NSExtension NSExtensionPointIdentifier diff --git a/StepicWidget/Info-Production.plist b/StepicWidget/Info-Production.plist index 92bbbe388c..5237334ef2 100644 --- a/StepicWidget/Info-Production.plist +++ b/StepicWidget/Info-Production.plist @@ -17,9 +17,9 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 1.185 + 1.186 CFBundleVersion - 358 + 359 NSExtension NSExtensionPointIdentifier diff --git a/StepicWidget/Info-Release.plist b/StepicWidget/Info-Release.plist index a741061710..05e24bb462 100644 --- a/StepicWidget/Info-Release.plist +++ b/StepicWidget/Info-Release.plist @@ -17,9 +17,9 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 1.185-release + 1.186-release CFBundleVersion - 358 + 359 NSExtension NSExtensionPointIdentifier diff --git a/StickerPackExtension/Info-Develop.plist b/StickerPackExtension/Info-Develop.plist index 8aebdf0e76..46cca96a5d 100644 --- a/StickerPackExtension/Info-Develop.plist +++ b/StickerPackExtension/Info-Develop.plist @@ -17,9 +17,9 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 1.185-develop + 1.186-develop CFBundleVersion - 358 + 359 NSExtension NSExtensionPointIdentifier diff --git a/StickerPackExtension/Info-Production.plist b/StickerPackExtension/Info-Production.plist index 8c533e4a7f..c3f6a4afe4 100644 --- a/StickerPackExtension/Info-Production.plist +++ b/StickerPackExtension/Info-Production.plist @@ -17,9 +17,9 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 1.185 + 1.186 CFBundleVersion - 358 + 359 NSExtension NSExtensionPointIdentifier diff --git a/StickerPackExtension/Info-Release.plist b/StickerPackExtension/Info-Release.plist index c230461f11..687acdd5b6 100644 --- a/StickerPackExtension/Info-Release.plist +++ b/StickerPackExtension/Info-Release.plist @@ -17,9 +17,9 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 1.185-release + 1.186-release CFBundleVersion - 358 + 359 NSExtension NSExtensionPointIdentifier