Commit 6d5900c7 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

project: replace deprecated functions

-fix warnings
-support swift4
-replace deprecated functions

Change-Id: I797d1b8078a5d8ad62a93ace3c5a32dd542a82d0
parent 90a90d80
......@@ -139,7 +139,7 @@ struct AccountModelHelper {
}
if userName.contains(AccountModelHelper.ringIdPrefix) {
let index = userName.range(of: AccountModelHelper.ringIdPrefix)?.upperBound
return userName.substring(from: index!)
return String(userName[index!...])
} else {
return nil
}
......
......@@ -117,8 +117,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
// themetize the app
Chameleon.setRingThemeUsingPrimaryColor(UIColor.jamiMain, withSecondaryColor: UIColor.jamiSecondary, andContentStyle: .light)
UIApplication.shared.statusBarStyle = .default
self.interactionsManager = GeneratedInteractionsManager(accountService: self.accountService,
contactService: self.contactsService,
conversationService: self.conversationsService,
......@@ -249,6 +247,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
}
}
// swiftlint:disable cyclomatic_complexity
func updateNotificationAvailability() {
let enabled = LocalNotificationsHelper.isEnabled()
if #available(iOS 10.0, *) {
......@@ -378,7 +377,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
if let rootViewController = self.topViewControllerWithRootViewController(rootViewController: window?.rootViewController) {
if rootViewController.responds(to: Selector(("canRotate"))) {
if rootViewController.responds(to: #selector(CallViewController.canRotate)) {
return .all
}
}
......
......@@ -80,7 +80,7 @@ static id <AccountAdapterDelegate> _delegate;
[AccountAdapter.delegate knownDevicesChangedFor:accountId devices:knDev];
}
}));
registerConfHandlers(confHandlers);
registerSignalHandlers(confHandlers);
}
#pragma mark -
......
......@@ -130,7 +130,7 @@ static id <CallsAdapterDelegate> _delegate;
}
}));
registerCallHandlers(callHandlers);
registerSignalHandlers(callHandlers);
}
#pragma mark -
......
......@@ -85,7 +85,7 @@ static id <ContactsAdapterDelegate> _delegate;
}
}));
registerConfHandlers(confHandlers);
registerSignalHandlers(confHandlers);
}
#pragma mark -
......
......@@ -67,7 +67,7 @@ static id <DataTransferAdapterDelegate> _delegate;
}
}));
registerDataXferHandlers(dataTransferHandlers);
registerSignalHandlers(dataTransferHandlers);
}
#pragma mark API calls
......
......@@ -73,7 +73,7 @@ static id <MessagesAdapterDelegate> _delegate;
}
}));
registerConfHandlers(confHandlers);
registerSignalHandlers(confHandlers);
}
#pragma mark -
......
......@@ -70,8 +70,7 @@ static id <NameRegistrationAdapterDelegate> _delegate;
}
}));
registerConfHandlers(confHandlers);
registerSignalHandlers(confHandlers);
}
#pragma mark -
......
......@@ -60,7 +60,7 @@ static id <PresenceAdapterDelegate> _delegate;
}
}));
registerPresHandlers(presenceHandlers);
registerSignalHandlers(presenceHandlers);
}
#pragma mark -
......
......@@ -48,7 +48,7 @@ using namespace DRing;
ret->push_back(std::string([documentsDirectory UTF8String]));
}
}));
registerConfHandlers(confHandlers);
registerSignalHandlers(confHandlers);
}
#pragma mark -
......
......@@ -135,7 +135,7 @@ static id <VideoAdapterDelegate> _delegate;
}
}));
registerVideoHandlers(videoHandlers);
registerSignalHandlers(videoHandlers);
}
#pragma mark -
......
......@@ -43,7 +43,7 @@ class ButtonsContainerView: UIView, NibLoadable {
@IBOutlet weak var stackViewYConstraint: NSLayoutConstraint!
@IBOutlet weak var stackViewWidthConstraint: NSLayoutConstraint!
@IBOutlet weak var containerHeightConstraint: NSLayoutConstraint!
let disposeBag = DisposeBag()
var isCallStarted: Bool = false
......
......@@ -27,6 +27,7 @@ import Reusable
import SwiftyBeaver
// swiftlint:disable type_body_length
// swiftlint:disable file_length
class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
//preview screen
......@@ -70,7 +71,6 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
@IBOutlet weak var profileImageViewWidthConstraint: NSLayoutConstraint!
@IBOutlet weak var profileImageViewHeightConstraint: NSLayoutConstraint!
var viewModel: CallViewModel!
var isCallStarted: Bool = false
var isMenuShowed = false
......@@ -85,6 +85,10 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
private var shouldRotateScreen = false
override var preferredStatusBarStyle: UIStatusBarStyle {
return self.viewModel.isAudioOnly ? .lightContent : .default
}
override func viewDidLoad() {
super.viewDidLoad()
self.setAvatarView(true)
......@@ -117,9 +121,6 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
self.buttonsContainer.stackView.alpha = 0
self.showAllInfo()
self.setWhiteAvatarView()
} else {
//The status bar should be white for video calls and black for audio calls
UIApplication.shared.statusBarStyle = .lightContent
}
UIDevice.current.isProximityMonitoringEnabled = self.viewModel.isAudioOnly
......@@ -154,7 +155,6 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
}
func setWhiteAvatarView() {
UIApplication.shared.statusBarStyle = .default
self.callPulse.backgroundColor = UIColor.jamiCallPulse
self.avatarView.backgroundColor = UIColor.white
}
......@@ -247,6 +247,8 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
self.switchCameraButton.isEnabled = !(self.viewModel.isAudioOnly)
}
// swiftlint:disable function_body_length
// swiftlint:disable cyclomatic_complexity
func setupBindings() {
self.viewModel.contactImageData?.asObservable()
......@@ -468,7 +470,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
}
@objc func screenTapped() {
if self.avatarView.isHidden{
if self.avatarView.isHidden {
self.viewModel.respondOnTap()
}
}
......@@ -497,7 +499,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
DispatchQueue.main.async { [weak self] in
guard let hidden = self?.infoContainer.isHidden else {return}
self?.resizeCapturedVideo(withInfoContainer: !hidden)
if UIDevice.current.hasNotch && (UIDevice.current.orientation == .landscapeRight || UIDevice.current.orientation == .landscapeLeft) && self?.infoContainer.isHidden == false {
if UIDevice.current.hasNotch && (UIDevice.current.orientation == .landscapeRight || UIDevice.current.orientation == .landscapeLeft) && self?.infoContainer.isHidden == false {
self?.buttonsContainerBottomConstraint.constant = 1
}
}
......@@ -509,7 +511,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
func resizeCapturedVideo(withInfoContainer: Bool) {
self.leftArrow.alpha = 0
//Don't change anything if the orientation change to portraitUpsideDown, faceUp or faceDown
if UIDevice.current.orientation.rawValue != 5 && UIDevice.current.orientation.rawValue != 6 && UIDevice.current.orientation.rawValue != 2 {
if UIDevice.current.orientation.rawValue != 5 && UIDevice.current.orientation.rawValue != 6 && UIDevice.current.orientation.rawValue != 2 {
self.orientation = UIDevice.current.orientation
}
switch self.orientation {
......@@ -590,7 +592,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
self?.capturedVideoBlurEffect.alpha = 0
self?.resizeCapturedVideo(withInfoContainer: true)
self?.infoContainerTopConstraint.constant = -10
if UIDevice.current.hasNotch && (self?.orientation == .landscapeRight || self?.orientation == .landscapeLeft) {
if UIDevice.current.hasNotch && (self?.orientation == .landscapeRight || self?.orientation == .landscapeLeft) {
self?.buttonsContainerBottomConstraint.constant = 1
} else if UIDevice.current.userInterfaceIdiom == .pad {
self?.buttonsContainerBottomConstraint.constant = 30
......
......@@ -35,16 +35,19 @@ class ContactViewController: UIViewController, StoryboardBased, ViewModelBased {
private var stretchyHeader: ProfileHeaderView!
private let titleView = TitleView(frame: CGRect(x: 0, y: 0, width: 200, height: 50))
override var preferredStatusBarStyle: UIStatusBarStyle {
return .default
}
override func viewDidLoad() {
super.viewDidLoad()
self.addHeaderView()
self.setUpTableView()
navigationItem.titleView = titleView
navigationItem.titleView = titleView
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
UIApplication.shared.statusBarStyle = .default
self.navigationController?.navigationBar.layer.shadowColor = UIColor.clear.cgColor
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
}
......
......@@ -111,7 +111,7 @@ enum InteractionType: String {
case oTransfer = "OUTGOING_DATA_TRANSFER"
}
typealias savedMessageForConversation = (messageID: Int64, conversationID: Int64)
typealias SavedMessageForConversation = (messageID: Int64, conversationID: Int64)
class DBManager {
......@@ -135,7 +135,7 @@ class DBManager {
try interactionHepler.createTable()
}
func saveMessage(for accountUri: String, with contactUri: String, message: MessageModel, incoming: Bool, interactionType: InteractionType) -> Observable<savedMessageForConversation> {
func saveMessage(for accountUri: String, with contactUri: String, message: MessageModel, incoming: Bool, interactionType: InteractionType) -> Observable<SavedMessageForConversation> {
//create completable which will be executed on background thread
return Observable.create { [weak self] observable in
......@@ -184,7 +184,7 @@ class DBManager {
result = nil
}
if let messageID = result {
let savedMessage = savedMessageForConversation(messageID, conversationID)
let savedMessage = SavedMessageForConversation(messageID, conversationID)
observable.onNext(savedMessage)
observable.on(.completed)
} else {
......
......@@ -33,6 +33,10 @@ class EditProfileViewController: UIViewController, UITextFieldDelegate, UIImageP
var model: EditProfileViewModel!
fileprivate let disposeBag = DisposeBag()
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
// MARK: - functions
override func viewDidLoad() {
......@@ -43,7 +47,6 @@ class EditProfileViewController: UIViewController, UITextFieldDelegate, UIImageP
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.setupUI()
UIApplication.shared.statusBarStyle = .lightContent
}
func setupUI() {
......
......@@ -88,7 +88,7 @@ extension String {
scalars.append(currentScalarSet)
return scalars.map { $0.map{ String($0) } .reduce("", +) }
return scalars.map { $0.map { String($0) } .reduce("", +) }
}
fileprivate var emojiScalars: [UnicodeScalar] {
......
......@@ -11,7 +11,7 @@ import ImageIO
// FIXME: comparison operators with optionals were removed from the Swift Standard Libary.
// Consider refactoring the code to use the non-optional operators.
fileprivate func < <T : Comparable>(lhs: T?, rhs: T?) -> Bool {
fileprivate func < <T: Comparable>(lhs: T?, rhs: T?) -> Bool {
switch (lhs, rhs) {
case let (varL?, varR?):
return varL < varR
......@@ -61,7 +61,9 @@ extension UIImage {
Unmanaged.passUnretained(kCGImagePropertyGIFDelayTime).toOpaque()), to: AnyObject.self)
}
delay = delayObject as! Double
guard let delayDouble = delayObject as? Double else {return delay}
delay = delayDouble
if delay < 0.1 {
delay = 0.1
......@@ -102,7 +104,7 @@ extension UIImage {
}
}
class func gcdForArray(_ array: Array<Int>) -> Int {
class func gcdForArray(_ array: [Int]) -> Int {
if array.isEmpty {
return 1
}
......
......@@ -59,6 +59,6 @@ extension String {
}
func prefixString() -> String {
return String(self.characters.prefix(1))
return String(self.prefix(1))
}
}
......@@ -184,7 +184,6 @@ extension UIImage {
return newSize
}
func resizeImageWith(newSize: CGSize) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(newSize, true, 0)
draw(in: CGRect(origin: CGPoint(x: 0, y: 0), size: newSize))
......
......@@ -179,24 +179,24 @@ enum GradientOrientation {
case horizontal
case vertical
var startPoint : CGPoint {
var startPoint: CGPoint {
return points.startPoint
}
var endPoint : CGPoint {
var endPoint: CGPoint {
return points.endPoint
}
var points : GradientPoints {
var points: GradientPoints {
switch self {
case .topRightBottomLeft:
return (CGPoint(x: 0.0,y: 1.0), CGPoint(x: 1.0,y: 0.0))
return (CGPoint(x: 0.0, y: 1.0), CGPoint(x: 1.0, y: 0.0))
case .topLeftBottomRight:
return (CGPoint(x: 0.0,y: 0.0), CGPoint(x: 1,y: 1))
return (CGPoint(x: 0.0, y: 0.0), CGPoint(x: 1, y: 1))
case .horizontal:
return (CGPoint(x: 0.0,y: 0.5), CGPoint(x: 1.0,y: 0.5))
return (CGPoint(x: 0.0, y: 0.5), CGPoint(x: 1.0, y: 0.5))
case .vertical:
return (CGPoint(x: 0.0,y: 0.0), CGPoint(x: 0.0,y: 1.0))
return (CGPoint(x: 0.0, y: 0.0), CGPoint(x: 0.0, y: 1.0))
}
}
}
......@@ -22,16 +22,15 @@ import UIKit
import RxSwift
import RxCocoa
extension Reactive where Base : UIView {
extension Reactive where Base: UIView {
//show view with animation and hide without
public var isVisible: AnyObserver<Bool> {
return UIBindingObserver(UIElement: self.base) { view, hidden in
return Binder (self.base) { view, hidden in
if hidden == true {
view.isHidden = true
view.alpha = 0
} else {
UIView.animate(withDuration: 0.3, delay: 0.5, options: .curveEaseOut,
animations: {view.alpha = 1},
completion: { _ in view.isHidden = false
......
......@@ -100,7 +100,7 @@ extension UIViewController {
NotificationCenter.keyboardHeight.observeOn(MainScheduler.instance).subscribe(onNext: { [unowned self, unowned tableView] (height) in
let trueHeight = height > 0 ? height + 100 : 0.0
// reset insets if they were changed before
if tableView.contentInset.bottom > 0 && trueHeight <= 0 {
if tableView.contentInset.bottom > 0 && trueHeight <= 0 {
var contentInsets = tableView.contentInset
contentInsets.bottom = 0
tableView.contentInset = contentInsets
......
......@@ -23,7 +23,7 @@ import UIKit
import RxSwift
import RxCocoa
extension Reactive where Base : UIViewController {
extension Reactive where Base: UIViewController {
public var viewDidLoad: ControlEvent<Void> {
let source = self.sentMessage(#selector(Base.viewDidLoad)).map { _ in }
return ControlEvent(events: source)
......
......@@ -36,6 +36,10 @@ class ContactRequestsViewController: UIViewController, StoryboardBased, ViewMode
fileprivate let cellIdentifier = "ContactRequestCell"
fileprivate let log = SwiftyBeaver.self
override var preferredStatusBarStyle: UIStatusBarStyle {
return .default
}
override func viewDidLoad() {
super.viewDidLoad()
......@@ -51,10 +55,11 @@ class ContactRequestsViewController: UIViewController, StoryboardBased, ViewMode
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
UIApplication.shared.statusBarStyle = .default
self.setupTableView()
self.setupBindings()
self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.font: UIFont(name: "HelveticaNeue-Light", size: 25)!,NSAttributedStringKey.foregroundColor : UIColor.jamiMain]
self.navigationController?.navigationBar
.titleTextAttributes = [NSAttributedStringKey.font: UIFont(name: "HelveticaNeue-Light", size: 25)!,
NSAttributedStringKey.foregroundColor: UIColor.jamiMain]
}
func setupTableView() {
......
......@@ -58,7 +58,6 @@ class MessageCell: UITableViewCell, NibReusable {
var disposeBag = DisposeBag()
override func prepareForReuse() {
super.prepareForReuse()
self.stopProgressMonitor()
......@@ -247,7 +246,7 @@ class MessageCell: UITableViewCell, NibReusable {
}
}
/// swiftlint:disable function_body_length
// swiftlint:disable function_body_length
func configureFromItem(_ conversationViewModel: ConversationViewModel,
_ items: [MessageViewModel]?,
cellForRowAt indexPath: IndexPath) {
......@@ -339,12 +338,12 @@ class MessageCell: UITableViewCell, NibReusable {
// When the message contains only emoji
if item.content.containsOnlyEmoji {
self.bubble.backgroundColor = UIColor.jamiMsgCellEmoji
if (self.avatarBotomAlignConstraint != nil) {
if self.avatarBotomAlignConstraint != nil {
self.avatarBotomAlignConstraint.constant = -14
}
} else {
self.bubble.backgroundColor = UIColor.jamiMsgCellReceived
if (self.avatarBotomAlignConstraint != nil) {
if self.avatarBotomAlignConstraint != nil {
self.avatarBotomAlignConstraint.constant = -1
}
}
......
......@@ -46,6 +46,10 @@ class ConversationViewController: UIViewController,
let scrollOffsetThreshold: CGFloat = 600
var bottomHeight: CGFloat = 0.00
override var preferredStatusBarStyle: UIStatusBarStyle {
return .default
}
var keyboardDismissTapRecognizer: UITapGestureRecognizer!
override func viewDidLoad() {
......@@ -115,7 +119,7 @@ class ConversationViewController: UIViewController,
}
}
func fixImageOrientation(image: UIImage)->UIImage {
func fixImageOrientation(image: UIImage) -> UIImage {
UIGraphicsBeginImageContext(image.size)
image.draw(at: .zero)
let newImage = UIGraphicsGetImageFromCurrentImageContext()
......@@ -215,11 +219,6 @@ class ConversationViewController: UIViewController,
}
// swiftlint:enable cyclomatic_complexity
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
UIApplication.shared.statusBarStyle = .default
}
@objc func dismissKeyboard() {
self.becomeFirstResponder()
view.removeGestureRecognizer(keyboardDismissTapRecognizer)
......@@ -294,7 +293,7 @@ class ConversationViewController: UIViewController,
userNameYOffset = 18
}
} else {
if displayName == nil || displayName == "" {
if displayName == nil || displayName == "" {
userNameYOffset = 1
} else {
dnlabelYOffset = -4
......@@ -651,6 +650,7 @@ class ConversationViewController: UIViewController,
return dateFormatter.string(from: time).uppercased()
}
// swiftlint:disable cyclomatic_complexity
func changeTransferStatus(_ cell: MessageCell,
_ indexPath: IndexPath?,
_ status: DataTransferStatus,
......@@ -760,6 +760,7 @@ extension ConversationViewController: UITableViewDataSource {
return self.messageViewModels?.count ?? 0
}
// swiftlint:disable cyclomatic_complexity
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if let item = self.messageViewModels?[indexPath.row] {
var type = MessageCell.self
......
......@@ -103,14 +103,14 @@ class ConversationViewModel: Stateable, ViewModel {
.disposed(by: self.disposeBag)
// invite and block buttons
if let _ = contact {
if contact != nil {
self.inviteButtonIsAvailable.onNext(false)
}
self.contactsService.contactStatus.filter({ cont in
return cont.ringId == contactRingId
})
.subscribe(onNext: { [unowned self] contact in
.subscribe(onNext: { [unowned self] _ in
self.inviteButtonIsAvailable.onNext(false)
}).disposed(by: self.disposeBag)
......
......@@ -13,7 +13,7 @@ import UIKit
@objc optional func textViewDidChangeHeight(_ textView: GrowingTextView, height: CGFloat)
}
@IBDesignable @objc
@IBDesignable
open class GrowingTextView: UITextView {
override open var text: String! {
didSet { setNeedsDisplay() }
......@@ -73,11 +73,9 @@ open class GrowingTextView: UITextView {
private func associateConstraints() {
// iterate through all text view's constraints and identify
// height,from: https://github.com/legranddamien/MBAutoGrowingTextView
for constraint in constraints {
if (constraint.firstAttribute == .height) {
if (constraint.relation == .equal) {
heightConstraint = constraint;
}
for constraint in constraints where constraint.firstAttribute == .height {
if constraint.relation == .equal {
heightConstraint = constraint
}
}
}
......@@ -110,7 +108,7 @@ open class GrowingTextView: UITextView {
height = maxHeight > 0 ? min(height, maxHeight) : height
// Add height constraint if it is not found
if (heightConstraint == nil) {
if heightConstraint == nil {
heightConstraint = NSLayoutConstraint(item: self, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: height)
addConstraint(heightConstraint!)
}
......@@ -131,9 +129,9 @@ open class GrowingTextView: UITextView {
private func scrollToCorrectPosition() {
if self.isFirstResponder {
self.scrollRangeToVisible(NSMakeRange(-1, 0)) // Scroll to bottom
self.scrollRangeToVisible(NSRange(location: -1, length: 0)) // Scroll to bottom
} else {
self.scrollRangeToVisible(NSMakeRange(0, 0)) // Scroll to top
self.scrollRangeToVisible(NSRange(location: 0, length: 0)) // Scroll to top
}
}
......@@ -191,5 +189,3 @@ open class GrowingTextView: UITextView {
}
}
}
......@@ -57,6 +57,7 @@ class MessageViewModel {
private let disposeBag = DisposeBag()
// swiftlint:disable cyclomatic_complexity
init(withInjectionBag injectionBag: InjectionBag,
withMessage message: MessageModel) {
self.accountService = injectionBag.accountService
......
......@@ -161,24 +161,6 @@
</objects>
<point key="canvasLocation" x="-108" y="-1208.5457271364319"/>
</scene>
<!--View Controller-->
<scene sceneID="YBM-c2-EWl">
<objects>
<viewController id="9uj-4q-nGi" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="EEa-ZN-DDP"/>
<viewControllerLayoutGuide type="bottom" id="VVG-rs-LcN"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="zCu-ae-k0m">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="bOs-td-edL" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-108" y="-1209"/>
</scene>
</scenes>
<resources>
<image name="settings_icon" width="48" height="48"/>
......
......@@ -26,7 +26,6 @@ import RxCocoa
import Reusable
import SwiftyBeaver
//Constants
private struct SmartlistConstants {
static let smartlistRowHeight: CGFloat = 64.0
......@@ -55,6 +54,10 @@ class SmartlistViewController: UIViewController, StoryboardBased, ViewModelBased
var viewModel: SmartlistViewModel!
fileprivate let disposeBag = DisposeBag()
override var preferredStatusBarStyle: UIStatusBarStyle {
return .default
}
// MARK: functions
@IBAction func openScan() {
self.viewModel.showQRCode()
......@@ -78,10 +81,11 @@ class SmartlistViewController: UIViewController, StoryboardBased, ViewModelBased
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
UIApplication.shared.statusBarStyle = .default
self.navigationController?.navigationBar.layer.shadowColor = UIColor.clear.cgColor
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.font: UIFont(name: "HelveticaNeue-Light", size: 25)!,NSAttributedStringKey.foregroundColor : UIColor.jamiMain]
self.navigationController?.navigationBar
.titleTextAttributes = [NSAttributedStringKey.font: UIFont(name: "HelveticaNeue-Light", size: 25)!,
NSAttributedStringKey.foregroundColor: UIColor.jamiMain]
}
func setupUI() {
......@@ -116,7 +120,6 @@ class SmartlistViewController: UIViewController, StoryboardBased, ViewModelBased
}
}).disposed(by: self.disposeBag)
let imageScanSearch = UIImage(asset: Asset.qrCodeScan) as UIImage?
let scanButton = UIButton(type: UIButtonType.custom) as UIButton
scanButton.setImage(imageScanSearch, for: .normal)
......
......@@ -57,8 +57,9 @@ class SmartlistViewModel: Stateable, ViewModel {
return self.networkService.connectionState.value
}
// swiftlint:disable function_body_length
// swiftlint:disable cyclomatic_complexity
required init(with injectionBag: InjectionBag) {