Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Part 2 sync to upstream #530

Merged
merged 5 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Core/Core/SwiftGen/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ import Foundation
// swiftlint:disable explicit_type_interface function_parameter_count identifier_name line_length
// swiftlint:disable nesting type_body_length type_name vertical_whitespace_opening_braces
public enum CoreLocalization {
/// Back
public static let back = CoreLocalization.tr("Localizable", "BACK", fallback: "Back")
/// Close
public static let close = CoreLocalization.tr("Localizable", "CLOSE", fallback: "Close")
/// Done
public static let done = CoreLocalization.tr("Localizable", "DONE", fallback: "Done")
/// Ok
public static let ok = CoreLocalization.tr("Localizable", "OK", fallback: "Ok")
/// View in Safari
public static let openInBrowser = CoreLocalization.tr("Localizable", "OPEN_IN_BROWSER", fallback: "View in Safari")
/// Register
Expand All @@ -21,7 +27,7 @@ public enum CoreLocalization {
/// Tomorrow
public static let tomorrow = CoreLocalization.tr("Localizable", "TOMORROW", fallback: "Tomorrow")
/// View
public static let view = CoreLocalization.tr("Localizable", "VIEW ", fallback: "View")
public static let view = CoreLocalization.tr("Localizable", "VIEW", fallback: "View")
/// Yesterday
public static let yesterday = CoreLocalization.tr("Localizable", "YESTERDAY", fallback: "Yesterday")
public enum Alert {
Expand Down
2 changes: 2 additions & 0 deletions Core/Core/View/Base/BackNavigationButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public struct BackNavigationButton: View {

public var body: some View {
BackNavigationButtonRepresentable(action: action, color: color, viewModel: viewModel)
.accessibilityIdentifier("back_button")
.accessibilityLabel(CoreLocalization.back)
.onAppear {
viewModel.loadItems()
}
Expand Down
16 changes: 11 additions & 5 deletions Core/Core/View/Base/OfflineSnackBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,29 @@ public struct OfflineSnackBarView: View {
HStack(spacing: 12) {
Text(CoreLocalization.NoInternet.offline)
.accessibilityIdentifier("no_internet_text")
.foregroundColor(Theme.Colors.snackbarTextColor)
Spacer()
Button(CoreLocalization.NoInternet.dismiss,
action: {
Button(action: {
withAnimation {
dismiss = true
}
}, label: {
Text(CoreLocalization.NoInternet.dismiss)
.foregroundColor(Theme.Colors.snackbarTextColor)
})
.accessibilityIdentifier("no_internet_dismiss_button")
Button(CoreLocalization.NoInternet.reload,
action: {
Button(action: {
Task {
await reloadAction()
}
withAnimation {
dismiss = true
}
})
}, label: {
Text(CoreLocalization.NoInternet.reload)
.foregroundColor(Theme.Colors.snackbarTextColor)
}
)
.accessibilityIdentifier("no_internet_reload_button")
}.padding(.horizontal, 16)
.font(Theme.Fonts.titleSmall)
Expand Down
6 changes: 5 additions & 1 deletion Core/Core/View/Base/UnitButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ public struct UnitButtonView: View {
.padding(.leading, 20)
.font(Theme.Fonts.labelLarge)
CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template)
.foregroundColor(Theme.Colors.styledButtonText)
.foregroundColor(
type == .continueLesson
? Theme.Colors.accentColor
: Theme.Colors.styledButtonText
)
.rotationEffect(Angle.degrees(180))
.padding(.trailing, 20)
}
Expand Down
21 changes: 12 additions & 9 deletions Core/Core/View/Base/Webview/WebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,23 @@ public struct WebView: UIViewRepresentable {
}

let baseURL = await parent.viewModel.baseURL
if !baseURL.isEmpty, !url.absoluteString.starts(with: baseURL) {
if navigationAction.navigationType == .other {
return .allow
} else if navigationAction.navigationType == .linkActivated {
await MainActor.run {
switch navigationAction.navigationType {
case .other, .formSubmitted, .formResubmitted:
return .allow
case .linkActivated:
await MainActor.run {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:])
}
} else if navigationAction.navigationType == .formSubmitted {
return .allow
}
return .cancel
default:
if !baseURL.isEmpty, !url.absoluteString.starts(with: baseURL) {
return .cancel
} else {
return .allow
}
}

return .allow
}

public func webView(
Expand Down
5 changes: 4 additions & 1 deletion Core/Core/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@
"SETTINGS.DOWNLOAD_QUALITY_720_DESCRIPTION" = "Best quality";

"DONE" = "Done";
"VIEW " = "View";
"VIEW" = "View";
"BACK" = "Back";
"OK" = "Ok";
"CLOSE" = "Close";

"PICKER.SEARCH" = "Search";
"PICKER.ACCEPT" = "Accept";
Expand Down
3 changes: 2 additions & 1 deletion Dashboard/Dashboard/Data/Network/DashboardEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ enum DashboardEndpoint: EndPointType {
return .requestParameters(parameters: params, encoding: URLEncoding.queryString)

case let .getAllCourses(_, filteredBy, page):
var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }
let params: Parameters = [
"page_size": 10,
"page_size": idiom == .pad ? 24 : 12,
"status": filteredBy,
"requested_fields": "course_progress",
"page": page
Expand Down
8 changes: 4 additions & 4 deletions Profile/Profile/Presentation/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public struct SettingsView: View {
.resizable()
.edgesIgnoringSafeArea(.top)
}
.frame(maxWidth: .infinity, maxHeight: 200)
.frame(maxWidth: .infinity, maxHeight: 50)
.accessibilityIdentifier("auth_bg_image")

// MARK: - Page name
Expand Down Expand Up @@ -120,7 +120,7 @@ public struct SettingsView: View {
viewModel.router.showDatesAndCalendar()
}, label: {
HStack {
Text("Dates & Calendar") // TODO: add ProfileLocalization...
Text(ProfileLocalization.datesAndCalendar)
.font(Theme.Fonts.titleMedium)
Spacer()
Image(systemName: "chevron.right")
Expand All @@ -130,7 +130,7 @@ public struct SettingsView: View {

}
.accessibilityElement(children: .ignore)
.accessibilityLabel(ProfileLocalization.settingsVideo)
.accessibilityLabel(ProfileLocalization.datesAndCalendar)
.cardStyle(
bgColor: Theme.Colors.textInputUnfocusedBackground,
strokeColor: .clear
Expand All @@ -156,7 +156,7 @@ public struct SettingsView: View {
.accessibilityIdentifier("video_settings_button")
}
.accessibilityElement(children: .ignore)
.accessibilityLabel(ProfileLocalization.settingsVideo)
.accessibilityLabel(ProfileLocalization.manageAccount)
.cardStyle(
bgColor: Theme.Colors.textInputUnfocusedBackground,
strokeColor: .clear
Expand Down
2 changes: 2 additions & 0 deletions Profile/Profile/SwiftGen/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public enum ProfileLocalization {
public static let contact = ProfileLocalization.tr("Localizable", "CONTACT", fallback: "Contact support")
/// Cookie policy
public static let cookiePolicy = ProfileLocalization.tr("Localizable", "COOKIE_POLICY", fallback: "Cookie policy")
/// Dates & Calendar
public static let datesAndCalendar = ProfileLocalization.tr("Localizable", "DATES_AND_CALENDAR", fallback: "Dates & Calendar")
/// Do not sell my personal information
public static let doNotSellInformation = ProfileLocalization.tr("Localizable", "DO_NOT_SELL_INFORMATION", fallback: "Do not sell my personal information")
/// Edit Profile
Expand Down
1 change: 1 addition & 0 deletions Profile/Profile/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"BIO" = "Bio:";
"SETTINGS" = "Settings";
"SETTINGS_VIDEO" = "Video settings";
"DATES_AND_CALENDAR" = "Dates & Calendar";
"SUPPORT_INFO" = "Support info";
"CONTACT" = "Contact support";
"TERMS" = "Terms of use";
Expand Down
Loading