Skip to content

Commit

Permalink
Merge pull request #69 from 87kangsw/release/2.1.3
Browse files Browse the repository at this point in the history
[Release] 2.1.3
  • Loading branch information
87kangsw committed Nov 30, 2021
2 parents 1b1e2e2 + 408bca3 commit 4a26636
Show file tree
Hide file tree
Showing 41 changed files with 176 additions and 260 deletions.
60 changes: 14 additions & 46 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,26 @@
disabled_rules: # rule identifiers to exclude from running
- trailing_whitespace
- line_length
- identifier_name
- function_body_length
- cyclomatic_complexity
- switch_case_alignment
- trailing_whitespace
- line_length
- identifier_name
- function_body_length
- cyclomatic_complexity
- switch_case_alignment
- type_name
- function_parameter_count
- type_body_length
opt_in_rules: # some rules are only opt-in
- empty_count
- empty_count
# Find all the available rules by running:
# swiftlint rules
included: # paths to include during linting. `--path` is ignored if present.
- GitTime
- GitTime
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods
- Carthage
- Pods

analyzer_rules: # Rules run by `swiftlint analyze` (experimental)
- explicit_self
- explicit_self

# configurable rules can be customized from this configuration file
# binary rules can set their severity level
force_cast: warning # implicitly
force_try:
severity: warning # explicitly
# rules that have both warning and error levels, can set just the warning level
# implicitly
line_length:
warning: 120
ignores_function_declarations: true
ignores_comments: true
ignores_interpolated_strings: true
ignores_urls: true
# they can set both implicitly with an array
type_body_length:
- 300 # warning
- 400 # error
# or they can set both explicitly
file_length:
warning: 500
error: 1200
# naming rules can set warnings/errors for min_length and max_length
# additionally they can set excluded names
type_name:
min_length: 4 # only warning
max_length: # warning and error
warning: 40
error: 50
excluded: iPhone # excluded via string
identifier_name:
min_length: # only min_length
error: 4 # only error
excluded: # excluded via string array
- id
- URL
- GlobalAPIKey
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji, sonarqube, markdown)

