Skip to content

Commit

Permalink
updated libs
Browse files Browse the repository at this point in the history
  • Loading branch information
khoren93 committed Jun 19, 2021
1 parent 83e9ec6 commit e330844
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 61 deletions.
7 changes: 4 additions & 3 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ disabled_rules: # rule identifiers to exclude from running
- missing_docs
- unused_closure_parameter
- cyclomatic_complexity
- inclusive_language

opt_in_rules: # some rules are only opt-in
- empty_count
Expand Down Expand Up @@ -50,9 +51,9 @@ file_length:
warning: 1000
error: 2000

cyclomatic_complexity:
- 15 # warning
- 30 # error
#cyclomatic_complexity:
# - 15 # warning
# - 30 # error

# naming rules can set warnings/errors for min_length and max_length
# additionally they can set excluded names
Expand Down
10 changes: 5 additions & 5 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ target 'SwiftHub' do

# Networking
pod 'Moya/RxSwift' # https://github.com/Moya/Moya
pod 'Apollo', '0.42.0' # https://github.com/apollographql/apollo-ios
pod 'Apollo', '0.44.0' # https://github.com/apollographql/apollo-ios

# Rx Extensions
pod 'RxDataSources', '~> 4.0' # https://github.com/RxSwiftCommunity/RxDataSources
Expand All @@ -32,13 +32,13 @@ target 'SwiftHub' do

# Tools
pod 'R.swift', '~> 5.0' # https://github.com/mac-cain13/R.swift
pod 'SwiftLint', '0.43.0' # https://github.com/realm/SwiftLint
pod 'SwiftLint', '0.43.1' # https://github.com/realm/SwiftLint

# Keychain
pod 'KeychainAccess', '~> 4.0' # https://github.com/kishikawakatsumi/KeychainAccess

# UI
pod 'NVActivityIndicatorView', '~> 4.0' # https://github.com/ninjaprox/NVActivityIndicatorView
pod 'SVProgressHUD', '~> 2.0' # https://github.com/SVProgressHUD/SVProgressHUD
pod 'ImageSlideshow/Kingfisher', '~> 1.8' # https://github.com/zvonicek/ImageSlideshow
pod 'DZNEmptyDataSet', '~> 1.0' # https://github.com/dzenbot/DZNEmptyDataSet
pod 'Hero', '~> 1.6' # https://github.com/lkzhao/Hero
Expand All @@ -51,7 +51,7 @@ target 'SwiftHub' do
pod 'DropDown', '~> 2.0' # https://github.com/AssistoLab/DropDown
pod 'Toast-Swift', '~> 5.0' # https://github.com/scalessec/Toast-Swift
pod 'HMSegmentedControl', '~> 1.0' # https://github.com/HeshamMegid/HMSegmentedControl
pod 'FloatingPanel', '~> 1.0' # https://github.com/SCENEE/FloatingPanel
pod 'FloatingPanel', '~> 2.0' # https://github.com/SCENEE/FloatingPanel
pod 'MessageKit', '~> 3.0' # https://github.com/MessageKit/MessageKit
pod 'MultiProgressView', '~> 1.0' # https://github.com/mac-gallagher/MultiProgressView
pod 'Charts', '~> 3.0' # https://github.com/danielgindi/Charts
Expand Down Expand Up @@ -79,7 +79,7 @@ target 'SwiftHub' do
target 'SwiftHubTests' do
inherit! :search_paths
# Pods for testing
pod 'Quick', '~> 3.0' # https://github.com/Quick/Quick
pod 'Quick', '~> 4.0' # https://github.com/Quick/Quick
pod 'Nimble', '~> 9.0' # https://github.com/Quick/Nimble
pod 'RxAtomic', :modular_headers => true
pod 'RxBlocking' # https://github.com/ReactiveX/RxSwift
Expand Down
38 changes: 20 additions & 18 deletions SwiftHub.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@
07FDBC0B223D090C00D72AFC /* Repository.graphql in Resources */ = {isa = PBXBuildFile; fileRef = 07FDBC0A223D090C00D72AFC /* Repository.graphql */; };
10FF001614268611DEEC3698 /* Pods_SwiftHub.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E6D5D7DF286987ECF4F8FDD /* Pods_SwiftHub.framework */; };
21C12854A33FB761C193427F /* Pods_SwiftHubUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7DCB88A802BEA0D429184566 /* Pods_SwiftHubUITests.framework */; };
A003B32A25A318360061EB1B /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = A003B32925A318360061EB1B /* FirebaseAnalytics */; };
A003B32C25A318360061EB1B /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = A003B32B25A318360061EB1B /* FirebaseCrashlytics */; };
A003B32A25A318360061EB1B /* BuildFile in Frameworks */ = {isa = PBXBuildFile; productRef = A003B32925A318360061EB1B /* SwiftPackageProductDependency */; };
A003B32C25A318360061EB1B /* BuildFile in Frameworks */ = {isa = PBXBuildFile; productRef = A003B32B25A318360061EB1B /* SwiftPackageProductDependency */; };
A00871CF21A6E2BD006E5A2B /* Comment.swift in Sources */ = {isa = PBXBuildFile; fileRef = A00871CE21A6E2BD006E5A2B /* Comment.swift */; };
A00C54C920E25B5A00DA5F98 /* StackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A00C54C820E25B5A00DA5F98 /* StackView.swift */; };
A017B3DB1E92995300E4FCED /* SplitViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A017B3DA1E92995300E4FCED /* SplitViewController.swift */; };
Expand Down Expand Up @@ -610,8 +610,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A003B32C25A318360061EB1B /* FirebaseCrashlytics in Frameworks */,
A003B32A25A318360061EB1B /* FirebaseAnalytics in Frameworks */,
A003B32C25A318360061EB1B /* BuildFile in Frameworks */,
A003B32A25A318360061EB1B /* BuildFile in Frameworks */,
10FF001614268611DEEC3698 /* Pods_SwiftHub.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -1459,8 +1459,8 @@
);
name = SwiftHub;
packageProductDependencies = (
A003B32925A318360061EB1B /* FirebaseAnalytics */,
A003B32B25A318360061EB1B /* FirebaseCrashlytics */,
A003B32925A318360061EB1B /* SwiftPackageProductDependency */,
A003B32B25A318360061EB1B /* SwiftPackageProductDependency */,
);
productName = SwiftHub;
productReference = A09499521E1D1CB600EFDE29 /* SwiftHub.app */;
Expand Down Expand Up @@ -1512,7 +1512,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0820;
LastUpgradeCheck = 0940;
LastUpgradeCheck = 1250;
ORGANIZATIONNAME = "Khoren Markosyan";
TargetAttributes = {
A09499511E1D1CB600EFDE29 = {
Expand Down Expand Up @@ -1550,7 +1550,7 @@
);
mainGroup = A09499491E1D1CB500EFDE29;
packageReferences = (
A003B32825A318360061EB1B /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
A003B32825A318360061EB1B /* RemoteSwiftPackageReference */,
);
productRefGroup = A09499531E1D1CB600EFDE29 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -1716,7 +1716,6 @@
"${BUILT_PRODUCTS_DIR}/Moya-ObjectMapper/Moya_ObjectMapper.framework",
"${BUILT_PRODUCTS_DIR}/MultiProgressView/MultiProgressView.framework",
"${BUILT_PRODUCTS_DIR}/NSObject+Rx/NSObject_Rx.framework",
"${BUILT_PRODUCTS_DIR}/NVActivityIndicatorView/NVActivityIndicatorView.framework",
"${BUILT_PRODUCTS_DIR}/ObjectMapper/ObjectMapper.framework",
"${BUILT_PRODUCTS_DIR}/PromisesObjC/FBLPromises.framework",
"${BUILT_PRODUCTS_DIR}/R.swift.Library/Rswift.framework",
Expand All @@ -1730,6 +1729,7 @@
"${BUILT_PRODUCTS_DIR}/RxSwiftExt/RxSwiftExt.framework",
"${BUILT_PRODUCTS_DIR}/RxTheme/RxTheme.framework",
"${BUILT_PRODUCTS_DIR}/RxViewController/RxViewController.framework",
"${BUILT_PRODUCTS_DIR}/SVProgressHUD/SVProgressHUD.framework",
"${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework",
"${BUILT_PRODUCTS_DIR}/SwiftDate/SwiftDate.framework",
"${BUILT_PRODUCTS_DIR}/SwifterSwift/SwifterSwift.framework",
Expand Down Expand Up @@ -1768,7 +1768,6 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Moya_ObjectMapper.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MultiProgressView.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NSObject_Rx.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NVActivityIndicatorView.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ObjectMapper.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBLPromises.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Rswift.framework",
Expand All @@ -1782,6 +1781,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwiftExt.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxTheme.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxViewController.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SVProgressHUD.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftDate.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwifterSwift.framework",
Expand Down Expand Up @@ -1849,7 +1849,7 @@
);
name = R.swift;
outputPaths = (
$SRCROOT/SwiftHub/Resources/R.generated.swift,
"$SRCROOT/SwiftHub/Resources/R.generated.swift",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -2213,6 +2213,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -2237,7 +2238,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -2273,6 +2274,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -2291,7 +2293,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
Expand Down Expand Up @@ -2457,7 +2459,7 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
A003B32825A318360061EB1B /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = {
A003B32825A318360061EB1B /* RemoteSwiftPackageReference */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/firebase/firebase-ios-sdk.git";
requirement = {
Expand All @@ -2468,14 +2470,14 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
A003B32925A318360061EB1B /* FirebaseAnalytics */ = {
A003B32925A318360061EB1B /* SwiftPackageProductDependency */ = {
isa = XCSwiftPackageProductDependency;
package = A003B32825A318360061EB1B /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
package = A003B32825A318360061EB1B /* RemoteSwiftPackageReference */;
productName = FirebaseAnalytics;
};
A003B32B25A318360061EB1B /* FirebaseCrashlytics */ = {
A003B32B25A318360061EB1B /* SwiftPackageProductDependency */ = {
isa = XCSwiftPackageProductDependency;
package = A003B32825A318360061EB1B /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
package = A003B32825A318360061EB1B /* RemoteSwiftPackageReference */;
productName = FirebaseCrashlytics;
};
/* End XCSwiftPackageProductDependency section */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1140"
LastUpgradeVersion = "1250"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1140"
LastUpgradeVersion = "1250"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1140"
LastUpgradeVersion = "1250"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion SwiftHub/Application/Navigator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class Navigator {
}

if let nav = sender as? UINavigationController {
//push root controller on navigation stack
// push root controller on navigation stack
nav.pushViewController(target, animated: false)
return
}
Expand Down
2 changes: 1 addition & 1 deletion SwiftHub/Common/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ChatViewController: MessagesViewController {
messagesCollectionView.messagesLayoutDelegate = self
messagesCollectionView.messagesDisplayDelegate = self

scrollsToBottomOnKeyboardBeginsEditing = true
scrollsToLastItemOnKeyboardBeginsEditing = true
maintainPositionOnKeyboardFrameChanged = true

themeService.rx
Expand Down
14 changes: 11 additions & 3 deletions SwiftHub/Common/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import UIKit
import RxSwift
import RxCocoa
import DZNEmptyDataSet
import NVActivityIndicatorView
import Hero
import Localize_Swift
import GoogleMobileAds
import SVProgressHUD

class ViewController: UIViewController, Navigatable, NVActivityIndicatorViewable {
class ViewController: UIViewController, Navigatable {

var viewModel: ViewModel?
var navigator: Navigator!
Expand Down Expand Up @@ -75,7 +75,7 @@ class ViewController: UIViewController, Navigatable, NVActivityIndicatorViewable
}()

lazy var bannerView: GADBannerView = {
let view = GADBannerView(adSize: kGADAdSizeSmartBannerPortrait)
let view = GADBannerView(adSize: GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(view.width))
view.rootViewController = self
view.adUnitID = Keys.adMob.apiKey
view.hero.id = "BannerView"
Expand Down Expand Up @@ -226,6 +226,14 @@ class ViewController: UIViewController, Navigatable, NVActivityIndicatorViewable

}

func startAnimating() {
SVProgressHUD.show()
}

func stopAnimating() {
SVProgressHUD.dismiss()
}

override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
if motion == .motionShake {
motionShakeEvent.onNext(())
Expand Down
2 changes: 1 addition & 1 deletion SwiftHub/Extensions/Foundation/Foundation+SwiftHub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extension Int {
return "\(sign)\(self)"
}
let num = fabs(self.double)
let exp: Int = Int(log10(num) / 3.0 ) //log10(1000))
let exp: Int = Int(log10(num) / 3.0 )
let units: [String] = ["K", "M", "G", "T", "P", "E"]
let roundedNum: Double = round(10 * num / pow(1000.0, Double(exp))) / 10
return "\(sign)\(roundedNum)\(units[exp-1])"
Expand Down
7 changes: 0 additions & 7 deletions SwiftHub/Managers/LibsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import Kingfisher
import FLEX
#endif
import FirebaseCrashlytics
import NVActivityIndicatorView
import NSObject_Rx
import RxViewController
import RxOptional
Expand Down Expand Up @@ -63,7 +62,6 @@ class LibsManager: NSObject {
libsManager.setupKafkaRefresh()
libsManager.setupFLEX()
libsManager.setupKeyboardManager()
libsManager.setupActivityView()
libsManager.setupDropDown()
libsManager.setupToast()
}
Expand Down Expand Up @@ -104,11 +102,6 @@ class LibsManager: NSObject {
}
}

func setupActivityView() {
NVActivityIndicatorView.DEFAULT_TYPE = .ballRotateChase
NVActivityIndicatorView.DEFAULT_COLOR = .secondary()
}

func setupKeyboardManager() {
IQKeyboardManager.shared.enable = true
}
Expand Down
24 changes: 13 additions & 11 deletions SwiftHub/Modules/Login/LoginViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import RxCocoa
import RxSwift
import RxSwiftExt
import SafariServices
import AuthenticationServices

private let loginURL = URL(string: "http://github.com/login/oauth/authorize?client_id=\(Keys.github.appId)&scope=\(Configs.App.githubScope)")!
private let callbackURLScheme = "swifthub"
Expand Down Expand Up @@ -41,16 +42,7 @@ class LoginViewModel: ViewModel, ViewModelType {

var tokenSaved = PublishSubject<Void>()

private var _authSession: Any?

private var authSession: SFAuthenticationSession? {
get {
return _authSession as? SFAuthenticationSession
}
set {
_authSession = newValue
}
}
private var authSession: ASWebAuthenticationSession?

func transform(input: Input) -> Output {

Expand All @@ -71,14 +63,17 @@ class LoginViewModel: ViewModel, ViewModelType {
}).disposed(by: rx.disposeBag)

input.oAuthLoginTrigger.drive(onNext: { [weak self] () in
self?.authSession = SFAuthenticationSession(url: loginURL, callbackURLScheme: callbackURLScheme, completionHandler: { (callbackUrl, error) in
self?.authSession = ASWebAuthenticationSession(url: loginURL, callbackURLScheme: callbackURLScheme, completionHandler: { callbackUrl, error in
if let error = error {
logError(error.localizedDescription)
}
if let codeValue = callbackUrl?.queryParameters?["code"] {
self?.code.onNext(codeValue)
}
})
if #available(iOS 13.0, *) {
self?.authSession?.presentationContextProvider = self
}
self?.authSession?.start()
}).disposed(by: rx.disposeBag)

Expand Down Expand Up @@ -136,3 +131,10 @@ class LoginViewModel: ViewModel, ViewModelType {
hidesOAuthLoginView: hidesOAuthLoginView)
}
}

extension LoginViewModel: ASWebAuthenticationPresentationContextProviding {
@available(iOS 13.0, *)
func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
return UIApplication.shared.keyWindow!
}
}
Loading

0 comments on commit e330844

Please sign in to comment.