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

feat: use custom font and colors across the app where were missing #311

Merged
merged 23 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0d99fac
chore: use custom fonts where missing
saeedbashir Feb 29, 2024
633a315
refactor: add light logo as universal image as its a svg
saeedbashir Feb 29, 2024
04239ca
refactor: moving colors inside under folder Colors
saeedbashir Feb 29, 2024
eda0293
chore: use custom font for navigation bar title and segment control
saeedbashir Feb 29, 2024
93ca6a2
refactor: color combination improvements
saeedbashir Mar 1, 2024
1a75644
chore: using custom color and font across the app for more elements
saeedbashir Mar 1, 2024
c01c436
Merge branch 'develop' into saeed/fonts
saeedbashir Mar 1, 2024
a36ebdb
refactor: color combination improvements for light dark modes
saeedbashir Mar 1, 2024
e6f08c1
chore: theme improvements
saeedbashir Mar 4, 2024
8ea2cb8
refactor: improvement
saeedbashir Mar 4, 2024
0c181b7
chore: set application tint color as per accent color
saeedbashir Mar 4, 2024
f931ae8
refactor: fix logo color and forgot password style
saeedbashir Mar 4, 2024
ac10c9d
fix: handouts colors fix
saeedbashir Mar 5, 2024
00ce0a5
chore: configure launch screen from info.plist so open source communi…
saeedbashir Mar 5, 2024
5898556
chore: using different app logo images for light and dark modes
saeedbashir Mar 5, 2024
f29b32a
refactor: removing extra image
saeedbashir Mar 5, 2024
6228e72
fix: icon color fix
saeedbashir Mar 5, 2024
bf678e4
fix: color fixs
saeedbashir Mar 5, 2024
43da576
chore: define a new color for switch
saeedbashir Mar 5, 2024
b26e9e5
Merge branch 'develop' into saeed/fonts
saeedbashir Mar 5, 2024
4b6a878
refactor: update color combinations
saeedbashir Mar 5, 2024
492395b
fix: address review feedback
saeedbashir Mar 6, 2024
225b09b
refactor: re adding launchscreen.storyboard
saeedbashir Mar 11, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public struct SignInView: View {
}

