Commit eb4a2d48 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

project: support iOS 12.2

Support iOS 12.2 and convert to swift5 syntax.
Also this patch removes framework Chameleon.

Change-Id: I4135c87b14c9c04dff86c3e7eede33162bb8ca34
parent 630f63c3
...@@ -3,7 +3,6 @@ github "RxSwiftCommunity/RxDataSources" ~> 3.0 ...@@ -3,7 +3,6 @@ github "RxSwiftCommunity/RxDataSources" ~> 3.0
github "pkluz/PKHUD" ~> 5.0 github "pkluz/PKHUD" ~> 5.0
github "AliSoftware/Reusable" ~> 4.0 github "AliSoftware/Reusable" ~> 4.0
github "SwiftyBeaver/SwiftyBeaver" ~> 1.0 github "SwiftyBeaver/SwiftyBeaver" ~> 1.0
github "ViccAlexander/Chameleon"
github "andreamazz/AMPopTip" github "andreamazz/AMPopTip"
github "ashleymills/Reachability.swift" github "ashleymills/Reachability.swift"
github "stephencelis/SQLite.swift" ~> 0.11.4 github "stephencelis/SQLite.swift" ~> 0.11.4
......
github "AliSoftware/Reusable" "4.0.4" github "AliSoftware/Reusable" "4.1.0"
github "ReactiveX/RxSwift" "4.4.0" github "ReactiveX/RxSwift" "4.5.0"
github "RxSwiftCommunity/RxDataSources" "3.1.0" github "RxSwiftCommunity/RxDataSources" "3.1.0"
github "RxSwiftCommunity/RxRealm" "0.7.6" github "RxSwiftCommunity/RxRealm" "0.7.7"
github "SwiftyBeaver/SwiftyBeaver" "1.6.1" github "SwiftyBeaver/SwiftyBeaver" "1.7.0"
github "ViccAlexander/Chameleon" "2.2.0" github "andreamazz/AMPopTip" "4.0.1"
github "andreamazz/AMPopTip" "3.5.0" github "ashleymills/Reachability.swift" "v4.3.1"
github "ashleymills/Reachability.swift" "v4.3.0"
github "gskbyte/GSKStretchyHeaderView" "1.0.4" github "gskbyte/GSKStretchyHeaderView" "1.0.4"
github "optonaut/ActiveLabel.swift" "1.0.1" github "optonaut/ActiveLabel.swift" "1.0.1"
github "pkluz/PKHUD" "5.2.0" github "pkluz/PKHUD" "5.3.0"
github "realm/realm-cocoa" "v3.12.0" github "realm/realm-cocoa" "v3.16.1"
github "stephencelis/SQLite.swift" "0.11.5" github "stephencelis/SQLite.swift" "0.11.6"
This diff is collapsed.
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
import UIKit import UIKit
import SwiftyBeaver import SwiftyBeaver
import RxSwift import RxSwift
import Chameleon
//import Contacts
import PushKit import PushKit
import ContactsUI import ContactsUI
...@@ -90,7 +88,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD ...@@ -90,7 +88,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
fileprivate let disposeBag = DisposeBag() fileprivate let disposeBag = DisposeBag()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// ignore sigpipe // ignore sigpipe
// swiftlint:disable nesting // swiftlint:disable nesting
...@@ -131,9 +129,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD ...@@ -131,9 +129,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
}) })
.disposed(by: self.disposeBag) .disposed(by: self.disposeBag)
// themetize the app
Chameleon.setRingThemeUsingPrimaryColor(UIColor.jamiMain, withSecondaryColor: UIColor.jamiSecondary, andContentStyle: .light)
self.interactionsManager = GeneratedInteractionsManager(accountService: self.accountService, self.interactionsManager = GeneratedInteractionsManager(accountService: self.accountService,
contactService: self.contactsService, contactService: self.contactsService,
conversationService: self.conversationsService, conversationService: self.conversationsService,
...@@ -278,6 +273,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD ...@@ -278,6 +273,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
if !enabled { LocalNotificationsHelper.setNotification(enable: true)} if !enabled { LocalNotificationsHelper.setNotification(enable: true)}
case .provisional: case .provisional:
if !enabled { LocalNotificationsHelper.setNotification(enable: true)} if !enabled { LocalNotificationsHelper.setNotification(enable: true)}
@unknown default:
break
} }
}) })
} else { } else {
......
...@@ -30,13 +30,11 @@ ...@@ -30,13 +30,11 @@
#import "RegistrationResponse.h" #import "RegistrationResponse.h"
#import "NameRegistrationResponse.h" #import "NameRegistrationResponse.h"
#import "MessagesAdapter.h" #import "MessagesAdapter.h"
#import "Chameleon/Chameleon.h"
#import "ContactsAdapter.h" #import "ContactsAdapter.h"
#import "PresenceAdapter.h" #import "PresenceAdapter.h"
#import "VideoAdapter.h" #import "VideoAdapter.h"
#import "AudioAdapter.h" #import "AudioAdapter.h"
#import <CommonCrypto/CommonCrypto.h> #import <CommonCrypto/CommonCrypto.h>
//#import <Contacts/Contacts.h>
#import <ContactsUI/ContactsUI.h> #import <ContactsUI/ContactsUI.h>
#import <UserNotifications/UserNotifications.h> #import <UserNotifications/UserNotifications.h>
#import "CallsAdapter.h" #import "CallsAdapter.h"
......
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#import "Chameleon/Chameleon-Swift.h"
#import "Ring-Swift.h" #import "Ring-Swift.h"
#import "SystemAdapter.h" #import "SystemAdapter.h"
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
*/ */
import UIKit import UIKit
import Chameleon
import RxSwift import RxSwift
import Reusable import Reusable
import SwiftyBeaver import SwiftyBeaver
...@@ -127,8 +126,8 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased { ...@@ -127,8 +126,8 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
@objc func capturedVideoSwipped(gesture: UISwipeGestureRecognizer) { @objc func capturedVideoSwipped(gesture: UISwipeGestureRecognizer) {
if self.avatarView.isHidden == false { return } if self.avatarView.isHidden == false { return }
if gesture.direction == UISwipeGestureRecognizerDirection.left && (self.isVideoHidden == false) { return } if gesture.direction == UISwipeGestureRecognizer.Direction.left && (self.isVideoHidden == false) { return }
if gesture.direction == UISwipeGestureRecognizerDirection.right && (self.isVideoHidden == true) { return } if gesture.direction == UISwipeGestureRecognizer.Direction.right && (self.isVideoHidden == true) { return }
self.hideCapturedVideo() self.hideCapturedVideo()
} }
...@@ -174,7 +173,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased { ...@@ -174,7 +173,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
} }
func setUpCallButtons() { func setUpCallButtons() {
self.mainView.bringSubview(toFront: self.buttonsContainer) self.mainView.bringSubviewToFront(self.buttonsContainer)
self.buttonsContainer.viewModel = self.viewModel.containerViewModel self.buttonsContainer.viewModel = self.viewModel.containerViewModel
self.buttonsContainer.cancelButton.rx.tap self.buttonsContainer.cancelButton.rx.tap
.subscribe(onNext: { [weak self] in .subscribe(onNext: { [weak self] in
...@@ -183,9 +182,10 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased { ...@@ -183,9 +182,10 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
}).disposed(by: self.disposeBag) }).disposed(by: self.disposeBag)
self.buttonsContainer.acceptCallButton.rx.tap self.buttonsContainer.acceptCallButton.rx.tap
.subscribe(onNext: { [weak self] in .subscribe(onNext: { [unowned self] in
self?.viewModel.answerCall() self.viewModel.answerCall()
.subscribe() .subscribe()
.disposed(by: self.disposeBag)
}).disposed(by: self.disposeBag) }).disposed(by: self.disposeBag)
self.buttonsContainer.dialpadButton.rx.tap self.buttonsContainer.dialpadButton.rx.tap
......
...@@ -105,6 +105,8 @@ enum InteractionStatus: String { ...@@ -105,6 +105,8 @@ enum InteractionStatus: String {
case .sent: self = .succeed case .sent: self = .succeed
case .read: self = .read case .read: self = .read
case .failure: self = .failed case .failure: self = .failed
@unknown default:
self = .unknown
} }
} }
......
...@@ -80,15 +80,15 @@ class EditProfileViewController: UIViewController, UITextFieldDelegate, UIImageP ...@@ -80,15 +80,15 @@ class EditProfileViewController: UIViewController, UITextFieldDelegate, UIImageP
message: nil, message: nil,
preferredStyle: .actionSheet) preferredStyle: .actionSheet)
let cameraAction = UIAlertAction(title: L10n.Alerts.profileTakePhoto, style: UIAlertActionStyle.default) { _ in let cameraAction = UIAlertAction(title: L10n.Alerts.profileTakePhoto, style: UIAlertAction.Style.default) { _ in
self.takePicture() self.takePicture()
} }
let pictureAction = UIAlertAction(title: L10n.Alerts.profileUploadPhoto, style: UIAlertActionStyle.default) { _ in let pictureAction = UIAlertAction(title: L10n.Alerts.profileUploadPhoto, style: UIAlertAction.Style.default) { _ in
self.importPicture() self.importPicture()
} }
let cancelAction = UIAlertAction(title: L10n.Alerts.profileCancelPhoto, style: UIAlertActionStyle.cancel) let cancelAction = UIAlertAction(title: L10n.Alerts.profileCancelPhoto, style: UIAlertAction.Style.cancel)
alert.addAction(cameraAction) alert.addAction(cameraAction)
alert.addAction(pictureAction) alert.addAction(pictureAction)
...@@ -100,11 +100,11 @@ class EditProfileViewController: UIViewController, UITextFieldDelegate, UIImageP ...@@ -100,11 +100,11 @@ class EditProfileViewController: UIViewController, UITextFieldDelegate, UIImageP
} }
func takePicture() { func takePicture() {
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera) { if UIImagePickerController.isSourceTypeAvailable(UIImagePickerController.SourceType.camera) {
let imagePicker = UIImagePickerController() let imagePicker = UIImagePickerController()
imagePicker.delegate = self imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerControllerSourceType.camera imagePicker.sourceType = UIImagePickerController.SourceType.camera
imagePicker.cameraDevice = UIImagePickerControllerCameraDevice.front imagePicker.cameraDevice = UIImagePickerController.CameraDevice.front
imagePicker.allowsEditing = true imagePicker.allowsEditing = true
imagePicker.modalPresentationStyle = .overFullScreen imagePicker.modalPresentationStyle = .overFullScreen
self.present(imagePicker, animated: true, completion: nil) self.present(imagePicker, animated: true, completion: nil)
...@@ -115,19 +115,20 @@ class EditProfileViewController: UIViewController, UITextFieldDelegate, UIImageP ...@@ -115,19 +115,20 @@ class EditProfileViewController: UIViewController, UITextFieldDelegate, UIImageP
let imagePicker = UIImagePickerController() let imagePicker = UIImagePickerController()
imagePicker.delegate = self imagePicker.delegate = self
imagePicker.allowsEditing = true imagePicker.allowsEditing = true
imagePicker.sourceType = UIImagePickerControllerSourceType.photoLibrary imagePicker.sourceType = UIImagePickerController.SourceType.photoLibrary
imagePicker.modalPresentationStyle = .overFullScreen imagePicker.modalPresentationStyle = .overFullScreen
self.present(imagePicker, animated: true, completion: nil) self.present(imagePicker, animated: true, completion: nil)
} }
// MARK: - Delegates // MARK: - Delegates
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String: Any]) { internal func imagePickerController(_ picker: UIImagePickerController,
didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) {
var image: UIImage! var image: UIImage!
if let img = info[UIImagePickerControllerEditedImage] as? UIImage { if let img = info[.editedImage] as? UIImage {
image = img image = img
} else if let img = info[UIImagePickerControllerOriginalImage] as? UIImage { } else if let img = info[.originalImage] as? UIImage {
image = img image = img
} }
......
...@@ -92,7 +92,7 @@ class EditProfileViewModel { ...@@ -92,7 +92,7 @@ class EditProfileViewModel {
guard let account = self.accountService.currentAccount else {return} guard let account = self.accountService.currentAccount else {return}
var photo: String? var photo: String?
if let image = self.image, !image.isEqual(defaultImage), if let image = self.image, !image.isEqual(defaultImage),
let imageData = UIImagePNGRepresentation(image) { let imageData = image.pngData() {
photo = imageData.base64EncodedString() photo = imageData.base64EncodedString()
} }
self.profileService.updateAccountProfile(accountId: account.id, self.profileService.updateAccountProfile(accountId: account.id,
......
...@@ -63,8 +63,8 @@ extension CNContactVCardSerialization { ...@@ -63,8 +63,8 @@ extension CNContactVCardSerialization {
} }
if let scaledImage = scaledImage { if let scaledImage = scaledImage {
if UIImagePNGRepresentation(scaledImage) != nil { if scaledImage.pngData() != nil {
image = UIImagePNGRepresentation(scaledImage)! image = scaledImage.pngData()!
} }
} }
......
/*
* Copyright (C) 2017-2019 Savoir-faire Linux Inc.
*
* Author: Thibault Wittemberg <thibault.wittemberg@savoirfairelinux.com>
* Author: Quentin Muret <quentin.muret@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
import Foundation
import Chameleon
extension Chameleon {
static func setRingThemeUsingPrimaryColor (_ primaryColor: UIColor, withSecondaryColor secondaryColor: UIColor, andContentStyle contentStyle: UIContentStyle) {
var contentColor: UIColor
var secondaryContentColor: UIColor
switch contentStyle {
case .contrast:
contentColor = ContrastColorOf(primaryColor, returnFlat: false)
secondaryContentColor = ContrastColorOf(secondaryColor, returnFlat: false)
case .light:
contentColor = UIColor.white
secondaryContentColor = UIColor.white
case .dark:
contentColor = UIColor.flatBlackColorDark()
secondaryContentColor = UIColor.flatBlackColorDark()
}
MessageBubble.appearance().tintColor = secondaryContentColor
MessageBubble.appearance().backgroundColor = secondaryColor
MessageBubble.appearance(whenContainedInInstancesOf: [MessageCellSent.self]).tintColor = contentColor
MessageBubble.appearance(whenContainedInInstancesOf: [MessageCellSent.self]).backgroundColor = UIColor.jamiMsgCellSent
UILabel.appearance(whenContainedInInstancesOf: [MessageBubble.self, MessageCellSent.self]).textColor = UIColor.jamiMsgCellSentText
MessageBubble.appearance(whenContainedInInstancesOf: [MessageCellReceived.self]).tintColor = secondaryContentColor
MessageBubble.appearance(whenContainedInInstancesOf: [MessageCellReceived.self]).backgroundColor = UIColor.jamiMsgCellReceived
UILabel.appearance(whenContainedInInstancesOf: [MessageBubble.self, MessageCellReceived.self]).textColor = UIColor.jamiMsgCellReceivedText
MessageBubble.appearance(whenContainedInInstancesOf: [MessageCellGenerated.self]).tintColor = UIColor.clear
MessageBubble.appearance(whenContainedInInstancesOf: [MessageCellGenerated.self]).backgroundColor = UIColor.clear
}
}
...@@ -25,11 +25,11 @@ extension NotificationCenter { ...@@ -25,11 +25,11 @@ extension NotificationCenter {
static var keyboardHeight: Observable<CGFloat> { static var keyboardHeight: Observable<CGFloat> {
return Observable return Observable
.from([ .from([
NotificationCenter.default.rx.notification(NSNotification.Name.UIKeyboardWillShow) NotificationCenter.default.rx.notification(UIResponder.keyboardWillShowNotification)
.map { notification -> CGFloat in .map { notification -> CGFloat in
return (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue.height ?? 0 return (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue.height ?? 0
}, },
NotificationCenter.default.rx.notification(NSNotification.Name.UIKeyboardWillHide) NotificationCenter.default.rx.notification(UIResponder.keyboardWillHideNotification)
.map { _ -> CGFloat in .map { _ -> CGFloat in
0 0
} }
......
...@@ -48,11 +48,14 @@ extension String { ...@@ -48,11 +48,14 @@ extension String {
guard let messageData = self.data(using: .utf8) else {return ""} guard let messageData = self.data(using: .utf8) else {return ""}
var digestData = Data(count: Int(CC_MD5_DIGEST_LENGTH)) var digestData = Data(count: Int(CC_MD5_DIGEST_LENGTH))
_ = digestData.withUnsafeMutableBytes { digestBytes in digestData.withUnsafeMutableBytes { (digestBytes: UnsafeMutableRawBufferPointer) -> Void in
messageData.withUnsafeBytes { messageBytes in messageData.withUnsafeBytes { (messageBytes: UnsafeRawBufferPointer) -> Void in
CC_MD5(messageBytes, CC_LONG(messageData.count), digestBytes) CC_MD5(messageBytes.baseAddress,
CC_LONG(messageData.count),
digestBytes.bindMemory(to: UInt8.self).baseAddress)
} }
} }
return digestData.map { String(format: "%02hhx", $0) }.joined() return digestData.map { String(format: "%02hhx", $0) }.joined()
} }
......
...@@ -35,6 +35,44 @@ extension UIColor { ...@@ -35,6 +35,44 @@ extension UIColor {
self.init(red: (hex >> 16) & 0xff, green: (hex >> 8) & 0xff, blue: hex & 0xff, alpha: alpha) self.init(red: (hex >> 16) & 0xff, green: (hex >> 8) & 0xff, blue: hex & 0xff, alpha: alpha)
} }
func lighten(by percentage: CGFloat = 30.0) -> UIColor? {
return self.adjust(by: abs(percentage) )
}
func darker(by percentage: CGFloat) -> UIColor? {
return self.adjust(by: -1 * abs(percentage) )
}
func adjust(by percentage: CGFloat = 30.0) -> UIColor? {
var red: CGFloat = 0, green: CGFloat = 0, blue: CGFloat = 0, alpha: CGFloat = 0
if self.getRed(&red, green: &green, blue: &blue, alpha: &alpha) {
return UIColor(red: min(red + percentage/100, 1.0),
green: min(green + percentage/100, 1.0),
blue: min(blue + percentage/100, 1.0),
alpha: alpha)
} else {
return nil
}
}
public convenience init?(hexString: String) {
let hexString: String = hexString.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
let scanner = Scanner(string: hexString)
if hexString.hasPrefix("#") {
scanner.scanLocation = 1
}
var color: UInt32 = 0
scanner.scanHexInt32(&color)
let mask = 0x000000FF
let r = Int(color >> 16) & mask
let g = Int(color >> 8) & mask
let b = Int(color) & mask
let red = CGFloat(r) / 255.0
let green = CGFloat(g) / 255.0
let blue = CGFloat(b) / 255.0
self.init(red: red, green: green, blue: blue, alpha: 1)
}
static let jamiMain = UIColor(hex: 0x3F6DA7, alpha: 1.0) static let jamiMain = UIColor(hex: 0x3F6DA7, alpha: 1.0)
static let jamiSecondary = UIColor(hex: 0x1F4971, alpha: 1.0) static let jamiSecondary = UIColor(hex: 0x1F4971, alpha: 1.0)
static let jamiButtonLight = UIColor(hex: 0x285F97, alpha: 1.0) static let jamiButtonLight = UIColor(hex: 0x285F97, alpha: 1.0)
......
...@@ -83,13 +83,13 @@ extension UIImage { ...@@ -83,13 +83,13 @@ extension UIImage {
} }
func convertToData(ofMaxSize maxSize: Int) -> Data? { func convertToData(ofMaxSize maxSize: Int) -> Data? {
guard let imageData = UIImageJPEGRepresentation(self, 0.9) else { guard let imageData = self.jpegData(compressionQuality: 0.9) else {
return nil return nil
} }
var fileSize = imageData.count var fileSize = imageData.count
var i = 10 var i = 10
while fileSize > maxSize && i >= 0 { while fileSize > maxSize && i >= 0 {
guard let imageData = UIImageJPEGRepresentation(self, CGFloat(0.1 * Double(i))) else { guard let imageData = self.jpegData(compressionQuality: CGFloat(0.1 * Double(i))) else {
return nil return nil
} }
fileSize = imageData.count fileSize = imageData.count
...@@ -125,10 +125,10 @@ extension UIImage { ...@@ -125,10 +125,10 @@ extension UIImage {
newHeight = newWidth / ratio newHeight = newWidth / ratio
} else if ratio < 1, ratio != 0 { } else if ratio < 1, ratio != 0 {
// android image orientation bug? // android image orientation bug?
if self.imageOrientation == UIImageOrientation.right || if self.imageOrientation == UIImage.Orientation.right ||
self.imageOrientation == UIImageOrientation.left || self.imageOrientation == UIImage.Orientation.left ||
self.imageOrientation == UIImageOrientation.rightMirrored || self.imageOrientation == UIImage.Orientation.rightMirrored ||
self.imageOrientation == UIImageOrientation.leftMirrored { self.imageOrientation == UIImage.Orientation.leftMirrored {
newHeight *= ratio newHeight *= ratio
} else { } else {
newWidth = newHeight * ratio newWidth = newHeight * ratio
...@@ -172,10 +172,10 @@ extension UIImage { ...@@ -172,10 +172,10 @@ extension UIImage {
newHeight = newWidth / ratio newHeight = newWidth / ratio
} else if ratio < 1, ratio != 0 { } else if ratio < 1, ratio != 0 {
// android image orientation bug? // android image orientation bug?
if self.imageOrientation == UIImageOrientation.right || if self.imageOrientation == UIImage.Orientation.right ||
self.imageOrientation == UIImageOrientation.left || self.imageOrientation == UIImage.Orientation.left ||
self.imageOrientation == UIImageOrientation.rightMirrored || self.imageOrientation == UIImage.Orientation.rightMirrored ||
self.imageOrientation == UIImageOrientation.leftMirrored { self.imageOrientation == UIImage.Orientation.leftMirrored {
newHeight *= ratio newHeight *= ratio
} else { } else {
newWidth = newHeight * ratio newWidth = newHeight * ratio
...@@ -198,8 +198,8 @@ extension UIImage { ...@@ -198,8 +198,8 @@ extension UIImage {
//Setups up the font attributes that will be later used to dictate how the text should be drawn //Setups up the font attributes that will be later used to dictate how the text should be drawn
let textFont = UIFont.systemFont(ofSize: 20, weight: .semibold) let textFont = UIFont.systemFont(ofSize: 20, weight: .semibold)
let textFontAttributes = [ let textFontAttributes = [
NSAttributedStringKey.font: textFont, NSAttributedString.Key.font: textFont,
NSAttributedStringKey.foregroundColor: textColor] NSAttributedString.Key.foregroundColor: textColor]
let rect = CGRect(x: 0, y: 0, width: size.width, height: size.height) let rect = CGRect(x: 0, y: 0, width: size.width, height: size.height)
UIGraphicsBeginImageContextWithOptions(size, false, 0) UIGraphicsBeginImageContextWithOptions(size, false, 0)
backgroundColor.setFill() backgroundColor.setFill()
...@@ -207,7 +207,7 @@ extension UIImage { ...@@ -207,7 +207,7 @@ extension UIImage {
//Put the image into a rectangle as large as the original image. //Put the image into a rectangle as large as the original image.
self.draw(in: rect) self.draw(in: rect)
// Our drawing bounds // Our drawing bounds
let textSize = text.size(withAttributes: [NSAttributedStringKey.font: textFont]) let textSize = text.size(withAttributes: [NSAttributedString.Key.font: textFont])
let textRect = CGRect(x: rect.size.width/2 - textSize.width/2, y: rect.size.height/2 - textSize.height/2, let textRect = CGRect(x: rect.size.width/2 - textSize.width/2, y: rect.size.height/2 - textSize.height/2,
width: textSize.width, height: textSize.height) width: textSize.width, height: textSize.height)
text.draw(in: textRect, withAttributes: textFontAttributes) text.draw(in: textRect, withAttributes: textFontAttributes)
......
...@@ -25,7 +25,7 @@ extension UILabel { ...@@ -25,7 +25,7 @@ extension UILabel {
let attrString = NSMutableAttributedString(string: withText) let attrString = NSMutableAttributedString(string: withText)
let style = NSMutableParagraphStyle() let style = NSMutableParagraphStyle()
style.lineSpacing = withLineSpacing style.lineSpacing = withLineSpacing
attrString.addAttribute(NSAttributedStringKey.paragraphStyle, attrString.addAttribute(NSAttributedString.Key.paragraphStyle,
value: style, value: style,
range: NSRange(location: 0, length: withText.utf16.count)) range: NSRange(location: 0, length: withText.utf16.count))
self.attributedText = attrString self.attributedText = attrString
......
...@@ -132,7 +132,7 @@ extension UIViewController { ...@@ -132,7 +132,7 @@ extension UIViewController {
self.navigationController?.navigationBar.layer.masksToBounds = false self.navigationController?.navigationBar.layer.masksToBounds = false
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default) self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
self.navigationController?.navigationBar.shadowImage = UIImage() self.navigationController?.navigationBar.shadowImage = UIImage()
let textAttributes = [NSAttributedStringKey.foregroundColor: UIColor.jamiMain] let textAttributes = [NSAttributedString.Key.foregroundColor: UIColor.jamiMain]
self.navigationController?.navigationBar.titleTextAttributes = textAttributes self.navigationController?.navigationBar.titleTextAttributes = textAttributes
self.navigationController?.navigationBar.tintColor = UIColor.jamiMain self.navigationController?.navigationBar.tintColor = UIColor.jamiMain
} }
......
...@@ -35,7 +35,7 @@ class ContactRequestCell: UITableViewCell, NibReusable { ...@@ -35,7 +35,7 @@ class ContactRequestCell: UITableViewCell, NibReusable {
override func setSelected(_ selected: Bool, animated: Bool) { override func setSelected(_ selected: Bool, animated: Bool) {
self.backgroundColor = UIColor.jamiUITableViewCellSelection self.backgroundColor = UIColor.jamiUITableViewCellSelection
UIView.animate(withDuration: 0.35, animations: { UIView.animate(withDuration: 0.35, animations: {
self.backgroundColor = UIColor.jamiUITableViewCellSelection.lighten(byPercentage: 5.0) self.backgroundColor = UIColor.jamiUITableViewCellSelection.lighten(by: 5.0)
}) })
} }
......
...@@ -59,8 +59,8 @@ class ContactRequestsViewController: UIViewController, StoryboardBased, ViewMode ...@@ -59,8 +59,8 @@ class ContactRequestsViewController: UIViewController, StoryboardBased, ViewMode
self.setupTableView() self.setupTableView()
self.setupBindings() self.setupBindings()
self.navigationController?.navigationBar self.navigationController?.navigationBar
.titleTextAttributes = [NSAttributedStringKey.font: UIFont(name: "HelveticaNeue-Light", size: 25)!, .titleTextAttributes = [NSAttributedString.Key.font: UIFont(name: "HelveticaNeue-Light", size: 25)!,
NSAttributedStringKey.foregroundColor: UIColor.jamiMain] NSAttributedString.Key.foregroundColor: UIColor.jamiMain]
} }
func applyL10n() { func applyL10n() {
...@@ -70,7 +70,7 @@ class ContactRequestsViewController: UIViewController, StoryboardBased, ViewMode ...@@ -70,7 +70,7 @@ class ContactRequestsViewController: UIViewController, StoryboardBased, ViewMode
func setupTableView() { func setupTableView() {
self.tableView.estimatedRowHeight = 100.0 self.tableView.estimatedRowHeight = 100.0
self.tableView.rowHeight = UITableViewAutomaticDimension self.tableView.rowHeight = UITableView.automaticDimension
self.tableView.allowsSelection = true self.tableView.allowsSelection = true
//Register cell //Register cell
......
...@@ -296,7 +296,7 @@ class MessageCell: UITableViewCell, NibReusable { ...@@ -296,7 +296,7 @@ class MessageCell: UITableViewCell, NibReusable {
self.progressBar.tintColor = UIColor.jamiMain self.progressBar.tintColor = UIColor.jamiMain
} else if item.bubblePosition() == .sent { } else if item.bubblePosition() == .sent {
self.cancelButton.tintColor = UIColor(hex: 0xf00000, alpha: 1.0) self.cancelButton.tintColor = UIColor(hex: 0xf00000, alpha: 1.0)
self.progressBar.tintColor = UIColor.jamiMain.lighten(byPercentage: 0.2) self.progressBar.tintColor = UIColor.jamiMain.lighten(by: 0.2)
} }
if item.shouldDisplayTransferedImage { if item.shouldDisplayTransferedImage {
......
...@@ -64,8 +64,8 @@ class ConversationViewController: UIViewController, ...@@ -64,8 +64,8 @@ class ConversationViewController: UIViewController,
Register to keyboard notifications to adjust tableView insets when the keybaord appears Register to keyboard notifications to adjust tableView insets when the keybaord appears
or disappears or disappears
*/ */
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(withNotification:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(withNotification:)), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(withNotification:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(withNotification:)), name: UIResponder.keyboardWillHideNotification, object: nil)
keyboardDismissTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard)) keyboardDismissTapRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
} }
...@@ -90,15 +90,15 @@ class ConversationViewController: UIViewController, ...@@ -90,15 +90,15 @@ class ConversationViewController: UIViewController,
message: nil, message: nil,