From 4cbed7c4b1178d23474b22ddd35691cfe39b286d Mon Sep 17 00:00:00 2001 From: IvanStepanok Date: Wed, 11 Dec 2024 15:46:51 +0200 Subject: [PATCH] fix: address feedback --- .../Scroller/DismissKeyboardTapHandler.swift | 8 +--- Core/Core/Network/DownloadManager.swift | 3 +- Core/Core/Network/RequestInterceptor.swift | 12 ++--- .../AppReview/Elements/AppReviewButton.swift | 47 ++++++++++--------- Core/Core/View/Base/CourseCellView.swift | 11 ++--- .../Dates/Elements/BlockStatusView.swift | 8 ---- .../Dates/Elements/CompletedBlocks.swift | 1 - .../Base/BaseResponsesViewModel.swift | 3 +- OpenEdX/DI/ContainerMainActor.swift | 3 +- OpenEdX/Info.plist | 15 ------ .../DatesAndCalendar/CoursesToSyncView.swift | 16 +++---- default_config/dev/config.yaml | 6 +-- 12 files changed, 54 insertions(+), 79 deletions(-) diff --git a/Core/Core/AvoidingHelpers/Scroller/DismissKeyboardTapHandler.swift b/Core/Core/AvoidingHelpers/Scroller/DismissKeyboardTapHandler.swift index a757893e1..61cdfd1b4 100644 --- a/Core/Core/AvoidingHelpers/Scroller/DismissKeyboardTapHandler.swift +++ b/Core/Core/AvoidingHelpers/Scroller/DismissKeyboardTapHandler.swift @@ -18,9 +18,7 @@ final class DismissKeyboardTapHandler: NSObject { let recognizer = makeTapGestureRecognizer() UIApplication .shared - .connectedScenes - .compactMap { ($0 as? UIWindowScene)?.keyWindow } - .last? + .oexKeyWindow? .addGestureRecognizer(recognizer) tapRecognizer = recognizer return @@ -29,9 +27,7 @@ final class DismissKeyboardTapHandler: NSObject { if let recognizer = tapRecognizer { UIApplication .shared - .connectedScenes - .compactMap { ($0 as? UIWindowScene)?.keyWindow } - .last? + .oexKeyWindow? .removeGestureRecognizer(recognizer) tapRecognizer = nil } diff --git a/Core/Core/Network/DownloadManager.swift b/Core/Core/Network/DownloadManager.swift index c12347d10..47bef7d17 100644 --- a/Core/Core/Network/DownloadManager.swift +++ b/Core/Core/Network/DownloadManager.swift @@ -158,8 +158,7 @@ public class DownloadManager: DownloadManagerProtocol { private let connectivity: ConnectivityProtocol private var downloadRequest: DownloadRequest? private var isDownloadingInProgress: Bool = false - private nonisolated(unsafe) var currentDownloadEventPublisher: - PassthroughSubject = .init() + private nonisolated(unsafe) var currentDownloadEventPublisher = PassthroughSubject() private let backgroundTaskProvider = BackgroundTaskProvider() private var cancellables = Set() private nonisolated(unsafe) var failedDownloads: [DownloadDataTask] = [] diff --git a/Core/Core/Network/RequestInterceptor.swift b/Core/Core/Network/RequestInterceptor.swift index c165bc4b0..d6bb9b8cd 100644 --- a/Core/Core/Network/RequestInterceptor.swift +++ b/Core/Core/Network/RequestInterceptor.swift @@ -43,12 +43,12 @@ final public class RequestInterceptor: Alamofire.RequestInterceptor { let userAgent: String = { if let info = Bundle.main.infoDictionary { - let executable: AnyObject = info[kCFBundleExecutableKey as String] - as AnyObject? ?? "Unknown" as AnyObject - let bundle: AnyObject = info[kCFBundleIdentifierKey as String] - as AnyObject? ?? "Unknown" as AnyObject - let version: AnyObject = info["CFBundleShortVersionString"] - as AnyObject? ?? "Unknown" as AnyObject + let executable: AnyObject = info[kCFBundleExecutableKey as String] as AnyObject? + ?? "Unknown" as AnyObject + let bundle: AnyObject = info[kCFBundleIdentifierKey as String] as AnyObject? + ?? "Unknown" as AnyObject + let version: AnyObject = info["CFBundleShortVersionString"] as AnyObject? + ?? "Unknown" as AnyObject let os: AnyObject = ProcessInfo.processInfo.operatingSystemVersionString as AnyObject let mutableUserAgent = NSMutableString( string: "\(executable)/\(bundle) (\(version); OS \(os))" diff --git a/Core/Core/View/Base/AppReview/Elements/AppReviewButton.swift b/Core/Core/View/Base/AppReview/Elements/AppReviewButton.swift index 002d6379e..fda848184 100644 --- a/Core/Core/View/Base/AppReview/Elements/AppReviewButton.swift +++ b/Core/Core/View/Base/AppReview/Elements/AppReviewButton.swift @@ -26,33 +26,38 @@ struct AppReviewButton: View { Group { HStack(spacing: 4) { Text( - type == .submit ? CoreLocalization.Review.Button.submit + type == .submit + ? CoreLocalization.Review.Button.submit : ( type == .shareFeedback ? CoreLocalization.Review.Button.shareFeedback : CoreLocalization.Review.Button.rateUs ) ) - .foregroundColor(isActive ? Color.white : Color.black.opacity(0.6)) - .font(Theme.Fonts.labelLarge) - .padding(3) - - }.padding(.horizontal, 20) - .padding(.vertical, 9) - }.fixedSize() - .background(isActive + .foregroundColor(isActive ? Color.white : Color.black.opacity(0.6)) + .font(Theme.Fonts.labelLarge) + .padding(3) + + }.padding(.horizontal, 20) + .padding(.vertical, 9) + }.fixedSize() + .background( + isActive ? Theme.Colors.accentColor - : Theme.Colors.cardViewStroke) - .accessibilityElement(children: .ignore) - .accessibilityLabel( - type == .submit ? CoreLocalization.Review.Button.submit - : ( - type == .shareFeedback - ? CoreLocalization.Review.Button.shareFeedback - : CoreLocalization.Review.Button.rateUs - ) - ) - .cornerRadius(8) - }) + : Theme.Colors.cardViewStroke + ) + .accessibilityElement(children: .ignore) + .accessibilityLabel( + type == .submit + ? CoreLocalization.Review.Button.submit + : ( + type == .shareFeedback + ? CoreLocalization.Review.Button.shareFeedback + : CoreLocalization.Review.Button.rateUs + ) + ) + .cornerRadius(8) + } + ) } } diff --git a/Core/Core/View/Base/CourseCellView.swift b/Core/Core/View/Base/CourseCellView.swift index 5f93307f8..9fa667628 100644 --- a/Core/Core/View/Base/CourseCellView.swift +++ b/Core/Core/View/Base/CourseCellView.swift @@ -99,7 +99,7 @@ public struct CourseCellView: View { .padding(.vertical, type == .discovery ? 10 : 0) Spacer() } - + }.frame(height: 105) .background(Theme.Colors.background) .opacity(showView ? 1 : 0) @@ -107,9 +107,9 @@ public struct CourseCellView: View { .accessibilityElement(children: .ignore) .accessibilityLabel( courseName + " " + ( - type == .dashboard ? ( - courseEnd == "" ? courseStart : courseEnd - ) : "" + type == .dashboard + ? (courseEnd == "" ? courseStart : courseEnd) + : "" ) ) .onAppear { @@ -120,7 +120,7 @@ public struct CourseCellView: View { } } } - + VStack { if Int(index) != cellsCount { Divider() @@ -169,7 +169,6 @@ struct CourseCellView_Previews: PreviewProvider { // Divider() } } - } } // swiftlint:enable all diff --git a/Course/Course/Presentation/Dates/Elements/BlockStatusView.swift b/Course/Course/Presentation/Dates/Elements/BlockStatusView.swift index 27510e43a..8a422966e 100644 --- a/Course/Course/Presentation/Dates/Elements/BlockStatusView.swift +++ b/Course/Course/Presentation/Dates/Elements/BlockStatusView.swift @@ -38,12 +38,4 @@ struct BlockStatusView: View { .padding(.top, 0.2) } } - - func applyStyle(string: String, forgroundColor: Color, backgroundColor: Color) -> AttributedString { - var attributedString = AttributedString(string) - attributedString.font = Theme.Fonts.bodySmall - attributedString.foregroundColor = forgroundColor - attributedString.backgroundColor = backgroundColor - return attributedString - } } diff --git a/Course/Course/Presentation/Dates/Elements/CompletedBlocks.swift b/Course/Course/Presentation/Dates/Elements/CompletedBlocks.swift index 3295dc224..81fef4b08 100644 --- a/Course/Course/Presentation/Dates/Elements/CompletedBlocks.swift +++ b/Course/Course/Presentation/Dates/Elements/CompletedBlocks.swift @@ -73,7 +73,6 @@ struct CompletedBlocks: View { Image(systemName: "chevron.right") .resizable() .flipsForRightToLeftLayoutDirection(true) - .scaledToFit() .frame(width: 6.55, height: 11.15) .labelStyle(.iconOnly) diff --git a/Discussion/Discussion/Presentation/Comments/Base/BaseResponsesViewModel.swift b/Discussion/Discussion/Presentation/Comments/Base/BaseResponsesViewModel.swift index da3070355..16e4def50 100644 --- a/Discussion/Discussion/Presentation/Comments/Base/BaseResponsesViewModel.swift +++ b/Discussion/Discussion/Presentation/Comments/Base/BaseResponsesViewModel.swift @@ -137,8 +137,7 @@ public class BaseResponsesViewModel { } func addNewPost(_ post: Post) { - let newPostWithAvatar = post - postComments?.comments.append(newPostWithAvatar) + postComments?.comments.append(post) itemsCount += 1 } diff --git a/OpenEdX/DI/ContainerMainActor.swift b/OpenEdX/DI/ContainerMainActor.swift index 294dbe9fd..4ae99ba37 100644 --- a/OpenEdX/DI/ContainerMainActor.swift +++ b/OpenEdX/DI/ContainerMainActor.swift @@ -8,6 +8,7 @@ import Foundation @preconcurrency import Swinject +//swiftlint:disable line_length // MARK: - MainActor registration @available(iOS 13.0, macOS 10.15, *) extension Container { @@ -275,5 +276,5 @@ extension Container { } } } - } +//swiftlint:enable line_length diff --git a/OpenEdX/Info.plist b/OpenEdX/Info.plist index 631e9050c..e9bd32e58 100644 --- a/OpenEdX/Info.plist +++ b/OpenEdX/Info.plist @@ -6,21 +6,6 @@ openEdx.offlineProgressSync - CFBundleURLTypes - - - CFBundleTypeRole - Viewer - CFBundleURLIconFile - - CFBundleURLName - test - CFBundleURLSchemes - - test - - - Configuration $(CONFIGURATION) FirebaseAppDelegateProxyEnabled diff --git a/Profile/Profile/Presentation/DatesAndCalendar/CoursesToSyncView.swift b/Profile/Profile/Presentation/DatesAndCalendar/CoursesToSyncView.swift index 8c4727954..ede274a85 100644 --- a/Profile/Profile/Presentation/DatesAndCalendar/CoursesToSyncView.swift +++ b/Profile/Profile/Presentation/DatesAndCalendar/CoursesToSyncView.swift @@ -94,9 +94,9 @@ public struct CoursesToSyncView: View { course.synced == viewModel.synced && ( !viewModel.hideInactiveCourses || course.recentlyActive ) - }) - .sorted { $0.recentlyActive && !$1.recentlyActive - } + } + ) + .sorted { $0.recentlyActive && !$1.recentlyActive } .enumerated() ), id: \.offset @@ -140,11 +140,11 @@ public struct CoursesToSyncView: View { Text(ProfileLocalization.Sync.noSynced) .foregroundStyle(Theme.Colors.textPrimary) .font(Theme.Fonts.titleMedium) - Text(ProfileLocalization.Sync.noSyncedDescription) - .multilineTextAlignment(.center) - .foregroundStyle(Theme.Colors.textPrimary) - .font(Theme.Fonts.labelMedium) - .frame(width: 245) + Text(ProfileLocalization.Sync.noSyncedDescription) + .multilineTextAlignment(.center) + .foregroundStyle(Theme.Colors.textPrimary) + .font(Theme.Fonts.labelMedium) + .frame(width: 245) } } } diff --git a/default_config/dev/config.yaml b/default_config/dev/config.yaml index 5277cfa3b..c3d9a7338 100644 --- a/default_config/dev/config.yaml +++ b/default_config/dev/config.yaml @@ -1,9 +1,9 @@ -API_HOST_URL: 'https://axim-mobile.raccoongang.net' +API_HOST_URL: 'http://localhost:8000' SSO_URL: 'http://localhost:8000' SSO_FINISHED_URL: 'http://localhost:8000' -ENVIRONMENT_DISPLAY_NAME: 'lms-axim-stage' +ENVIRONMENT_DISPLAY_NAME: 'Localhost' FEEDBACK_EMAIL_ADDRESS: 'support@example.com' -OAUTH_CLIENT_ID: 'zP3vPz00c8fTRpYjNbVSlA1fxt9LnCxTM4JK1KQ0' +OAUTH_CLIENT_ID: '' DISCOVERY: TYPE: "native"