VStack(alignment: .center) {
ThemeAssets.appLogoLight.swiftUIImage
ThemeAssets.appLogo.swiftUIImage
.resizable()
.aspectRatio(contentMode: .fit)
.frame(maxWidth: 189, maxHeight: 89)
Expand All @@ -75,6 +75,8 @@ public struct SignInView: View {
.foregroundColor(Theme.Colors.textPrimary)
.accessibilityIdentifier("username_text")
TextField(AuthLocalization.SignIn.emailOrUsername, text: $email)
.font(Theme.Fonts.bodyLarge)
.foregroundColor(Theme.Colors.textPrimary)
.keyboardType(.emailAddress)
.textContentType(.emailAddress)
.autocapitalization(.none)
Expand All @@ -97,6 +99,8 @@ public struct SignInView: View {
.padding(.top, 18)
.accessibilityIdentifier("password_text")
SecureField(AuthLocalization.SignIn.password, text: $password)
.font(Theme.Fonts.bodyLarge)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.all, 14)
.background(
Theme.Shapes.textInputShape
Expand All @@ -123,7 +127,8 @@ public struct SignInView: View {
viewModel.trackForgotPasswordClicked()
viewModel.router.showForgotPasswordScreen()
}
.foregroundColor(Theme.Colors.accentColor)
.font(Theme.Fonts.bodyLarge)
.foregroundColor(Theme.Colors.accentXColor)
.padding(.top, 0)
.accessibilityIdentifier("forgot_password_button")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public struct SignUpView: View {
Text(disclosureGroupOpen
? AuthLocalization.SignUp.hideFields
: AuthLocalization.SignUp.showFields)
.font(Theme.Fonts.labelLarge)
}
.accessibilityLabel("optional_fields_text")
.padding(.top, 10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public struct ResetPasswordView: View {
.foregroundColor(Theme.Colors.textPrimary)
.accessibilityIdentifier("email_text")
TextField(AuthLocalization.SignIn.email, text: $email)
.font(Theme.Fonts.bodyLarge)
.foregroundColor(Theme.Colors.textPrimary)
.keyboardType(.emailAddress)
.textContentType(.emailAddress)
.autocapitalization(.none)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import SwiftUI
import Core
import Theme

struct SocialAuthView: View {

Expand Down Expand Up @@ -51,7 +52,7 @@ struct SocialAuthView: View {
HStack {
Text("\(AuthLocalization.or) \(title.lowercased()):")
.padding(.vertical, 20)
.font(.system(size: 17, weight: .medium))
.font(Theme.Fonts.bodyMedium)
.accessibilityIdentifier("social_auth_title_text")
Spacer()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public struct StartupView: View {
Image(systemName: "magnifyingglass")
.padding(.leading, 16)
.padding(.top, 1)
.foregroundColor(Theme.Colors.textPrimary)
TextField(AuthLocalization.Startup.searchPlaceholder, text: $searchQuery, onCommit: {
if searchQuery.isEmpty { return }
viewModel.router.showDiscoveryScreen(
Expand All @@ -66,6 +67,8 @@ public struct StartupView: View {
.autocorrectionDisabled()
.frame(minHeight: 50)
.submitLabel(.search)
.font(Theme.Fonts.bodyLarge)
.foregroundColor(Theme.Colors.textPrimary)
.accessibilityIdentifier("explore_courses_textfield")

}.overlay(
Expand All @@ -86,7 +89,7 @@ public struct StartupView: View {
} label: {
Text(AuthLocalization.Startup.exploreAllCourses)
.underline()
.foregroundColor(Theme.Colors.accentColor)
.foregroundColor(Theme.Colors.accentXColor)
.font(Theme.Fonts.bodyLarge)
}
.padding(.top, isHorizontal ? 0 : 5)
Expand Down
2 changes: 1 addition & 1 deletion Core/Core/Configuration/CSSInjector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public class CSSInjector {
<style>
a {
text-decoration: none;
color: \(Theme.Colors.accentColor.uiColor().cgColor.hexString ?? "");
color: \(Theme.UIColors.accentXColor.cgColor.hexString ?? "");
}
@font-face {
font-family: "San Francisco";
Expand Down
16 changes: 14 additions & 2 deletions Core/Core/Extensions/UIApplicationExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,20 @@ extension UINavigationController {
navigationBar.backIndicatorImage = image.withTintColor(Theme.UIColors.accentXColor)
navigationBar.backItem?.backButtonTitle = " "
navigationBar.backIndicatorTransitionMaskImage = image.withTintColor(Theme.UIColors.accentXColor)
navigationBar.titleTextAttributes = [.foregroundColor: Theme.UIColors.navigationBarTintColor]
UIView.appearance(whenContainedInInstancesOf: [UIAlertController.self]).tintColor = Theme.UIColors.accentColor
navigationBar.titleTextAttributes = [
.foregroundColor: Theme.UIColors.navigationBarTintColor,
.font: Theme.UIFonts.titleMedium()
]

UISegmentedControl.appearance().setTitleTextAttributes(
[
.foregroundColor: Theme.Colors.primaryButtonTextColor.uiColor(),
.font: Theme.UIFonts.labelLarge()
],
for: .normal)
UISegmentedControl.appearance().selectedSegmentTintColor = UIColor(Theme.Colors.accentXColor)

UIView.appearance(whenContainedInInstancesOf: [UIAlertController.self]).tintColor = Theme.UIColors.accentXColor
}
}

Expand Down
20 changes: 14 additions & 6 deletions Core/Core/View/Base/AlertView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,30 +134,36 @@ public struct AlertView: View {
case .logOut:
HStack {
Spacer(minLength: 100)
CoreAssets.logOut.swiftUIImage
CoreAssets.logOut.swiftUIImage.renderingMode(.template)
.padding(.top, isHorizontal ? 20 : 54)
.foregroundColor(Theme.Colors.textPrimary)
Spacer(minLength: 100)
}
Text(alertMessage)
.font(Theme.Fonts.titleLarge)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.vertical, isHorizontal ? 6 : 40)
.multilineTextAlignment(.center)
.padding(.horizontal, 40)
.frame(maxWidth: 250)
case .leaveProfile, .deleteVideo:
VStack(spacing: 20) {
if type == .deleteVideo {
CoreAssets.warning.swiftUIImage
CoreAssets.warning.swiftUIImage.renderingMode(.template)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.top, isHorizontal ? 20 : 54)
} else {
CoreAssets.leaveProfile.swiftUIImage
CoreAssets.leaveProfile.swiftUIImage.renderingMode(.template)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.top, isHorizontal ? 20 : 54)
}
Text(alertTitle)
.font(Theme.Fonts.titleLarge)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.horizontal, 40)
Text(alertMessage)
.font(Theme.Fonts.bodyMedium)
.foregroundColor(Theme.Colors.textPrimary)
.multilineTextAlignment(.center)
.padding(.horizontal, 40)

Expand All @@ -174,10 +180,12 @@ public struct AlertView: View {
}
Text(alertTitle)
.font(Theme.Fonts.titleLarge)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.horizontal, 40)
.padding(.top, 10)
Text(alertMessage)
.font(Theme.Fonts.bodyMedium)
.foregroundColor(Theme.Colors.textPrimary)
.multilineTextAlignment(.center)
.padding(.horizontal, 40)
.frame(maxWidth: 250)
Expand Down Expand Up @@ -260,7 +268,7 @@ public struct AlertView: View {
}, label: {
ZStack {
Text(CoreLocalization.Alert.logout)
.foregroundColor(Theme.Colors.white)
.foregroundColor(Theme.Colors.primaryButtonTextColor)
.font(Theme.Fonts.labelLarge)
.frame(maxWidth: .infinity)
.padding(.horizontal, 16)
Expand Down Expand Up @@ -292,7 +300,7 @@ public struct AlertView: View {
}, label: {
ZStack {
Text(CoreLocalization.Alert.leave)
.foregroundColor(Theme.Colors.white)
.foregroundColor(Theme.Colors.primaryButtonTextColor)
.font(Theme.Fonts.labelLarge)
.frame(maxWidth: .infinity)
.padding(.horizontal, 16)
Expand Down Expand Up @@ -351,7 +359,7 @@ public struct AlertView: View {
} label: {
ZStack {
Text(CoreLocalization.Alert.delete)
.foregroundColor(Theme.Colors.white)
.foregroundColor(Theme.Colors.primaryButtonTextColor)
.font(Theme.Fonts.labelLarge)
.frame(maxWidth: .infinity)
.padding(.horizontal, 16)
Expand Down
2 changes: 2 additions & 0 deletions Core/Core/View/Base/AppReview/AppReviewView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public struct AppReviewView: View {

case .feedback:
TextEditor(text: $viewModel.feedback)
.font(Theme.Fonts.bodyMedium)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.horizontal, 12)
.padding(.vertical, 4)
.hideScrollContentBackground()
Expand Down
3 changes: 2 additions & 1 deletion Core/Core/View/Base/CheckBoxView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ public struct CheckBoxView: View {
systemName: checked ? "checkmark.square.fill" : "square"
)
.foregroundColor(
checked ? Theme.Colors.accentColor : Theme.Colors.textPrimary
checked ? Theme.Colors.accentXColor : Theme.Colors.textPrimary
)
Text(text)
.font(font)
.foregroundColor(Theme.Colors.textPrimary)
}
.onTapGesture {
withAnimation(.linear(duration: 0.1)) {
Expand Down
2 changes: 1 addition & 1 deletion Core/Core/View/Base/CourseCellView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public struct CourseCellView: View {
.resizable()
.frame(width: 16, height: 16)
.offset(x: 15)
.foregroundColor(Theme.Colors.accentColor)
.foregroundColor(Theme.Colors.accentXColor)
.accessibilityIdentifier("arrow_image")
}
}
Expand Down
6 changes: 5 additions & 1 deletion Core/Core/View/Base/PickerMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,23 @@ public struct PickerMenu: View {
Text(titleText)
.foregroundColor(Theme.Colors.textPrimary)
.accessibilityIdentifier("picker_title_text")
.font(Theme.Fonts.bodyMedium)
TextField(CoreLocalization.Picker.search, text: $search)
.padding(.all, 8)
.font(Theme.Fonts.bodySmall)
.background(Theme.Colors.textInputStroke.cornerRadius(6))
.accessibilityIdentifier("picker_search_textfield")
Picker("", selection: $selectedItem) {
ForEach(filteredItems, id: \.self) { item in
Text(item.value)
.foregroundColor(Theme.Colors.textPrimary)
.font(Theme.Fonts.bodyMedium)
}
}
.pickerStyle(.wheel)
.accessibilityIdentifier("picker")
}
.frame(minWidth: 0,
.frame(minWidth: 0,
maxWidth: (idiom == .pad || (idiom == .phone && isHorizontal))
? ipadPickerWidth
: .infinity)
Expand All @@ -114,6 +117,7 @@ public struct PickerMenu: View {
router.dismiss(animated: true)
}) {
Text(CoreLocalization.Picker.accept)
.font(Theme.Fonts.bodyMedium)
.foregroundColor(Theme.Colors.textPrimary)
.frame(minWidth: 0,
maxWidth: (idiom == .pad || (idiom == .phone && isHorizontal))
Expand Down
4 changes: 2 additions & 2 deletions Core/Core/View/Base/PickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ public struct PickerView: View {
.stroke(lineWidth: 1)
.fill(config.error == "" ?
Theme.Colors.textInputStroke
: Color.red)
: Theme.Colors.alert)
)
.shake($config.shake)
Text(config.error == "" ? config.field.instructions
: config.error)
.font(Theme.Fonts.labelMedium)
.foregroundColor(config.error == ""
? Theme.Colors.textPrimary
: Color.red)
: Theme.Colors.alert)
.accessibilityIdentifier("\(config.field.name)_instructions_text")
}
}
Expand Down
14 changes: 9 additions & 5 deletions Core/Core/View/Base/RegistrationTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public struct RegistrationTextField: View {
}
if isTextArea {
TextEditor(text: $config.text)
.font(Theme.Fonts.bodyMedium)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.horizontal, 12)
.padding(.vertical, 4)
.frame(height: 100)
Expand All @@ -57,7 +59,7 @@ public struct RegistrationTextField: View {
.fill(
config.error == "" ?
Theme.Colors.textInputStroke
: Color.red
: Theme.Colors.alert
)
)
.shake($config.shake)
Expand All @@ -80,13 +82,15 @@ public struct RegistrationTextField: View {
.fill(
config.error == "" ?
Theme.Colors.textInputStroke
: Color.red
: Theme.Colors.alert
)
)
.shake($config.shake)
.accessibilityIdentifier("\(config.field.name)_textfield")
} else {
TextField(placeholder, text: $config.text)
.font(Theme.Fonts.bodyLarge)
.foregroundColor(Theme.Colors.textPrimary)
.keyboardType(keyboardType)
.textContentType(textContentType)
.autocapitalization(.none)
Expand All @@ -102,7 +106,7 @@ public struct RegistrationTextField: View {
.fill(
config.error == "" ?
Theme.Colors.textInputStroke
: Color.red
: Theme.Colors.alert
)
)
.shake($config.shake)
Expand All @@ -113,8 +117,8 @@ public struct RegistrationTextField: View {
Text(config.error == "" ? config.field.instructions : config.error)
.font(Theme.Fonts.bodySmall)
.foregroundColor(config.error == ""
? Theme.Colors.textSecondary
: Color.red)
? Theme.Colors.textSecondaryLight
: Theme.Colors.alert)
.accessibilityIdentifier("\(config.field.name)_instructions_text")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ extension ScrollSlidingTabBar {
}

public static let `default` = Style(
font: .body,
selectedFont: .body.bold(),
activeAccentColor: Theme.Colors.accentColor,
font: Theme.Fonts.bodyLarge,
selectedFont: Theme.Fonts.titleMedium,
activeAccentColor: Theme.Colors.accentXColor,
inactiveAccentColor: Theme.Colors.textSecondary,
indicatorHeight: 2,
borderColor: .gray.opacity(0.2),
Expand Down
1 change: 1 addition & 0 deletions Core/Core/View/Base/SocialAuthButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public struct SocialAuthButton: View {
Text(title)
.foregroundStyle(textColor)
.padding(.leading, 10)
.font(Theme.Fonts.bodyLarge)
Spacer()
} icon: {
image.padding(.leading, 10)
Expand Down
4 changes: 2 additions & 2 deletions Core/Core/View/Base/UnitButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ public struct UnitButtonView: View {
} else {
CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template)
.padding(.leading, 20)
.foregroundColor(Theme.Colors.accentColor)
.foregroundColor(Theme.Colors.secondaryButtonTextColor)
Text(type.stringValue())
.foregroundColor(Theme.Colors.accentColor)
.foregroundColor(Theme.Colors.secondaryButtonTextColor)
.font(Theme.Fonts.labelLarge)
.padding(.trailing, 20)
}
Expand Down
2 changes: 1 addition & 1 deletion Core/Core/View/Base/VideoDownloadQualityView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public struct SettingsCell: View {
.accessibilityIdentifier("video_quality_title_text")
if let description {
Text(description)
.font(Theme.Fonts.labelMedium)
.font(Theme.Fonts.bodySmall)
.foregroundColor(Theme.Colors.textSecondary)
.accessibilityIdentifier("video_quality_des_text")
}
Expand Down
Loading
Loading