Commit df2c6cdf authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

fix warnings

Change-Id: Iee5bc474b8e0962681cb99621ccda11c0bfd4ec7
parent 175317d5
......@@ -75,9 +75,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// ignore sigpipe
// swiftlint:disable nesting
typealias SigHandler = @convention(c) (Int32) -> Void
let SIG_IGN = unsafeBitCast(OpaquePointer(bitPattern: 1), to: SigHandler.self)
signal(SIGPIPE, SIG_IGN)
// swiftlint:enable nesting
self.window = UIWindow(frame: UIScreen.main.bounds)
......@@ -389,9 +391,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
return nil
}
if rootViewController.isKind(of: (UITabBarController).self) {
return topViewControllerWithRootViewController(rootViewController: (rootViewController as! UITabBarController).selectedViewController)
return topViewControllerWithRootViewController(rootViewController: (rootViewController as? UITabBarController)?.selectedViewController)
} else if rootViewController.isKind(of: (UINavigationController).self) {
return topViewControllerWithRootViewController(rootViewController: (rootViewController as! UINavigationController).visibleViewController)
return topViewControllerWithRootViewController(rootViewController: (rootViewController as? UINavigationController)?.visibleViewController)
} else if rootViewController.presentedViewController != nil {
return topViewControllerWithRootViewController(rootViewController: rootViewController.presentedViewController)
}
......
......@@ -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 {
private func < <T: Comparable>(lhs: T?, rhs: T?) -> Bool {
switch (lhs, rhs) {
case let (varL?, varR?):
return varL < varR
......
......@@ -299,14 +299,14 @@ class ConversationViewModel: Stateable, ViewModel {
}, onError: { [unowned self] (error) in
self.log.info(error)
}).disposed(by: self.disposeBag)
}) { [unowned self] error in
}, onError: { [unowned self] error in
self.contactsService.sendContactRequest(toContactRingId: self.conversation.value.recipientRingId, vCard: nil, withAccount: self.accountService.currentAccount!)
.subscribe(onCompleted: { [unowned self] in
self.log.info("contact request sent")
}, onError: { [unowned self] (error) in
self.log.info(error)
}).disposed(by: self.disposeBag)
}.disposed(by: self.disposeBag)
}).disposed(by: self.disposeBag)
}
func block() {
......
......@@ -40,9 +40,6 @@ open class GrowingTextView: UITextView {
@IBInspectable open var placeholderColor: UIColor = UIColor(white: 0.8, alpha: 1.0) {
didSet { setNeedsDisplay() }
}
@IBInspectable open var attributedPlaceholder: NSAttributedString? {
didSet { setNeedsDisplay() }
}
// Initialize
override public init(frame: CGRect, textContainer: NSTextContainer?) {
......@@ -73,10 +70,8 @@ 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 where constraint.firstAttribute == .height {
if constraint.relation == .equal {
for constraint in constraints where (constraint.firstAttribute == .height && constraint.relation == .equal) {
heightConstraint = constraint
}
}
}
......@@ -146,10 +141,7 @@ open class GrowingTextView: UITextView {
let height = rect.size.height - yValue - textContainerInset.bottom
let placeholderRect = CGRect(x: xValue, y: yValue, width: width, height: height)
if let attributedPlaceholder = attributedPlaceholder {
// Prefer to use attributedPlaceholder
attributedPlaceholder.draw(in: placeholderRect)
} else if let placeholder = placeholder {
if let placeholder = placeholder {
// Otherwise user placeholder and inherit `text` attributes
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = textAlignment
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina5_5" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
......@@ -31,8 +31,8 @@
</constraints>
<state key="normal" image="share_button"/>
</button>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" hasAttributedTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ifq-LQ-X1n" userLabel="Send Button">
<rect key="frame" x="272" y="35" width="30" height="34"/>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" hasAttributedTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ifq-LQ-X1n" userLabel="Send Button">
<rect key="frame" x="274" y="35" width="28" height="26"/>
<constraints>
<constraint firstAttribute="height" constant="26" id="9PM-CR-8PT"/>
<constraint firstAttribute="width" constant="28" id="cfz-1y-EkK"/>
......@@ -110,8 +110,8 @@
</view>
</objects>
<resources>
<image name="camera" width="72" height="72"/>
<image name="camera" width="64" height="67"/>
<image name="send_button" width="102.40000152587891" height="102.40000152587891"/>
<image name="share_button" width="72" height="72"/>
<image name="share_button" width="72" height="68"/>
</resources>
</document>
......@@ -88,7 +88,7 @@ class SmartlistViewModel: Stateable, ViewModel {
.filter({ self?.contactsService.contact(withRingId: $0.recipientRingId) != nil
|| (!$0.messages.isEmpty && (self?.contactsService.contactRequest(withRingId: $0.recipientRingId) == nil))
})
.flatMap({ conversationModel in
.compactMap({ conversationModel in
var conversationViewModel: ConversationViewModel?
......
......@@ -331,9 +331,9 @@ class VideoService: FrameExtractorDelegate {
self.camera.switchCamera()
.subscribe(onCompleted: {
print ("camera switched")
}) { error in
}, onError: { error in
print(error)
}.disposed(by: self.disposeBag)
}).disposed(by: self.disposeBag)
}
func setCameraOrientation(orientation: UIDeviceOrientation) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment