Skip to content

Commit

Permalink
MOB-4878 remove warnings (#609)
Browse files Browse the repository at this point in the history
* add explanation to imports in payment related files, remove unknown default warnings, inhibit pod warnings, suppress TODO warnings

* update pods to recommended settings

* remove or suppress line length and type name warnings

* remove public access to loading image view, fix more warnings

* remove warnings, adapt swiftlint exception for UITextView SwiftUI extension

* remove more warnings

* remove warning from client app delegate

* remove location manager deprecated warnings

* remove warning in ErrorBannerView

* improve region code selection

* remove LoyaltyViewDataModel
  • Loading branch information
dianakarh authored Sep 5, 2023
1 parent 8738bea commit 73a3798
Show file tree
Hide file tree
Showing 55 changed files with 165 additions and 143 deletions.
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
disabled_rules:
- identifier_name
- void_function_in_ternary
- todo
trailing_whitespace:
ignores_empty_lines: true
ignores_comments: true
Expand Down
2 changes: 1 addition & 1 deletion AdyenPSP/AdyenCardRegistrationFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation
import KarhooSDK
import KarhooUISDK
import KarhooUISDK // Even if the import may not be required in some configurations, it is needed for SPM linking. Do not remove unless you are sure a new solution allowes SPM-based project/app to be compiled.
#if canImport(Adyen)
import Adyen
#endif
Expand Down
2 changes: 1 addition & 1 deletion AdyenPSP/AdyenPaymentNonceProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation
import KarhooSDK
import KarhooUISDK
import KarhooUISDK // Even if the import may not be required in some configurations, it is needed for SPM linking. Do not remove unless you are sure a new solution allowes SPM-based project/app to be compiled.

final class AdyenPaymentNonceProvider: PaymentNonceProvider {

Expand Down
2 changes: 1 addition & 1 deletion AdyenPSP/AdyenResponseHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import Foundation
import KarhooSDK
import KarhooUISDK
import KarhooUISDK // Even if the import may not be required in some configurations, it is needed for SPM linking. Do not remove unless you are sure a new solution allowes SPM-based project/app to be compiled.
#if canImport(Adyen)
import Adyen
#endif
Expand Down
2 changes: 1 addition & 1 deletion AdyenPSP/AdyenThreeDSecureUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//
import Foundation
import KarhooUISDK
import KarhooUISDK // Even if the import may not be required in some configurations, it is needed for SPM linking. Do not remove unless you are sure a new solution allowes SPM-based project/app to be compiled.

public struct AdyenThreeDSecureUtils: ThreeDSecureUtils {
public init() {}
Expand Down
2 changes: 1 addition & 1 deletion BraintreePSP/BraintreeCardRegistrationFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation
import KarhooSDK
import KarhooUISDK
import KarhooUISDK // Even if the import may not be required in some configurations, it is needed for SPM linking. Do not remove unless you are sure a new solution allowes SPM-based project/app to be compiled.

public final class BraintreeCardRegistrationFlow: CardRegistrationFlow {

Expand Down
4 changes: 3 additions & 1 deletion BraintreePSP/BraintreePaymentNonceProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation
import KarhooSDK
import KarhooUISDK
import KarhooUISDK // Even if the import may not be required in some configurations, it is needed for SPM linking. Do not remove unless you are sure a new solution allowes SPM-based project/app to be compiled.

final class BraintreePaymentNonceProvider: PaymentNonceProvider {

Expand Down Expand Up @@ -59,6 +59,8 @@ final class BraintreePaymentNonceProvider: PaymentNonceProvider {
case .failure:
self?.callbackResult?(.completed(value: .failedToInitialisePaymentService(error: result.getErrorValue())))
return
@unknown default:
print("Unknown enum value in BraintreePaymentNonceProvider.getPaymentNonce")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion BraintreePSP/BraintreePaymentScreensBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation
import KarhooSDK
import KarhooUISDK
import KarhooUISDK // Even if the import may not be required in some configurations, it is needed for SPM linking. Do not remove unless you are sure a new solution allowes SPM-based project/app to be compiled.
#if canImport(BraintreeDropIn)
import BraintreeDropIn
#endif
Expand Down
2 changes: 1 addition & 1 deletion BraintreePSP/BraintreeThreeDSecureProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation
import KarhooSDK
import KarhooUISDK
import KarhooUISDK // Even if the import may not be required in some configurations, it is needed for SPM linking. Do not remove unless you are sure a new solution allowes SPM-based project/app to be compiled.
#if canImport(Braintree)
import Braintree
#endif
Expand Down
2 changes: 1 addition & 1 deletion Client/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
if notification.request.identifier.contains(KarhooAnalitycsServiceWithNotifications.karhooNotificationIdentifierPrefix){
completionHandler([.alert,.badge])
completionHandler([.banner,.badge])
}
}

Expand Down
4 changes: 2 additions & 2 deletions Client/KarhooAnalyticsServiceWithNotifications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class KarhooAnalitycsServiceWithNotifications: AnalyticsService {
trigger: trigger
)
UNUserNotificationCenter.current().add(request) { (error) in
if error != nil {
print(error)
if let error = error {
print(error)
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion KarhooUISDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -4291,6 +4291,7 @@
};
5C8316B92469FCB200BAA926 /* SwiftLint Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
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 = "1320"
LastUpgradeVersion = "1430"
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 = "1130"
LastUpgradeVersion = "1430"
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 = "1130"
LastUpgradeVersion = "1430"
version = "1.7">
<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 = "1130"
LastUpgradeVersion = "1430"
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 = "1400"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 3 additions & 1 deletion KarhooUISDK/API/KarhooUISDKConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public protocol KarhooUISDKConfiguration: KarhooSDKConfiguration {

var paymentManager: PaymentManager { get }

/// Return `true` if you want `Karhoo UISDK` to use `Add to calendar` feature, allowing users to add scheduled ride to the device main calendar. This feature required host app’s `info.plist` to have `Privacy - Calendars Usage Description` marked as used. If you do not want to modify your `info.plist`, or you don’t want user to see this feature, return `false`.
/// Return `true` if you want `Karhoo UISDK` to use `Add to calendar` feature, allowing users to add scheduled ride to the device main calendar.
/// This feature required host app’s `info.plist` to have `Privacy - Calendars Usage Description` marked as used.
/// If you do not want to modify your `info.plist`, or you don’t want user to see this feature, return `false`.
var useAddToCalendarFeature: Bool { get }
}

Expand Down
8 changes: 6 additions & 2 deletions KarhooUISDK/CommonUI/BaseControls/BaseView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ public extension BaseView {
configService.uiConfig(uiConfigRequest: UIConfigRequest(viewId: self.accessibilityIdentifier))
.execute(callback: { [weak self] result in
switch result {
case .success(let model, _): self?.set(configuration: model)
case .failure: print("no config for view: \(self?.accessibilityIdentifier ?? "nil" )")
case .success(let model, _):
self?.set(configuration: model)
case .failure:
print("no config for view: \(self?.accessibilityIdentifier ?? "nil" )")
@unknown default:
print("Unknown enum value in BaseView.configure")
}
})
}
Expand Down
3 changes: 1 addition & 2 deletions KarhooUISDK/CommonUI/BottomSheet/KarhooBottomSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ struct KarhooBottomSheet<Content: View>: View {
maxHeight: UIScreen.main.bounds.height - getTopPadding()
)
}
.colorScheme(.light) // Delete this line after dark mode modifications
.colorScheme(.light) // TODO: Delete this line after dark mode modifications

}


private func getTopPadding() -> CGFloat {
UIApplication.shared.windows.first?.safeAreaInsets.top ?? 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import UIKit
import SwiftUI

@available(*, deprecated, message: "Public access to this class will be removed in next release")
public final class LoadingImageView: UIView {
final class LoadingImageView: UIView {

private var imageView: UIImageView!
private var activityIndicator: UIActivityIndicatorView!
Expand Down Expand Up @@ -51,7 +50,7 @@ public final class LoadingImageView: UIView {
activityIndicator = UIActivityIndicatorView()
activityIndicator.translatesAutoresizingMaskIntoConstraints = false
activityIndicator.accessibilityIdentifier = "caching_activity_indicator"
activityIndicator.style = .gray
activityIndicator.style = .medium
activityIndicator.hidesWhenStopped = true

addSubview(activityIndicator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public final class LoadingView: UIView {
accessibilityIdentifier = "loading_view"
alpha = 0.0

activityIndicatorView = UIActivityIndicatorView(style: .whiteLarge)
activityIndicatorView = UIActivityIndicatorView(style: .large)
activityIndicatorView.accessibilityIdentifier = "activity_indicator"
activityIndicatorView.translatesAutoresizingMaskIntoConstraints = false
activityIndicatorView.startAnimating()
Expand Down
46 changes: 24 additions & 22 deletions KarhooUISDK/CommonUI/UIConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Diana Petrea on 05.01.2022.
// Copyright © 2022 Flit Technologies Ltd. All rights reserved.
//
// swiftlint:disable comment_spacing nesting
// swiftlint:disable nesting

import Foundation
import UIKit
Expand All @@ -20,25 +20,25 @@ public struct UIConstants {
public static let xxSmall: CGFloat = 2

/// 4
public static let xSmall: CGFloat = 4 //3...5
public static let xSmall: CGFloat = 4 // 3...5

/// 8
public static let small: CGFloat = 8 //6...10
public static let small: CGFloat = 8 // 6...10

/// 12
public static let medium: CGFloat = 12 //11...14
public static let medium: CGFloat = 12 // 11...14

/// 16
public static let standard: CGFloat = 16 //15...21
public static let standard: CGFloat = 16 // 15...21

/// 24
public static let large: CGFloat = 24 //22...28
public static let large: CGFloat = 24 // 22...28

/// 32
public static let xLarge: CGFloat = 32 //29...40
public static let xLarge: CGFloat = 32 // 29...40

/// 44
public static let xxLarge: CGFloat = 44 //41...56
public static let xxLarge: CGFloat = 44 // 41...56

/// 64
public static let xxxLarge: CGFloat = 64 // 57+
Expand Down Expand Up @@ -73,22 +73,22 @@ public struct UIConstants {

public struct Icon {
/// 11
public static let small: CGFloat = 11 //8...14
public static let small: CGFloat = 11 // 8...14

/// 16
public static let medium: CGFloat = 16 //15...17
public static let medium: CGFloat = 16 // 15...17

/// 22
public static let standard: CGFloat = 22 //18...26
public static let standard: CGFloat = 22 // 18...26

/// 32
public static let large: CGFloat = 32 //27...39
public static let large: CGFloat = 32 // 27...39

/// 44
public static let xLarge: CGFloat = 44 //44...53
public static let xLarge: CGFloat = 44 // 44...53

/// 64
public static let xxLarge: CGFloat = 64 //54+
public static let xxLarge: CGFloat = 64 // 54+

/// 120
public static let xxxLarge: CGFloat = 120
Expand Down Expand Up @@ -151,7 +151,7 @@ public struct UIConstants {
public static let headerHeight: CGFloat = 90

/// 50
public static let rowHeight: CGFloat = 50 //includes KarhooQuoteListViewController > prebookQuotesTitleLabel height
public static let rowHeight: CGFloat = 50 // includes KarhooQuoteListViewController > prebookQuotesTitleLabel height

/// 60
public static let largeRowHeight: CGFloat = 60 // includes the address search bar height
Expand All @@ -173,16 +173,16 @@ public struct UIConstants {
public static let findTripSpinnerSize = CGSize(width: 212, height: 212)

/// 150
public static let fleetAvailabilityHeight: CGFloat = 150 //KarhooBookingViewController > bottomNotificationViewBottomConstraint
public static let fleetAvailabilityHeight: CGFloat = 150 // KarhooBookingViewController > bottomNotificationViewBottomConstraint

/// 230
public static let quoteListHeight: CGFloat = 230 //QuoteListPanelLayout
public static let quoteListHeight: CGFloat = 230 // QuoteListPanelLayout

/// 140
public static let quoteListTopOffset: CGFloat = 140 //QuoteListPanelLayout
public static let quoteListTopOffset: CGFloat = 140 // QuoteListPanelLayout

/// 162
public static let cancelTripProgressViewWidth: CGFloat = 162 //KarhooCancelButtonView
public static let cancelTripProgressViewWidth: CGFloat = 162 // KarhooCancelButtonView

/// 180 x 180
public static let driverDetailsViewSize = CGSize(width: 180, height: 180)
Expand All @@ -199,7 +199,7 @@ public struct UIConstants {
public static let xSmall: CGFloat = 2

/// 4
public static let small: CGFloat = 4 //3...5
public static let small: CGFloat = 4 // 3...5

/// 8
public static let medium: CGFloat = 8
Expand All @@ -222,7 +222,7 @@ public struct UIConstants {
public static let border: CGFloat = 0.5
}

//Animation duration
// Animation duration
public struct Duration {
/// 0.1
public static let xShort: Double = 0.1
Expand All @@ -242,7 +242,7 @@ public struct UIConstants {
/// 0.1
public static let xxSmallDelay: Double = 0.1

///0.25
/// 0.25
public static let xSmallDelay: Double = 0.25

/// 0.3
Expand Down Expand Up @@ -290,3 +290,5 @@ public struct UIConstants {
static let shadowAlpha: CGFloat = 0.5
}
}

// swiftlint:enable nesting
2 changes: 1 addition & 1 deletion KarhooUISDK/CommonUI/UITexts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ public enum UITexts {
public static let vehicleLogoHybrid = "kh_uisdk_accessibility_icon_hybrid".localized
public static let vehicleLogoEconomy = "kh_uisdk_accessibility_icon_economy".localized
public static let loyaltySwitchEnabled = "kh_uisdk_accessibility_loyalty_switch_enabled".localized
public static let loyaltySwitchDisabled = "kh_uisdk_accessibility_loyalty_switch_disabled".localized
public static let loyaltySwitchDisabled = "kh_uisdk_accessibility_loyalty_switch_disabled".localized
public static let pickUpAddress = "kh_uisdk_accessibility_label_pickup_address".localized
public static let dropOffAddress = "kh_uisdk_accessibility_label_drop_off_address".localized
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import Foundation
import UIKit
import KarhooSDK



final class VehicleCapacityView: UIStackView {

private var passengerCapacityView: IconPlusTextHorizontalView?
Expand Down
Loading

0 comments on commit 73a3798

Please sign in to comment.