42 changes: 25 additions & 17 deletions GitTime/Sources/CompositionRoot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,11 @@ final class CompositionRoot {

extension CompositionRoot {
// MARK: - Activity
static func configureActivityScreen(activityService: ActivityServiceType,
userService: UserServiceType,
crawlerService: GitTimeCrawlerServiceType) -> ActivityViewController {
static func configureActivityScreen(
activityService: ActivityServiceType,
userService: UserServiceType,
crawlerService: GitTimeCrawlerServiceType
) -> ActivityViewController {
let reactor = ActivityViewReactor(activityService: activityService,
userService: userService,
crawlerService: crawlerService)
Expand All @@ -189,9 +191,11 @@ extension CompositionRoot {
}

// MARK: - Setting
static func configureSettingScreen(authService: AuthServiceType,
githubService: GitHubServiceType,
presentLoginScreen: @escaping () -> Void) -> SettingViewController {
static func configureSettingScreen(
authService: AuthServiceType,
githubService: GitHubServiceType,
presentLoginScreen: @escaping () -> Void
) -> SettingViewController {

// 앱아이콘 변경
var pushAppIconScreen: () -> AppIconsViewController
Expand Down Expand Up @@ -222,12 +226,14 @@ extension CompositionRoot {
}

// MARK: - Buddy
static func configureBuddyScreen(crawlerService: GitTimeCrawlerServiceType,
realmService: RealmServiceType,
userDefaultService: UserDefaultsServiceType,
followService: FollowServiceType,
userService: UserServiceType,
githubService: GitHubServiceType) -> BuddyViewController {
static func configureBuddyScreen(
crawlerService: GitTimeCrawlerServiceType,
realmService: RealmServiceType,
userDefaultService: UserDefaultsServiceType,
followService: FollowServiceType,
userService: UserServiceType,
githubService: GitHubServiceType
) -> BuddyViewController {

var presentFollowScreen: () -> FollowViewController
presentFollowScreen = {
Expand All @@ -246,15 +252,17 @@ extension CompositionRoot {
controller.title = "Buddys"
controller.tabBarItem.title = "Buddys"
controller.tabBarItem.image = UIImage.assetImage(name: TabBarImages.follow)
controller.tabBarItem.selectedImage = UIImage.assetImage(name: TabBarImages.followFilled)
controller.tabBarItem.selectedImage = UIImage.assetImage(name: TabBarImages.followFilled)
return controller
}

// MARK: - Trending
static func configureTrendingScreen(crawlerService: GitTimeCrawlerServiceType,
languagesService: LanguagesServiceType,
userDefaultService: UserDefaultsServiceType,
realmService: RealmServiceType) -> TrendViewController {
static func configureTrendingScreen(
crawlerService: GitTimeCrawlerServiceType,
languagesService: LanguagesServiceType,
userDefaultService: UserDefaultsServiceType,
realmService: RealmServiceType
) -> TrendViewController {

var presentLanguageScreen: () -> LanguageListViewController
presentLanguageScreen = {
Expand Down
2 changes: 1 addition & 1 deletion GitTime/Sources/Models/Contribution.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ extension ContributionInfo: RealmPersistable {
let contributionInfo = ContributionInfoObject()
contributionInfo.count = self.count
contributionInfo.userName = self.userName
contributionInfo.additionalName = self.additionalName ?? ""
contributionInfo.additionalName = self.additionalName
// contributionInfo.contributions = self.contributions.map { $0.managedObject() }
contributionInfo.createdAt = Date()
return contributionInfo
Expand Down
2 changes: 1 addition & 1 deletion GitTime/Sources/Network/GitTimeProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Toaster
class GitTimeProvider<Target: TargetType>: MoyaProvider<Target> {

init(plugins: [PluginType]? = nil) {
var finalPlugins: [PluginType] = plugins ?? [PluginType]()
let finalPlugins: [PluginType] = plugins ?? [PluginType]()
// finalPlugins.append(NetworkLoggerPlugin(verbose: true))
super.init(plugins: finalPlugins)
}
Expand Down
2 changes: 1 addition & 1 deletion GitTime/Sources/Protocols/CellType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UIKit

protocol CellType: class {
protocol CellType: AnyObject {
static var reuseIdentifier: String { get }
static var cellFromNib: Self { get }
}
Expand Down
2 changes: 1 addition & 1 deletion GitTime/Sources/Protocols/ReactorBased.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import ReactorKit
import RxCocoa
import RxSwift

protocol ReactorBased: class {
protocol ReactorBased: AnyObject {

}

Expand Down
2 changes: 1 addition & 1 deletion GitTime/Sources/Services/FollowService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import RxSwift

protocol FollowServiceType: class {
protocol FollowServiceType: AnyObject {
func fetchFollowers(userName: String, page: Int) -> Observable<[User]>
func fetchFollowing(userName: String, page: Int) -> Observable<[User]>
func trialFollow() -> Observable<[User]>
Expand Down
2 changes: 1 addition & 1 deletion GitTime/Sources/Services/GitTimeCrawlerService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import RxSwift
import Moya

protocol GitTimeCrawlerServiceType: class {
protocol GitTimeCrawlerServiceType: AnyObject {
func fetchTrendingRepositories(language: String?, period: String?, spokenLanguage: String?) -> Observable<[TrendRepo]>
func fetchTrendingDevelopers(language: String?, period: String?) -> Observable<[TrendDeveloper]>
func fetchContributions(userName: String) -> Observable<ContributionInfo>
Expand Down
2 changes: 1 addition & 1 deletion GitTime/Sources/Services/KeychainService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ enum KeychainKey {
static let accessToken = "accessToken"
}

protocol KeychainServiceType: class {
protocol KeychainServiceType: AnyObject {
func getAccessToken() -> String?
func setAccessToken(_ token: String) throws
func removeAccessToken() throws
Expand Down
3 changes: 1 addition & 2 deletions GitTime/Sources/Services/RealmService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import RealmSwift
import RxSwift
import SwiftUI


protocol RealmServiceType {
// Search History
func addSearchText(text: String)
Expand All @@ -33,7 +32,7 @@ class RealmService: RealmServiceType {

var disposeBag = DisposeBag()

static let schemaVersion: UInt64 = 1
static let schemaVersion: UInt64 = 2

init() {
migration()
Expand Down
38 changes: 20 additions & 18 deletions GitTime/Sources/Utils/Extensions/Rx/UIAlertController+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,26 @@ enum RxAlertControllerResult {
}

extension UIAlertController {
static func rx_presentAlert<Action: RxAlertActionType, Result>(viewController: UIViewController,
title: String? = nil,
message: String? = nil,
preferredStyle: UIAlertController.Style = .alert,
animated: Bool = true,
button: Any? = nil,
actions: [Action]) -> Observable<Result> where Action.Result == Result {
return Observable.create { observer -> Disposable in
let alertController = UIAlertController(title: title, message: message, preferredStyle: preferredStyle)

actions.map { rxAction in
UIAlertAction(title: rxAction.title, style: rxAction.style, handler: { _ in
observer.onNext(rxAction.result)
observer.onCompleted()
})
}
.forEach(alertController.addAction)

static func rx_presentAlert<Action: RxAlertActionType, Result>(
viewController: UIViewController,
title: String? = nil,
message: String? = nil,
preferredStyle: UIAlertController.Style = .alert,
animated: Bool = true,
button: Any? = nil,
actions: [Action]
) -> Observable<Result> where Action.Result == Result {
return Observable.create { observer -> Disposable in
let alertController = UIAlertController(title: title, message: message, preferredStyle: preferredStyle)

actions.map { rxAction in
UIAlertAction(title: rxAction.title, style: rxAction.style, handler: { _ in
observer.onNext(rxAction.result)
observer.onCompleted()
})
}
.forEach(alertController.addAction)

if UIDevice.isPhone {
viewController.present(alertController, animated: animated, completion: nil)
} else {
Expand Down
76 changes: 0 additions & 76 deletions GitTime/Sources/Utils/Extensions/UIViewController+Preview.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import Foundation
}
}

fileprivate protocol OptionalProtocol {
private protocol OptionalProtocol {
func isNil() -> Bool
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ActivityViewController: BaseViewController, ReactorKit.View {
$0.frame = .zero
}
private let refreshControl = UIRefreshControl()
private let profileButton = UIButton().then {
private let profileButton = UIButton(frame: CGRect(x: 0, y: 0, width: 30, height: 30)).then {
$0.setImage(UIImage(systemName: "person.circle"), for: .normal)
$0.layer.cornerRadius = 30.0 / 2
$0.layer.masksToBounds = true
Expand All @@ -57,7 +57,7 @@ class ActivityViewController: BaseViewController, ReactorKit.View {

// MARK: - Properties
static var dataSource: RxTableViewSectionedReloadDataSource<ActivitySection> {
return .init(configureCell: { (datasource, tableView, indexPath, sectionItem) -> UITableViewCell in
return .init(configureCell: { (_, tableView, indexPath, sectionItem) -> UITableViewCell in
switch sectionItem {
case .createEvent(let reactor),
.forkEvent(let reactor),
Expand Down Expand Up @@ -145,7 +145,7 @@ class ActivityViewController: BaseViewController, ReactorKit.View {
.disposed(by: self.disposeBag)

tableView.rx.reachedBottom
.observeOn(MainScheduler.instance)
.observe(on: MainScheduler.instance)
.map { Reactor.Action.loadMoreActivities }
.bind(to: reactor.action)
.disposed(by: self.disposeBag)
Expand Down Expand Up @@ -190,6 +190,7 @@ class ActivityViewController: BaseViewController, ReactorKit.View {
.subscribe(onNext: { [weak self] profileURL in
guard let self = self, let url = URL(string: profileURL) else { return }
self.profileButton.kf.setImage(with: url, for: .normal)
self.profileButton.layoutIfNeeded()
}).disposed(by: self.disposeBag)

// View
Expand Down
Loading

0 comments on commit 4a26636

Please sign in to comment.