Skip to content

Commit

Permalink
🔀️ Merge branch 'release/LekaApp/1.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Oct 16, 2024
2 parents 37b9854 + cf66ef6 commit 316e544
Show file tree
Hide file tree
Showing 194 changed files with 3,721 additions and 1,613 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-fastlane-release_beta_internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
- "Modules/ContentKit/**"
- "Tuist/Package.swift"
- "Tuist/Package.resolved"
- "fastlane/Fastfile" # TODO: (@ladislas) remove this line after test
- "!**/Examples/**/*.swift"
workflow_dispatch: # nothing to setup here, just to trigger the workflow manually

concurrency:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-linter-license_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
lfs: false

- name: Install deno
uses: denoland/setup-deno@v1
uses: denoland/setup-deno@v2
with:
deno-version: vx.x.x

- name: Check licenses in all files
run: |
deno run --allow-read https://deno.land/x/[email protected]/main.ts
deno run --allow-read jsr:@kt3k/[email protected]/main
22 changes: 14 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,23 @@
# ? See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: detect-private-key
- id: end-of-file-fixer
exclude_types: [json]
exclude: '(.*\.xcstrings|\.xcassets|\.svg)'
- id: forbid-submodules
- id: mixed-line-ending
- id: no-commit-to-branch
args: [--branch, main, --branch, develop]
- id: trailing-whitespace
- id: check-yaml
exclude: exercise_templates.yml
- id: check-json
Expand All @@ -23,18 +34,13 @@ repos:
types: [file]
files: \.(json|xcstrings)$
exclude: '(\.vscode/settings\.json|\.jtd\.json$|.*\.xcassets/.*|.*\.colorset/.*|\.animation\.lottie\.json$)'
- id: check-added-large-files
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: detect-private-key
- id: forbid-submodules
- id: mixed-line-ending

- repo: https://github.com/realm/SwiftLint
rev: 0.57.0
hooks:
- id: swiftlint
entry: swiftlint
args: ["--use-alternative-excluding"]

- repo: https://github.com/nicklockwood/SwiftFormat
rev: 0.54.5
Expand Down
3 changes: 1 addition & 2 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ disabled_rules:
- closure_parameter_position

excluded:
- Tuist/Dependencies
- ./*/Derived
- Tuist/.build

reporter: "emoji"
2 changes: 1 addition & 1 deletion Apps/LekaApp/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let kLekaAppVersion: String = {
}

// ? App version
return "1.10.0"
return "1.11.0"
}()

let project = Project.app(
Expand Down
18 changes: 18 additions & 0 deletions Apps/LekaApp/Resources/l10n/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,24 @@
}
}
},
"lekaapp.caregiver_creation.email_whitespaces_error_message": {
"comment": "Error message when whitespaces or linebreaks detected in email textfield",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Email cannot contain spaces or line breaks"
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "L\u2019e-mail ne doit pas contenir d\u2019espaces ou de sauts de ligne"
}
}
}
},
"lekaapp.caregiver_creation.profession_label": {
"comment": "Caregiver creation profession label above profession selection button",
"extractionState": "extracted_with_value",
Expand Down
12 changes: 12 additions & 0 deletions Apps/LekaApp/Sources/Views/TextFields/TextFieldDefault.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import SwiftUI
// MARK: - TextFieldDefault

struct TextFieldDefault: View {
// MARK: Internal

let label: String
@Binding var entry: String

Expand All @@ -18,8 +20,18 @@ struct TextFieldDefault: View {
TextField("", text: self.$entry)
.textFieldStyle(.roundedBorder)
.autocorrectionDisabled()
.focused(self.$focused)
.onChange(of: self.focused) { focused in
if !focused {
self.entry = self.entry.trimLeadingAndTrailingWhitespaces()
}
}
}
}

// MARK: Private

@FocusState private var focused: Bool
}

#Preview {
Expand Down
6 changes: 4 additions & 2 deletions Apps/LekaApp/Sources/Views/TextFields/TextFieldEmail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ struct TextFieldEmail: View {
.textInputAutocapitalization(.never)
.autocorrectionDisabled()
.focused(self.$focused)
.onChange(of: self.entry) { newValue in
self.entry = newValue.trimmingCharacters(in: .whitespaces)
.onChange(of: self.focused) { focused in
if !focused {
self.entry = self.entry.trimLeadingAndTrailingWhitespaces()
}
}
.overlay(
RoundedRectangle(cornerRadius: 8)
Expand Down
3 changes: 0 additions & 3 deletions Apps/LekaApp/Sources/Views/TextFields/TextFieldPassword.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ struct TextFieldPassword: View {
.textInputAutocapitalization(.never)
.autocorrectionDisabled()
.focused(self.$focused)
.onChange(of: self.entry) { newValue in
self.entry = newValue.trimmingCharacters(in: .whitespaces)
}
.overlay(
RoundedRectangle(cornerRadius: 8)
.stroke(self.focused ? .blue : .clear, lineWidth: 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ struct CreateCarereceiverView: View {
.autocorrectionDisabled()
.multilineTextAlignment(.trailing)
.foregroundStyle(Color.secondary)
.focused(self.$focused)
.onChange(of: self.focused) { focused in
if !focused {
self.newCarereceiver.username = self.newCarereceiver.username.trimLeadingAndTrailingWhitespaces()
}
}
}
}

Expand Down Expand Up @@ -114,6 +120,8 @@ struct CreateCarereceiverView: View {
@State private var isCarereceiverCreated: Bool = false
@StateObject private var viewModel = CreateCarereceiverViewModel()

@FocusState private var focused: Bool

@State private var newCarereceiver = Carereceiver()
@State private var isAvatarPickerPresented: Bool = false
@State private var cancellables = Set<AnyCancellable>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ struct EditCarereceiverView: View {
.autocorrectionDisabled()
.multilineTextAlignment(.trailing)
.foregroundStyle(Color.secondary)
.focused(self.$focused)
.onChange(of: self.focused) { focused in
if !focused {
self.modifiedCarereceiver.username = self.modifiedCarereceiver.username.trimLeadingAndTrailingWhitespaces()
}
}
}
}

Expand Down Expand Up @@ -65,6 +71,8 @@ struct EditCarereceiverView: View {
@State private var isAvatarPickerPresented: Bool = false
var carereceiverManager: CarereceiverManager = .shared

@FocusState private var focused: Bool

private var avatarPickerButton: some View {
Button {
self.isAvatarPickerPresented = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ struct CreateCaregiverView: View {
.autocorrectionDisabled()
.multilineTextAlignment(.trailing)
.foregroundStyle(Color.secondary)
.focused(self.$focused)
.onChange(of: self.focused) { focused in
if !focused {
self.newCaregiver.firstName = self.newCaregiver.firstName.trimLeadingAndTrailingWhitespaces()
}
}
}
LabeledContent(String(l10n.CaregiverCreation.caregiverLastNameLabel.characters)) {
TextField("", text: self.$newCaregiver.lastName, prompt: self.placeholderLastName)
Expand All @@ -78,6 +84,12 @@ struct CreateCaregiverView: View {
.autocorrectionDisabled()
.multilineTextAlignment(.trailing)
.foregroundStyle(Color.secondary)
.focused(self.$focused)
.onChange(of: self.focused) { focused in
if !focused {
self.newCaregiver.lastName = self.newCaregiver.lastName.trimLeadingAndTrailingWhitespaces()
}
}
}
LabeledContent(String(l10n.CaregiverCreation.caregiverEmailLabel.characters)) {
TextField("", text: self.$newCaregiver.email, prompt: self.placeholderEmail)
Expand All @@ -86,7 +98,14 @@ struct CreateCaregiverView: View {
.autocorrectionDisabled()
.multilineTextAlignment(.trailing)
.foregroundStyle(Color.secondary)
.onChange(of: self.newCaregiver.email) { newValue in
self.isWhitespacesErrorMessageVisible = newValue.containsInvalidCharacters()
}
}
} footer: {
Text(String(l10n.CaregiverCreation.emailWhitespacesErrorMessage.characters))
.font(.footnote)
.foregroundStyle(self.isWhitespacesErrorMessageVisible ? .red : .clear)
}

Section {
Expand Down Expand Up @@ -143,6 +162,9 @@ struct CreateCaregiverView: View {
@State private var isCaregiverCreated: Bool = false
@StateObject private var viewModel = CreateCaregiverViewModel()

@FocusState private var focused: Bool
@State private var isWhitespacesErrorMessageVisible = false

@State private var newCaregiver = Caregiver()
@State private var isAvatarPickerPresented: Bool = false
@State private var cancellables = Set<AnyCancellable>()
Expand Down Expand Up @@ -201,6 +223,8 @@ extension l10n {

static let caregiverBirthdateLabel = LocalizedString("lekaapp.caregiver_creation.caregiver_birthdate_label", value: "Birthdate", comment: "Caregiver creation caregiver birthdate textfield label")

static let emailWhitespacesErrorMessage = LocalizedString("lekaapp.caregiver_creation.email_whitespaces_error_message", value: "Email cannot contain spaces or line breaks", comment: "Error message when whitespaces or linebreaks detected in email textfield")

static let professionLabel = LocalizedString("lekaapp.caregiver_creation.profession_label", value: "Profession(s)", comment: "Caregiver creation profession label above profession selection button")

static let createProfileButtonLabel = LocalizedString("lekaapp.caregiver_creation.create_profile_button_label", value: "Create profile", comment: "Caregiver creation create profile button label")
Expand Down
26 changes: 26 additions & 0 deletions Apps/LekaApp/Sources/Views/Users/Caregiver/EditCaregiverView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ struct EditCaregiverView: View {
.autocorrectionDisabled()
.multilineTextAlignment(.trailing)
.foregroundStyle(Color.secondary)
.focused(self.$focused)
.onChange(of: self.focused) { focused in
if !focused {
self.viewModel.caregiver.firstName = self.viewModel.caregiver.firstName.trimLeadingAndTrailingWhitespaces()
}
}
}
LabeledContent(String(l10n.CaregiverCreation.caregiverLastNameLabel.characters)) {
TextField("", text: self.$viewModel.caregiver.lastName, prompt: self.placeholderLastName)
Expand All @@ -44,6 +50,12 @@ struct EditCaregiverView: View {
.autocorrectionDisabled()
.multilineTextAlignment(.trailing)
.foregroundStyle(Color.secondary)
.focused(self.$focused)
.onChange(of: self.focused) { focused in
if !focused {
self.viewModel.caregiver.lastName = self.viewModel.caregiver.lastName.trimLeadingAndTrailingWhitespaces()
}
}
}
LabeledContent(String(l10n.CaregiverCreation.caregiverEmailLabel.characters)) {
TextField("", text: self.$viewModel.caregiver.email, prompt: self.placeholderEmail)
Expand All @@ -52,6 +64,17 @@ struct EditCaregiverView: View {
.autocorrectionDisabled()
.multilineTextAlignment(.trailing)
.foregroundStyle(Color.secondary)
.onChange(of: self.viewModel.caregiver.email) { newValue in
withAnimation {
self.isWhitespacesErrorMessageVisible = newValue.containsInvalidCharacters()
}
}
}
} footer: {
if self.isWhitespacesErrorMessageVisible {
Text(String(l10n.CaregiverCreation.emailWhitespacesErrorMessage.characters))
.font(.footnote)
.foregroundStyle(.red)
}
}

Expand Down Expand Up @@ -100,6 +123,9 @@ struct EditCaregiverView: View {

@Environment(\.dismiss) private var dismiss

@FocusState private var focused: Bool
@State private var isWhitespacesErrorMessageVisible = false

private var caregiverManager: CaregiverManager = .shared

@StateObject private var viewModel: EditCaregiverViewViewModel
Expand Down
Loading

0 comments on commit 316e544

Please sign in to comment.