From b80cfee87b45474347d299bcd52420fa237bd966 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 9 Jul 2024 08:05:14 -0400 Subject: [PATCH 01/58] Add swiftlint config and workflow --- .github/.swiftlint.yml | 75 ++++++++++++++++++++++++++++++++ .github/workflows/swift-lint.yml | 28 ++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 .github/.swiftlint.yml create mode 100644 .github/workflows/swift-lint.yml diff --git a/.github/.swiftlint.yml b/.github/.swiftlint.yml new file mode 100644 index 0000000000..3e7093fd14 --- /dev/null +++ b/.github/.swiftlint.yml @@ -0,0 +1,75 @@ +# By default, SwiftLint uses a set of sensible default rules you can adjust: +disabled_rules: # rule identifiers turned on by default to exclude from running + - colon + - comma + - control_statement +opt_in_rules: # some rules are turned off by default, so you need to opt-in + - empty_count # find all the available rules by running: `swiftlint rules` + +# Alternatively, specify all rules explicitly by uncommenting this option: +# only_rules: # delete `disabled_rules` & `opt_in_rules` if using this +# - empty_parameters +# - vertical_whitespace + +analyzer_rules: # rules run by `swiftlint analyze` + - explicit_self + +# Case-sensitive paths to include during linting. Directory paths supplied on the +# command line will be ignored. +included: + - Sources +excluded: # case-sensitive paths to ignore during linting. Takes precedence over `included` + - Carthage + - Pods + - Sources/ExcludedFolder + - Sources/ExcludedFile.swift + - Sources/*/ExcludedFile.swift # exclude files with a wildcard + +# If true, SwiftLint will not fail if no lintable files are found. +allow_zero_lintable_files: false + +# If true, SwiftLint will treat all warnings as errors. +strict: false + +# The path to a baseline file, which will be used to filter out detected violations. +baseline: Baseline.json + +# The path to save detected violations to as a new baseline. +write_baseline: Baseline.json + +# If true, SwiftLint will check for updates after linting or analyzing. +check_for_updates: true + +# configurable rules can be customized from this configuration file +# binary rules can set their severity level +force_cast: warning # implicitly +force_try: + severity: warning # explicitly +# rules that have both warning and error levels, can set just the warning level +# implicitly +line_length: 110 +# they can set both implicitly with an array +type_body_length: + - 300 # warning + - 400 # error +# or they can set both explicitly +file_length: + warning: 500 + error: 1200 +# naming rules can set warnings/errors for min_length and max_length +# additionally they can set excluded names +type_name: + min_length: 4 # only warning + max_length: # warning and error + warning: 40 + error: 50 + excluded: iPhone # excluded via string + allowed_symbols: ["_"] # these are allowed in type names +identifier_name: + min_length: # only min_length + error: 4 # only error + excluded: # excluded via string array + - id + - URL + - GlobalAPIKey +reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, codeclimate, junit, html, emoji, sonarqube, markdown, github-actions-logging, summary) \ No newline at end of file diff --git a/.github/workflows/swift-lint.yml b/.github/workflows/swift-lint.yml new file mode 100644 index 0000000000..0990411b7c --- /dev/null +++ b/.github/workflows/swift-lint.yml @@ -0,0 +1,28 @@ +name: Swift Lint + +on: + pull_request: + branches: [ develop, master, feature/* ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + run_tests: + runs-on: macos-14 + env: + FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 60 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Pod Install + uses: ./.github/actions/pod-install + + - name: Swift Lint + run: bundle exec fastlane cru_shared_lane_swift_lint config_file:./.swiftlint.yml mode:lint raise_if_swiftlint_error:true \ No newline at end of file From 6bd70d5d8aa192a54e5ba4e458c10fecab1e0c6f Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 9 Jul 2024 08:11:11 -0400 Subject: [PATCH 02/58] Install swift lint --- .github/workflows/swift-lint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/swift-lint.yml b/.github/workflows/swift-lint.yml index 0990411b7c..bb2d855f30 100644 --- a/.github/workflows/swift-lint.yml +++ b/.github/workflows/swift-lint.yml @@ -21,6 +21,9 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Install SwiftLint + run: brew install swiftlint + - name: Pod Install uses: ./.github/actions/pod-install From ed1e1573289514b3918cae024a814cba8611fb50 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 9 Jul 2024 08:14:59 -0400 Subject: [PATCH 03/58] Update config path --- .github/{.swiftlint.yml => swiftlint.yml} | 0 .github/workflows/swift-lint.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/{.swiftlint.yml => swiftlint.yml} (100%) diff --git a/.github/.swiftlint.yml b/.github/swiftlint.yml similarity index 100% rename from .github/.swiftlint.yml rename to .github/swiftlint.yml diff --git a/.github/workflows/swift-lint.yml b/.github/workflows/swift-lint.yml index bb2d855f30..fe6aa5c5d2 100644 --- a/.github/workflows/swift-lint.yml +++ b/.github/workflows/swift-lint.yml @@ -28,4 +28,4 @@ jobs: uses: ./.github/actions/pod-install - name: Swift Lint - run: bundle exec fastlane cru_shared_lane_swift_lint config_file:./.swiftlint.yml mode:lint raise_if_swiftlint_error:true \ No newline at end of file + run: bundle exec fastlane cru_shared_lane_swift_lint config_file:./.github/swiftlint.yml mode:lint raise_if_swiftlint_error:true \ No newline at end of file From a64e3ed72d89eef8025b90f547b03783269eff9d Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 9 Jul 2024 08:25:20 -0400 Subject: [PATCH 04/58] Add path to lint --- .github/workflows/swift-lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/swift-lint.yml b/.github/workflows/swift-lint.yml index fe6aa5c5d2..577ea0e260 100644 --- a/.github/workflows/swift-lint.yml +++ b/.github/workflows/swift-lint.yml @@ -12,7 +12,7 @@ concurrency: cancel-in-progress: true jobs: - run_tests: + swift_lint: runs-on: macos-14 env: FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 60 @@ -28,4 +28,4 @@ jobs: uses: ./.github/actions/pod-install - name: Swift Lint - run: bundle exec fastlane cru_shared_lane_swift_lint config_file:./.github/swiftlint.yml mode:lint raise_if_swiftlint_error:true \ No newline at end of file + run: bundle exec fastlane cru_shared_lane_swift_lint config_file:./.github/swiftlint.yml mode:lint path:./godtools/App raise_if_swiftlint_error:true \ No newline at end of file From 06ed74654192590c51ec5f2309f669102c01abde Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 9 Jul 2024 08:28:47 -0400 Subject: [PATCH 05/58] Remove mode --- .github/workflows/swift-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/swift-lint.yml b/.github/workflows/swift-lint.yml index 577ea0e260..659d8a5540 100644 --- a/.github/workflows/swift-lint.yml +++ b/.github/workflows/swift-lint.yml @@ -28,4 +28,4 @@ jobs: uses: ./.github/actions/pod-install - name: Swift Lint - run: bundle exec fastlane cru_shared_lane_swift_lint config_file:./.github/swiftlint.yml mode:lint path:./godtools/App raise_if_swiftlint_error:true \ No newline at end of file + run: bundle exec fastlane cru_shared_lane_swift_lint config_file:./.github/swiftlint.yml path:./godtools/App raise_if_swiftlint_error:true \ No newline at end of file From 9d923fb80aa0f22f8916ee857e29e525eb175b30 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 9 Jul 2024 12:22:13 -0400 Subject: [PATCH 06/58] Move file --- .github/workflows/swift-lint.yml | 2 +- .github/swiftlint.yml => .swiftlint.yml | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/swiftlint.yml => .swiftlint.yml (100%) diff --git a/.github/workflows/swift-lint.yml b/.github/workflows/swift-lint.yml index 659d8a5540..a4d9ae573b 100644 --- a/.github/workflows/swift-lint.yml +++ b/.github/workflows/swift-lint.yml @@ -28,4 +28,4 @@ jobs: uses: ./.github/actions/pod-install - name: Swift Lint - run: bundle exec fastlane cru_shared_lane_swift_lint config_file:./.github/swiftlint.yml path:./godtools/App raise_if_swiftlint_error:true \ No newline at end of file + run: bundle exec fastlane cru_shared_lane_swift_lint config_file:./.swiftlint.yml raise_if_swiftlint_error:true \ No newline at end of file diff --git a/.github/swiftlint.yml b/.swiftlint.yml similarity index 100% rename from .github/swiftlint.yml rename to .swiftlint.yml From 239237f6111141a60b4c4de848399c9abed9ace8 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 9 Jul 2024 12:52:54 -0400 Subject: [PATCH 07/58] Update included --- .swiftlint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 3e7093fd14..4a11552195 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -17,7 +17,7 @@ analyzer_rules: # rules run by `swiftlint analyze` # Case-sensitive paths to include during linting. Directory paths supplied on the # command line will be ignored. included: - - Sources + - godtools/App excluded: # case-sensitive paths to ignore during linting. Takes precedence over `included` - Carthage - Pods From fc71ce28614c4181d94a9c3b4878f915e8a5cd1b Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 9 Jul 2024 15:31:06 -0400 Subject: [PATCH 08/58] Add some opt ins --- .swiftlint.yml | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 4a11552195..e1d28ebb29 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,10 +1,32 @@ # By default, SwiftLint uses a set of sensible default rules you can adjust: disabled_rules: # rule identifiers turned on by default to exclude from running - - colon - - comma - - control_statement opt_in_rules: # some rules are turned off by default, so you need to opt-in - - empty_count # find all the available rules by running: `swiftlint rules` + - closure_end_indentation + - closure_spacing + - collection_alignment + - comma_inheritance + - conditional_returns_on_newline + - convenience_type + - discouraged_none_name + - discouraged_object_literal + - empty_count + - empty_string + - enum_case_associated_values_count + - explicit_enum_raw_value + - explicit_type_interface + - fallthrough + - fatal_error_message + - file_name_no_space + # - file_types_order #Curious about this one. ~Levi + - first_where + - force_unwrapping + - function_default_parameter_at_end + - ibinspectable_in_extension + - identical_operands + - implicit_return + - implicitly_unwrapped_optional + - indentation_width + - last_where # Alternatively, specify all rules explicitly by uncommenting this option: # only_rules: # delete `disabled_rules` & `opt_in_rules` if using this From 703c255bdcfaac4e636abc9024ccb178d90284d5 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Wed, 10 Jul 2024 12:35:44 -0400 Subject: [PATCH 09/58] Remove white space --- .github/workflows/create-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-version.yml b/.github/workflows/create-version.yml index d4bb0aa79a..0512484b4c 100644 --- a/.github/workflows/create-version.yml +++ b/.github/workflows/create-version.yml @@ -61,7 +61,7 @@ jobs: - name: Set Version Output id: version run: | - echo "version=$(grep -m 1 MARKETING_VERSION godtools.xcodeproj/project.pbxproj | sed 's/;//g' | sed 's/ //g' | sed 's/=//g' | sed 's/MARKETING_VERSION//g')" >> $GITHUB_OUTPUT + echo "version=$(grep -m 1 MARKETING_VERSION godtools.xcodeproj/project.pbxproj | sed 's/;//g' | sed 's/ //g' | sed 's/=//g' | sed 's/MARKETING_VERSION//g' | sed 's/^ *//g' | sed 's/^[[:space:]]*//g')" >> $GITHUB_OUTPUT print_current_version: name: Print Current Version From 636440b2955e58010f241351276e94f382fcf981 Mon Sep 17 00:00:00 2001 From: levieggertcru <59846460+levieggertcru@users.noreply.github.com> Date: Wed, 10 Jul 2024 23:08:14 +0000 Subject: [PATCH 10/58] [create-pull-request] automated change --- fastlane/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fastlane/README.md b/fastlane/README.md index a053a6d2f5..dc4d4a278c 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -13,6 +13,17 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do # Available Actions +### cru_shared_lane_swift_lint + +```sh +[bundle exec] fastlane cru_shared_lane_swift_lint +``` + + + +---- + + ## iOS ### ios release From ac72792a7918044bf96ba6af8fbd2f8ac409d54f Mon Sep 17 00:00:00 2001 From: Rachael Skeath Date: Thu, 11 Jul 2024 16:07:49 -0400 Subject: [PATCH 11/58] convert to language ID to check if language is supported --- .../AppDataLayerDependencies.swift | 1 + .../GetTranslatedToolCategory.swift | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/godtools/App/DependencyContainer/AppDataLayerDependencies.swift b/godtools/App/DependencyContainer/AppDataLayerDependencies.swift index b99745e1e7..014271c4de 100644 --- a/godtools/App/DependencyContainer/AppDataLayerDependencies.swift +++ b/godtools/App/DependencyContainer/AppDataLayerDependencies.swift @@ -314,6 +314,7 @@ class AppDataLayerDependencies { func getTranslatedToolCategory() -> GetTranslatedToolCategory { return GetTranslatedToolCategory( + languagesRepository: getLanguagesRepository(), localizationServices: getLocalizationServices(), resourcesRepository: getResourcesRepository() ) diff --git a/godtools/App/Share/Data-DomainInterface/Supporting/GetTranslatedToolCategory/GetTranslatedToolCategory.swift b/godtools/App/Share/Data-DomainInterface/Supporting/GetTranslatedToolCategory/GetTranslatedToolCategory.swift index b0780217d0..9522d1e3c0 100644 --- a/godtools/App/Share/Data-DomainInterface/Supporting/GetTranslatedToolCategory/GetTranslatedToolCategory.swift +++ b/godtools/App/Share/Data-DomainInterface/Supporting/GetTranslatedToolCategory/GetTranslatedToolCategory.swift @@ -11,11 +11,13 @@ import LocalizationServices class GetTranslatedToolCategory { + private let languagesRepository: LanguagesRepository private let localizationServices: LocalizationServices private let resourcesRepository: ResourcesRepository - init(localizationServices: LocalizationServices, resourcesRepository: ResourcesRepository) { + init(languagesRepository: LanguagesRepository, localizationServices: LocalizationServices, resourcesRepository: ResourcesRepository) { + self.languagesRepository = languagesRepository self.localizationServices = localizationServices self.resourcesRepository = resourcesRepository } @@ -33,8 +35,11 @@ class GetTranslatedToolCategory { let localeId: String - if resource.supportsLanguage(languageId: translateInLanguage) { - localeId = translateInLanguage + if + let translateInLanguageModel = languagesRepository.getLanguage(code: translateInLanguage), + resource.supportsLanguage(languageId: translateInLanguageModel.id) + { + localeId = translateInLanguageModel.code } else { localeId = resource.attrDefaultLocale } From e5bf49a5244b5160131b8f5f7347fc8b0e018718 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Fri, 12 Jul 2024 07:14:29 -0400 Subject: [PATCH 12/58] Add additional opt in parameters --- .swiftlint.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.swiftlint.yml b/.swiftlint.yml index e1d28ebb29..c5b5348377 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -27,6 +27,16 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in - implicitly_unwrapped_optional - indentation_width - last_where + - let_var_whitespace + - literal_expression_end_indentation + - multiline_arguments + - multiline_arguments_brackets + - multiline_function_chains + - multiline_literal_brackets + - multiline_parameters + - multiline_parameters_brackets + - no_extension_access_modifier + - no_magic_numbers # Alternatively, specify all rules explicitly by uncommenting this option: # only_rules: # delete `disabled_rules` & `opt_in_rules` if using this From a4a04d84ad8d3434e3d0b700d9dabeaa44751e43 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Fri, 12 Jul 2024 09:49:00 -0400 Subject: [PATCH 13/58] Change type to BCP47LanguageIdentifier for code attribute --- .../Share/Data/LanguagesRepository/LanguagesRepository.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/godtools/App/Share/Data/LanguagesRepository/LanguagesRepository.swift b/godtools/App/Share/Data/LanguagesRepository/LanguagesRepository.swift index 8bcf893e67..e7ee1846b4 100644 --- a/godtools/App/Share/Data/LanguagesRepository/LanguagesRepository.swift +++ b/godtools/App/Share/Data/LanguagesRepository/LanguagesRepository.swift @@ -33,7 +33,7 @@ class LanguagesRepository { return cache.getLanguage(id: id) } - func getLanguage(code: String) -> LanguageModel? { + func getLanguage(code: BCP47LanguageIdentifier) -> LanguageModel? { return cache.getLanguage(code: code) } @@ -41,7 +41,7 @@ class LanguagesRepository { return cache.getLanguages(ids: ids) } - func getLanguages(languageCodes: [String]) -> [LanguageModel] { + func getLanguages(languageCodes: [BCP47LanguageIdentifier]) -> [LanguageModel] { return cache.getLanguages(languageCodes: languageCodes) } From 9f6753f5c02ca2320ed3d9aae3c5a284ac48fa11 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2024 01:45:18 +0000 Subject: [PATCH 14/58] Lock file maintenance --- Gemfile.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a8294659e4..73993b8231 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -23,19 +23,19 @@ GEM artifactory (3.0.17) atomos (0.1.3) aws-eventstream (1.3.0) - aws-partitions (1.949.0) - aws-sdk-core (3.200.0) + aws-partitions (1.956.0) + aws-sdk-core (3.201.1) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.8) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.87.0) - aws-sdk-core (~> 3, >= 3.199.0) - aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.155.0) - aws-sdk-core (~> 3, >= 3.199.0) + aws-sdk-kms (1.88.0) + aws-sdk-core (~> 3, >= 3.201.0) + aws-sigv4 (~> 1.5) + aws-sdk-s3 (1.156.0) + aws-sdk-core (~> 3, >= 3.201.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.8) + aws-sigv4 (~> 1.5) aws-sigv4 (1.8.0) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) @@ -95,7 +95,7 @@ GEM escape (0.0.4) ethon (0.16.0) ffi (>= 1.15.0) - excon (0.110.0) + excon (0.111.0) faraday (1.10.3) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) @@ -223,8 +223,8 @@ GEM base64 mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2024.0604) - mini_magick (4.13.1) + mime-types-data (3.2024.0702) + mini_magick (4.13.2) mini_mime (1.1.5) minitest (5.24.1) molinillo (0.8.0) From 99aff95b6af6b5476a625fdf63a61879aeceb361 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 08:19:25 -0400 Subject: [PATCH 15/58] Add some opt ins --- .swiftlint.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.swiftlint.yml b/.swiftlint.yml index c5b5348377..0af2b9bd9f 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -37,6 +37,11 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in - multiline_parameters_brackets - no_extension_access_modifier - no_magic_numbers + - one_declaration_per_file + - operator_usage_whitespace + - overridden_super_call + - prefer_self_in_static_references + - prefer_self_type_over_type_of_self # Alternatively, specify all rules explicitly by uncommenting this option: # only_rules: # delete `disabled_rules` & `opt_in_rules` if using this From a1bad6eb5e6969a99cfe94dd83a076b3523ff6f5 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 14:36:50 -0400 Subject: [PATCH 16/58] Update opt ins and analyzer rules --- .swiftlint.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 0af2b9bd9f..5b70df917c 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -39,9 +39,21 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in - no_magic_numbers - one_declaration_per_file - operator_usage_whitespace - - overridden_super_call - prefer_self_in_static_references - prefer_self_type_over_type_of_self + - private_action + - private_outlet + - private_subject + - private_swiftui_state + - sorted_enum_cases + - strict_fileprivate + - switch_case_on_newline + - toggle_bool + - trailing_closure + - unowned_variable_capture + - unused_capture_list + - weak_delegate + - yoda_condition # Alternatively, specify all rules explicitly by uncommenting this option: # only_rules: # delete `disabled_rules` & `opt_in_rules` if using this @@ -49,7 +61,9 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in # - vertical_whitespace analyzer_rules: # rules run by `swiftlint analyze` + - capture_variable - explicit_self + - unused_import # Case-sensitive paths to include during linting. Directory paths supplied on the # command line will be ignored. From 077693c3a9cebc18eb5cd0965f7f00d7f4640944 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 14:54:48 -0400 Subject: [PATCH 17/58] sort enum cases --- godtools/App/AppBuild/AppBuildConfiguration.swift | 2 +- godtools/App/AppBuild/AppEnvironment.swift | 2 +- .../ToolSettingsToolLanguagesListTypeDomainModel.swift | 2 +- .../ToolSettingsOptionViewTitleColorStyle.swift | 2 +- .../AnimationTransitions/FadeAnimationTransition.swift | 2 +- .../App/Share/Common/KeyboardObserver/KeyboardState.swift | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/godtools/App/AppBuild/AppBuildConfiguration.swift b/godtools/App/AppBuild/AppBuildConfiguration.swift index 50afd2c4a0..497af5d61e 100644 --- a/godtools/App/AppBuild/AppBuildConfiguration.swift +++ b/godtools/App/AppBuild/AppBuildConfiguration.swift @@ -11,7 +11,7 @@ import Foundation enum AppBuildConfiguration { case analyticsLogging - case staging case production case release + case staging } diff --git a/godtools/App/AppBuild/AppEnvironment.swift b/godtools/App/AppBuild/AppEnvironment.swift index 3adc3f9eeb..b38fdc6aa5 100644 --- a/godtools/App/AppBuild/AppEnvironment.swift +++ b/godtools/App/AppBuild/AppEnvironment.swift @@ -10,6 +10,6 @@ import Foundation enum AppEnvironment { - case staging case production + case staging } diff --git a/godtools/App/Features/ToolSettings/Domain/Entities/ToolSettingsToolLanguagesListTypeDomainModel.swift b/godtools/App/Features/ToolSettings/Domain/Entities/ToolSettingsToolLanguagesListTypeDomainModel.swift index 69f0db176e..edfb3730c4 100644 --- a/godtools/App/Features/ToolSettings/Domain/Entities/ToolSettingsToolLanguagesListTypeDomainModel.swift +++ b/godtools/App/Features/ToolSettings/Domain/Entities/ToolSettingsToolLanguagesListTypeDomainModel.swift @@ -10,6 +10,6 @@ import Foundation enum ToolSettingsToolLanguagesListTypeDomainModel { - case choosePrimaryLanguage case chooseParallelLanguage + case choosePrimaryLanguage } diff --git a/godtools/App/Features/ToolSettings/Presentation/ToolSettings/Subviews/ToolSettingsOptions/Subviews/ToolSettingsOption/ToolSettingsOptionViewTitleColorStyle.swift b/godtools/App/Features/ToolSettings/Presentation/ToolSettings/Subviews/ToolSettingsOptions/Subviews/ToolSettingsOption/ToolSettingsOptionViewTitleColorStyle.swift index d97fd29c55..d92794b44b 100644 --- a/godtools/App/Features/ToolSettings/Presentation/ToolSettings/Subviews/ToolSettingsOptions/Subviews/ToolSettingsOption/ToolSettingsOptionViewTitleColorStyle.swift +++ b/godtools/App/Features/ToolSettings/Presentation/ToolSettings/Subviews/ToolSettingsOptions/Subviews/ToolSettingsOption/ToolSettingsOptionViewTitleColorStyle.swift @@ -10,8 +10,8 @@ import SwiftUI enum ToolSettingsOptionViewTitleColorStyle { - case lightBackground case darkBackground + case lightBackground func getColor() -> Color { switch self { diff --git a/godtools/App/Share/AnimationTransitions/FadeAnimationTransition.swift b/godtools/App/Share/AnimationTransitions/FadeAnimationTransition.swift index 838d0ef7c1..535935e7f9 100644 --- a/godtools/App/Share/AnimationTransitions/FadeAnimationTransition.swift +++ b/godtools/App/Share/AnimationTransitions/FadeAnimationTransition.swift @@ -37,7 +37,7 @@ class FadeAnimationTransition: NSObject, UIViewControllerAnimatedTransitioning { let fromView: UIView = fromViewController.view let toView: UIView = toViewController.view - switch (self.fade) { + switch fade { case .fadeIn: diff --git a/godtools/App/Share/Common/KeyboardObserver/KeyboardState.swift b/godtools/App/Share/Common/KeyboardObserver/KeyboardState.swift index e6d4b9c67a..0476e2aa0d 100644 --- a/godtools/App/Share/Common/KeyboardObserver/KeyboardState.swift +++ b/godtools/App/Share/Common/KeyboardObserver/KeyboardState.swift @@ -10,8 +10,8 @@ import Foundation enum KeyboardState { - case willShow - case willHide - case didShow case didHide + case didShow + case willHide + case willShow } From 1d24e9e4813191ec6f9f19a7880122b329380467 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 14:55:04 -0400 Subject: [PATCH 18/58] Disable trailing white space Set line length to 500 --- .swiftlint.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 5b70df917c..a5310ecd0f 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,5 +1,6 @@ # By default, SwiftLint uses a set of sensible default rules you can adjust: disabled_rules: # rule identifiers turned on by default to exclude from running + - trailing_whitespace # disabling for now as this touches a lot of files. Command swiftlint --fix is a way to fix whitespace. opt_in_rules: # some rules are turned off by default, so you need to opt-in - closure_end_indentation - closure_spacing @@ -98,7 +99,7 @@ force_try: severity: warning # explicitly # rules that have both warning and error levels, can set just the warning level # implicitly -line_length: 110 +line_length: 500 # they can set both implicitly with an array type_body_length: - 300 # warning From e11d722d6ca72f3867cd2bcc321937fa24c5c9d5 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 15:34:18 -0400 Subject: [PATCH 19/58] Comment out some rules until they can be resolved at a later time --- .swiftlint.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index a5310ecd0f..e6283335c1 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,6 +1,7 @@ # By default, SwiftLint uses a set of sensible default rules you can adjust: disabled_rules: # rule identifiers turned on by default to exclude from running - - trailing_whitespace # disabling for now as this touches a lot of files. Command swiftlint --fix is a way to fix whitespace. + - statement_position #disabling for now as this touches many files. + - trailing_whitespace #disabling for now as this touches many files. Command swiftlint --fix is a way to fix whitespace. opt_in_rules: # some rules are turned off by default, so you need to opt-in - closure_end_indentation - closure_spacing @@ -14,7 +15,7 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in - empty_string - enum_case_associated_values_count - explicit_enum_raw_value - - explicit_type_interface + # - explicit_type_interface - fallthrough - fatal_error_message - file_name_no_space @@ -24,7 +25,7 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in - function_default_parameter_at_end - ibinspectable_in_extension - identical_operands - - implicit_return + # - implicit_return #Will disable for now as many warnings. - implicitly_unwrapped_optional - indentation_width - last_where @@ -37,8 +38,8 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in - multiline_parameters - multiline_parameters_brackets - no_extension_access_modifier - - no_magic_numbers - - one_declaration_per_file + # - no_magic_numbers #Disabling for now as this touches many files. + # - one_declaration_per_file #SwiftUI Preview breaks this, may need to update preview to use macros. - operator_usage_whitespace - prefer_self_in_static_references - prefer_self_type_over_type_of_self @@ -52,7 +53,6 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in - toggle_bool - trailing_closure - unowned_variable_capture - - unused_capture_list - weak_delegate - yoda_condition @@ -99,7 +99,7 @@ force_try: severity: warning # explicitly # rules that have both warning and error levels, can set just the warning level # implicitly -line_length: 500 +line_length: 1200 # they can set both implicitly with an array type_body_length: - 300 # warning From f7352f4aa75043d42548641bf0cb1295b07131cd Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 15:43:44 -0400 Subject: [PATCH 20/58] Update length to 4 letters --- .swiftlint.yml | 6 +++--- .../Dashboard/Domain/Entities/ToolDomainModel.swift | 4 ++-- .../Shareables/Domain/Entities/ShareableDomainModel.swift | 4 ++-- .../Entities/ToolSettingsToolLanguageDomainModel.swift | 4 ++-- .../Categories/Models/CategoryArticleUUID.swift | 4 ++-- .../Data/LanguagesRepository/Api/Models/LanguageModel.swift | 4 ++-- .../Data/ResourcesRepository/Api/Models/ResourceModel.swift | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index e6283335c1..dc2811662f 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -31,7 +31,7 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in - last_where - let_var_whitespace - literal_expression_end_indentation - - multiline_arguments + # - multiline_arguments #Disabling this rule as UIView.animate would fail when using animate and completion together. - multiline_arguments_brackets - multiline_function_chains - multiline_literal_brackets @@ -113,8 +113,8 @@ file_length: type_name: min_length: 4 # only warning max_length: # warning and error - warning: 40 - error: 50 + warning: 80 + error: 90 excluded: iPhone # excluded via string allowed_symbols: ["_"] # these are allowed in type names identifier_name: diff --git a/godtools/App/Features/Dashboard/Domain/Entities/ToolDomainModel.swift b/godtools/App/Features/Dashboard/Domain/Entities/ToolDomainModel.swift index 4a145d2209..4199059d54 100644 --- a/godtools/App/Features/Dashboard/Domain/Entities/ToolDomainModel.swift +++ b/godtools/App/Features/Dashboard/Domain/Entities/ToolDomainModel.swift @@ -28,8 +28,8 @@ struct ToolDomainModel: ToolListItemDomainModelInterface { } extension ToolDomainModel: Equatable { - static func ==(lhs: ToolDomainModel, rhs: ToolDomainModel) -> Bool { - return lhs.dataModelId == rhs.dataModelId + static func ==(this: ToolDomainModel, that: ToolDomainModel) -> Bool { + return this.dataModelId == that.dataModelId } } diff --git a/godtools/App/Features/Shareables/Domain/Entities/ShareableDomainModel.swift b/godtools/App/Features/Shareables/Domain/Entities/ShareableDomainModel.swift index a75b66d6a2..6293b1e376 100644 --- a/godtools/App/Features/Shareables/Domain/Entities/ShareableDomainModel.swift +++ b/godtools/App/Features/Shareables/Domain/Entities/ShareableDomainModel.swift @@ -22,7 +22,7 @@ extension ShareableDomainModel: Identifiable { } extension ShareableDomainModel: Equatable { - static func ==(lhs: ShareableDomainModel, rhs: ShareableDomainModel) -> Bool { - return lhs.dataModelId == rhs.dataModelId + static func ==(this: ShareableDomainModel, that: ShareableDomainModel) -> Bool { + return this.dataModelId == that.dataModelId } } diff --git a/godtools/App/Features/ToolSettings/Domain/Entities/ToolSettingsToolLanguageDomainModel.swift b/godtools/App/Features/ToolSettings/Domain/Entities/ToolSettingsToolLanguageDomainModel.swift index 11feecd5c9..8cf940e760 100644 --- a/godtools/App/Features/ToolSettings/Domain/Entities/ToolSettingsToolLanguageDomainModel.swift +++ b/godtools/App/Features/ToolSettings/Domain/Entities/ToolSettingsToolLanguageDomainModel.swift @@ -21,7 +21,7 @@ extension ToolSettingsToolLanguageDomainModel: Identifiable { } extension ToolSettingsToolLanguageDomainModel: Equatable { - static func ==(lhs: ToolSettingsToolLanguageDomainModel, rhs: ToolSettingsToolLanguageDomainModel) -> Bool { - return lhs.dataModelId == rhs.dataModelId + static func ==(this: ToolSettingsToolLanguageDomainModel, that: ToolSettingsToolLanguageDomainModel) -> Bool { + return this.dataModelId == that.dataModelId } } diff --git a/godtools/App/Share/Data/ArticlesRepository/Categories/Models/CategoryArticleUUID.swift b/godtools/App/Share/Data/ArticlesRepository/Categories/Models/CategoryArticleUUID.swift index a52f294890..118e175d70 100644 --- a/godtools/App/Share/Data/ArticlesRepository/Categories/Models/CategoryArticleUUID.swift +++ b/godtools/App/Share/Data/ArticlesRepository/Categories/Models/CategoryArticleUUID.swift @@ -19,7 +19,7 @@ struct CategoryArticleUUID { } extension CategoryArticleUUID: Equatable { - static func ==(lhs: CategoryArticleUUID, rhs: CategoryArticleUUID) -> Bool { - return lhs.uuidString == rhs.uuidString + static func ==(this: CategoryArticleUUID, that: CategoryArticleUUID) -> Bool { + return this.uuidString == that.uuidString } } diff --git a/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift b/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift index a77d6f2c31..875bbb9f25 100644 --- a/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift +++ b/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift @@ -68,7 +68,7 @@ struct LanguageModel: LanguageModelType, Codable { } extension LanguageModel: Equatable { - static func ==(lhs: LanguageModel, rhs: LanguageModel) -> Bool { - return lhs.id == rhs.id + static func ==(this: LanguageModel, that: LanguageModel) -> Bool { + return this.id == that.id } } diff --git a/godtools/App/Share/Data/ResourcesRepository/Api/Models/ResourceModel.swift b/godtools/App/Share/Data/ResourcesRepository/Api/Models/ResourceModel.swift index b1770f6452..099b79a2b7 100644 --- a/godtools/App/Share/Data/ResourcesRepository/Api/Models/ResourceModel.swift +++ b/godtools/App/Share/Data/ResourcesRepository/Api/Models/ResourceModel.swift @@ -188,8 +188,8 @@ struct ResourceModel: ResourceModelType, Decodable, Identifiable { } extension ResourceModel: Equatable { - static func ==(lhs: ResourceModel, rhs: ResourceModel) -> Bool { - return lhs.id == rhs.id + static func ==(this: ResourceModel, that: ResourceModel) -> Bool { + return this.id == that.id } } From e3a23f3001668f3462eda593a581b9a698c423bb Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 15:53:03 -0400 Subject: [PATCH 21/58] FIx colon spacing --- godtools/App/AppDelegate.swift | 6 +++--- .../GetDownloadToolProgressInterfaceStringsRepository.swift | 2 +- .../GlobalActivityDataLayerDependencies.swift | 2 +- .../GetLearnToShareToolTutorialItemsRepository.swift | 2 +- .../Domain/UseCases/GetLessonEvaluatedUseCase.swift | 4 ++-- .../TractRemoteSharePublisher.swift | 2 +- .../TractRemoteShareSubscriber.swift | 2 +- .../Services/Analytics/AppsFlyer/AppsFlyerAnalytics.swift | 2 +- .../App/Services/Analytics/Firebase/FirebaseAnalytics.swift | 2 +- .../Systems/User/MobileContentRendererUserAnalytics.swift | 2 +- .../MobileContentEmbeddedVideoViewModel.swift | 2 +- godtools/App/Share/Common/Json/JsonServices.swift | 6 +++--- godtools/App/Share/Data/AppsFlyer/AppsFlyer.swift | 4 ++-- .../AppsFlyerDeepLinkValueParser.swift | 2 +- .../ArticleAemPath/ArticleAemPathDeepLinkParser.swift | 2 +- .../Parsers/DashboardPath/DashboardPathDeepLinkParser.swift | 2 +- .../Lessons/GodToolsAppLessonsPathDeepLinkParser.swift | 2 +- .../Parsers/KnowGod/KnowGodDeepLinkParser.swift | 6 +++--- .../LanguageSettings/LanguageSettingsDeepLinkParser.swift | 2 +- .../Parsers/Legacy/LegacyAppsFlyerDeepLinkValueParser.swift | 2 +- .../Parsers/ToolPath/ToolPathDeepLinkParser.swift | 2 +- .../Parsers/UITests/UITestsDeepLinkParser.swift | 2 +- .../LanguagesRepository/Cache/RealmLanguagesCache.swift | 2 +- 23 files changed, 31 insertions(+), 31 deletions(-) diff --git a/godtools/App/AppDelegate.swift b/godtools/App/AppDelegate.swift index c43a451765..482c860f46 100644 --- a/godtools/App/AppDelegate.swift +++ b/godtools/App/AppDelegate.swift @@ -156,12 +156,12 @@ extension AppDelegate { appDiContainer.dataLayer.getSharedAppsFlyer().registerUninstall(deviceToken: deviceToken) } - func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) { + func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) { appDiContainer.dataLayer.getSharedAppsFlyer().handlePushNotification(userInfo: userInfo) } - func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { + func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { appDiContainer.dataLayer.getSharedAppsFlyer().handlePushNotification(userInfo: userInfo) } @@ -212,7 +212,7 @@ extension AppDelegate { extension AppDelegate { - func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { + func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { appDiContainer.dataLayer.getSharedAppsFlyer().handleOpenUrl(url: url, options: options) diff --git a/godtools/App/Features/DownloadToolProgress/Data-DomainInterface/GetDownloadToolProgressInterfaceStringsRepository.swift b/godtools/App/Features/DownloadToolProgress/Data-DomainInterface/GetDownloadToolProgressInterfaceStringsRepository.swift index f07a5f7852..148c1678fd 100644 --- a/godtools/App/Features/DownloadToolProgress/Data-DomainInterface/GetDownloadToolProgressInterfaceStringsRepository.swift +++ b/godtools/App/Features/DownloadToolProgress/Data-DomainInterface/GetDownloadToolProgressInterfaceStringsRepository.swift @@ -56,7 +56,7 @@ class GetDownloadToolProgressInterfaceStringsRepository: GetDownloadToolProgress } let interfaceStrings = DownloadToolProgressInterfaceStringsDomainModel( - downloadMessage: downloadMessage + downloadMessage: downloadMessage ) return Just(interfaceStrings) diff --git a/godtools/App/Features/GlobalActivity/DependencyContainer/GlobalActivityDataLayerDependencies.swift b/godtools/App/Features/GlobalActivity/DependencyContainer/GlobalActivityDataLayerDependencies.swift index 307f750ba8..2154696f72 100644 --- a/godtools/App/Features/GlobalActivity/DependencyContainer/GlobalActivityDataLayerDependencies.swift +++ b/godtools/App/Features/GlobalActivity/DependencyContainer/GlobalActivityDataLayerDependencies.swift @@ -22,7 +22,7 @@ class GlobalActivityDataLayerDependencies { private func getGlobalAnalyticsRepository() -> GlobalAnalyticsRepository { return GlobalAnalyticsRepository( - api: MobileContentGlobalAnalyticsApi( + api: MobileContentGlobalAnalyticsApi( baseUrl: coreDataLayer.getAppConfig().getMobileContentApiBaseUrl(), ignoreCacheSession: coreDataLayer.getSharedIgnoreCacheSession() ), diff --git a/godtools/App/Features/LearnToShareTool/Data-DomainInterface/GetLearnToShareToolTutorialItemsRepository.swift b/godtools/App/Features/LearnToShareTool/Data-DomainInterface/GetLearnToShareToolTutorialItemsRepository.swift index 93661da592..bcf8a05b19 100644 --- a/godtools/App/Features/LearnToShareTool/Data-DomainInterface/GetLearnToShareToolTutorialItemsRepository.swift +++ b/godtools/App/Features/LearnToShareTool/Data-DomainInterface/GetLearnToShareToolTutorialItemsRepository.swift @@ -32,7 +32,7 @@ class GetLearnToShareToolTutorialItemsRepository: GetLearnToShareToolTutorialIte ), LearnToShareToolItemDomainModel( imageName: nil, - animationName: "training_tip_callout", + animationName: "training_tip_callout", title: localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: "learn_to_share_tool.tips_light_the_way.title"), message: localizationServices.stringForLocaleElseEnglish(localeIdentifier: localeId, key: "learn_to_share_tool.tips_light_the_way.message") ), diff --git a/godtools/App/Features/LessonEvaluation/Domain/UseCases/GetLessonEvaluatedUseCase.swift b/godtools/App/Features/LessonEvaluation/Domain/UseCases/GetLessonEvaluatedUseCase.swift index fd54b72e4d..d8cf3c39bb 100644 --- a/godtools/App/Features/LessonEvaluation/Domain/UseCases/GetLessonEvaluatedUseCase.swift +++ b/godtools/App/Features/LessonEvaluation/Domain/UseCases/GetLessonEvaluatedUseCase.swift @@ -11,9 +11,9 @@ import Combine class GetLessonEvaluatedUseCase { - private let getLessonEvaluatedRepositoryInterface: GetLessonEvaluatedRepositoryInterface + private let getLessonEvaluatedRepositoryInterface: GetLessonEvaluatedRepositoryInterface - init(getLessonEvaluatedRepositoryInterface: GetLessonEvaluatedRepositoryInterface) { + init(getLessonEvaluatedRepositoryInterface: GetLessonEvaluatedRepositoryInterface) { self.getLessonEvaluatedRepositoryInterface = getLessonEvaluatedRepositoryInterface } diff --git a/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteSharePublisher/TractRemoteSharePublisher.swift b/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteSharePublisher/TractRemoteSharePublisher.swift index 77b6b3a389..50ce9ee6d9 100644 --- a/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteSharePublisher/TractRemoteSharePublisher.swift +++ b/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteSharePublisher/TractRemoteSharePublisher.swift @@ -141,7 +141,7 @@ class TractRemoteSharePublisher: NSObject { } } - // MARK: Timeout Timer + // MARK: Timeout Timer private func startTimeoutTimer() { diff --git a/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteShareSubscriber/TractRemoteShareSubscriber.swift b/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteShareSubscriber/TractRemoteShareSubscriber.swift index eeb1b0e9ff..6054d8eb7f 100644 --- a/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteShareSubscriber/TractRemoteShareSubscriber.swift +++ b/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteShareSubscriber/TractRemoteShareSubscriber.swift @@ -112,7 +112,7 @@ class TractRemoteShareSubscriber: NSObject { } } - // MARK: Timeout Timer + // MARK: Timeout Timer private func startTimeoutTimer() { diff --git a/godtools/App/Services/Analytics/AppsFlyer/AppsFlyerAnalytics.swift b/godtools/App/Services/Analytics/AppsFlyer/AppsFlyerAnalytics.swift index 442b80f4f0..56e189556c 100644 --- a/godtools/App/Services/Analytics/AppsFlyer/AppsFlyerAnalytics.swift +++ b/godtools/App/Services/Analytics/AppsFlyer/AppsFlyerAnalytics.swift @@ -57,7 +57,7 @@ class AppsFlyerAnalytics: NSObject { } } - func trackAction(actionName: String, data: [String : Any]?) { + func trackAction(actionName: String, data: [String: Any]?) { serialQueue.async { [weak self] in diff --git a/godtools/App/Services/Analytics/Firebase/FirebaseAnalytics.swift b/godtools/App/Services/Analytics/Firebase/FirebaseAnalytics.swift index 70bd443de3..543e618df3 100644 --- a/godtools/App/Services/Analytics/Firebase/FirebaseAnalytics.swift +++ b/godtools/App/Services/Analytics/Firebase/FirebaseAnalytics.swift @@ -71,7 +71,7 @@ class FirebaseAnalytics { previousTrackedScreenName = screenName } - func trackAction(screenName: String, siteSection: String, siteSubSection: String, contentLanguage: String?, secondaryContentLanguage: String?, actionName: String, data: [String : Any]?) { + func trackAction(screenName: String, siteSection: String, siteSubSection: String, contentLanguage: String?, secondaryContentLanguage: String?, actionName: String, data: [String: Any]?) { internalTrackEvent( screenName: screenName, diff --git a/godtools/App/Services/Renderer/Analytics/Systems/User/MobileContentRendererUserAnalytics.swift b/godtools/App/Services/Renderer/Analytics/Systems/User/MobileContentRendererUserAnalytics.swift index e8268ea888..91d5c886cd 100644 --- a/godtools/App/Services/Renderer/Analytics/Systems/User/MobileContentRendererUserAnalytics.swift +++ b/godtools/App/Services/Renderer/Analytics/Systems/User/MobileContentRendererUserAnalytics.swift @@ -27,7 +27,7 @@ extension MobileContentRendererUserAnalytics: MobileContentRendererAnalyticsSyst private static let lessonCompletionsActionPrefix = "lesson_completions" - func trackMobileContentAction(screenName: String, siteSection: String, action: String, data: [String : Any]?) { + func trackMobileContentAction(screenName: String, siteSection: String, action: String, data: [String: Any]?) { guard action.hasPrefix(MobileContentRendererUserAnalytics.lessonCompletionsActionPrefix) else { return diff --git a/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentEmbeddedVideo/MobileContentEmbeddedVideoViewModel.swift b/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentEmbeddedVideo/MobileContentEmbeddedVideoViewModel.swift index d425e486f8..cdb5ee3ecc 100644 --- a/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentEmbeddedVideo/MobileContentEmbeddedVideoViewModel.swift +++ b/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentEmbeddedVideo/MobileContentEmbeddedVideoViewModel.swift @@ -42,7 +42,7 @@ class MobileContentEmbeddedVideoViewModel: MobileContentViewModel { return id } - var youtubePlayerParameters: [String : Any] { + var youtubePlayerParameters: [String: Any] { let playsInFullScreen = 0 diff --git a/godtools/App/Share/Common/Json/JsonServices.swift b/godtools/App/Share/Common/Json/JsonServices.swift index 5fe2d943c3..70a95e4b2b 100644 --- a/godtools/App/Share/Common/Json/JsonServices.swift +++ b/godtools/App/Share/Common/Json/JsonServices.swift @@ -250,9 +250,9 @@ struct JsonServices: JsonServicesType { // MARK: - Encoding - func encode(object: T, options: JSONSerialization.ReadingOptions = []) -> [String : Any] where T : Encodable { + func encode(object: T, options: JSONSerialization.ReadingOptions = []) -> [String: Any] where T : Encodable { - let result: Result<[String : Any], Error> = encode(object: object, options: options) + let result: Result<[String: Any], Error> = encode(object: object, options: options) switch result { case .success(let data): @@ -263,7 +263,7 @@ struct JsonServices: JsonServicesType { } } - func encode(object: T, options: JSONSerialization.ReadingOptions = []) -> Result<[String : Any], Error> where T : Encodable { + func encode(object: T, options: JSONSerialization.ReadingOptions = []) -> Result<[String: Any], Error> where T : Encodable { do { diff --git a/godtools/App/Share/Data/AppsFlyer/AppsFlyer.swift b/godtools/App/Share/Data/AppsFlyer/AppsFlyer.swift index cf900230c3..88353a3278 100644 --- a/godtools/App/Share/Data/AppsFlyer/AppsFlyer.swift +++ b/godtools/App/Share/Data/AppsFlyer/AppsFlyer.swift @@ -47,7 +47,7 @@ class AppsFlyer { appsFlyerLib.useUninstallSandbox = configuration.shouldUseUninstallSandbox } - func handleOpenUrl(url: URL, options: [UIApplication.OpenURLOptionsKey : Any]) { + func handleOpenUrl(url: URL, options: [UIApplication.OpenURLOptionsKey: Any]) { appsFlyerLib.handleOpen(url, options: options) } @@ -59,7 +59,7 @@ class AppsFlyer { appsFlyerLib.registerUninstall(deviceToken) } - func handlePushNotification(userInfo: [AnyHashable : Any]) { + func handlePushNotification(userInfo: [AnyHashable: Any]) { appsFlyerLib.handlePushNotification(userInfo) } } diff --git a/godtools/App/Share/Data/DeepLinkingService/Parsers/AppsFlyerDeepLinkValue/AppsFlyerDeepLinkValueParser.swift b/godtools/App/Share/Data/DeepLinkingService/Parsers/AppsFlyerDeepLinkValue/AppsFlyerDeepLinkValueParser.swift index f5f38df550..4ec5da8034 100644 --- a/godtools/App/Share/Data/DeepLinkingService/Parsers/AppsFlyerDeepLinkValue/AppsFlyerDeepLinkValueParser.swift +++ b/godtools/App/Share/Data/DeepLinkingService/Parsers/AppsFlyerDeepLinkValue/AppsFlyerDeepLinkValueParser.swift @@ -16,7 +16,7 @@ class AppsFlyerDeepLinkValueParser: DeepLinkAppsFlyerParserType { } - func parse(data: [AnyHashable : Any]) -> ParsedDeepLinkType? { + func parse(data: [AnyHashable: Any]) -> ParsedDeepLinkType? { guard let deepLinkValue = data["deep_link_value"] as? String else { return nil diff --git a/godtools/App/Share/Data/DeepLinkingService/Parsers/ArticleAemPath/ArticleAemPathDeepLinkParser.swift b/godtools/App/Share/Data/DeepLinkingService/Parsers/ArticleAemPath/ArticleAemPathDeepLinkParser.swift index 2292f61369..f6a1d489e0 100644 --- a/godtools/App/Share/Data/DeepLinkingService/Parsers/ArticleAemPath/ArticleAemPathDeepLinkParser.swift +++ b/godtools/App/Share/Data/DeepLinkingService/Parsers/ArticleAemPath/ArticleAemPathDeepLinkParser.swift @@ -14,7 +14,7 @@ class ArticleAemPathDeepLinkParser: DeepLinkUrlParserType { } - func parse(url: URL, pathComponents: [String], queryParameters: [String : Any]) -> ParsedDeepLinkType? { + func parse(url: URL, pathComponents: [String], queryParameters: [String: Any]) -> ParsedDeepLinkType? { guard let aemUri = queryParameters["uri"] as? String else { return nil diff --git a/godtools/App/Share/Data/DeepLinkingService/Parsers/DashboardPath/DashboardPathDeepLinkParser.swift b/godtools/App/Share/Data/DeepLinkingService/Parsers/DashboardPath/DashboardPathDeepLinkParser.swift index 202c4398ed..50e4ce3824 100644 --- a/godtools/App/Share/Data/DeepLinkingService/Parsers/DashboardPath/DashboardPathDeepLinkParser.swift +++ b/godtools/App/Share/Data/DeepLinkingService/Parsers/DashboardPath/DashboardPathDeepLinkParser.swift @@ -14,7 +14,7 @@ class DashboardPathDeepLinkParser: DeepLinkUrlParserType { } - func parse(url: URL, pathComponents: [String], queryParameters: [String : Any]) -> ParsedDeepLinkType? { + func parse(url: URL, pathComponents: [String], queryParameters: [String: Any]) -> ParsedDeepLinkType? { guard let dashboardPathIndex = pathComponents.firstIndex(of: DashboardDeepLinkDashboardPath.dashboard.rawValue) else { return nil diff --git a/godtools/App/Share/Data/DeepLinkingService/Parsers/GodtoolsApp/Lessons/GodToolsAppLessonsPathDeepLinkParser.swift b/godtools/App/Share/Data/DeepLinkingService/Parsers/GodtoolsApp/Lessons/GodToolsAppLessonsPathDeepLinkParser.swift index 3a069e5ef2..b8eb28a830 100644 --- a/godtools/App/Share/Data/DeepLinkingService/Parsers/GodtoolsApp/Lessons/GodToolsAppLessonsPathDeepLinkParser.swift +++ b/godtools/App/Share/Data/DeepLinkingService/Parsers/GodtoolsApp/Lessons/GodToolsAppLessonsPathDeepLinkParser.swift @@ -14,7 +14,7 @@ class GodToolsAppLessonsPathDeepLinkParser: DeepLinkUrlParserType { } - func parse(url: URL, pathComponents: [String], queryParameters: [String : Any]) -> ParsedDeepLinkType? { + func parse(url: URL, pathComponents: [String], queryParameters: [String: Any]) -> ParsedDeepLinkType? { guard pathComponents.first == "lessons" else { return nil diff --git a/godtools/App/Share/Data/DeepLinkingService/Parsers/KnowGod/KnowGodDeepLinkParser.swift b/godtools/App/Share/Data/DeepLinkingService/Parsers/KnowGod/KnowGodDeepLinkParser.swift index ac01ebff91..7d502e7897 100644 --- a/godtools/App/Share/Data/DeepLinkingService/Parsers/KnowGod/KnowGodDeepLinkParser.swift +++ b/godtools/App/Share/Data/DeepLinkingService/Parsers/KnowGod/KnowGodDeepLinkParser.swift @@ -14,7 +14,7 @@ class KnowGodDeepLinkParser: DeepLinkUrlParserType { } - func parse(url: URL, pathComponents: [String], queryParameters: [String : Any]) -> ParsedDeepLinkType? { + func parse(url: URL, pathComponents: [String], queryParameters: [String: Any]) -> ParsedDeepLinkType? { if pathComponents.first == "lessons" { @@ -26,7 +26,7 @@ class KnowGodDeepLinkParser: DeepLinkUrlParserType { } } - private func parseLesson(url: URL, pathComponents: [String], queryParameters: [String : Any]) -> ParsedDeepLinkType? { + private func parseLesson(url: URL, pathComponents: [String], queryParameters: [String: Any]) -> ParsedDeepLinkType? { guard let resourceAbbreviation = pathComponents[safe: 1] else { return nil @@ -54,7 +54,7 @@ class KnowGodDeepLinkParser: DeepLinkUrlParserType { return .tool(toolDeepLink: toolDeepLink) } - private func parseTract(url: URL, pathComponents: [String], queryParameters: [String : Any]) -> ParsedDeepLinkType? { + private func parseTract(url: URL, pathComponents: [String], queryParameters: [String: Any]) -> ParsedDeepLinkType? { let knowGodQueryParameters: KnowGodTractDeepLinkQueryParameters? = JsonServices().decodeJsonObject(jsonObject: queryParameters) diff --git a/godtools/App/Share/Data/DeepLinkingService/Parsers/LanguageSettings/LanguageSettingsDeepLinkParser.swift b/godtools/App/Share/Data/DeepLinkingService/Parsers/LanguageSettings/LanguageSettingsDeepLinkParser.swift index 54d3e9e6be..30e2e2e09b 100644 --- a/godtools/App/Share/Data/DeepLinkingService/Parsers/LanguageSettings/LanguageSettingsDeepLinkParser.swift +++ b/godtools/App/Share/Data/DeepLinkingService/Parsers/LanguageSettings/LanguageSettingsDeepLinkParser.swift @@ -14,7 +14,7 @@ class LanguageSettingsDeepLinkParser: DeepLinkUrlParserType { } - func parse(url: URL, pathComponents: [String], queryParameters: [String : Any]) -> ParsedDeepLinkType? { + func parse(url: URL, pathComponents: [String], queryParameters: [String: Any]) -> ParsedDeepLinkType? { return .languageSettings } diff --git a/godtools/App/Share/Data/DeepLinkingService/Parsers/Legacy/LegacyAppsFlyerDeepLinkValueParser.swift b/godtools/App/Share/Data/DeepLinkingService/Parsers/Legacy/LegacyAppsFlyerDeepLinkValueParser.swift index b8887df9ab..72a5bd6afe 100644 --- a/godtools/App/Share/Data/DeepLinkingService/Parsers/Legacy/LegacyAppsFlyerDeepLinkValueParser.swift +++ b/godtools/App/Share/Data/DeepLinkingService/Parsers/Legacy/LegacyAppsFlyerDeepLinkValueParser.swift @@ -14,7 +14,7 @@ class LegacyAppsFlyerDeepLinkValueParser: DeepLinkAppsFlyerParserType { } - func parse(data: [AnyHashable : Any]) -> ParsedDeepLinkType? { + func parse(data: [AnyHashable: Any]) -> ParsedDeepLinkType? { let resourceAbbreviation: String? diff --git a/godtools/App/Share/Data/DeepLinkingService/Parsers/ToolPath/ToolPathDeepLinkParser.swift b/godtools/App/Share/Data/DeepLinkingService/Parsers/ToolPath/ToolPathDeepLinkParser.swift index ae50ed5889..c8806de464 100644 --- a/godtools/App/Share/Data/DeepLinkingService/Parsers/ToolPath/ToolPathDeepLinkParser.swift +++ b/godtools/App/Share/Data/DeepLinkingService/Parsers/ToolPath/ToolPathDeepLinkParser.swift @@ -14,7 +14,7 @@ class ToolPathDeepLinkParser: DeepLinkUrlParserType { } - func parse(url: URL, pathComponents: [String], queryParameters: [String : Any]) -> ParsedDeepLinkType? { + func parse(url: URL, pathComponents: [String], queryParameters: [String: Any]) -> ParsedDeepLinkType? { guard let toolPathIndex = pathComponents.firstIndex(of: "tool") else { return nil diff --git a/godtools/App/Share/Data/DeepLinkingService/Parsers/UITests/UITestsDeepLinkParser.swift b/godtools/App/Share/Data/DeepLinkingService/Parsers/UITests/UITestsDeepLinkParser.swift index 5ca9ad3425..d77532d5b9 100644 --- a/godtools/App/Share/Data/DeepLinkingService/Parsers/UITests/UITestsDeepLinkParser.swift +++ b/godtools/App/Share/Data/DeepLinkingService/Parsers/UITests/UITestsDeepLinkParser.swift @@ -14,7 +14,7 @@ class UITestsDeepLinkParser: DeepLinkUrlParserType { } - func parse(url: URL, pathComponents: [String], queryParameters: [String : Any]) -> ParsedDeepLinkType? { + func parse(url: URL, pathComponents: [String], queryParameters: [String: Any]) -> ParsedDeepLinkType? { let appLanguage: AppLanguageDomainModel = (queryParameters["appLanguageCode"] as? String) ?? LanguageCodeDomainModel.english.value diff --git a/godtools/App/Share/Data/LanguagesRepository/Cache/RealmLanguagesCache.swift b/godtools/App/Share/Data/LanguagesRepository/Cache/RealmLanguagesCache.swift index 3621b11f69..4400aef838 100644 --- a/godtools/App/Share/Data/LanguagesRepository/Cache/RealmLanguagesCache.swift +++ b/godtools/App/Share/Data/LanguagesRepository/Cache/RealmLanguagesCache.swift @@ -59,7 +59,7 @@ class RealmLanguagesCache { func getLanguages(languageCodes: [String]) -> [LanguageModel] { - return languageCodes.compactMap({getLanguage(code:$0)}) + return languageCodes.compactMap({getLanguage(code: $0)}) } func getLanguages(realm: Realm? = nil) -> [LanguageModel] { From 84d038e3985726e4824aeaf5ff0b2155e00c92a3 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 15:59:41 -0400 Subject: [PATCH 22/58] Update to spacings where colons are --- .../MobileContentBackgroundImageView.swift | 2 +- .../ContentStack/MobileContentStackView.swift | 2 +- .../TrainingTip/TrainingTipViewModel.swift | 14 ++++++------- .../ActionCableChannelPublisher.swift | 2 +- .../ActionCableChannelSubscriber.swift | 2 +- .../App/Share/Common/Json/JsonServices.swift | 20 +++++++++---------- .../KeyboardNotificationObserver.swift | 8 ++++---- .../Oberservables/ObservableValue.swift | 2 +- .../TwoRowHStack/TwoRowHStack.swift | 2 +- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/godtools/App/Services/Renderer/Views/MobileContent/Views/BackgroundImage/MobileContentBackgroundImageView.swift b/godtools/App/Services/Renderer/Views/MobileContent/Views/BackgroundImage/MobileContentBackgroundImageView.swift index 5d840df958..00fd3fa0e7 100644 --- a/godtools/App/Services/Renderer/Views/MobileContent/Views/BackgroundImage/MobileContentBackgroundImageView.swift +++ b/godtools/App/Services/Renderer/Views/MobileContent/Views/BackgroundImage/MobileContentBackgroundImageView.swift @@ -77,7 +77,7 @@ class MobileContentBackgroundImageView: UIImageView { lastRenderedParentBounds = parentBounds } - override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { + override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) { guard let parentView = self.superview else { return diff --git a/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentStack/MobileContentStackView.swift b/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentStack/MobileContentStackView.swift index 21c4bb65e9..f979cc33f6 100644 --- a/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentStack/MobileContentStackView.swift +++ b/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentStack/MobileContentStackView.swift @@ -325,7 +325,7 @@ extension MobileContentStackView { } } - override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { + override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) { guard let objectValue = object as? NSObject else { return diff --git a/godtools/App/Services/Renderer/Views/Training/Views/TrainingTip/TrainingTipViewModel.swift b/godtools/App/Services/Renderer/Views/Training/Views/TrainingTip/TrainingTipViewModel.swift index 3d02c953b3..abd3624ace 100644 --- a/godtools/App/Services/Renderer/Views/Training/Views/TrainingTip/TrainingTipViewModel.swift +++ b/godtools/App/Services/Renderer/Views/Training/Views/TrainingTip/TrainingTipViewModel.swift @@ -58,24 +58,24 @@ class TrainingTipViewModel: MobileContentViewModel { let backgroundImageName: String switch viewType { case .upArrow: - backgroundImageName = trainingTipViewed ? "training_tip_red_arrow_up_bg" : "training_tip_arrow_up_bg" + backgroundImageName = trainingTipViewed ? "training_tip_red_arrow_up_bg": "training_tip_arrow_up_bg" case .rounded: - backgroundImageName = trainingTipViewed ? "training_tip_red_square_bg" : "training_tip_square_bg" + backgroundImageName = trainingTipViewed ? "training_tip_red_square_bg": "training_tip_square_bg" } let imageName: String switch tipModel.type { case .ask: - imageName = trainingTipViewed ? "training_tip_ask_filled_red" : "training_tip_ask" + imageName = trainingTipViewed ? "training_tip_ask_filled_red": "training_tip_ask" case .consider: - imageName = trainingTipViewed ? "training_tip_consider_filled_red" : "training_tip_consider" + imageName = trainingTipViewed ? "training_tip_consider_filled_red": "training_tip_consider" case .prepare: - imageName = trainingTipViewed ? "training_tip_prepare_filled_red" : "training_tip_prepare" + imageName = trainingTipViewed ? "training_tip_prepare_filled_red": "training_tip_prepare" case .quote: - imageName = trainingTipViewed ? "training_tip_quote_filled_red" : "training_tip_quote" + imageName = trainingTipViewed ? "training_tip_quote_filled_red": "training_tip_quote" case .tip: - imageName = trainingTipViewed ? "training_tip_tip_filled_red" : "training_tip_tip" + imageName = trainingTipViewed ? "training_tip_tip_filled_red": "training_tip_tip" default: imageName = "" } diff --git a/godtools/App/Services/WebSocket/ActionCableChannelPublisher.swift b/godtools/App/Services/WebSocket/ActionCableChannelPublisher.swift index 69a00f6e6f..8d6b988ced 100644 --- a/godtools/App/Services/WebSocket/ActionCableChannelPublisher.swift +++ b/godtools/App/Services/WebSocket/ActionCableChannelPublisher.swift @@ -132,7 +132,7 @@ class ActionCableChannelPublisher: NSObject, WebSocketChannelPublisherType { addTextSignalObserver() let stringChannel = "{ \"channel\": \"PublishChannel\",\"channelId\": \"\(channelId)\" }" - let message = ["command" : "subscribe", "identifier": stringChannel] + let message = ["command": "subscribe", "identifier": stringChannel] publishChannelIdentifier = stringChannel diff --git a/godtools/App/Services/WebSocket/ActionCableChannelSubscriber.swift b/godtools/App/Services/WebSocket/ActionCableChannelSubscriber.swift index 1c10e6ac92..e35f34b22d 100644 --- a/godtools/App/Services/WebSocket/ActionCableChannelSubscriber.swift +++ b/godtools/App/Services/WebSocket/ActionCableChannelSubscriber.swift @@ -112,7 +112,7 @@ class ActionCableChannelSubscriber: NSObject, WebSocketChannelSubscriberType { isSubscribingToChannel = channelId let strChannel = "{ \"channel\": \"SubscribeChannel\",\"channelId\": \"\(channelId)\" }" - let message = ["command" : "subscribe","identifier": strChannel] + let message = ["command": "subscribe","identifier": strChannel] do { diff --git a/godtools/App/Share/Common/Json/JsonServices.swift b/godtools/App/Share/Common/Json/JsonServices.swift index 70a95e4b2b..e7e00a2774 100644 --- a/godtools/App/Share/Common/Json/JsonServices.swift +++ b/godtools/App/Share/Common/Json/JsonServices.swift @@ -134,7 +134,7 @@ struct JsonServices: JsonServicesType { // MARK: - Decoding - func decodeArray(fileName: String?) -> [T] where T : Decodable { + func decodeArray(fileName: String?) -> [T] where T: Decodable { let result: Result<[T], Error> = decodeArray(fileName: fileName) @@ -147,7 +147,7 @@ struct JsonServices: JsonServicesType { } } - func decodeArray(fileName: String?) -> Result<[T], Error> where T : Decodable { + func decodeArray(fileName: String?) -> Result<[T], Error> where T: Decodable { let dataResult: Result = getJsonData(fileName: fileName) @@ -168,7 +168,7 @@ struct JsonServices: JsonServicesType { } } - func decodeArray(data: Data?) -> [T] where T : Decodable { + func decodeArray(data: Data?) -> [T] where T: Decodable { let result: Result<[T], Error> = decodeArray(data: data) @@ -181,7 +181,7 @@ struct JsonServices: JsonServicesType { } } - func decodeArray(data: Data?) -> Result<[T], Error> where T : Decodable { + func decodeArray(data: Data?) -> Result<[T], Error> where T: Decodable { guard let data = data else { return .success([]) @@ -196,7 +196,7 @@ struct JsonServices: JsonServicesType { } } - func decodeObject(data: Data?) -> T? where T : Decodable { + func decodeObject(data: Data?) -> T? where T: Decodable { let result: Result = decodeObject(data: data) @@ -209,7 +209,7 @@ struct JsonServices: JsonServicesType { } } - func decodeObject(data: Data?) -> Result where T : Decodable { + func decodeObject(data: Data?) -> Result where T: Decodable { guard let data = data else { return .success(nil) @@ -224,7 +224,7 @@ struct JsonServices: JsonServicesType { } } - func decodeJsonObject(jsonObject: [String: Any], options: JSONSerialization.WritingOptions = []) -> T? where T : Decodable { + func decodeJsonObject(jsonObject: [String: Any], options: JSONSerialization.WritingOptions = []) -> T? where T: Decodable { let result: Result = decodeJsonObject(jsonObject: jsonObject, options: options) @@ -237,7 +237,7 @@ struct JsonServices: JsonServicesType { } } - func decodeJsonObject(jsonObject: [String: Any], options: JSONSerialization.WritingOptions = []) -> Result where T : Decodable { + func decodeJsonObject(jsonObject: [String: Any], options: JSONSerialization.WritingOptions = []) -> Result where T: Decodable { do { let jsonData: Data = try JSONSerialization.data(withJSONObject: jsonObject, options: options) @@ -250,7 +250,7 @@ struct JsonServices: JsonServicesType { // MARK: - Encoding - func encode(object: T, options: JSONSerialization.ReadingOptions = []) -> [String: Any] where T : Encodable { + func encode(object: T, options: JSONSerialization.ReadingOptions = []) -> [String: Any] where T: Encodable { let result: Result<[String: Any], Error> = encode(object: object, options: options) @@ -263,7 +263,7 @@ struct JsonServices: JsonServicesType { } } - func encode(object: T, options: JSONSerialization.ReadingOptions = []) -> Result<[String: Any], Error> where T : Encodable { + func encode(object: T, options: JSONSerialization.ReadingOptions = []) -> Result<[String: Any], Error> where T: Encodable { do { diff --git a/godtools/App/Share/Common/KeyboardObserver/KeyboardNotificationObserver.swift b/godtools/App/Share/Common/KeyboardObserver/KeyboardNotificationObserver.swift index a7dd3d513f..ab3ce0e1ff 100644 --- a/godtools/App/Share/Common/KeyboardObserver/KeyboardNotificationObserver.swift +++ b/godtools/App/Share/Common/KeyboardObserver/KeyboardNotificationObserver.swift @@ -140,7 +140,7 @@ extension KeyboardNotificationObserver { @objc func handleNotification(notification: Notification) { if notification.name == UIResponder.keyboardWillShowNotification { - log(string:"\nKeyboardNotificationObserver: UIKeyboardWillShow()") + log(string: "\nKeyboardNotificationObserver: UIKeyboardWillShow()") if let keyboardInfo = notification.userInfo { if let keyboardAnimationDurationNumber = keyboardInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber { @@ -164,7 +164,7 @@ extension KeyboardNotificationObserver { } else if notification.name == UIResponder.keyboardDidShowNotification { - log(string:"\nKeyboardNotificationObserver: UIKeyboardDidShow()") + log(string: "\nKeyboardNotificationObserver: UIKeyboardDidShow()") keyboardIsUp = true @@ -178,7 +178,7 @@ extension KeyboardNotificationObserver { } else if notification.name == UIResponder.keyboardWillHideNotification { - log(string:"\nKeyboardNotificationObserver: UIKeyboardWillHide()") + log(string: "\nKeyboardNotificationObserver: UIKeyboardWillHide()") keyboardIsUp = false @@ -196,7 +196,7 @@ extension KeyboardNotificationObserver { } else if notification.name == UIResponder.keyboardDidChangeFrameNotification { - log(string:"\nKeyboardNotificationObserver: UIKeyboardDidChangeFrame()") + log(string: "\nKeyboardNotificationObserver: UIKeyboardDidChangeFrame()") if keyboardIsUp { updateKeyboardHeightIfNeededFromKeyboardNotification( diff --git a/godtools/App/Share/Common/Oberservables/ObservableValue.swift b/godtools/App/Share/Common/Oberservables/ObservableValue.swift index beb257a270..62b0a8b6dc 100644 --- a/godtools/App/Share/Common/Oberservables/ObservableValue.swift +++ b/godtools/App/Share/Common/Oberservables/ObservableValue.swift @@ -12,7 +12,7 @@ class ObservableValue { typealias Handler = ((_ value: T) -> Void) - private(set) var value : T + private(set) var value: T private var observers = [String: Handler]() diff --git a/godtools/App/Share/SwiftUI Views/TwoRowHStack/TwoRowHStack.swift b/godtools/App/Share/SwiftUI Views/TwoRowHStack/TwoRowHStack.swift index af20eac7df..fa64af3b37 100644 --- a/godtools/App/Share/SwiftUI Views/TwoRowHStack/TwoRowHStack.swift +++ b/godtools/App/Share/SwiftUI Views/TwoRowHStack/TwoRowHStack.swift @@ -15,7 +15,7 @@ struct TwoRowHStack: View { private let spacing: CGFloat private let content: (Int) -> Content - init(itemCount: Int, spacing: CGFloat, @ViewBuilder content:@escaping (Int) -> Content) { + init(itemCount: Int, spacing: CGFloat, @ViewBuilder content: @escaping (Int) -> Content) { self.itemCount = itemCount self.numberOfColumns = Int(ceil(Double(itemCount) / 2)) From 4d909de5d4ee62c9e6394ab337b9e49972c1e9e2 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 16:02:11 -0400 Subject: [PATCH 23/58] Fix operator whitespace --- .swiftlint.yml | 2 +- .../Features/Dashboard/Domain/Entities/ToolDomainModel.swift | 2 +- .../Shareables/Domain/Entities/ShareableDomainModel.swift | 2 +- .../Domain/Entities/ToolSettingsToolLanguageDomainModel.swift | 2 +- .../Categories/Models/CategoryArticleUUID.swift | 2 +- .../Data/LanguagesRepository/Api/Models/LanguageModel.swift | 2 +- .../Data/ResourcesRepository/Api/Models/ResourceModel.swift | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index dc2811662f..e4a4502434 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -41,7 +41,7 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in # - no_magic_numbers #Disabling for now as this touches many files. # - one_declaration_per_file #SwiftUI Preview breaks this, may need to update preview to use macros. - operator_usage_whitespace - - prefer_self_in_static_references + # - prefer_self_in_static_references #Disabling for now as touches many files. - prefer_self_type_over_type_of_self - private_action - private_outlet diff --git a/godtools/App/Features/Dashboard/Domain/Entities/ToolDomainModel.swift b/godtools/App/Features/Dashboard/Domain/Entities/ToolDomainModel.swift index 4199059d54..1eb65ed846 100644 --- a/godtools/App/Features/Dashboard/Domain/Entities/ToolDomainModel.swift +++ b/godtools/App/Features/Dashboard/Domain/Entities/ToolDomainModel.swift @@ -28,7 +28,7 @@ struct ToolDomainModel: ToolListItemDomainModelInterface { } extension ToolDomainModel: Equatable { - static func ==(this: ToolDomainModel, that: ToolDomainModel) -> Bool { + static func == (this: ToolDomainModel, that: ToolDomainModel) -> Bool { return this.dataModelId == that.dataModelId } } diff --git a/godtools/App/Features/Shareables/Domain/Entities/ShareableDomainModel.swift b/godtools/App/Features/Shareables/Domain/Entities/ShareableDomainModel.swift index 6293b1e376..e36cf48562 100644 --- a/godtools/App/Features/Shareables/Domain/Entities/ShareableDomainModel.swift +++ b/godtools/App/Features/Shareables/Domain/Entities/ShareableDomainModel.swift @@ -22,7 +22,7 @@ extension ShareableDomainModel: Identifiable { } extension ShareableDomainModel: Equatable { - static func ==(this: ShareableDomainModel, that: ShareableDomainModel) -> Bool { + static func == (this: ShareableDomainModel, that: ShareableDomainModel) -> Bool { return this.dataModelId == that.dataModelId } } diff --git a/godtools/App/Features/ToolSettings/Domain/Entities/ToolSettingsToolLanguageDomainModel.swift b/godtools/App/Features/ToolSettings/Domain/Entities/ToolSettingsToolLanguageDomainModel.swift index 8cf940e760..a9ebcabaec 100644 --- a/godtools/App/Features/ToolSettings/Domain/Entities/ToolSettingsToolLanguageDomainModel.swift +++ b/godtools/App/Features/ToolSettings/Domain/Entities/ToolSettingsToolLanguageDomainModel.swift @@ -21,7 +21,7 @@ extension ToolSettingsToolLanguageDomainModel: Identifiable { } extension ToolSettingsToolLanguageDomainModel: Equatable { - static func ==(this: ToolSettingsToolLanguageDomainModel, that: ToolSettingsToolLanguageDomainModel) -> Bool { + static func == (this: ToolSettingsToolLanguageDomainModel, that: ToolSettingsToolLanguageDomainModel) -> Bool { return this.dataModelId == that.dataModelId } } diff --git a/godtools/App/Share/Data/ArticlesRepository/Categories/Models/CategoryArticleUUID.swift b/godtools/App/Share/Data/ArticlesRepository/Categories/Models/CategoryArticleUUID.swift index 118e175d70..20ce76def9 100644 --- a/godtools/App/Share/Data/ArticlesRepository/Categories/Models/CategoryArticleUUID.swift +++ b/godtools/App/Share/Data/ArticlesRepository/Categories/Models/CategoryArticleUUID.swift @@ -19,7 +19,7 @@ struct CategoryArticleUUID { } extension CategoryArticleUUID: Equatable { - static func ==(this: CategoryArticleUUID, that: CategoryArticleUUID) -> Bool { + static func == (this: CategoryArticleUUID, that: CategoryArticleUUID) -> Bool { return this.uuidString == that.uuidString } } diff --git a/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift b/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift index 875bbb9f25..a561954ff4 100644 --- a/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift +++ b/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift @@ -68,7 +68,7 @@ struct LanguageModel: LanguageModelType, Codable { } extension LanguageModel: Equatable { - static func ==(this: LanguageModel, that: LanguageModel) -> Bool { + static func == (this: LanguageModel, that: LanguageModel) -> Bool { return this.id == that.id } } diff --git a/godtools/App/Share/Data/ResourcesRepository/Api/Models/ResourceModel.swift b/godtools/App/Share/Data/ResourcesRepository/Api/Models/ResourceModel.swift index 099b79a2b7..d2b1799faf 100644 --- a/godtools/App/Share/Data/ResourcesRepository/Api/Models/ResourceModel.swift +++ b/godtools/App/Share/Data/ResourcesRepository/Api/Models/ResourceModel.swift @@ -188,7 +188,7 @@ struct ResourceModel: ResourceModelType, Decodable, Identifiable { } extension ResourceModel: Equatable { - static func ==(this: ResourceModel, that: ResourceModel) -> Bool { + static func == (this: ResourceModel, that: ResourceModel) -> Bool { return this.id == that.id } } From 1f86ee0f7c97566483104ca7b16c269e4817d9cf Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 16:10:37 -0400 Subject: [PATCH 24/58] Disabling some default rules and will enable at a later time --- .swiftlint.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index e4a4502434..89d335c2cd 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,7 +1,9 @@ # By default, SwiftLint uses a set of sensible default rules you can adjust: disabled_rules: # rule identifiers turned on by default to exclude from running + - multiple_closures_with_trailing_closure #disabling for now as this touches many files. - statement_position #disabling for now as this touches many files. - trailing_whitespace #disabling for now as this touches many files. Command swiftlint --fix is a way to fix whitespace. + - unused_closure_parameter #disabling for now as this touches many files. opt_in_rules: # some rules are turned off by default, so you need to opt-in - closure_end_indentation - closure_spacing @@ -11,7 +13,7 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in - convenience_type - discouraged_none_name - discouraged_object_literal - - empty_count + # - empty_count #disabling for now as this touches many files. - empty_string - enum_case_associated_values_count - explicit_enum_raw_value From a28037ad024a1ac1784233ee80286aee762c51e9 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 16:16:36 -0400 Subject: [PATCH 25/58] Fix comma spacing --- .../Domain/UseCases/ViewLanguageSettingsUseCase.swift | 2 +- .../Articles/Presentation/ArticlesWeb/ArticleWebView.swift | 2 +- .../Features/Lessons/Presentation/Lesson/LessonViewModel.swift | 2 +- .../ToolFilterLanguageSelectionViewModel.swift | 2 +- .../App/Services/WebSocket/ActionCableChannelSubscriber.swift | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/godtools/App/Features/AppLanguage/Domain/UseCases/ViewLanguageSettingsUseCase.swift b/godtools/App/Features/AppLanguage/Domain/UseCases/ViewLanguageSettingsUseCase.swift index 6c7eaef53e..7dacc959a9 100644 --- a/godtools/App/Features/AppLanguage/Domain/UseCases/ViewLanguageSettingsUseCase.swift +++ b/godtools/App/Features/AppLanguage/Domain/UseCases/ViewLanguageSettingsUseCase.swift @@ -14,7 +14,7 @@ class ViewLanguageSettingsUseCase { private let getInterfaceStringsRepository: GetLanguageSettingsInterfaceStringsRepositoryInterface private let getDownloadedLanguagesListRepositoryInterface: GetDownloadedLanguagesListRepositoryInterface - init(getInterfaceStringsRepository: GetLanguageSettingsInterfaceStringsRepositoryInterface, getDownloadedLanguagesListRepositoryInterface: GetDownloadedLanguagesListRepositoryInterface) { + init(getInterfaceStringsRepository: GetLanguageSettingsInterfaceStringsRepositoryInterface, getDownloadedLanguagesListRepositoryInterface: GetDownloadedLanguagesListRepositoryInterface) { self.getInterfaceStringsRepository = getInterfaceStringsRepository self.getDownloadedLanguagesListRepositoryInterface = getDownloadedLanguagesListRepositoryInterface diff --git a/godtools/App/Features/Articles/Presentation/ArticlesWeb/ArticleWebView.swift b/godtools/App/Features/Articles/Presentation/ArticlesWeb/ArticleWebView.swift index 4ac50146e3..f3f651332a 100644 --- a/godtools/App/Features/Articles/Presentation/ArticlesWeb/ArticleWebView.swift +++ b/godtools/App/Features/Articles/Presentation/ArticlesWeb/ArticleWebView.swift @@ -94,7 +94,7 @@ class ArticleWebView: AppViewController { switch currentViewState { - case .errorMessage( _, _): + case .errorMessage( _, _): errorTitleLabel.text = "" errorMessageLabel.text = "" setErrorViewHidden(hidden: true) diff --git a/godtools/App/Features/Lessons/Presentation/Lesson/LessonViewModel.swift b/godtools/App/Features/Lessons/Presentation/Lesson/LessonViewModel.swift index a41659192d..7393e71278 100644 --- a/godtools/App/Features/Lessons/Presentation/Lesson/LessonViewModel.swift +++ b/godtools/App/Features/Lessons/Presentation/Lesson/LessonViewModel.swift @@ -18,7 +18,7 @@ class LessonViewModel: MobileContentPagesViewModel { self.flowDelegate = flowDelegate - super.init(renderer: renderer,initialPage: initialPage, resourcesRepository: resourcesRepository, translationsRepository: translationsRepository, mobileContentEventAnalytics: mobileContentEventAnalytics, getCurrentAppLanguageUseCase: getCurrentAppLanguageUseCase, getTranslatedLanguageName: getTranslatedLanguageName, initialPageRenderingType: .visiblePages, trainingTipsEnabled: trainingTipsEnabled, incrementUserCounterUseCase: incrementUserCounterUseCase, selectedLanguageIndex: nil) + super.init(renderer: renderer, initialPage: initialPage, resourcesRepository: resourcesRepository, translationsRepository: translationsRepository, mobileContentEventAnalytics: mobileContentEventAnalytics, getCurrentAppLanguageUseCase: getCurrentAppLanguageUseCase, getTranslatedLanguageName: getTranslatedLanguageName, initialPageRenderingType: .visiblePages, trainingTipsEnabled: trainingTipsEnabled, incrementUserCounterUseCase: incrementUserCounterUseCase, selectedLanguageIndex: nil) } deinit { diff --git a/godtools/App/Features/ToolsFilter/Presentation/ToolFilterLanguageSelectionView/ToolFilterLanguageSelectionViewModel.swift b/godtools/App/Features/ToolsFilter/Presentation/ToolFilterLanguageSelectionView/ToolFilterLanguageSelectionViewModel.swift index f441da80bc..f1e208c5e5 100644 --- a/godtools/App/Features/ToolsFilter/Presentation/ToolFilterLanguageSelectionView/ToolFilterLanguageSelectionViewModel.swift +++ b/godtools/App/Features/ToolsFilter/Presentation/ToolFilterLanguageSelectionView/ToolFilterLanguageSelectionViewModel.swift @@ -32,7 +32,7 @@ class ToolFilterLanguageSelectionViewModel: ObservableObject { @Published var searchText: String = "" @Published var navTitle: String = "" - init(viewToolFilterLanguagesUseCase: ViewToolFilterLanguagesUseCase, searchToolFilterLanguagesUseCase: SearchToolFilterLanguagesUseCase, getUserToolFiltersUseCase: GetUserToolFiltersUseCase, storeUserToolFilterUseCase: StoreUserToolFiltersUseCase, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase, viewSearchBarUseCase: ViewSearchBarUseCase, flowDelegate: FlowDelegate) { + init(viewToolFilterLanguagesUseCase: ViewToolFilterLanguagesUseCase, searchToolFilterLanguagesUseCase: SearchToolFilterLanguagesUseCase, getUserToolFiltersUseCase: GetUserToolFiltersUseCase, storeUserToolFilterUseCase: StoreUserToolFiltersUseCase, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase, viewSearchBarUseCase: ViewSearchBarUseCase, flowDelegate: FlowDelegate) { self.viewToolFilterLanguagesUseCase = viewToolFilterLanguagesUseCase self.searchToolFilterLanguagesUseCase = searchToolFilterLanguagesUseCase diff --git a/godtools/App/Services/WebSocket/ActionCableChannelSubscriber.swift b/godtools/App/Services/WebSocket/ActionCableChannelSubscriber.swift index e35f34b22d..eff19ffc6b 100644 --- a/godtools/App/Services/WebSocket/ActionCableChannelSubscriber.swift +++ b/godtools/App/Services/WebSocket/ActionCableChannelSubscriber.swift @@ -112,7 +112,7 @@ class ActionCableChannelSubscriber: NSObject, WebSocketChannelSubscriberType { isSubscribingToChannel = channelId let strChannel = "{ \"channel\": \"SubscribeChannel\",\"channelId\": \"\(channelId)\" }" - let message = ["command": "subscribe","identifier": strChannel] + let message = ["command": "subscribe", "identifier": strChannel] do { From 4c6edfbd1f1e896dd6cef40b8faf2a1cd986d04b Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 16:16:50 -0400 Subject: [PATCH 26/58] Remove FlowStep from linting due to enum case sorting --- .swiftlint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.swiftlint.yml b/.swiftlint.yml index 89d335c2cd..7f573cf5ea 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -73,6 +73,7 @@ analyzer_rules: # rules run by `swiftlint analyze` included: - godtools/App excluded: # case-sensitive paths to ignore during linting. Takes precedence over `included` + - godtools/App/Flows/Flow/FlowStep.swift - Carthage - Pods - Sources/ExcludedFolder From da92d3f6061186af5421ba3bfc6ff5c597841a9b Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 16:21:23 -0400 Subject: [PATCH 27/58] Fix to vertical whitespace --- .../DownloadableLanguages/DownloadableLanguagesViewModel.swift | 2 -- .../Articles/Presentation/ArticleDebug/ArticleDebugView.swift | 2 -- .../Domain/UseCases/DisableOptInOnboardingBannerUseCase.swift | 1 - .../GlobalAnalyticsRepository/GlobalAnalyticsRepository.swift | 1 - .../ContentEmbeddedVideo/MobileContentEmbeddedVideoView.swift | 2 -- .../Renderer/Views/Tool/Views/Form/ToolPageFormViewModel.swift | 1 - .../App/Share/Common/FileCache/FileCache+SSZipArchive.swift | 3 ++- .../ArticlesRepository/Articles/Cache/ArticleAemCache.swift | 1 - .../GetToolTranslationsFilesUseCase.swift | 3 --- .../FullScreenVideoView/FullScreenVideoView.swift | 1 - 10 files changed, 2 insertions(+), 15 deletions(-) diff --git a/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/DownloadableLanguagesViewModel.swift b/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/DownloadableLanguagesViewModel.swift index cf1653bfc0..fbbe858781 100644 --- a/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/DownloadableLanguagesViewModel.swift +++ b/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/DownloadableLanguagesViewModel.swift @@ -171,5 +171,3 @@ extension DownloadableLanguagesViewModel { .store(in: &DownloadableLanguagesViewModel.backgrounDownloadCancellables) } } - - diff --git a/godtools/App/Features/Articles/Presentation/ArticleDebug/ArticleDebugView.swift b/godtools/App/Features/Articles/Presentation/ArticleDebug/ArticleDebugView.swift index 02f3c8ab8c..497f9a3e8b 100644 --- a/godtools/App/Features/Articles/Presentation/ArticleDebug/ArticleDebugView.swift +++ b/godtools/App/Features/Articles/Presentation/ArticleDebug/ArticleDebugView.swift @@ -53,5 +53,3 @@ struct ArticleDebugView: View { } } } - - diff --git a/godtools/App/Features/Dashboard/Domain/UseCases/DisableOptInOnboardingBannerUseCase.swift b/godtools/App/Features/Dashboard/Domain/UseCases/DisableOptInOnboardingBannerUseCase.swift index 971a2bff25..889e9c1305 100644 --- a/godtools/App/Features/Dashboard/Domain/UseCases/DisableOptInOnboardingBannerUseCase.swift +++ b/godtools/App/Features/Dashboard/Domain/UseCases/DisableOptInOnboardingBannerUseCase.swift @@ -8,7 +8,6 @@ import Foundation - class DisableOptInOnboardingBannerUseCase { private let optInOnboardingBannerEnabledRepository: OptInOnboardingBannerEnabledRepository diff --git a/godtools/App/Features/GlobalActivity/Data/GlobalAnalyticsRepository/GlobalAnalyticsRepository.swift b/godtools/App/Features/GlobalActivity/Data/GlobalAnalyticsRepository/GlobalAnalyticsRepository.swift index ade3a88f14..80f4d4b480 100644 --- a/godtools/App/Features/GlobalActivity/Data/GlobalAnalyticsRepository/GlobalAnalyticsRepository.swift +++ b/godtools/App/Features/GlobalActivity/Data/GlobalAnalyticsRepository/GlobalAnalyticsRepository.swift @@ -27,7 +27,6 @@ class GlobalAnalyticsRepository { getGlobalAnalyticsFromRemotePublisher() .sink { value in - } receiveValue: { value in } diff --git a/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentEmbeddedVideo/MobileContentEmbeddedVideoView.swift b/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentEmbeddedVideo/MobileContentEmbeddedVideoView.swift index c80d4b3bb3..40feba5ba0 100644 --- a/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentEmbeddedVideo/MobileContentEmbeddedVideoView.swift +++ b/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentEmbeddedVideo/MobileContentEmbeddedVideoView.swift @@ -65,7 +65,6 @@ class MobileContentEmbeddedVideoView: MobileContentView { } } - // MARK: - YTPlayerViewDelegate extension MobileContentEmbeddedVideoView: YTPlayerViewDelegate { @@ -92,4 +91,3 @@ extension MobileContentEmbeddedVideoView: YTPlayerViewDelegate { } } - diff --git a/godtools/App/Services/Renderer/Views/Tool/Views/Form/ToolPageFormViewModel.swift b/godtools/App/Services/Renderer/Views/Tool/Views/Form/ToolPageFormViewModel.swift index 99968d16ef..e7ed6f3dfc 100644 --- a/godtools/App/Services/Renderer/Views/Tool/Views/Form/ToolPageFormViewModel.swift +++ b/godtools/App/Services/Renderer/Views/Tool/Views/Form/ToolPageFormViewModel.swift @@ -65,7 +65,6 @@ class ToolPageFormViewModel: MobileContentFormViewModel { return } - let languageId: Int = Int(renderedPageContext.language.id) ?? 0 let followUpModel = FollowUpModel( diff --git a/godtools/App/Share/Common/FileCache/FileCache+SSZipArchive.swift b/godtools/App/Share/Common/FileCache/FileCache+SSZipArchive.swift index 96364d83bf..a40dd5b7ce 100644 --- a/godtools/App/Share/Common/FileCache/FileCache+SSZipArchive.swift +++ b/godtools/App/Share/Common/FileCache/FileCache+SSZipArchive.swift @@ -105,10 +105,11 @@ extension FileCache { let location: FileCacheLocation = FileCacheLocation(relativeUrlString: relativeUrlString) - switch storeFile(location: location, data: data) { + case .success( _): storedFileLocations.append(location) + case .failure(let error): return .failure(error) } diff --git a/godtools/App/Share/Data/ArticlesRepository/Articles/Cache/ArticleAemCache.swift b/godtools/App/Share/Data/ArticlesRepository/Articles/Cache/ArticleAemCache.swift index 473f30318b..34ffaf6dc9 100644 --- a/godtools/App/Share/Data/ArticlesRepository/Articles/Cache/ArticleAemCache.swift +++ b/godtools/App/Share/Data/ArticlesRepository/Articles/Cache/ArticleAemCache.swift @@ -45,7 +45,6 @@ class ArticleAemCache { return getAemCacheObject(realm: realm, aemUri: aemUri) } - private func getAemCacheObject(realm: Realm, aemUri: String) -> ArticleAemCacheObject? { guard let realmAemData = realm.object(ofType: RealmArticleAemData.self, forPrimaryKey: aemUri) else { diff --git a/godtools/App/Share/Domain/UseCases/GetToolTranslationsFilesUseCase/GetToolTranslationsFilesUseCase.swift b/godtools/App/Share/Domain/UseCases/GetToolTranslationsFilesUseCase/GetToolTranslationsFilesUseCase.swift index 03829194a2..985760c39e 100644 --- a/godtools/App/Share/Domain/UseCases/GetToolTranslationsFilesUseCase/GetToolTranslationsFilesUseCase.swift +++ b/godtools/App/Share/Domain/UseCases/GetToolTranslationsFilesUseCase/GetToolTranslationsFilesUseCase.swift @@ -145,6 +145,3 @@ class GetToolTranslationsFilesUseCase { return sortedLanguageTranslationManifests } } - - - diff --git a/godtools/App/Share/SwiftUI Views/FullScreenVideoView/FullScreenVideoView.swift b/godtools/App/Share/SwiftUI Views/FullScreenVideoView/FullScreenVideoView.swift index 081ffaef7a..0d333b479c 100644 --- a/godtools/App/Share/SwiftUI Views/FullScreenVideoView/FullScreenVideoView.swift +++ b/godtools/App/Share/SwiftUI Views/FullScreenVideoView/FullScreenVideoView.swift @@ -44,7 +44,6 @@ struct FullScreenVideoView: View { }) .frame(width: videoWidth, height: videoHeight) - Spacer() } } From 2a911de001dfb8254868bc9f3c2ff52cebba2162 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 16:28:26 -0400 Subject: [PATCH 28/58] Fix operator usage whitespace --- godtools/App/AppBuild/AppBuild.swift | 4 ++-- .../ConfirmAppLanguageView.swift | 2 +- .../NoFavoriteTools/NoFavoriteToolsView.swift | 2 +- .../Views/Pages/MobileContentPagesViewModel.swift | 2 +- .../Views/TrainingTip/TrainingTipViewModel.swift | 14 +++++++------- .../LanguageSupportedText.swift | 2 +- .../PageNavigationCollectionView.swift | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/godtools/App/AppBuild/AppBuild.swift b/godtools/App/AppBuild/AppBuild.swift index f0e5848b37..eed6e64bc8 100644 --- a/godtools/App/AppBuild/AppBuild.swift +++ b/godtools/App/AppBuild/AppBuild.swift @@ -31,13 +31,13 @@ class AppBuild { configuration = .release } else if let buildConfiguration = buildConfiguration { - configuration = buildConfiguration + configuration = buildConfiguration } else if isDebug { configuration = .staging } else { - configuration = .release + configuration = .release } switch configuration { diff --git a/godtools/App/Features/AppLanguage/Presentation/ConfirmAppLanguage/ConfirmAppLanguageView.swift b/godtools/App/Features/AppLanguage/Presentation/ConfirmAppLanguage/ConfirmAppLanguageView.swift index a360485e9b..f9c6a62fff 100644 --- a/godtools/App/Features/AppLanguage/Presentation/ConfirmAppLanguage/ConfirmAppLanguageView.swift +++ b/godtools/App/Features/AppLanguage/Presentation/ConfirmAppLanguage/ConfirmAppLanguageView.swift @@ -64,7 +64,7 @@ struct ConfirmAppLanguageView: View { HStack(spacing: buttonSpacing) { - let buttonWidth = (geometry.size.width - buttonSpacing - 2*horizontalPadding) / 2 + let buttonWidth = (geometry.size.width - buttonSpacing - 2 * horizontalPadding) / 2 GTWhiteButton(title: viewModel.nevermindButtonTitle, fontSize: 15, width: buttonWidth, height: 48) { diff --git a/godtools/App/Features/Favorites/Presentation/Favorites/Subviews/YourFavoriteTools/Subviews/NoFavoriteTools/NoFavoriteToolsView.swift b/godtools/App/Features/Favorites/Presentation/Favorites/Subviews/YourFavoriteTools/Subviews/NoFavoriteTools/NoFavoriteToolsView.swift index d5bbab84a8..26ac2a3a81 100644 --- a/godtools/App/Features/Favorites/Presentation/Favorites/Subviews/YourFavoriteTools/Subviews/NoFavoriteTools/NoFavoriteToolsView.swift +++ b/godtools/App/Features/Favorites/Presentation/Favorites/Subviews/YourFavoriteTools/Subviews/NoFavoriteTools/NoFavoriteToolsView.swift @@ -20,7 +20,7 @@ struct NoFavoriteToolsView: View { var body: some View { ZStack { - Color(.sRGB, red: 243/256, green: 243/256, blue: 243/256, opacity: 1) + Color(.sRGB, red: 243 / 256, green: 243 / 256, blue: 243 / 256, opacity: 1) VStack(spacing: 4) { diff --git a/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesViewModel.swift b/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesViewModel.swift index 73c6c4b465..c2af601fcd 100644 --- a/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesViewModel.swift +++ b/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesViewModel.swift @@ -540,7 +540,7 @@ class MobileContentPagesViewModel: NSObject, ObservableObject { return nil } - let renderPageResult: Result = currentPageRenderer.value.renderPageModel( + let renderPageResult: Result = currentPageRenderer.value.renderPageModel( pageModel: pageModels[page], page: page, numberOfPages: pageModels.count, diff --git a/godtools/App/Services/Renderer/Views/Training/Views/TrainingTip/TrainingTipViewModel.swift b/godtools/App/Services/Renderer/Views/Training/Views/TrainingTip/TrainingTipViewModel.swift index abd3624ace..3d02c953b3 100644 --- a/godtools/App/Services/Renderer/Views/Training/Views/TrainingTip/TrainingTipViewModel.swift +++ b/godtools/App/Services/Renderer/Views/Training/Views/TrainingTip/TrainingTipViewModel.swift @@ -58,24 +58,24 @@ class TrainingTipViewModel: MobileContentViewModel { let backgroundImageName: String switch viewType { case .upArrow: - backgroundImageName = trainingTipViewed ? "training_tip_red_arrow_up_bg": "training_tip_arrow_up_bg" + backgroundImageName = trainingTipViewed ? "training_tip_red_arrow_up_bg" : "training_tip_arrow_up_bg" case .rounded: - backgroundImageName = trainingTipViewed ? "training_tip_red_square_bg": "training_tip_square_bg" + backgroundImageName = trainingTipViewed ? "training_tip_red_square_bg" : "training_tip_square_bg" } let imageName: String switch tipModel.type { case .ask: - imageName = trainingTipViewed ? "training_tip_ask_filled_red": "training_tip_ask" + imageName = trainingTipViewed ? "training_tip_ask_filled_red" : "training_tip_ask" case .consider: - imageName = trainingTipViewed ? "training_tip_consider_filled_red": "training_tip_consider" + imageName = trainingTipViewed ? "training_tip_consider_filled_red" : "training_tip_consider" case .prepare: - imageName = trainingTipViewed ? "training_tip_prepare_filled_red": "training_tip_prepare" + imageName = trainingTipViewed ? "training_tip_prepare_filled_red" : "training_tip_prepare" case .quote: - imageName = trainingTipViewed ? "training_tip_quote_filled_red": "training_tip_quote" + imageName = trainingTipViewed ? "training_tip_quote_filled_red" : "training_tip_quote" case .tip: - imageName = trainingTipViewed ? "training_tip_tip_filled_red": "training_tip_tip" + imageName = trainingTipViewed ? "training_tip_tip_filled_red" : "training_tip_tip" default: imageName = "" } diff --git a/godtools/App/Share/SwiftUI Views/LanguageSupportedText/LanguageSupportedText.swift b/godtools/App/Share/SwiftUI Views/LanguageSupportedText/LanguageSupportedText.swift index e81e921759..3f8e2e50fd 100644 --- a/godtools/App/Share/SwiftUI Views/LanguageSupportedText/LanguageSupportedText.swift +++ b/godtools/App/Share/SwiftUI Views/LanguageSupportedText/LanguageSupportedText.swift @@ -18,7 +18,7 @@ struct LanguageSupportedText: View { HStack(alignment: .bottom, spacing: 4) { Text(languageName) - Image(isSupported ? ImageCatalog.languageAvailableCheck.name: ImageCatalog.languageUnavailableX.name) + Image(isSupported ? ImageCatalog.languageAvailableCheck.name : ImageCatalog.languageUnavailableX.name) .padding(EdgeInsets(top: 0, leading: 0, bottom: 4, trailing: 0)) } } diff --git a/godtools/App/Share/Views/PageNavigationCollectionView/PageNavigationCollectionView.swift b/godtools/App/Share/Views/PageNavigationCollectionView/PageNavigationCollectionView.swift index fe17c2d9ba..e5ba644982 100644 --- a/godtools/App/Share/Views/PageNavigationCollectionView/PageNavigationCollectionView.swift +++ b/godtools/App/Share/Views/PageNavigationCollectionView/PageNavigationCollectionView.swift @@ -66,7 +66,7 @@ class PageNavigationCollectionView: UIView, NibBased { assertionFailure("init(frame:) not supported") self.layout = PageNavigationCollectionView.getDefaultFlowLayout() - self.layoutType = .fullScreen + self.layoutType = .fullScreen super.init(frame: frame) } @@ -74,7 +74,7 @@ class PageNavigationCollectionView: UIView, NibBased { required init?(coder: NSCoder) { self.layout = PageNavigationCollectionView.getDefaultFlowLayout() - self.layoutType = .fullScreen + self.layoutType = .fullScreen super.init(coder: coder) From 878e542b3dcf6a428f1aa0302149fde7cff0214d Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 16:28:39 -0400 Subject: [PATCH 29/58] Disable some rules due to many warnings --- .swiftlint.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 7f573cf5ea..5cb507b7f8 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,6 +1,7 @@ # By default, SwiftLint uses a set of sensible default rules you can adjust: disabled_rules: # rule identifiers turned on by default to exclude from running - multiple_closures_with_trailing_closure #disabling for now as this touches many files. + - redundant_string_enum_value - statement_position #disabling for now as this touches many files. - trailing_whitespace #disabling for now as this touches many files. Command swiftlint --fix is a way to fix whitespace. - unused_closure_parameter #disabling for now as this touches many files. @@ -34,13 +35,13 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in - let_var_whitespace - literal_expression_end_indentation # - multiline_arguments #Disabling this rule as UIView.animate would fail when using animate and completion together. - - multiline_arguments_brackets + # - multiline_arguments_brackets #disabling for now as this touches many files. - multiline_function_chains - multiline_literal_brackets - multiline_parameters - multiline_parameters_brackets - no_extension_access_modifier - # - no_magic_numbers #Disabling for now as this touches many files. + # - no_magic_numbers #disabling for now as this touches many files. # - one_declaration_per_file #SwiftUI Preview breaks this, may need to update preview to use macros. - operator_usage_whitespace # - prefer_self_in_static_references #Disabling for now as touches many files. @@ -53,7 +54,7 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in - strict_fileprivate - switch_case_on_newline - toggle_bool - - trailing_closure + # - trailing_closure #disabling for now as this touches many files. - unowned_variable_capture - weak_delegate - yoda_condition From 02c010cc816ecd7fb128105f2a1cdb67fbfb11a3 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 16:43:46 -0400 Subject: [PATCH 30/58] Fix swift lint redundant_optional_initialization --- .../Tools/Subviews/ToolCard/ToolCardViewModel.swift | 2 +- .../LessonEvaluation/LessonEvaluationViewModel.swift | 2 +- .../Cache/RealmUserToolSettings.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/godtools/App/Features/Dashboard/Presentation/Tools/Subviews/ToolCard/ToolCardViewModel.swift b/godtools/App/Features/Dashboard/Presentation/Tools/Subviews/ToolCard/ToolCardViewModel.swift index 82174dceb9..fa797d5897 100644 --- a/godtools/App/Features/Dashboard/Presentation/Tools/Subviews/ToolCard/ToolCardViewModel.swift +++ b/godtools/App/Features/Dashboard/Presentation/Tools/Subviews/ToolCard/ToolCardViewModel.swift @@ -23,7 +23,7 @@ class ToolCardViewModel: ObservableObject { @Published var isFavorited = false @Published var name: String = "" @Published var category: String = "" - @Published var languageAvailability: String? = nil + @Published var languageAvailability: String? @Published var detailsButtonTitle: String = "" @Published var openButtonTitle: String = "" diff --git a/godtools/App/Features/LessonEvaluation/Presentation/LessonEvaluation/LessonEvaluationViewModel.swift b/godtools/App/Features/LessonEvaluation/Presentation/LessonEvaluation/LessonEvaluationViewModel.swift index 431655a2d8..e93e6b2fba 100644 --- a/godtools/App/Features/LessonEvaluation/Presentation/LessonEvaluation/LessonEvaluationViewModel.swift +++ b/godtools/App/Features/LessonEvaluation/Presentation/LessonEvaluation/LessonEvaluationViewModel.swift @@ -36,7 +36,7 @@ class LessonEvaluationViewModel: ObservableObject { @Published var noButtonTitle: String = "" @Published var shareFaithReadiness: String = "" @Published var sendFeedbackButtonTitle: String = "" - @Published var readyToShareFaithScale: SpiritualConversationReadinessScaleDomainModel? = nil + @Published var readyToShareFaithScale: SpiritualConversationReadinessScaleDomainModel? @Published var readyToShareFaithScaleIntValue: Int = 6 init(flowDelegate: FlowDelegate, lessonId: String, pageIndexReached: Int, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase, getLessonEvaluationInterfaceStringsUseCase: GetLessonEvaluationInterfaceStringsUseCase, didChangeScaleForSpiritualConversationReadinessUseCase: DidChangeScaleForSpiritualConversationReadinessUseCase, evaluateLessonUseCase: EvaluateLessonUseCase, cancelLessonEvaluationUseCase: CancelLessonEvaluationUseCase) { diff --git a/godtools/App/Features/PersistUserToolLanguageSettings/Data/UserToolSettingsRepository/Cache/RealmUserToolSettings.swift b/godtools/App/Features/PersistUserToolLanguageSettings/Data/UserToolSettingsRepository/Cache/RealmUserToolSettings.swift index 82614e16ce..908c77b953 100644 --- a/godtools/App/Features/PersistUserToolLanguageSettings/Data/UserToolSettingsRepository/Cache/RealmUserToolSettings.swift +++ b/godtools/App/Features/PersistUserToolLanguageSettings/Data/UserToolSettingsRepository/Cache/RealmUserToolSettings.swift @@ -14,7 +14,7 @@ class RealmUserToolSettings: Object { @Persisted var createdAt: Date = Date() @Persisted var toolId: String = "" @Persisted var primaryLanguageId: String = "" - @Persisted var parallelLanguageId: String? = nil + @Persisted var parallelLanguageId: String? @Persisted var selectedLanguageId: String = "" override static func primaryKey() -> String? { From d506051151d4bbba6c7b44265706e5c25bdf39a0 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 16:45:14 -0400 Subject: [PATCH 31/58] Update max length --- .swiftlint.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 5cb507b7f8..e4c4364f5b 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -17,7 +17,7 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in # - empty_count #disabling for now as this touches many files. - empty_string - enum_case_associated_values_count - - explicit_enum_raw_value + # - explicit_enum_raw_value #disabling for now as this touches many files. # - explicit_type_interface - fallthrough - fatal_error_message @@ -28,7 +28,7 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in - function_default_parameter_at_end - ibinspectable_in_extension - identical_operands - # - implicit_return #Will disable for now as many warnings. + # - implicit_return #disabling for now as this touches many files. - implicitly_unwrapped_optional - indentation_width - last_where @@ -44,13 +44,13 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in # - no_magic_numbers #disabling for now as this touches many files. # - one_declaration_per_file #SwiftUI Preview breaks this, may need to update preview to use macros. - operator_usage_whitespace - # - prefer_self_in_static_references #Disabling for now as touches many files. + # - prefer_self_in_static_references #disabling for now as this touches many files. - prefer_self_type_over_type_of_self - private_action - private_outlet - private_subject - private_swiftui_state - - sorted_enum_cases + # - sorted_enum_cases #disabling for now as this touches many files. - strict_fileprivate - switch_case_on_newline - toggle_bool @@ -124,6 +124,9 @@ type_name: identifier_name: min_length: # only min_length error: 4 # only error + max_length: # warning and error + warning: 80 + error: 90 excluded: # excluded via string array - id - URL From a1246ce97b507a036765cb0ea96ef11e2357e177 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 16:54:49 -0400 Subject: [PATCH 32/58] Set min length to 2 --- .swiftlint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index e4c4364f5b..dc9ac76a81 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -123,7 +123,7 @@ type_name: allowed_symbols: ["_"] # these are allowed in type names identifier_name: min_length: # only min_length - error: 4 # only error + error: 2 # only error max_length: # warning and error warning: 80 error: 90 From 7948d6fc49768059655def9b70af206659765def Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 17:02:08 -0400 Subject: [PATCH 33/58] resolve identifier_name swift lint errors --- .swiftlint.yml | 2 +- .../RealmDatabase/SwiftUIPreviewDatabase.swift | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index dc9ac76a81..122a691fa1 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -123,7 +123,7 @@ type_name: allowed_symbols: ["_"] # these are allowed in type names identifier_name: min_length: # only min_length - error: 2 # only error + error: 1 # only error max_length: # warning and error warning: 80 error: 90 diff --git a/godtools/App/Preview/Data/RealmDatabase/SwiftUIPreviewDatabase.swift b/godtools/App/Preview/Data/RealmDatabase/SwiftUIPreviewDatabase.swift index 0d3acfd16c..6ccb9a29e3 100644 --- a/godtools/App/Preview/Data/RealmDatabase/SwiftUIPreviewDatabase.swift +++ b/godtools/App/Preview/Data/RealmDatabase/SwiftUIPreviewDatabase.swift @@ -33,17 +33,17 @@ class SwiftUIPreviewDatabase: RealmDatabase { private func getResources() -> [RealmResource] { - let resource_1 = RealmResource() + let resourceKgpGospel = RealmResource() - resource_1.abbreviation = "kgp" - resource_1.attrCategory = "gospel" - resource_1.attrSpotlight = true - resource_1.id = "1" - resource_1.name = "Preview Resource" - resource_1.resourceDescription = "" - resource_1.totalViews = 12579 + resourceKgpGospel.abbreviation = "kgp" + resourceKgpGospel.attrCategory = "gospel" + resourceKgpGospel.attrSpotlight = true + resourceKgpGospel.id = "1" + resourceKgpGospel.name = "Preview Resource" + resourceKgpGospel.resourceDescription = "" + resourceKgpGospel.totalViews = 12579 - return [resource_1] + return [resourceKgpGospel] } private func getLanguages() -> [RealmLanguage] { From b3e13a9d9b0e74a76022dbd9cc3bdb046ba1cb9e Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 17:11:46 -0400 Subject: [PATCH 34/58] Remove extension access modifier --- .../Foundation/Collection/Collection+SafeLookup.swift | 2 +- .../SharedAppleExtensions/Foundation/Error/Error+Code.swift | 2 +- .../Foundation/Error/NSError+WithDescription.swift | 2 +- .../Foundation/Locale/Locale+Extensions.swift | 2 +- .../Common/SharedAppleExtensions/SwiftUI/Color/Color+RGB.swift | 2 +- .../SwiftUI/Image/Image+OptionalUIImage.swift | 2 +- .../UIKit/UIButton/UIButton+ImageColor.swift | 2 +- .../SharedAppleExtensions/UIKit/UIColor/UIColor+HexColor.swift | 2 +- .../UIKit/UIImage/UIImage+CreateImageWithColor.swift | 2 +- .../UIKit/UIImage/UIImage+ScalePresevingAspectRatio.swift | 2 +- .../UIKit/UIImageView/UIImageView+ImageColor.swift | 2 +- .../UIKit/UILabel/UILabel+AttributedString.swift | 2 +- .../UIKit/UITextView/UITextView+AttributedString.swift | 2 +- .../SharedAppleExtensions/UIKit/UIView/UIView+Animations.swift | 2 +- .../SharedAppleExtensions/UIKit/UIView/UIView+Constraints.swift | 2 +- .../SharedAppleExtensions/UIKit/UIView/UIView+DrawBorder.swift | 2 +- .../UIKit/UIViewController/UIViewController+Containment.swift | 2 +- .../UIViewController/UIViewController+DismissPresented.swift | 2 +- .../Data/LaunchCountRepository/Cache/LaunchCountCache.swift | 2 +- .../OptInOnboardingBannerEnabledCache.swift | 2 +- godtools/App/Share/Extensions/View+CornerRadius.swift | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Collection/Collection+SafeLookup.swift b/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Collection/Collection+SafeLookup.swift index 851eb56c4f..8c3bd31bb7 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Collection/Collection+SafeLookup.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Collection/Collection+SafeLookup.swift @@ -8,7 +8,7 @@ import Foundation -public extension Collection where Indices.Iterator.Element == Index { +extension Collection where Indices.Iterator.Element == Index { subscript (safe index: Index) -> Iterator.Element? { return indices.contains(index) ? self[index] : nil diff --git a/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Error/Error+Code.swift b/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Error/Error+Code.swift index 9e23ef2f24..51e95f09da 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Error/Error+Code.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Error/Error+Code.swift @@ -8,7 +8,7 @@ import Foundation -public extension Error { +extension Error { var code: Int { return (self as NSError).code diff --git a/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Error/NSError+WithDescription.swift b/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Error/NSError+WithDescription.swift index cc45653857..e6d39c9202 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Error/NSError+WithDescription.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Error/NSError+WithDescription.swift @@ -8,7 +8,7 @@ import Foundation -public extension NSError { +extension NSError { static func errorWithDescription(description: String) -> NSError { diff --git a/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Locale/Locale+Extensions.swift b/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Locale/Locale+Extensions.swift index a29765d64f..3c21ca02ab 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Locale/Locale+Extensions.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Locale/Locale+Extensions.swift @@ -8,7 +8,7 @@ import Foundation -public extension Locale { +extension Locale { var isBaseLanguage: Bool { diff --git a/godtools/App/Share/Common/SharedAppleExtensions/SwiftUI/Color/Color+RGB.swift b/godtools/App/Share/Common/SharedAppleExtensions/SwiftUI/Color/Color+RGB.swift index 5dd2e44b66..b78c95a19b 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/SwiftUI/Color/Color+RGB.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/SwiftUI/Color/Color+RGB.swift @@ -9,7 +9,7 @@ import Foundation import SwiftUI -public extension Color { +extension Color { static func getColorWithRGB(red: CGFloat, green: CGFloat, blue: CGFloat, opacity: CGFloat) -> Color { Color(.sRGB, red: red / 255, green: green / 255, blue: blue / 255, opacity: opacity) diff --git a/godtools/App/Share/Common/SharedAppleExtensions/SwiftUI/Image/Image+OptionalUIImage.swift b/godtools/App/Share/Common/SharedAppleExtensions/SwiftUI/Image/Image+OptionalUIImage.swift index 2f419c112a..8db4ece242 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/SwiftUI/Image/Image+OptionalUIImage.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/SwiftUI/Image/Image+OptionalUIImage.swift @@ -8,7 +8,7 @@ import SwiftUI -public extension Image { +extension Image { static func from(uiImage: UIImage?) -> Image? { diff --git a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIButton/UIButton+ImageColor.swift b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIButton/UIButton+ImageColor.swift index bf70ca3f05..6d26fec4e2 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIButton/UIButton+ImageColor.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIButton/UIButton+ImageColor.swift @@ -8,7 +8,7 @@ import UIKit -public extension UIButton { +extension UIButton { func setImageColor(color: UIColor) { diff --git a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIColor/UIColor+HexColor.swift b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIColor/UIColor+HexColor.swift index b17ba8bb7b..535ebcc82e 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIColor/UIColor+HexColor.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIColor/UIColor+HexColor.swift @@ -8,7 +8,7 @@ import UIKit -public extension UIColor { +extension UIColor { static func hexColor(hexValue: Int, alpha: CGFloat = 1) -> UIColor { let red: Int = (hexValue >> 16) & 0xff diff --git a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+CreateImageWithColor.swift b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+CreateImageWithColor.swift index 6daf52dac7..b54c51149b 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+CreateImageWithColor.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+CreateImageWithColor.swift @@ -8,7 +8,7 @@ import UIKit -public extension UIImage { +extension UIImage { static func createImageWithColor(color: UIColor) -> UIImage? { diff --git a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+ScalePresevingAspectRatio.swift b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+ScalePresevingAspectRatio.swift index fe7b9c5d26..4f35e4aec9 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+ScalePresevingAspectRatio.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+ScalePresevingAspectRatio.swift @@ -8,7 +8,7 @@ import UIKit -public extension UIImage { +extension UIImage { //found here: https://www.advancedswift.com/resize-uiimage-no-stretching-swift/ func scalePreservingAspectRatio(targetSize: CGSize) -> UIImage { // Determine the scale factor that preserves aspect ratio diff --git a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImageView/UIImageView+ImageColor.swift b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImageView/UIImageView+ImageColor.swift index a9ecef8956..3d927fc00e 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImageView/UIImageView+ImageColor.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImageView/UIImageView+ImageColor.swift @@ -8,7 +8,7 @@ import UIKit -public extension UIImageView { +extension UIImageView { func setImageColor(color: UIColor) { diff --git a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UILabel/UILabel+AttributedString.swift b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UILabel/UILabel+AttributedString.swift index 57a33a6ed1..34a6a88c87 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UILabel/UILabel+AttributedString.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UILabel/UILabel+AttributedString.swift @@ -8,7 +8,7 @@ import UIKit -public extension UILabel { +extension UILabel { private func getAttributedString() -> NSMutableAttributedString { diff --git a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UITextView/UITextView+AttributedString.swift b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UITextView/UITextView+AttributedString.swift index ce34d00d16..f40390ad87 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UITextView/UITextView+AttributedString.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UITextView/UITextView+AttributedString.swift @@ -8,7 +8,7 @@ import UIKit -public extension UITextView { +extension UITextView { private func getAttributedString() -> NSMutableAttributedString { return attributedText.mutableCopy() as? NSMutableAttributedString ?? NSMutableAttributedString() diff --git a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIView/UIView+Animations.swift b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIView/UIView+Animations.swift index ff77bb8b4b..a114cc5ebc 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIView/UIView+Animations.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIView/UIView+Animations.swift @@ -8,7 +8,7 @@ import UIKit -public extension UIView { +extension UIView { func animateHidden(hidden: Bool, animated: Bool) { diff --git a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIView/UIView+Constraints.swift b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIView/UIView+Constraints.swift index ba29cb898a..cf02e421c3 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIView/UIView+Constraints.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIView/UIView+Constraints.swift @@ -8,7 +8,7 @@ import UIKit -public extension UIView { +extension UIView { func constrainEdgesToView(view: UIView, edgeInsets: UIEdgeInsets = .zero, horizontalConstraintType: UIViewHorizontalContraintType = .leadingAndTrailing) { diff --git a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIView/UIView+DrawBorder.swift b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIView/UIView+DrawBorder.swift index 41a09fdcb4..d39b7d8077 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIView/UIView+DrawBorder.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIView/UIView+DrawBorder.swift @@ -8,7 +8,7 @@ import UIKit -public extension UIView { +extension UIView { func drawBorder(color: UIColor = UIColor.red) { layer.borderWidth = 1 diff --git a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIViewController/UIViewController+Containment.swift b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIViewController/UIViewController+Containment.swift index f61849b7ce..47256e301c 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIViewController/UIViewController+Containment.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIViewController/UIViewController+Containment.swift @@ -8,7 +8,7 @@ import UIKit -public extension UIViewController { +extension UIViewController { func addChildController(child: UIViewController, toView: UIView? = nil) { addChild(child) diff --git a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIViewController/UIViewController+DismissPresented.swift b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIViewController/UIViewController+DismissPresented.swift index 09c921af2f..eb47ae2cc9 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIViewController/UIViewController+DismissPresented.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIViewController/UIViewController+DismissPresented.swift @@ -8,7 +8,7 @@ import UIKit -public extension UIViewController { +extension UIViewController { // Helper ensures completion will always be called. I believe if animated is false when calling UIKit's UIViewController.dismiss(animated:) the completion closure will never be called. diff --git a/godtools/App/Share/Data/LaunchCountRepository/Cache/LaunchCountCache.swift b/godtools/App/Share/Data/LaunchCountRepository/Cache/LaunchCountCache.swift index 2d7563b20e..d20b3cb160 100644 --- a/godtools/App/Share/Data/LaunchCountRepository/Cache/LaunchCountCache.swift +++ b/godtools/App/Share/Data/LaunchCountRepository/Cache/LaunchCountCache.swift @@ -34,7 +34,7 @@ class LaunchCountCache { } } -private extension UserDefaults { +extension UserDefaults { private static let launchCountCacheKey: String = "LaunchCountCache.launchCountCacheKey" diff --git a/godtools/App/Share/Data/OptInOnboardingBannerEnabledRepository/OptInOnboardingBannerEnabledCache.swift b/godtools/App/Share/Data/OptInOnboardingBannerEnabledRepository/OptInOnboardingBannerEnabledCache.swift index dcfb334254..d469513900 100644 --- a/godtools/App/Share/Data/OptInOnboardingBannerEnabledRepository/OptInOnboardingBannerEnabledCache.swift +++ b/godtools/App/Share/Data/OptInOnboardingBannerEnabledRepository/OptInOnboardingBannerEnabledCache.swift @@ -25,7 +25,7 @@ class OptInOnboardingBannerEnabledCache { } } -private extension UserDefaults { +extension UserDefaults { private static let enabledCacheKey: String = "keyOpenTutorialCalloutDisabled" diff --git a/godtools/App/Share/Extensions/View+CornerRadius.swift b/godtools/App/Share/Extensions/View+CornerRadius.swift index 4155428142..9d593846b9 100644 --- a/godtools/App/Share/Extensions/View+CornerRadius.swift +++ b/godtools/App/Share/Extensions/View+CornerRadius.swift @@ -8,7 +8,7 @@ import SwiftUI -public extension View { +extension View { func cornerRadius(_ radius: CGFloat, corners: UIRectCorner) -> some View { clipShape( RoundedCorner(radius: radius, corners: corners) ) From b12ef1c71afe335ec5aaf886ba70e7de45181ba8 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 17:18:24 -0400 Subject: [PATCH 35/58] Fix swift lint indentation_width --- godtools/App/AppDelegate.swift | 7 +-- .../ConfirmAppLanguageView.swift | 2 +- .../DownloadableLanguageItemView.swift | 8 ++-- .../Favorites/FavoritesViewModel.swift | 2 +- .../ToolDetails/ToolDetailsView.swift | 4 +- .../TractRemoteSharePublisher.swift | 2 +- .../TractRemoteShareSubscriber.swift | 2 +- .../GetToolFilterLanguagesRepository.swift | 4 +- ...ToolFilterCategorySelectionViewModel.swift | 3 +- godtools/App/Flows/App/AppFlow.swift | 2 +- .../ToolScreenShare/ToolScreenShareFlow.swift | 3 +- .../AppsFlyer/AppsFlyerAnalytics.swift | 6 ++- .../Firebase/FirebaseAnalytics.swift | 5 +- .../Views/MobileContentViewModel.swift | 3 +- .../Views/Pages/MobileContentPagesView.swift | 8 +--- .../UIImage+ScalePresevingAspectRatio.swift | 47 ++++++++++--------- 16 files changed, 54 insertions(+), 54 deletions(-) diff --git a/godtools/App/AppDelegate.swift b/godtools/App/AppDelegate.swift index 482c860f46..a5644b968b 100644 --- a/godtools/App/AppDelegate.swift +++ b/godtools/App/AppDelegate.swift @@ -92,9 +92,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { let uiTestsDeepLinkString: String? = ProcessInfo.processInfo.environment[LaunchEnvironmentKey.urlDeeplink.value] - if let uiTestsDeepLinkString = uiTestsDeepLinkString, !uiTestsDeepLinkString.isEmpty, - let url = URL(string: uiTestsDeepLinkString) { - + if let uiTestsDeepLinkString = uiTestsDeepLinkString, !uiTestsDeepLinkString.isEmpty, let url = URL(string: uiTestsDeepLinkString) { _ = appDeepLinkingService.parseDeepLinkAndNotify(incomingDeepLink: .url(incomingUrl: IncomingDeepLinkUrl(url: url))) } @@ -177,8 +175,7 @@ extension AppDelegate { let successfullyHandledQuickAction: Bool - if let toolDeepLinkUrlString = ToolShortcutLinksView.getToolDeepLinkUrl(shortcutItem: shortcutItem), - let toolDeepLinkUrl = URL(string: toolDeepLinkUrlString) { + if let toolDeepLinkUrlString = ToolShortcutLinksView.getToolDeepLinkUrl(shortcutItem: shortcutItem), let toolDeepLinkUrl = URL(string: toolDeepLinkUrlString) { let trackActionAnalyticsUseCase: TrackActionAnalyticsUseCase = appDiContainer.domainLayer.getTrackActionAnalyticsUseCase() diff --git a/godtools/App/Features/AppLanguage/Presentation/ConfirmAppLanguage/ConfirmAppLanguageView.swift b/godtools/App/Features/AppLanguage/Presentation/ConfirmAppLanguage/ConfirmAppLanguageView.swift index f9c6a62fff..5acf01493b 100644 --- a/godtools/App/Features/AppLanguage/Presentation/ConfirmAppLanguage/ConfirmAppLanguageView.swift +++ b/godtools/App/Features/AppLanguage/Presentation/ConfirmAppLanguage/ConfirmAppLanguageView.swift @@ -97,5 +97,5 @@ struct ConfirmAppLanguageView: View { } .font(FontLibrary.sfProTextRegular.font(size: fontSize)) .foregroundColor(ColorPalette.gtGrey.color) - } + } } diff --git a/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/DownloadableLanguageItemView.swift b/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/DownloadableLanguageItemView.swift index dcba6d09e8..34aad3d7b4 100644 --- a/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/DownloadableLanguageItemView.swift +++ b/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/DownloadableLanguageItemView.swift @@ -164,9 +164,11 @@ struct DownloadableLanguageItemView: View { private func startProgressAnimationTimer() { progressAnimationTimer = Timer.scheduledTimer(withTimeInterval: 0.2, repeats: true, block: { timer in - guard let downloadProgress = self.animationDownloadProgress, - let progressTarget = self.downloadProgressTarget - else { return } + + guard let downloadProgress = self.animationDownloadProgress, let progressTarget = self.downloadProgressTarget else { + + return + } if downloadProgress < progressTarget { diff --git a/godtools/App/Features/Favorites/Presentation/Favorites/FavoritesViewModel.swift b/godtools/App/Features/Favorites/Presentation/Favorites/FavoritesViewModel.swift index c144420eaf..73dd328f5d 100644 --- a/godtools/App/Features/Favorites/Presentation/Favorites/FavoritesViewModel.swift +++ b/godtools/App/Features/Favorites/Presentation/Favorites/FavoritesViewModel.swift @@ -158,7 +158,7 @@ class FavoritesViewModel: ObservableObject { data: [ AnalyticsConstants.Keys.source: AnalyticsConstants.Sources.featured, AnalyticsConstants.Keys.tool: featuredLesson.analyticsToolName - ] + ] ) } diff --git a/godtools/App/Features/ToolDetails/Presentation/ToolDetails/ToolDetailsView.swift b/godtools/App/Features/ToolDetails/Presentation/ToolDetails/ToolDetailsView.swift index be42c9b73b..773e1b4526 100644 --- a/godtools/App/Features/ToolDetails/Presentation/ToolDetails/ToolDetailsView.swift +++ b/godtools/App/Features/ToolDetails/Presentation/ToolDetails/ToolDetailsView.swift @@ -44,10 +44,10 @@ struct ToolDetailsView: View { VStack(alignment: .center, spacing: 0) { ToolDetailsTitleHeaderView(viewModel: viewModel) - .padding(EdgeInsets(top: 40, leading: contentInsets.leading, bottom: 0, trailing: contentInsets.trailing)) + .padding(EdgeInsets(top: 40, leading: contentInsets.leading, bottom: 0, trailing: contentInsets.trailing)) ToolDetailsPrimaryButtonsView(viewModel: viewModel, primaryButtonWidth: contentWidth) - .padding(EdgeInsets(top: 16, leading: contentInsets.leading, bottom: 0, trailing: contentInsets.trailing)) + .padding(EdgeInsets(top: 16, leading: contentInsets.leading, bottom: 0, trailing: contentInsets.trailing)) SegmentControl(selectedIndex: $selectedSegmentIndex, segments: viewModel.segments, segmentTappedClosure: { (index: Int) in diff --git a/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteSharePublisher/TractRemoteSharePublisher.swift b/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteSharePublisher/TractRemoteSharePublisher.swift index 50ce9ee6d9..b99728864f 100644 --- a/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteSharePublisher/TractRemoteSharePublisher.swift +++ b/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteSharePublisher/TractRemoteSharePublisher.swift @@ -173,7 +173,7 @@ class TractRemoteSharePublisher: NSObject { if loggingEnabled { print("\n TractRemoteSharePublisher \(method)") if let label = label, let labelValue = labelValue { - print(" \(label): \(labelValue)") + print(" \(label): \(labelValue)") } } } diff --git a/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteShareSubscriber/TractRemoteShareSubscriber.swift b/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteShareSubscriber/TractRemoteShareSubscriber.swift index 6054d8eb7f..47ad9b61cb 100644 --- a/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteShareSubscriber/TractRemoteShareSubscriber.swift +++ b/godtools/App/Features/ToolScreenShare/Data/TractRemoteShare/TractRemoteShareSubscriber/TractRemoteShareSubscriber.swift @@ -146,7 +146,7 @@ class TractRemoteShareSubscriber: NSObject { if loggingEnabled { print("\n TractRemoteShareSubscriber \(method)") if let label = label, let labelValue = labelValue { - print(" \(label): \(labelValue)") + print(" \(label): \(labelValue)") } } } diff --git a/godtools/App/Features/ToolsFilter/Data-DomainInterface/GetToolFilterLanguagesRepository.swift b/godtools/App/Features/ToolsFilter/Data-DomainInterface/GetToolFilterLanguagesRepository.swift index 91b287ec34..1a46712f8a 100644 --- a/godtools/App/Features/ToolsFilter/Data-DomainInterface/GetToolFilterLanguagesRepository.swift +++ b/godtools/App/Features/ToolsFilter/Data-DomainInterface/GetToolFilterLanguagesRepository.swift @@ -48,7 +48,7 @@ class GetToolFilterLanguagesRepository: GetToolFilterLanguagesRepositoryInterfac func getLanguageFilter(from languageId: String?, translatedInAppLanguage: AppLanguageDomainModel) -> LanguageFilterDomainModel? { guard let languageId = languageId, - let language = languagesRepository.getLanguage(id: languageId) + let language = languagesRepository.getLanguage(id: languageId) else { return nil } @@ -64,7 +64,7 @@ extension GetToolFilterLanguagesRepository { private func getLanguageFilterPublisher(from languageId: String?, translatedInAppLanguage: AppLanguageDomainModel) -> AnyPublisher { guard let languageId = languageId, - let language = languagesRepository.getLanguage(id: languageId) + let language = languagesRepository.getLanguage(id: languageId) else { return Just(nil) .eraseToAnyPublisher() diff --git a/godtools/App/Features/ToolsFilter/Presentation/ToolFilterCategorySelectionView/ToolFilterCategorySelectionViewModel.swift b/godtools/App/Features/ToolsFilter/Presentation/ToolFilterCategorySelectionView/ToolFilterCategorySelectionViewModel.swift index 167fc0eee2..6077e888a7 100644 --- a/godtools/App/Features/ToolsFilter/Presentation/ToolFilterCategorySelectionView/ToolFilterCategorySelectionViewModel.swift +++ b/godtools/App/Features/ToolsFilter/Presentation/ToolFilterCategorySelectionView/ToolFilterCategorySelectionViewModel.swift @@ -32,8 +32,7 @@ class ToolFilterCategorySelectionViewModel: ObservableObject { @Published var navTitle: String = "" @Published var categorySearchResults: [CategoryFilterDomainModel] = [CategoryFilterDomainModel]() - init(viewToolFilterCategoriesUseCase: ViewToolFilterCategoriesUseCase, searchToolFilterCategoriesUseCase: SearchToolFilterCategoriesUseCase, getUserToolFiltersUseCase: GetUserToolFiltersUseCase -, storeUserToolFiltersUseCase: StoreUserToolFiltersUseCase, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase, viewSearchBarUseCase: ViewSearchBarUseCase, flowDelegate: FlowDelegate) { + init(viewToolFilterCategoriesUseCase: ViewToolFilterCategoriesUseCase, searchToolFilterCategoriesUseCase: SearchToolFilterCategoriesUseCase, getUserToolFiltersUseCase: GetUserToolFiltersUseCase, storeUserToolFiltersUseCase: StoreUserToolFiltersUseCase, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase, viewSearchBarUseCase: ViewSearchBarUseCase, flowDelegate: FlowDelegate) { self.viewToolFilterCategoriesUseCase = viewToolFilterCategoriesUseCase self.searchToolFilterCategoriesUseCase = searchToolFilterCategoriesUseCase diff --git a/godtools/App/Flows/App/AppFlow.swift b/godtools/App/Flows/App/AppFlow.swift index fcf9d5f7db..0c640bd787 100644 --- a/godtools/App/Flows/App/AppFlow.swift +++ b/godtools/App/Flows/App/AppFlow.swift @@ -978,7 +978,7 @@ extension AppFlow { getCurrentAppLanguageUseCase: appDiContainer.feature.appLanguage.domainLayer.getCurrentAppLanguageUseCase(), viewSearchBarUseCase: appDiContainer.domainLayer.getViewSearchBarUseCase(), flowDelegate: self - ) + ) let view = ToolFilterCategorySelectionView(viewModel: viewModel) diff --git a/godtools/App/Flows/ToolScreenShare/ToolScreenShareFlow.swift b/godtools/App/Flows/ToolScreenShare/ToolScreenShareFlow.swift index 3240d34079..8ac57d6f07 100644 --- a/godtools/App/Flows/ToolScreenShare/ToolScreenShareFlow.swift +++ b/godtools/App/Flows/ToolScreenShare/ToolScreenShareFlow.swift @@ -139,8 +139,7 @@ class ToolScreenShareFlow: Flow { let tractRemoteShareURLBuilder: TractRemoteShareURLBuilder = appDiContainer.feature.toolScreenShare.dataLayer.getTractRemoteShareURLBuilder() - guard let domainModel = shareToolScreenShareSessionDomainModel, - let remoteShareUrl = tractRemoteShareURLBuilder.buildRemoteShareURL(toolId: toolSettingsObserver.toolId, primaryLanguageId: toolSettingsObserver.languages.primaryLanguageId, parallelLanguageId: toolSettingsObserver.languages.parallelLanguageId, selectedLanguageId: toolSettingsObserver.languages.selectedLanguageId, page: toolSettingsObserver.pageNumber, subscriberChannelId: channel.subscriberChannelId) else { + guard let domainModel = shareToolScreenShareSessionDomainModel, let remoteShareUrl = tractRemoteShareURLBuilder.buildRemoteShareURL(toolId: toolSettingsObserver.toolId, primaryLanguageId: toolSettingsObserver.languages.primaryLanguageId, parallelLanguageId: toolSettingsObserver.languages.parallelLanguageId, selectedLanguageId: toolSettingsObserver.languages.selectedLanguageId, page: toolSettingsObserver.pageNumber, subscriberChannelId: channel.subscriberChannelId) else { let viewModel = AlertMessageViewModel( title: "Error", diff --git a/godtools/App/Services/Analytics/AppsFlyer/AppsFlyerAnalytics.swift b/godtools/App/Services/Analytics/AppsFlyer/AppsFlyerAnalytics.swift index 56e189556c..eedd464f59 100644 --- a/godtools/App/Services/Analytics/AppsFlyer/AppsFlyerAnalytics.swift +++ b/godtools/App/Services/Analytics/AppsFlyer/AppsFlyerAnalytics.swift @@ -77,13 +77,17 @@ class AppsFlyerAnalytics: NSObject { private func log(method: String, label: String?, labelValue: String?, data: [String: Any]?) { if loggingEnabled { + print("\nAppsFlyer \(method)") + if let label = label, let labelValue = labelValue { - print(" \(label): \(labelValue)") + print(" \(label): \(labelValue)") } + if let data = data { print(" data: \(data)") } + if let customData = appsFlyer.appsFlyerLib.customData { print(" customData: \(customData)") } diff --git a/godtools/App/Services/Analytics/Firebase/FirebaseAnalytics.swift b/godtools/App/Services/Analytics/Firebase/FirebaseAnalytics.swift index 543e618df3..83441e7296 100644 --- a/godtools/App/Services/Analytics/Firebase/FirebaseAnalytics.swift +++ b/godtools/App/Services/Analytics/Firebase/FirebaseAnalytics.swift @@ -192,10 +192,13 @@ class FirebaseAnalytics { private func log(method: String, label: String?, labelValue: String?, data: [String: Any]?) { if loggingEnabled { + print("\nFirebaseAnalytics \(method)") + if let label = label, let labelValue = labelValue { - print(" \(label): \(labelValue)") + print(" \(label): \(labelValue)") } + if let data = data { print(" data: \(data)") } diff --git a/godtools/App/Services/Renderer/Views/MobileContent/Views/MobileContentViewModel.swift b/godtools/App/Services/Renderer/Views/MobileContent/Views/MobileContentViewModel.swift index 23b53956c6..6781fdccb3 100644 --- a/godtools/App/Services/Renderer/Views/MobileContent/Views/MobileContentViewModel.swift +++ b/godtools/App/Services/Renderer/Views/MobileContent/Views/MobileContentViewModel.swift @@ -93,8 +93,7 @@ extension MobileContentViewModel { func getClickableAnalyticsEvents() -> [AnalyticsEvent] { - guard let clickableModel = baseModel as? Clickable, clickableModel.isClickable, - let modelHasAnalyticsEvents = clickableModel as? HasAnalyticsEvents else { + guard let clickableModel = baseModel as? Clickable, clickableModel.isClickable, let modelHasAnalyticsEvents = clickableModel as? HasAnalyticsEvents else { return Array() } diff --git a/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesView.swift b/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesView.swift index 5c0c6479ce..be5e0a0d7c 100644 --- a/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesView.swift +++ b/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesView.swift @@ -124,9 +124,7 @@ class MobileContentPagesView: AppViewController { weakSelf.pageNavigationView.scrollToPage(pageNavigation: navigationEvent.pageNavigation, completion: { (completedNavigation: PageNavigationCollectionViewNavigationCompleted) in - if let pagePositions = navigationEvent.pagePositions, - let pageCell = completedNavigation.pageCell as? MobileContentPageCell, - let pageView = pageCell.mobileContentView as? MobileContentPageView { + if let pagePositions = navigationEvent.pagePositions, let pageCell = completedNavigation.pageCell as? MobileContentPageCell, let pageView = pageCell.mobileContentView as? MobileContentPageView { pageView.setPositionStateForViewHierarchy( positionState: pagePositions, @@ -159,9 +157,7 @@ class MobileContentPagesView: AppViewController { for cell in visiblePageCells { - if let pageCell = cell as? MobileContentPageCell, - let pageView = pageCell.mobileContentView as? MobileContentPageView, - let indexPath = pageNavigationView.getIndexPathForPageCell(pageCell: pageCell) { + if let pageCell = cell as? MobileContentPageCell, let pageView = pageCell.mobileContentView as? MobileContentPageView, let indexPath = pageNavigationView.getIndexPathForPageCell(pageCell: pageCell) { let page: Int = indexPath.row let currentPagePositions: MobileContentViewPositionState = pageView.getPositionStateForViewHierarchy() diff --git a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+ScalePresevingAspectRatio.swift b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+ScalePresevingAspectRatio.swift index 4f35e4aec9..5944985ad4 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+ScalePresevingAspectRatio.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+ScalePresevingAspectRatio.swift @@ -11,30 +11,31 @@ import UIKit extension UIImage { //found here: https://www.advancedswift.com/resize-uiimage-no-stretching-swift/ func scalePreservingAspectRatio(targetSize: CGSize) -> UIImage { - // Determine the scale factor that preserves aspect ratio - let widthRatio = targetSize.width / size.width - let heightRatio = targetSize.height / size.height - - let scaleFactor = min(widthRatio, heightRatio) - - // Compute the new image size that preserves aspect ratio - let scaledImageSize = CGSize( - width: size.width * scaleFactor, - height: size.height * scaleFactor - ) + + // Determine the scale factor that preserves aspect ratio + let widthRatio = targetSize.width / size.width + let heightRatio = targetSize.height / size.height + + let scaleFactor = min(widthRatio, heightRatio) + + // Compute the new image size that preserves aspect ratio + let scaledImageSize = CGSize( + width: size.width * scaleFactor, + height: size.height * scaleFactor + ) - // Draw and return the resized UIImage - let renderer = UIGraphicsImageRenderer( - size: scaledImageSize - ) + // Draw and return the resized UIImage + let renderer = UIGraphicsImageRenderer( + size: scaledImageSize + ) - let scaledImage = renderer.image { _ in - self.draw(in: CGRect( - origin: .zero, - size: scaledImageSize - )) - } - - return scaledImage + let scaledImage = renderer.image { _ in + self.draw(in: CGRect( + origin: .zero, + size: scaledImageSize + )) } + + return scaledImage + } } From 31600e90293e0e906400248beb3efbae4a3887a3 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Mon, 15 Jul 2024 17:26:27 -0400 Subject: [PATCH 36/58] Fix swift lint closure_end_indentation --- .../Favorites/FavoritesView.swift | 7 +- .../FeaturedLessons/FeaturedLessonsView.swift | 5 +- .../OpenTutorialBannerView.swift | 2 +- .../LessonEvaluationView.swift | 3 +- .../Presentation/Lessons/LessonsView.swift | 5 +- .../GetUserActivityUseCase.swift | 13 ++-- .../ToolDetails/ToolDetailsView.swift | 69 +++++++++---------- .../MobileContentRendererNavigation.swift | 3 +- 8 files changed, 55 insertions(+), 52 deletions(-) diff --git a/godtools/App/Features/Favorites/Presentation/Favorites/FavoritesView.swift b/godtools/App/Features/Favorites/Presentation/Favorites/FavoritesView.swift index 8893e88bbd..7ce382c4b7 100644 --- a/godtools/App/Features/Favorites/Presentation/Favorites/FavoritesView.swift +++ b/godtools/App/Features/Favorites/Presentation/Favorites/FavoritesView.swift @@ -64,9 +64,10 @@ struct FavoritesView: View { geometry: geometry, contentHorizontalInsets: contentHorizontalInsets, lessonTappedClosure: { (featuredLesson: FeaturedLessonDomainModel) in - - viewModel.featuredLessonTapped(featuredLesson: featuredLesson) - }) + + viewModel.featuredLessonTapped(featuredLesson: featuredLesson) + } + ) .padding([.top], 30) YourFavoriteToolsView( diff --git a/godtools/App/Features/Favorites/Presentation/Favorites/Subviews/FeaturedLessons/FeaturedLessonsView.swift b/godtools/App/Features/Favorites/Presentation/Favorites/Subviews/FeaturedLessons/FeaturedLessonsView.swift index d96aad9177..c4fc28fac7 100644 --- a/godtools/App/Features/Favorites/Presentation/Favorites/Subviews/FeaturedLessons/FeaturedLessonsView.swift +++ b/godtools/App/Features/Favorites/Presentation/Favorites/Subviews/FeaturedLessons/FeaturedLessonsView.swift @@ -44,8 +44,9 @@ struct FeaturedLessonsView: View { geometry: geometry, cardTappedClosure: { - lessonTappedClosure?(featuredLesson) - }) + lessonTappedClosure?(featuredLesson) + } + ) } } .padding([.top], lessonCardSpacing) diff --git a/godtools/App/Features/Favorites/Presentation/Favorites/Subviews/OpenTutorialBanner/OpenTutorialBannerView.swift b/godtools/App/Features/Favorites/Presentation/Favorites/Subviews/OpenTutorialBanner/OpenTutorialBannerView.swift index a76cec7640..5fc3e34b45 100644 --- a/godtools/App/Features/Favorites/Presentation/Favorites/Subviews/OpenTutorialBanner/OpenTutorialBannerView.swift +++ b/godtools/App/Features/Favorites/Presentation/Favorites/Subviews/OpenTutorialBanner/OpenTutorialBannerView.swift @@ -38,7 +38,7 @@ struct OpenTutorialBannerView: View { .font(FontLibrary.sfProTextRegular.font(size: 17)) .onTapGesture { openTutorialTappedClosure?() - } + } Image(ImageCatalog.openTutorialArrow.name) .resizable() diff --git a/godtools/App/Features/LessonEvaluation/Presentation/LessonEvaluation/LessonEvaluationView.swift b/godtools/App/Features/LessonEvaluation/Presentation/LessonEvaluation/LessonEvaluationView.swift index b4338125bb..c1497cd78a 100644 --- a/godtools/App/Features/LessonEvaluation/Presentation/LessonEvaluation/LessonEvaluationView.swift +++ b/godtools/App/Features/LessonEvaluation/Presentation/LessonEvaluation/LessonEvaluationView.swift @@ -39,7 +39,8 @@ struct LessonEvaluationView: View { buttonSize: closeButtonSize, tapped: { viewModel.closeTapped() - }) + } + ) .padding([.top], closeButtonTop) .padding([.trailing], 5) } diff --git a/godtools/App/Features/Lessons/Presentation/Lessons/LessonsView.swift b/godtools/App/Features/Lessons/Presentation/Lessons/LessonsView.swift index ea592916a3..80b8cfe259 100644 --- a/godtools/App/Features/Lessons/Presentation/Lessons/LessonsView.swift +++ b/godtools/App/Features/Lessons/Presentation/Lessons/LessonsView.swift @@ -53,8 +53,9 @@ struct LessonsView: View { geometry: geometry, cardTappedClosure: { - viewModel.lessonCardTapped(lessonListItem: lessonListItem) - }) + viewModel.lessonCardTapped(lessonListItem: lessonListItem) + } + ) } } .padding([.top], lessonCardSpacing) diff --git a/godtools/App/Features/Menu/Domain/UseCases/GetUserActivityUseCase/GetUserActivityUseCase.swift b/godtools/App/Features/Menu/Domain/UseCases/GetUserActivityUseCase/GetUserActivityUseCase.swift index e3786b339a..b46b6980c8 100644 --- a/godtools/App/Features/Menu/Domain/UseCases/GetUserActivityUseCase/GetUserActivityUseCase.swift +++ b/godtools/App/Features/Menu/Domain/UseCases/GetUserActivityUseCase/GetUserActivityUseCase.swift @@ -30,15 +30,14 @@ class GetUserActivityUseCase { return userCounterRepository .getUserCountersChanged(reloadFromRemote: true) .flatMap { _ in - + let allUserCounters = self.getAllUserCounters() - + let userActivityDomainModel = self.getUserActivityDomainModel(from: allUserCounters, translatedInAppLanguage: appLanguage) - - return Just(userActivityDomainModel) - - } - .eraseToAnyPublisher() + + return Just(userActivityDomainModel) + } + .eraseToAnyPublisher() } private func getAllUserCounters() -> [UserCounterDomainModel] { diff --git a/godtools/App/Features/ToolDetails/Presentation/ToolDetails/ToolDetailsView.swift b/godtools/App/Features/ToolDetails/Presentation/ToolDetails/ToolDetailsView.swift index 773e1b4526..c13e0d39bf 100644 --- a/godtools/App/Features/ToolDetails/Presentation/ToolDetails/ToolDetailsView.swift +++ b/godtools/App/Features/ToolDetails/Presentation/ToolDetails/ToolDetailsView.swift @@ -42,50 +42,49 @@ struct ToolDetailsView: View { ToolDetailsMediaView(viewModel: viewModel, width: geometry.size.width) VStack(alignment: .center, spacing: 0) { - - ToolDetailsTitleHeaderView(viewModel: viewModel) + + ToolDetailsTitleHeaderView(viewModel: viewModel) .padding(EdgeInsets(top: 40, leading: contentInsets.leading, bottom: 0, trailing: contentInsets.trailing)) - - ToolDetailsPrimaryButtonsView(viewModel: viewModel, primaryButtonWidth: contentWidth) + + ToolDetailsPrimaryButtonsView(viewModel: viewModel, primaryButtonWidth: contentWidth) .padding(EdgeInsets(top: 16, leading: contentInsets.leading, bottom: 0, trailing: contentInsets.trailing)) - - SegmentControl(selectedIndex: $selectedSegmentIndex, segments: viewModel.segments, segmentTappedClosure: { (index: Int) in - - viewModel.segmentTapped(index: index) - }) - .padding(EdgeInsets(top: 50, leading: 0, bottom: 0, trailing: 0)) - } - .background(Rectangle() - .fill(Color.white) - .shadow(color: Color.black.opacity(0.3), radius: 4, x: 0, y: 1) - .mask(Rectangle().padding(.bottom, -8)) - ) - - Rectangle() - .frame(width: geometry.size.width, height: 20) - .foregroundColor(.clear) - - switch viewModel.selectedSegment { - - case .about: - ToolDetailsAboutView( + + SegmentControl(selectedIndex: $selectedSegmentIndex, segments: viewModel.segments, segmentTappedClosure: { (index: Int) in + viewModel.segmentTapped(index: index) + }) + .padding(EdgeInsets(top: 50, leading: 0, bottom: 0, trailing: 0)) + } + .background(Rectangle() + .fill(Color.white) + .shadow(color: Color.black.opacity(0.3), radius: 4, x: 0, y: 1) + .mask(Rectangle().padding(.bottom, -8)) + ) + + Rectangle() + .frame(width: geometry.size.width, height: 20) + .foregroundColor(.clear) + + switch viewModel.selectedSegment { + + case .about: + ToolDetailsAboutView( viewModel: viewModel, geometry: geometry - ) - - case .versions: - ToolDetailsVersionsView( + ) + + case .versions: + ToolDetailsVersionsView( viewModel: viewModel, geometry: geometry, toolVersionTappedClosure: { scrollViewReader.scrollTo(ToolDetailsView.scrollToTopViewId) } - ) - } - - Rectangle() - .frame(width: geometry.size.width, height: 20) - .foregroundColor(.clear) + ) + } + + Rectangle() + .frame(width: geometry.size.width, height: 20) + .foregroundColor(.clear) } .frame(width: geometry.size.width) } diff --git a/godtools/App/Services/Renderer/Navigation/MobileContentRendererNavigation.swift b/godtools/App/Services/Renderer/Navigation/MobileContentRendererNavigation.swift index aee33f8953..4928a9c15e 100644 --- a/godtools/App/Services/Renderer/Navigation/MobileContentRendererNavigation.swift +++ b/godtools/App/Services/Renderer/Navigation/MobileContentRendererNavigation.swift @@ -153,7 +153,8 @@ class MobileContentRendererNavigation { localizationServices: appDiContainer.dataLayer.getLocalizationServices(), closeTappedClosure: { [weak self] in self?.dismissToolTraining() - }) + } + ) let view = ToolTrainingView(viewModel: viewModel) From dd4ade76ea608334b6520d0d8c27556b7a23d671 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 08:31:23 -0400 Subject: [PATCH 37/58] Fix swift lint (multiline_function_chains) --- ...tDownloadableLanguagesListRepository.swift | 65 ++++++++++--------- .../Cache/RealmAppLanguagesCache.swift | 5 +- .../Cache/RealmDownloadedLanguagesCache.swift | 3 +- .../Cache/RealmUserAppLanguageCache.swift | 4 +- .../Presentation/Tools/ToolsViewModel.swift | 2 +- .../Cache/RealmGlobalAnalyticsCache.swift | 4 +- .../GetUserAccountDetailsUseCase.swift | 8 ++- .../Cache/RealmUserToolFiltersCache.swift | 6 +- .../RealmCategoryArticlesCache.swift | 3 +- .../Cache/RealmFavoritedResourcesCache.swift | 17 +++-- .../Cache/RealmLanguagesCache.swift | 24 +++++-- .../Cache/RealmResourcesCache.swift | 31 ++++++--- .../Cache/RealmTranslationsCache.swift | 15 +++-- .../Cache/RealmUserCountersCache.swift | 13 ++-- .../Cache/RealmUserDetailsCache.swift | 8 ++- .../HTMLDocument+ResourceUrls.swift | 6 +- .../UseCases/ViewSearchBarUseCase.swift | 11 ++-- 17 files changed, 142 insertions(+), 83 deletions(-) diff --git a/godtools/App/Features/AppLanguage/Data-DomainInterface/GetDownloadableLanguagesListRepository.swift b/godtools/App/Features/AppLanguage/Data-DomainInterface/GetDownloadableLanguagesListRepository.swift index 11afdcb360..cf3046d159 100644 --- a/godtools/App/Features/AppLanguage/Data-DomainInterface/GetDownloadableLanguagesListRepository.swift +++ b/godtools/App/Features/AppLanguage/Data-DomainInterface/GetDownloadableLanguagesListRepository.swift @@ -36,39 +36,40 @@ class GetDownloadableLanguagesListRepository: GetDownloadableLanguagesListReposi ) .map { _ in - return self.languagesRepository.getLanguages().compactMap { language in - - let numberToolsAvailable = self.getNumberToolsAvailable(for: language.code) - if numberToolsAvailable == 0 { - return nil + return self.languagesRepository.getLanguages() + .compactMap { language in + + let numberToolsAvailable = self.getNumberToolsAvailable(for: language.code) + if numberToolsAvailable == 0 { + return nil + } + + let languageNameInOwnLanguage = self.getTranslatedLanguageName.getLanguageName( + language: language, + translatedInLanguage: language.code + ) + let languageNameInAppLanguage = self.getTranslatedLanguageName.getLanguageName( + language: language, + translatedInLanguage: currentAppLanguage + ) + + let toolsAvailableText = self.getToolsAvailableText(numberOfTools: numberToolsAvailable, translatedIn: currentAppLanguage) + + let downloadStatus = self.getDownloadStatus(for: language.id) + + return DownloadableLanguageListItemDomainModel( + languageId: language.id, + languageCode: language.languageCode, + languageNameInOwnLanguage: languageNameInOwnLanguage, + languageNameInAppLanguage: languageNameInAppLanguage, + toolsAvailableText: toolsAvailableText, + downloadStatus: downloadStatus + ) + } + .sorted { language1, language2 in + + return self.getSortOrder(language1: language1, language2: language2) } - - let languageNameInOwnLanguage = self.getTranslatedLanguageName.getLanguageName( - language: language, - translatedInLanguage: language.code - ) - let languageNameInAppLanguage = self.getTranslatedLanguageName.getLanguageName( - language: language, - translatedInLanguage: currentAppLanguage - ) - - let toolsAvailableText = self.getToolsAvailableText(numberOfTools: numberToolsAvailable, translatedIn: currentAppLanguage) - - let downloadStatus = self.getDownloadStatus(for: language.id) - - return DownloadableLanguageListItemDomainModel( - languageId: language.id, - languageCode: language.languageCode, - languageNameInOwnLanguage: languageNameInOwnLanguage, - languageNameInAppLanguage: languageNameInAppLanguage, - toolsAvailableText: toolsAvailableText, - downloadStatus: downloadStatus - ) - } - .sorted { language1, language2 in - - return self.getSortOrder(language1: language1, language2: language2) - } } .eraseToAnyPublisher() } diff --git a/godtools/App/Features/AppLanguage/Data/AppLanguagesRepository/Cache/RealmAppLanguagesCache.swift b/godtools/App/Features/AppLanguage/Data/AppLanguagesRepository/Cache/RealmAppLanguagesCache.swift index 8a95cac53e..8f961ca9ab 100644 --- a/godtools/App/Features/AppLanguage/Data/AppLanguagesRepository/Cache/RealmAppLanguagesCache.swift +++ b/godtools/App/Features/AppLanguage/Data/AppLanguagesRepository/Cache/RealmAppLanguagesCache.swift @@ -20,8 +20,9 @@ class RealmAppLanguagesCache { } func observeChangesPublisher() -> AnyPublisher { - return realmDatabase.openRealm().objects(RealmAppLanguage.self).objectWillChange - .eraseToAnyPublisher() + return realmDatabase.openRealm() + .objects(RealmAppLanguage.self) + .objectWillChange .prepend(Void()) .eraseToAnyPublisher() } diff --git a/godtools/App/Features/AppLanguage/Data/DownloadedLanguagesRepository/Cache/RealmDownloadedLanguagesCache.swift b/godtools/App/Features/AppLanguage/Data/DownloadedLanguagesRepository/Cache/RealmDownloadedLanguagesCache.swift index 4585155983..1f907b9050 100644 --- a/godtools/App/Features/AppLanguage/Data/DownloadedLanguagesRepository/Cache/RealmDownloadedLanguagesCache.swift +++ b/godtools/App/Features/AppLanguage/Data/DownloadedLanguagesRepository/Cache/RealmDownloadedLanguagesCache.swift @@ -21,7 +21,8 @@ class RealmDownloadedLanguagesCache { func getDownloadedLanguagesChangedPublisher() -> AnyPublisher { - return realmDatabase.openRealm().objects(RealmDownloadedLanguage.self) + return realmDatabase.openRealm() + .objects(RealmDownloadedLanguage.self) .objectWillChange .eraseToAnyPublisher() } diff --git a/godtools/App/Features/AppLanguage/Data/UserAppLanguageRepository/Cache/RealmUserAppLanguageCache.swift b/godtools/App/Features/AppLanguage/Data/UserAppLanguageRepository/Cache/RealmUserAppLanguageCache.swift index fee922b611..dffd44f6f2 100644 --- a/godtools/App/Features/AppLanguage/Data/UserAppLanguageRepository/Cache/RealmUserAppLanguageCache.swift +++ b/godtools/App/Features/AppLanguage/Data/UserAppLanguageRepository/Cache/RealmUserAppLanguageCache.swift @@ -40,7 +40,9 @@ class RealmUserAppLanguageCache { func getLanguageChangedPublisher() -> AnyPublisher { - return realmDatabase.openRealm().objects(RealmUserAppLanguage.self).objectWillChange + return realmDatabase.openRealm() + .objects(RealmUserAppLanguage.self) + .objectWillChange .map { _ in Void() } diff --git a/godtools/App/Features/Dashboard/Presentation/Tools/ToolsViewModel.swift b/godtools/App/Features/Dashboard/Presentation/Tools/ToolsViewModel.swift index 004d2018f7..b5d2d36935 100644 --- a/godtools/App/Features/Dashboard/Presentation/Tools/ToolsViewModel.swift +++ b/godtools/App/Features/Dashboard/Presentation/Tools/ToolsViewModel.swift @@ -74,7 +74,7 @@ class ToolsViewModel: ObservableObject { $toolFilterCategorySelection.eraseToAnyPublisher().dropFirst(), $toolFilterLanguageSelection.eraseToAnyPublisher().dropFirst() ) - .map{ (appLanguage, toolFilterCategory, toolFilterLanguage) in + .map { (appLanguage, toolFilterCategory, toolFilterLanguage) in Publishers.CombineLatest( viewToolsUseCase.viewPublisher( diff --git a/godtools/App/Features/GlobalActivity/Data/GlobalAnalyticsRepository/Cache/RealmGlobalAnalyticsCache.swift b/godtools/App/Features/GlobalActivity/Data/GlobalAnalyticsRepository/Cache/RealmGlobalAnalyticsCache.swift index fecec67d53..af3974db36 100644 --- a/godtools/App/Features/GlobalActivity/Data/GlobalAnalyticsRepository/Cache/RealmGlobalAnalyticsCache.swift +++ b/godtools/App/Features/GlobalActivity/Data/GlobalAnalyticsRepository/Cache/RealmGlobalAnalyticsCache.swift @@ -21,7 +21,9 @@ class RealmGlobalAnalyticsCache { func getGlobalAnalyticsChangedPublisher(id: String) -> AnyPublisher { - return realmDatabase.openRealm().objects(RealmGlobalAnalytics.self).objectWillChange + return realmDatabase.openRealm() + .objects(RealmGlobalAnalytics.self) + .objectWillChange .map { _ in return self.getGlobalAnalytics(id: id) diff --git a/godtools/App/Features/Menu/Domain/UseCases/GetUserAccountDetailsUseCase/GetUserAccountDetailsUseCase.swift b/godtools/App/Features/Menu/Domain/UseCases/GetUserAccountDetailsUseCase/GetUserAccountDetailsUseCase.swift index e1c72454f2..ab573493e3 100644 --- a/godtools/App/Features/Menu/Domain/UseCases/GetUserAccountDetailsUseCase/GetUserAccountDetailsUseCase.swift +++ b/godtools/App/Features/Menu/Domain/UseCases/GetUserAccountDetailsUseCase/GetUserAccountDetailsUseCase.swift @@ -24,12 +24,16 @@ class GetUserAccountDetailsUseCase { func getUserAccountDetailsPublisher(appLanguage: AppLanguageDomainModel) -> AnyPublisher { return Publishers.CombineLatest( - repository.getAuthUserDetailsFromRemotePublisher().prepend(UserDetailsDataModel.emptyDataModel()) + repository + .getAuthUserDetailsFromRemotePublisher() + .prepend(UserDetailsDataModel.emptyDataModel()) .catch({ _ in return Just(UserDetailsDataModel.emptyDataModel()) .eraseToAnyPublisher() }), - repository.getAuthUserDetailsChangedPublisher().prepend(nil) + repository + .getAuthUserDetailsChangedPublisher() + .prepend(nil) ) .flatMap({ (remoteUserDetails: UserDetailsDataModel, changedUserDetails: UserDetailsDataModel?) -> AnyPublisher in diff --git a/godtools/App/Features/ToolsFilter/Data/UserToolFiltersRepository/Cache/RealmUserToolFiltersCache.swift b/godtools/App/Features/ToolsFilter/Data/UserToolFiltersRepository/Cache/RealmUserToolFiltersCache.swift index 8bc6980d0b..93bb3b8100 100644 --- a/godtools/App/Features/ToolsFilter/Data/UserToolFiltersRepository/Cache/RealmUserToolFiltersCache.swift +++ b/godtools/App/Features/ToolsFilter/Data/UserToolFiltersRepository/Cache/RealmUserToolFiltersCache.swift @@ -20,14 +20,16 @@ class RealmUserToolFiltersCache { func getUserToolCategoryFilterChangedPublisher() -> AnyPublisher { - return realmDatabase.openRealm().objects(RealmUserToolCategoryFilter.self) + return realmDatabase.openRealm() + .objects(RealmUserToolCategoryFilter.self) .objectWillChange .eraseToAnyPublisher() } func getUserToolLanguageFilterChangedPublisher() -> AnyPublisher { - return realmDatabase.openRealm().objects(RealmUserToolLanguageFilter.self) + return realmDatabase.openRealm() + .objects(RealmUserToolLanguageFilter.self) .objectWillChange .eraseToAnyPublisher() } diff --git a/godtools/App/Share/Data/ArticlesRepository/Categories/RealmCache/RealmCategoryArticlesCache.swift b/godtools/App/Share/Data/ArticlesRepository/Categories/RealmCache/RealmCategoryArticlesCache.swift index 2524208d8c..0962bce34f 100644 --- a/godtools/App/Share/Data/ArticlesRepository/Categories/RealmCache/RealmCategoryArticlesCache.swift +++ b/godtools/App/Share/Data/ArticlesRepository/Categories/RealmCache/RealmCategoryArticlesCache.swift @@ -21,7 +21,8 @@ class RealmCategoryArticlesCache { func getCategoryArticles(categoryId: String, languageCode: String) -> [CategoryArticleModel] { - return realmDatabase.openRealm().objects(RealmCategoryArticle.self) + return realmDatabase.openRealm() + .objects(RealmCategoryArticle.self) .filter(NSPredicate(format: "categoryId == %@ AND languageCode == %@", categoryId, languageCode)) .map({CategoryArticleModel(realmModel: $0)}) } diff --git a/godtools/App/Share/Data/FavoritedResourcesRepository/Cache/RealmFavoritedResourcesCache.swift b/godtools/App/Share/Data/FavoritedResourcesRepository/Cache/RealmFavoritedResourcesCache.swift index c345c777cb..90e888e561 100644 --- a/godtools/App/Share/Data/FavoritedResourcesRepository/Cache/RealmFavoritedResourcesCache.swift +++ b/godtools/App/Share/Data/FavoritedResourcesRepository/Cache/RealmFavoritedResourcesCache.swift @@ -25,7 +25,9 @@ class RealmFavoritedResourcesCache { func getFavoritedResourcesChangedPublisher() -> AnyPublisher { - return realmDatabase.openRealm().objects(RealmFavoritedResource.self).objectWillChange + return realmDatabase.openRealm() + .objects(RealmFavoritedResource.self) + .objectWillChange .eraseToAnyPublisher() } @@ -39,7 +41,9 @@ class RealmFavoritedResourcesCache { func getFavoritedResource(resourceId: String) -> FavoritedResourceDataModel? { - guard let realmFavoritedResource = realmDatabase.openRealm().object(ofType: RealmFavoritedResource.self, forPrimaryKey: resourceId) else { + guard let realmFavoritedResource = realmDatabase.openRealm() + .object(ofType: RealmFavoritedResource.self, forPrimaryKey: resourceId) else { + return nil } @@ -48,19 +52,22 @@ class RealmFavoritedResourcesCache { func getResourceIsFavorited(id: String) -> Bool { - return realmDatabase.openRealm().object(ofType: RealmFavoritedResource.self, forPrimaryKey: id) != nil + return realmDatabase.openRealm() + .object(ofType: RealmFavoritedResource.self, forPrimaryKey: id) != nil } func getFavoritedResourcesSortedByCreatedAt(ascendingOrder: Bool) -> [FavoritedResourceDataModel] { - return realmDatabase.openRealm().objects(RealmFavoritedResource.self) + return realmDatabase.openRealm() + .objects(RealmFavoritedResource.self) .sorted(byKeyPath: #keyPath(RealmFavoritedResource.createdAt), ascending: ascendingOrder) .map({FavoritedResourceDataModel(realmFavoritedResource: $0)}) } func getFavoritedResourcesSortedByCreatedAtPublisher(ascendingOrder: Bool) -> AnyPublisher<[FavoritedResourceDataModel], Never> { - let favoritedResources: [FavoritedResourceDataModel] = realmDatabase.openRealm().objects(RealmFavoritedResource.self) + let favoritedResources: [FavoritedResourceDataModel] = realmDatabase.openRealm() + .objects(RealmFavoritedResource.self) .sorted(byKeyPath: #keyPath(RealmFavoritedResource.createdAt), ascending: ascendingOrder) .map({ return FavoritedResourceDataModel(realmFavoritedResource: $0) diff --git a/godtools/App/Share/Data/LanguagesRepository/Cache/RealmLanguagesCache.swift b/godtools/App/Share/Data/LanguagesRepository/Cache/RealmLanguagesCache.swift index 4400aef838..b174ee2134 100644 --- a/godtools/App/Share/Data/LanguagesRepository/Cache/RealmLanguagesCache.swift +++ b/godtools/App/Share/Data/LanguagesRepository/Cache/RealmLanguagesCache.swift @@ -22,17 +22,23 @@ class RealmLanguagesCache { } var numberOfLanguages: Int { - return realmDatabase.openRealm().objects(RealmLanguage.self).count + return realmDatabase.openRealm() + .objects(RealmLanguage.self) + .count } func getLanguagesChanged() -> AnyPublisher { - return realmDatabase.openRealm().objects(RealmLanguage.self).objectWillChange + return realmDatabase.openRealm() + .objects(RealmLanguage.self) + .objectWillChange .eraseToAnyPublisher() } func getLanguage(id: String) -> LanguageModel? { - guard let realmLanguage = realmDatabase.openRealm().object(ofType: RealmLanguage.self, forPrimaryKey: id) else { + guard let realmLanguage = realmDatabase.openRealm() + .object(ofType: RealmLanguage.self, forPrimaryKey: id) else { + return nil } @@ -41,7 +47,10 @@ class RealmLanguagesCache { func getLanguage(code: String) -> LanguageModel? { - guard let realmLanguage = realmDatabase.openRealm().objects(RealmLanguage.self).filter(NSPredicate(format: "code".appending(" = [c] %@"), code.lowercased())).first else { + guard let realmLanguage = realmDatabase.openRealm() + .objects(RealmLanguage.self).filter(NSPredicate(format: "code".appending(" = [c] %@"), code.lowercased())) + .first else { + return nil } @@ -50,16 +59,17 @@ class RealmLanguagesCache { func getLanguages(ids: [String]) -> [LanguageModel] { - return realmDatabase.openRealm().objects(RealmLanguage.self) + return realmDatabase.openRealm() + .objects(RealmLanguage.self) .filter("id IN %@", ids) - .map{ + .map { LanguageModel(model: $0) } } func getLanguages(languageCodes: [String]) -> [LanguageModel] { - return languageCodes.compactMap({getLanguage(code: $0)}) + return languageCodes.compactMap({ getLanguage(code: $0) }) } func getLanguages(realm: Realm? = nil) -> [LanguageModel] { diff --git a/godtools/App/Share/Data/ResourcesRepository/Cache/RealmResourcesCache.swift b/godtools/App/Share/Data/ResourcesRepository/Cache/RealmResourcesCache.swift index 1c242bc90a..7d667597de 100644 --- a/godtools/App/Share/Data/ResourcesRepository/Cache/RealmResourcesCache.swift +++ b/godtools/App/Share/Data/ResourcesRepository/Cache/RealmResourcesCache.swift @@ -26,13 +26,17 @@ class RealmResourcesCache { } func getResourcesChangedPublisher() -> AnyPublisher { - return realmDatabase.openRealm().objects(RealmResource.self).objectWillChange + return realmDatabase.openRealm() + .objects(RealmResource.self) + .objectWillChange .eraseToAnyPublisher() } func getResource(id: String) -> ResourceModel? { - guard let realmResource = realmDatabase.openRealm().object(ofType: RealmResource.self, forPrimaryKey: id) else { + guard let realmResource = realmDatabase.openRealm() + .object(ofType: RealmResource.self, forPrimaryKey: id) else { + return nil } @@ -41,7 +45,11 @@ class RealmResourcesCache { func getResource(abbreviation: String) -> ResourceModel? { - guard let realmResource = realmDatabase.openRealm().objects(RealmResource.self).filter("\(#keyPath(RealmResource.abbreviation)) = '\(abbreviation)'").first else { + guard let realmResource = realmDatabase.openRealm() + .objects(RealmResource.self) + .filter("\(#keyPath(RealmResource.abbreviation)) = '\(abbreviation)'") + .first else { + return nil } @@ -50,15 +58,18 @@ class RealmResourcesCache { func getResources(ids: [String]) -> [ResourceModel] { - return realmDatabase.openRealm().objects(RealmResource.self) + return realmDatabase.openRealm() + .objects(RealmResource.self) .filter("\(#keyPath(RealmResource.id)) IN %@", ids) - .map{ + .map { ResourceModel(model: $0) } } func getResources(sorted: Bool = false) -> [ResourceModel] { - var realmResources = realmDatabase.openRealm().objects(RealmResource.self) + + var realmResources = realmDatabase.openRealm() + .objects(RealmResource.self) if sorted { realmResources = realmResources.sorted(byKeyPath: #keyPath(RealmResource.attrDefaultOrder), ascending: true) @@ -68,13 +79,15 @@ class RealmResourcesCache { } func getResources(with metaToolIds: [String?]) -> [ResourceModel] { - return realmDatabase.openRealm().objects(RealmResource.self) + return realmDatabase.openRealm() + .objects(RealmResource.self) .filter(NSPredicate(format: "%K IN %@", #keyPath(RealmResource.metatoolId), metaToolIds)) .map { ResourceModel(model: $0)} } func getResources(with resourceType: ResourceType) -> [ResourceModel] { - return realmDatabase.openRealm().objects(RealmResource.self) + return realmDatabase.openRealm() + .objects(RealmResource.self) .where { $0.resourceType == resourceType.rawValue } .map { ResourceModel(model: $0) } } @@ -328,7 +341,7 @@ extension RealmResourcesCache { let realm: Realm = realmDatabase.openRealm() - return realm.objects(RealmResource.self).filter(filterPredicate).map{ + return realm.objects(RealmResource.self).filter(filterPredicate).map { ResourceModel(model: $0) } } diff --git a/godtools/App/Share/Data/TranslationsRepository/Cache/RealmTranslationsCache.swift b/godtools/App/Share/Data/TranslationsRepository/Cache/RealmTranslationsCache.swift index d09b358b48..9e036f1c3b 100644 --- a/godtools/App/Share/Data/TranslationsRepository/Cache/RealmTranslationsCache.swift +++ b/godtools/App/Share/Data/TranslationsRepository/Cache/RealmTranslationsCache.swift @@ -20,7 +20,9 @@ class RealmTranslationsCache { func getTranslation(id: String) -> TranslationModel? { - guard let realmTranslation = realmDatabase.openRealm().object(ofType: RealmTranslation.self, forPrimaryKey: id) else { + guard let realmTranslation = realmDatabase.openRealm() + .object(ofType: RealmTranslation.self, forPrimaryKey: id) else { + return nil } @@ -29,16 +31,18 @@ class RealmTranslationsCache { func getTranslations(ids: [String]) -> [TranslationModel] { - return realmDatabase.openRealm().objects(RealmTranslation.self) + return realmDatabase.openRealm() + .objects(RealmTranslation.self) .filter("id IN %@", ids) - .map{ + .map { TranslationModel(model: $0) } } func getTranslationsSortedByLatestVersion(resourceId: String, languageId: String) -> [TranslationModel] { - guard let realmResource = realmDatabase.openRealm().object(ofType: RealmResource.self, forPrimaryKey: resourceId) else { + guard let realmResource = realmDatabase.openRealm() + .object(ofType: RealmResource.self, forPrimaryKey: resourceId) else { return Array() } @@ -52,7 +56,8 @@ class RealmTranslationsCache { func getTranslationsSortedByLatestVersion(resourceId: String, languageCode: String) -> [TranslationModel] { - guard let realmResource = realmDatabase.openRealm().object(ofType: RealmResource.self, forPrimaryKey: resourceId) else { + guard let realmResource = realmDatabase.openRealm() + .object(ofType: RealmResource.self, forPrimaryKey: resourceId) else { return Array() } diff --git a/godtools/App/Share/Data/UserCountersRepository/Cache/RealmUserCountersCache.swift b/godtools/App/Share/Data/UserCountersRepository/Cache/RealmUserCountersCache.swift index 8a4058b629..6a4916e753 100644 --- a/godtools/App/Share/Data/UserCountersRepository/Cache/RealmUserCountersCache.swift +++ b/godtools/App/Share/Data/UserCountersRepository/Cache/RealmUserCountersCache.swift @@ -23,14 +23,17 @@ class RealmUserCountersCache { func getUserCountersChanged() -> AnyPublisher { - return realmDatabase.openRealm().objects(RealmUserCounter.self) + return realmDatabase.openRealm() + .objects(RealmUserCounter.self) .objectWillChange .eraseToAnyPublisher() } func getUserCounter(id: String) -> UserCounterDataModel? { - guard let realmUserCounter = realmDatabase.openRealm().object(ofType: RealmUserCounter.self, forPrimaryKey: id) else { + guard let realmUserCounter = realmDatabase.openRealm() + .object(ofType: RealmUserCounter.self, forPrimaryKey: id) else { + return nil } @@ -39,13 +42,15 @@ class RealmUserCountersCache { func getAllUserCounters() -> [UserCounterDataModel] { - return realmDatabase.openRealm().objects(RealmUserCounter.self) + return realmDatabase.openRealm() + .objects(RealmUserCounter.self) .map { UserCounterDataModel(realmUserCounter: $0) } } func getUserCountersWithIncrementGreaterThanZero() -> [UserCounterDataModel] { - return realmDatabase.openRealm().objects(RealmUserCounter.self) + return realmDatabase.openRealm() + .objects(RealmUserCounter.self) .filter(NSPredicate(format: "%K > 0", #keyPath(RealmUserCounter.incrementValue))) .map { UserCounterDataModel(realmUserCounter: $0) } } diff --git a/godtools/App/Share/Data/UserDetailsRepository/Cache/RealmUserDetailsCache.swift b/godtools/App/Share/Data/UserDetailsRepository/Cache/RealmUserDetailsCache.swift index 14712610e7..92666cc89f 100644 --- a/godtools/App/Share/Data/UserDetailsRepository/Cache/RealmUserDetailsCache.swift +++ b/godtools/App/Share/Data/UserDetailsRepository/Cache/RealmUserDetailsCache.swift @@ -23,7 +23,9 @@ class RealmUserDetailsCache { func getAuthUserDetailsChangedPublisher() -> AnyPublisher { - return realmDatabase.openRealm().objects(RealmUserDetails.self).objectWillChange + return realmDatabase.openRealm() + .objects(RealmUserDetails.self) + .objectWillChange .map { _ in return self.getAuthUserDetails() } @@ -32,7 +34,9 @@ class RealmUserDetailsCache { func getUserDetailsChangedPublisher(id: String) -> AnyPublisher { - return realmDatabase.openRealm().objects(RealmUserDetails.self).objectWillChange + return realmDatabase.openRealm() + .objects(RealmUserDetails.self) + .objectWillChange .map { _ in let realmObject: RealmUserDetails? = self.realmDatabase.readObject(primaryKey: id) diff --git a/godtools/App/Share/Data/WebArchiveQueue/HTMLDocument+ResourceUrls.swift b/godtools/App/Share/Data/WebArchiveQueue/HTMLDocument+ResourceUrls.swift index 58a2e3ae80..2ff50d5a04 100644 --- a/godtools/App/Share/Data/WebArchiveQueue/HTMLDocument+ResourceUrls.swift +++ b/godtools/App/Share/Data/WebArchiveQueue/HTMLDocument+ResourceUrls.swift @@ -14,10 +14,10 @@ extension HTMLDocument { func getHTMLReferences(host: String, includeJavascript: Bool) -> [String] { var references: [String] = Array() - references += xpath("//img[@src]").compactMap{ $0["src"] } // images - references += xpath("//link[@rel='stylesheet'][@href]").compactMap{ $0["href"] } // css + references += xpath("//img[@src]").compactMap { $0["src"] } // images + references += xpath("//link[@rel='stylesheet'][@href]").compactMap { $0["href"] } // css if includeJavascript { - references += xpath("//script[@src]").compactMap{ $0["src"] } // javascript + references += xpath("//script[@src]").compactMap { $0["src"] } // javascript } return references.map { ref in diff --git a/godtools/App/Share/Domain/UseCases/ViewSearchBarUseCase.swift b/godtools/App/Share/Domain/UseCases/ViewSearchBarUseCase.swift index 116b60b276..0106da340c 100644 --- a/godtools/App/Share/Domain/UseCases/ViewSearchBarUseCase.swift +++ b/godtools/App/Share/Domain/UseCases/ViewSearchBarUseCase.swift @@ -20,10 +20,11 @@ class ViewSearchBarUseCase { func viewPublisher(appLanguage: AppLanguageDomainModel) -> AnyPublisher { - return self.getInterfaceStringsRepository.getStringsPublisher(translateInAppLanguage: appLanguage).map { - - return ViewSearchBarDomainModel(interfaceStrings: $0) - } - .eraseToAnyPublisher() + return self.getInterfaceStringsRepository + .getStringsPublisher(translateInAppLanguage: appLanguage) + .map { + return ViewSearchBarDomainModel(interfaceStrings: $0) + } + .eraseToAnyPublisher() } } From ff65b9350459bf2c5d6ddc3748dc85747f7fda19 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 08:55:27 -0400 Subject: [PATCH 38/58] Fix swift lint unneeded_override --- .../LoadingArticle/LoadingArticleView.swift | 5 ----- .../ChooseYourOwnAdventureView.swift | 4 ---- .../Dashboard/Presentation/Tool/ToolView.swift | 8 -------- .../ToolTraining/Subviews/ToolTrainingTipView.swift | 4 ---- .../Views/Lesson/Views/Page/LessonPageView.swift | 5 ----- .../Renderer/Views/Tool/Views/Page/ToolPageView.swift | 4 ---- .../Training/Views/TrainingTip/TrainingTipView.swift | 11 ----------- 7 files changed, 41 deletions(-) diff --git a/godtools/App/Features/Articles/Presentation/LoadingArticle/LoadingArticleView.swift b/godtools/App/Features/Articles/Presentation/LoadingArticle/LoadingArticleView.swift index b66e40baab..09e175c0cd 100644 --- a/godtools/App/Features/Articles/Presentation/LoadingArticle/LoadingArticleView.swift +++ b/godtools/App/Features/Articles/Presentation/LoadingArticle/LoadingArticleView.swift @@ -22,9 +22,4 @@ class LoadingArticleView: LoadingView { required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } - - override func setupLayout() { - super.setupLayout() - } } - diff --git a/godtools/App/Features/Dashboard/Presentation/ChooseYourOwnAdventure/ChooseYourOwnAdventureView.swift b/godtools/App/Features/Dashboard/Presentation/ChooseYourOwnAdventure/ChooseYourOwnAdventureView.swift index 7d321fc6c4..eb99c99677 100644 --- a/godtools/App/Features/Dashboard/Presentation/ChooseYourOwnAdventure/ChooseYourOwnAdventureView.swift +++ b/godtools/App/Features/Dashboard/Presentation/ChooseYourOwnAdventure/ChooseYourOwnAdventureView.swift @@ -38,10 +38,6 @@ class ChooseYourOwnAdventureView: MobileContentPagesView { pageNavigationView.gestureScrollingEnabled = false } - override func setupBinding() { - super.setupBinding() - } - func languageTapped(index: Int) { viewModel.languageTapped(index: index) } diff --git a/godtools/App/Features/Dashboard/Presentation/Tool/ToolView.swift b/godtools/App/Features/Dashboard/Presentation/Tool/ToolView.swift index cecb1d0087..6f3498e140 100644 --- a/godtools/App/Features/Dashboard/Presentation/Tool/ToolView.swift +++ b/godtools/App/Features/Dashboard/Presentation/Tool/ToolView.swift @@ -30,10 +30,6 @@ class ToolView: MobileContentPagesView { print("view didload: \(type(of: self))") } - override func setupLayout() { - super.setupLayout() - } - override func setupBinding() { super.setupBinding() @@ -52,10 +48,6 @@ class ToolView: MobileContentPagesView { } } - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - } - override func didConfigurePageView(pageView: MobileContentPageView) { if let toolPageView = pageView as? ToolPageView { toolPageView.setToolPageDelegate(delegate: self) diff --git a/godtools/App/Features/ToolTraining/Subviews/ToolTrainingTipView.swift b/godtools/App/Features/ToolTraining/Subviews/ToolTrainingTipView.swift index 2347fd6a23..7509dbaf50 100644 --- a/godtools/App/Features/ToolTraining/Subviews/ToolTrainingTipView.swift +++ b/godtools/App/Features/ToolTraining/Subviews/ToolTrainingTipView.swift @@ -15,10 +15,6 @@ class ToolTrainingTipView: UICollectionViewCell { private var mobileContentView: MobileContentView? - override func awakeFromNib() { - super.awakeFromNib() - } - override func prepareForReuse() { super.prepareForReuse() diff --git a/godtools/App/Services/Renderer/Views/Lesson/Views/Page/LessonPageView.swift b/godtools/App/Services/Renderer/Views/Lesson/Views/Page/LessonPageView.swift index 3ebace3a44..ffdc22307c 100644 --- a/godtools/App/Services/Renderer/Views/Lesson/Views/Page/LessonPageView.swift +++ b/godtools/App/Services/Renderer/Views/Lesson/Views/Page/LessonPageView.swift @@ -57,11 +57,6 @@ class LessonPageView: MobileContentPageView { contentContainerView.backgroundColor = .clear } - override func setupBinding() { - super.setupBinding() - - } - // MARK: - MobileContentView override func renderChild(childView: MobileContentView) { diff --git a/godtools/App/Services/Renderer/Views/Tool/Views/Page/ToolPageView.swift b/godtools/App/Services/Renderer/Views/Tool/Views/Page/ToolPageView.swift index 04eb413cf7..1fa4e916e6 100644 --- a/godtools/App/Services/Renderer/Views/Tool/Views/Page/ToolPageView.swift +++ b/godtools/App/Services/Renderer/Views/Tool/Views/Page/ToolPageView.swift @@ -81,10 +81,6 @@ class ToolPageView: MobileContentPageView { setCallToActionHidden(hidden: true, animated: false) } - override func setupBinding() { - super.setupBinding() - } - override func getPositionState() -> MobileContentViewPositionState { let cardPosition: Int? = cardsView?.getCurrentCardPosition() diff --git a/godtools/App/Services/Renderer/Views/Training/Views/TrainingTip/TrainingTipView.swift b/godtools/App/Services/Renderer/Views/Training/Views/TrainingTip/TrainingTipView.swift index fb33894e73..dfae3e3dd6 100644 --- a/godtools/App/Services/Renderer/Views/Training/Views/TrainingTip/TrainingTipView.swift +++ b/godtools/App/Services/Renderer/Views/Training/Views/TrainingTip/TrainingTipView.swift @@ -22,7 +22,6 @@ class TrainingTipView: MobileContentView, NibBased { super.init(viewModel: viewModel, frame: CGRect(x: 0, y: 0, width: 100, height: 100)) loadNib() - setupLayout() setupBinding() tipButton.addTarget(self, action: #selector(handleTip(button:)), for: .touchUpInside) @@ -32,10 +31,6 @@ class TrainingTipView: MobileContentView, NibBased { fatalError("init(coder:) has not been implemented") } - private func setupLayout() { - - } - private func setupBinding() { viewModel.trainingTipBackgroundImage.addObserver(self) { [weak self] (backgroundImage: UIImage?) in @@ -58,13 +53,7 @@ class TrainingTipView: MobileContentView, NibBased { // MARK: - MobileContentView - override func renderChild(childView: MobileContentView) { - super.renderChild(childView: childView) - } - override var heightConstraintType: MobileContentViewHeightConstraintType { return .equalToSize(size: CGSize(width: 50, height: 50)) } - - // MARK: - } From ad411ee029f7807c7130888ad431504c51899e86 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 08:58:18 -0400 Subject: [PATCH 39/58] Fix swift lint shorthand_operator --- .../LearnToShareTool/LearnToShareToolViewModel.swift | 4 ++-- .../ToolScreenShareTutorialViewModel.swift | 2 +- .../Tutorial/Presentation/Tutorial/TutorialViewModel.swift | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/LearnToShareToolViewModel.swift b/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/LearnToShareToolViewModel.swift index 4ba4f730ad..36902d1f2f 100644 --- a/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/LearnToShareToolViewModel.swift +++ b/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/LearnToShareToolViewModel.swift @@ -121,7 +121,7 @@ extension LearnToShareToolViewModel { return } - currentPage = currentPage - 1 + currentPage -= 1 } @objc func closeTapped() { @@ -134,7 +134,7 @@ extension LearnToShareToolViewModel { flowDelegate?.navigate(step: .continueTappedFromLearnToShareTool(toolId: toolId, primaryLanguage: toolPrimaryLanguage, parallelLanguage: toolParallelLanguage, selectedLanguageIndex: toolSelectedLanguageIndex)) } else { - currentPage = currentPage + 1 + currentPage += 1 } } } diff --git a/godtools/App/Features/ToolScreenShare/Presentation/ToolScreenShareTutorial/ToolScreenShareTutorialViewModel.swift b/godtools/App/Features/ToolScreenShare/Presentation/ToolScreenShareTutorial/ToolScreenShareTutorialViewModel.swift index 95823361bb..b194459ffb 100644 --- a/godtools/App/Features/ToolScreenShare/Presentation/ToolScreenShareTutorial/ToolScreenShareTutorialViewModel.swift +++ b/godtools/App/Features/ToolScreenShare/Presentation/ToolScreenShareTutorial/ToolScreenShareTutorialViewModel.swift @@ -147,7 +147,7 @@ extension ToolScreenShareTutorialViewModel { } private func nextPageTapped() { - currentPage = currentPage + 1 + currentPage += 1 } private func shareLinkTapped() { diff --git a/godtools/App/Features/Tutorial/Presentation/Tutorial/TutorialViewModel.swift b/godtools/App/Features/Tutorial/Presentation/Tutorial/TutorialViewModel.swift index 3690a12136..53a2123b00 100644 --- a/godtools/App/Features/Tutorial/Presentation/Tutorial/TutorialViewModel.swift +++ b/godtools/App/Features/Tutorial/Presentation/Tutorial/TutorialViewModel.swift @@ -157,7 +157,7 @@ extension TutorialViewModel { @objc func backTapped() { if !isOnFirstPage { - currentPage = currentPage - 1 + currentPage -= 1 } } @@ -196,7 +196,7 @@ extension TutorialViewModel { flowDelegate?.navigate(step: .startUsingGodToolsTappedFromTutorial) } else { - currentPage = currentPage + 1 + currentPage += 1 } } } From 1973c44ea0425a84846656e2790a5bf77cdecf83 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 09:02:07 -0400 Subject: [PATCH 40/58] Fix swift lint conditional_returns_on_newline --- .../Cache/RealmDownloadedLanguagesCache.swift | 6 +++++- .../Entities/DownloadableLanguageListItemDomainModel.swift | 5 ++++- .../Subviews/DownloadableLanguageItemView.swift | 5 ++++- .../Subviews/LanguageDownloadIcon.swift | 5 ++++- .../Presentation/Dashboard/DashboardViewModel.swift | 4 +++- .../GetToolFilterCategoriesRepository.swift | 4 +++- .../ToolFilterLanguageSelectionViewModel.swift | 5 ++++- .../Views/Pages/MobileContentPagesViewModel.swift | 4 +++- 8 files changed, 30 insertions(+), 8 deletions(-) diff --git a/godtools/App/Features/AppLanguage/Data/DownloadedLanguagesRepository/Cache/RealmDownloadedLanguagesCache.swift b/godtools/App/Features/AppLanguage/Data/DownloadedLanguagesRepository/Cache/RealmDownloadedLanguagesCache.swift index 1f907b9050..2c816ece24 100644 --- a/godtools/App/Features/AppLanguage/Data/DownloadedLanguagesRepository/Cache/RealmDownloadedLanguagesCache.swift +++ b/godtools/App/Features/AppLanguage/Data/DownloadedLanguagesRepository/Cache/RealmDownloadedLanguagesCache.swift @@ -46,7 +46,11 @@ class RealmDownloadedLanguagesCache { func getDownloadedLanguage(languageId: String) -> DownloadedLanguageDataModel? { - guard let downloadedLanguage = realmDatabase.openRealm().object(ofType: RealmDownloadedLanguage.self, forPrimaryKey: languageId) else { return nil } + guard let downloadedLanguage = realmDatabase.openRealm() + .object(ofType: RealmDownloadedLanguage.self, forPrimaryKey: languageId) else { + + return nil + } return DownloadedLanguageDataModel(realmDownloadedLanguage: downloadedLanguage) } diff --git a/godtools/App/Features/AppLanguage/Domain/Entities/DownloadableLanguageListItemDomainModel.swift b/godtools/App/Features/AppLanguage/Domain/Entities/DownloadableLanguageListItemDomainModel.swift index 8f3d77351f..3b91398a7d 100644 --- a/godtools/App/Features/AppLanguage/Domain/Entities/DownloadableLanguageListItemDomainModel.swift +++ b/godtools/App/Features/AppLanguage/Domain/Entities/DownloadableLanguageListItemDomainModel.swift @@ -49,7 +49,10 @@ extension DownloadableLanguageListItemDomainModel: Identifiable { } func wasDownloadedBefore(date: Date) -> Bool { - guard let downloadedAt = downloadStatus.downloadedAt else { return false } + + guard let downloadedAt = downloadStatus.downloadedAt else { + return false + } return downloadedAt < date } diff --git a/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/DownloadableLanguageItemView.swift b/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/DownloadableLanguageItemView.swift index 34aad3d7b4..cf934fc669 100644 --- a/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/DownloadableLanguageItemView.swift +++ b/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/DownloadableLanguageItemView.swift @@ -182,7 +182,10 @@ struct DownloadableLanguageItemView: View { } private func stopProgressAnimationTimer() { - guard progressAnimationTimer != nil else { return } + + guard progressAnimationTimer != nil else { + return + } progressAnimationTimer?.invalidate() progressAnimationTimer = nil diff --git a/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/LanguageDownloadIcon.swift b/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/LanguageDownloadIcon.swift index 6ec5691ea3..83d2769bb4 100644 --- a/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/LanguageDownloadIcon.swift +++ b/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/LanguageDownloadIcon.swift @@ -131,7 +131,10 @@ struct LanguageDownloadIcon: View { private func shouldFinishAnimatingDownloadProgress() -> Bool { - guard let animationDownloadProgress = animationDownloadProgress else { return false } + guard let animationDownloadProgress = animationDownloadProgress else { + return false + } + return animationDownloadProgress <= 1 } } diff --git a/godtools/App/Features/Dashboard/Presentation/Dashboard/DashboardViewModel.swift b/godtools/App/Features/Dashboard/Presentation/Dashboard/DashboardViewModel.swift index f1b5245c1e..5c26357d5f 100644 --- a/godtools/App/Features/Dashboard/Presentation/Dashboard/DashboardViewModel.swift +++ b/godtools/App/Features/Dashboard/Presentation/Dashboard/DashboardViewModel.swift @@ -63,7 +63,9 @@ class DashboardViewModel: ObservableObject { $currentTab.eraseToAnyPublisher() .sink { [weak self] currentTab in - guard let self = self else { return } + guard let self = self else { + return + } dashboardTabObserver.send(self.tabs[currentTab]) } diff --git a/godtools/App/Features/ToolsFilter/Data-DomainInterface/GetToolFilterCategoriesRepository.swift b/godtools/App/Features/ToolsFilter/Data-DomainInterface/GetToolFilterCategoriesRepository.swift index d121ad331c..ddbf18d667 100644 --- a/godtools/App/Features/ToolsFilter/Data-DomainInterface/GetToolFilterCategoriesRepository.swift +++ b/godtools/App/Features/ToolsFilter/Data-DomainInterface/GetToolFilterCategoriesRepository.swift @@ -43,7 +43,9 @@ class GetToolFilterCategoriesRepository: GetToolFilterCategoriesRepositoryInterf func getCategoryFilter(from categoryId: String?, translatedInAppLanguage: AppLanguageDomainModel) -> CategoryFilterDomainModel? { - guard let categoryId = categoryId else { return nil } + guard let categoryId = categoryId else { + return nil + } return createCategoryDomainModel(with: categoryId, translatedInAppLanguage: translatedInAppLanguage, filteredByLanguageId: nil) } diff --git a/godtools/App/Features/ToolsFilter/Presentation/ToolFilterLanguageSelectionView/ToolFilterLanguageSelectionViewModel.swift b/godtools/App/Features/ToolsFilter/Presentation/ToolFilterLanguageSelectionView/ToolFilterLanguageSelectionViewModel.swift index f1e208c5e5..e577ac8c69 100644 --- a/godtools/App/Features/ToolsFilter/Presentation/ToolFilterLanguageSelectionView/ToolFilterLanguageSelectionViewModel.swift +++ b/godtools/App/Features/ToolsFilter/Presentation/ToolFilterLanguageSelectionView/ToolFilterLanguageSelectionViewModel.swift @@ -75,7 +75,10 @@ class ToolFilterLanguageSelectionViewModel: ObservableObject { .switchToLatest() .receive(on: DispatchQueue.main) .sink { [weak self] viewLanguageFiltersDomainModel in - guard let self = self else { return } + + guard let self = self else { + return + } let interfaceStrings = viewLanguageFiltersDomainModel.interfaceStrings diff --git a/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesViewModel.swift b/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesViewModel.swift index c2af601fcd..55d4915114 100644 --- a/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesViewModel.swift +++ b/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesViewModel.swift @@ -743,7 +743,9 @@ extension MobileContentPagesViewModel { private func countLanguageUsage(localeId: String) { - if languageUsageAlreadyCountedThisSession(localeId: localeId) { return } + if languageUsageAlreadyCountedThisSession(localeId: localeId) { + return + } let locale = Locale(identifier: localeId) From 2abe131ce5e1c7afe5a9bfc1d2e1b6da79d0d4d9 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 09:02:52 -0400 Subject: [PATCH 41/58] Disable some default rules as too many to fix at this point --- .swiftlint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.swiftlint.yml b/.swiftlint.yml index 122a691fa1..e143870505 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,6 +1,9 @@ # By default, SwiftLint uses a set of sensible default rules you can adjust: disabled_rules: # rule identifiers turned on by default to exclude from running + - empty_enum_arguments #disabling for now as this touches many files. + - function_body_length #disabling for now as this touches many files. - multiple_closures_with_trailing_closure #disabling for now as this touches many files. + - opening_brace #disabling for now as this touches many files. - redundant_string_enum_value - statement_position #disabling for now as this touches many files. - trailing_whitespace #disabling for now as this touches many files. Command swiftlint --fix is a way to fix whitespace. From 17d42068c542bbdcd78a9873bf7992e1d80a9e70 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 09:47:54 -0400 Subject: [PATCH 42/58] Fix swift lint force_cast --- .../ArticleCategories/ArticleCategoriesView.swift | 9 +++++++-- .../Articles/Presentation/Articles/ArticlesView.swift | 9 +++++++-- .../ToolTraining/Presentation/ToolTrainingView.swift | 9 +++++++-- .../MobileContentCardCollectionPageView.swift | 9 +++++++-- .../Views/Pages/MobileContentPagesView.swift | 9 +++++++-- 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/godtools/App/Features/Articles/Presentation/ArticleCategories/ArticleCategoriesView.swift b/godtools/App/Features/Articles/Presentation/ArticleCategories/ArticleCategoriesView.swift index 632a8a6be7..9401701c3a 100644 --- a/godtools/App/Features/Articles/Presentation/ArticleCategories/ArticleCategoriesView.swift +++ b/godtools/App/Features/Articles/Presentation/ArticleCategories/ArticleCategoriesView.swift @@ -117,9 +117,14 @@ extension ArticleCategoriesView: UITableViewDelegate, UITableViewDataSource { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell: ArticleCategoryCell = categoriesTableView.dequeueReusableCell( + guard let cell = categoriesTableView.dequeueReusableCell( withIdentifier: ArticleCategoryCell.reuseIdentifier, - for: indexPath) as! ArticleCategoryCell + for: indexPath) as? ArticleCategoryCell else { + + assertionFailure("Failed to dequeue reusable cell with identifier :\(ArticleCategoryCell.reuseIdentifier)") + + return UITableViewCell() + } let cellViewModel: ArticleCategoryCellViewModel = viewModel.categoryWillAppear(index: indexPath.row) diff --git a/godtools/App/Features/Articles/Presentation/Articles/ArticlesView.swift b/godtools/App/Features/Articles/Presentation/Articles/ArticlesView.swift index d62f1f1852..352127b656 100644 --- a/godtools/App/Features/Articles/Presentation/Articles/ArticlesView.swift +++ b/godtools/App/Features/Articles/Presentation/Articles/ArticlesView.swift @@ -116,9 +116,14 @@ extension ArticlesView: UITableViewDelegate, UITableViewDataSource { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell: ArticleCell = articlesTableView.dequeueReusableCell( + guard let cell: ArticleCell = articlesTableView.dequeueReusableCell( withIdentifier: ArticleCell.reuseIdentifier, - for: indexPath) as! ArticleCell + for: indexPath) as? ArticleCell else { + + assertionFailure("Failed to dequeue reusable cell with identifier :\(ArticleCell.reuseIdentifier)") + + return UITableViewCell() + } cell.configure(viewModel: viewModel.articleWillAppear(index: indexPath.row)) diff --git a/godtools/App/Features/ToolTraining/Presentation/ToolTrainingView.swift b/godtools/App/Features/ToolTraining/Presentation/ToolTrainingView.swift index be50de6811..4c3abc50b1 100644 --- a/godtools/App/Features/ToolTraining/Presentation/ToolTrainingView.swift +++ b/godtools/App/Features/ToolTraining/Presentation/ToolTrainingView.swift @@ -193,9 +193,14 @@ extension ToolTrainingView: PageNavigationCollectionViewDelegate { func pageNavigation(pageNavigation: PageNavigationCollectionView, cellForPageAt indexPath: IndexPath) -> UICollectionViewCell { - let cell: ToolTrainingTipView = pageNavigation.getReusablePageCell( + guard let cell = pageNavigation.getReusablePageCell( cellReuseIdentifier: ToolTrainingTipView.reuseIdentifier, - indexPath: indexPath) as! ToolTrainingTipView + indexPath: indexPath) as? ToolTrainingTipView else { + + assertionFailure("Failed to dequeue reusable cell with identifier :\(ToolTrainingTipView.reuseIdentifier)") + + return UICollectionViewCell() + } let mobileContentView: MobileContentView? = viewModel.tipPageWillAppear( page: indexPath.row, diff --git a/godtools/App/Services/Renderer/Views/MobileContent/Views/CardCollectionPage/MobileContentCardCollectionPageView.swift b/godtools/App/Services/Renderer/Views/MobileContent/Views/CardCollectionPage/MobileContentCardCollectionPageView.swift index edcc84c676..f66c19e7a6 100644 --- a/godtools/App/Services/Renderer/Views/MobileContent/Views/CardCollectionPage/MobileContentCardCollectionPageView.swift +++ b/godtools/App/Services/Renderer/Views/MobileContent/Views/CardCollectionPage/MobileContentCardCollectionPageView.swift @@ -180,9 +180,14 @@ extension MobileContentCardCollectionPageView: PageNavigationCollectionViewDeleg func pageNavigation(pageNavigation: PageNavigationCollectionView, cellForPageAt indexPath: IndexPath) -> UICollectionViewCell { - let cell: MobileContentCardCollectionPageItemView = cardPageNavigationView.getReusablePageCell( + guard let cell = cardPageNavigationView.getReusablePageCell( cellReuseIdentifier: MobileContentCardCollectionPageItemView.reuseIdentifier, - indexPath: indexPath) as! MobileContentCardCollectionPageItemView + indexPath: indexPath) as? MobileContentCardCollectionPageItemView else { + + assertionFailure("Failed to dequeue reusable cell with identifier :\(MobileContentCardCollectionPageItemView.reuseIdentifier)") + + return UICollectionViewCell() + } if let cardView = viewModel.cardWillAppear(card: indexPath.row) as? MobileContentCardCollectionPageCardView { cell.configure(cardView: cardView) diff --git a/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesView.swift b/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesView.swift index be5e0a0d7c..1d4fb14fe2 100644 --- a/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesView.swift +++ b/godtools/App/Services/Renderer/Views/MobileContent/Views/Pages/MobileContentPagesView.swift @@ -220,9 +220,14 @@ extension MobileContentPagesView: PageNavigationCollectionViewDelegate { func pageNavigation(pageNavigation: PageNavigationCollectionView, cellForPageAt indexPath: IndexPath) -> UICollectionViewCell { - let cell: MobileContentPageCell = pageNavigationView.getReusablePageCell( + guard let cell = pageNavigationView.getReusablePageCell( cellReuseIdentifier: MobileContentPageCell.reuseIdentifier, - indexPath: indexPath) as! MobileContentPageCell + indexPath: indexPath) as? MobileContentPageCell else { + + assertionFailure("Failed to dequeue reusable cell with identifier :\(MobileContentPageCell.reuseIdentifier)") + + return UICollectionViewCell() + } let pageNumber: Int = indexPath.row From f603a0a7b089e40d5cd932627e32b45a005810ab Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 10:20:25 -0400 Subject: [PATCH 43/58] Fix swift lint implicitly_unwrapped_optional --- .../Presentation/ArticlesWeb/ArticleWebView.swift | 5 ++--- .../Presentation/ArticlesWeb/ArticleWebViewModel.swift | 4 ++-- .../Menu/Presentation/WebContent/WebContentView.swift | 6 ++---- .../Views/Spacer/MobileContentSpacerView.swift | 8 +++++--- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/godtools/App/Features/Articles/Presentation/ArticlesWeb/ArticleWebView.swift b/godtools/App/Features/Articles/Presentation/ArticlesWeb/ArticleWebView.swift index f3f651332a..5a6d6f9d17 100644 --- a/godtools/App/Features/Articles/Presentation/ArticlesWeb/ArticleWebView.swift +++ b/godtools/App/Features/Articles/Presentation/ArticlesWeb/ArticleWebView.swift @@ -12,8 +12,8 @@ import WebKit class ArticleWebView: AppViewController { private let viewModel: ArticleWebViewModel - - private var webView: WKWebView! + private let webView: WKWebView = WKWebView(frame: UIScreen.main.bounds) + private var currentViewState: ArticleWebViewState? @IBOutlet weak private var loadingView: UIActivityIndicatorView! @@ -24,7 +24,6 @@ class ArticleWebView: AppViewController { init(viewModel: ArticleWebViewModel, navigationBar: AppNavigationBar?) { - self.webView = WKWebView(frame: UIScreen.main.bounds) self.viewModel = viewModel super.init(nibName: String(describing: ArticleWebView.self), bundle: nil, navigationBar: navigationBar) diff --git a/godtools/App/Features/Articles/Presentation/ArticlesWeb/ArticleWebViewModel.swift b/godtools/App/Features/Articles/Presentation/ArticlesWeb/ArticleWebViewModel.swift index 3d8aff6a45..0144ea1178 100644 --- a/godtools/App/Features/Articles/Presentation/ArticlesWeb/ArticleWebViewModel.swift +++ b/godtools/App/Features/Articles/Presentation/ArticlesWeb/ArticleWebViewModel.swift @@ -223,14 +223,14 @@ extension ArticleWebViewModel { extension ArticleWebViewModel: WKNavigationDelegate { - func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { + func webView(_ webView: WKWebView, didFinish navigation: WKNavigation) { stopDisplayArticleTimer() viewState.accept(value: .viewingArticle) } - func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) { + func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation, withError error: Error) { stopDisplayArticleTimer() diff --git a/godtools/App/Features/Menu/Presentation/WebContent/WebContentView.swift b/godtools/App/Features/Menu/Presentation/WebContent/WebContentView.swift index 6a7756eac6..433bdb58a7 100644 --- a/godtools/App/Features/Menu/Presentation/WebContent/WebContentView.swift +++ b/godtools/App/Features/Menu/Presentation/WebContent/WebContentView.swift @@ -12,14 +12,12 @@ import WebKit class WebContentView: AppViewController { private let viewModel: WebContentViewModel - - private var webView: WKWebView! + private let webView: WKWebView = WKWebView(frame: UIScreen.main.bounds) @IBOutlet weak private var loadingView: UIActivityIndicatorView! init(viewModel: WebContentViewModel, navigationBar: AppNavigationBar?) { - self.webView = WKWebView(frame: UIScreen.main.bounds) self.viewModel = viewModel super.init(nibName: String(describing: WebContentView.self), bundle: nil, navigationBar: navigationBar) @@ -87,7 +85,7 @@ class WebContentView: AppViewController { extension WebContentView: WKNavigationDelegate { - func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { + func webView(_ webView: WKWebView, didFinish navigation: WKNavigation) { finishedLoadingWebView() } diff --git a/godtools/App/Services/Renderer/Views/MobileContent/Views/Spacer/MobileContentSpacerView.swift b/godtools/App/Services/Renderer/Views/MobileContent/Views/Spacer/MobileContentSpacerView.swift index 3621a7937a..019ac841d9 100644 --- a/godtools/App/Services/Renderer/Views/MobileContent/Views/Spacer/MobileContentSpacerView.swift +++ b/godtools/App/Services/Renderer/Views/MobileContent/Views/Spacer/MobileContentSpacerView.swift @@ -13,7 +13,7 @@ class MobileContentSpacerView: MobileContentView { private let viewModel: MobileContentSpacerViewModel - private var heightConstraint: NSLayoutConstraint! + private var heightConstraint: NSLayoutConstraint? init(viewModel: MobileContentSpacerViewModel) { @@ -23,7 +23,7 @@ class MobileContentSpacerView: MobileContentView { super.init(viewModel: viewModel, frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: height)) - heightConstraint = NSLayoutConstraint( + let heightConstraint = NSLayoutConstraint( item: self, attribute: .height, relatedBy: .equal, @@ -36,6 +36,8 @@ class MobileContentSpacerView: MobileContentView { heightConstraint.priority = UILayoutPriority(1000) addConstraint(heightConstraint) + + self.heightConstraint = heightConstraint } required init?(coder: NSCoder) { @@ -47,7 +49,7 @@ class MobileContentSpacerView: MobileContentView { } func setHeight(height: CGFloat) { - heightConstraint.constant = height + heightConstraint?.constant = height } // MARK: - MobileContentView From 541058f94f9c576d82c7d36ce5bf55fd4c4f97a3 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 10:24:08 -0400 Subject: [PATCH 44/58] Fix swift lint trailing_newline --- .../Features/Account/Domain/Entities/AuthUserDomainModel.swift | 1 - .../Subviews/AppInterfaceLanguageButtonView.swift | 1 - .../UserActivityStatDomainModel.swift | 1 - .../Features/Menu/Presentation/Menu/Subviews/MenuItemView.swift | 1 - .../ToolDetails/Subviews/ToolDetailsToggleFavoriteButton.swift | 1 - .../ToolFilterCategorySelectionRowView.swift | 1 - .../ToolFilterCategorySelectionView.swift | 1 - .../DownloadToolTranslations/DownloadToolTranslationsFlow.swift | 1 - .../Flow+PresentNativeMailApp/Flow+PresentNativeMailApp.swift | 1 - .../Renderer/Navigation/MobileContentRendererNavigation.swift | 1 - .../App/Services/Renderer/Renderer/MobileContentRenderer.swift | 1 - .../Views/ContentButton/Models/MobileContentButtonIcon.swift | 1 - .../MobileContent/Views/Spacer/MobileContentSpacerView.swift | 1 - .../ToolTranslationsDomainModel.swift | 1 - godtools/App/Share/SwiftUI Views/SearchBar/SearchBarLegacy.swift | 1 - godtools/App/Share/Views/LoadingView/LoadingView.swift | 1 - .../NavBarItem/ButtonsWithImage/AppLottieBarItem.swift | 1 - 17 files changed, 17 deletions(-) diff --git a/godtools/App/Features/Account/Domain/Entities/AuthUserDomainModel.swift b/godtools/App/Features/Account/Domain/Entities/AuthUserDomainModel.swift index 01a1ac2fcd..0918b42c45 100644 --- a/godtools/App/Features/Account/Domain/Entities/AuthUserDomainModel.swift +++ b/godtools/App/Features/Account/Domain/Entities/AuthUserDomainModel.swift @@ -17,4 +17,3 @@ struct AuthUserDomainModel { let name: String? let ssoGuid: String? } - diff --git a/godtools/App/Features/AppLanguage/Presentation/LanguageSettings/Subviews/LanguageSettingsAppInterfaceLanguage/Subviews/AppInterfaceLanguageButtonView.swift b/godtools/App/Features/AppLanguage/Presentation/LanguageSettings/Subviews/LanguageSettingsAppInterfaceLanguage/Subviews/AppInterfaceLanguageButtonView.swift index e614f53d7e..9ab9667ebd 100644 --- a/godtools/App/Features/AppLanguage/Presentation/LanguageSettings/Subviews/LanguageSettingsAppInterfaceLanguage/Subviews/AppInterfaceLanguageButtonView.swift +++ b/godtools/App/Features/AppLanguage/Presentation/LanguageSettings/Subviews/LanguageSettingsAppInterfaceLanguage/Subviews/AppInterfaceLanguageButtonView.swift @@ -69,4 +69,3 @@ struct AppInterfaceLanguageButtonView: View { } } } - diff --git a/godtools/App/Features/Menu/Domain/UseCases/GetUserActivityStatsUseCase/UserActivityStatDomainModel.swift b/godtools/App/Features/Menu/Domain/UseCases/GetUserActivityStatsUseCase/UserActivityStatDomainModel.swift index aca3b34b1a..af112a1e72 100644 --- a/godtools/App/Features/Menu/Domain/UseCases/GetUserActivityStatsUseCase/UserActivityStatDomainModel.swift +++ b/godtools/App/Features/Menu/Domain/UseCases/GetUserActivityStatsUseCase/UserActivityStatDomainModel.swift @@ -24,4 +24,3 @@ extension UserActivityStatDomainModel: Identifiable { return text } } - diff --git a/godtools/App/Features/Menu/Presentation/Menu/Subviews/MenuItemView.swift b/godtools/App/Features/Menu/Presentation/Menu/Subviews/MenuItemView.swift index 5a5dc1b28c..d1dfbb462c 100644 --- a/godtools/App/Features/Menu/Presentation/Menu/Subviews/MenuItemView.swift +++ b/godtools/App/Features/Menu/Presentation/Menu/Subviews/MenuItemView.swift @@ -60,4 +60,3 @@ struct MenuItemView: View { } } } - diff --git a/godtools/App/Features/ToolDetails/Presentation/ToolDetails/Subviews/ToolDetailsToggleFavoriteButton.swift b/godtools/App/Features/ToolDetails/Presentation/ToolDetails/Subviews/ToolDetailsToggleFavoriteButton.swift index 4303460588..6715784972 100644 --- a/godtools/App/Features/ToolDetails/Presentation/ToolDetails/Subviews/ToolDetailsToggleFavoriteButton.swift +++ b/godtools/App/Features/ToolDetails/Presentation/ToolDetails/Subviews/ToolDetailsToggleFavoriteButton.swift @@ -62,4 +62,3 @@ struct ToolDetailsToggleFavoriteButton: View { ) } } - diff --git a/godtools/App/Features/ToolsFilter/Presentation/ToolFilterCategorySelectionView/Subviews/ToolFilterCategorySelectionRowView/ToolFilterCategorySelectionRowView.swift b/godtools/App/Features/ToolsFilter/Presentation/ToolFilterCategorySelectionView/Subviews/ToolFilterCategorySelectionRowView/ToolFilterCategorySelectionRowView.swift index a7e991fb0e..5ff6fa9a32 100644 --- a/godtools/App/Features/ToolsFilter/Presentation/ToolFilterCategorySelectionView/Subviews/ToolFilterCategorySelectionRowView/ToolFilterCategorySelectionRowView.swift +++ b/godtools/App/Features/ToolsFilter/Presentation/ToolFilterCategorySelectionView/Subviews/ToolFilterCategorySelectionRowView/ToolFilterCategorySelectionRowView.swift @@ -44,4 +44,3 @@ struct ToolFilterCategorySelectionRowView: View { } } } - diff --git a/godtools/App/Features/ToolsFilter/Presentation/ToolFilterCategorySelectionView/ToolFilterCategorySelectionView.swift b/godtools/App/Features/ToolsFilter/Presentation/ToolFilterCategorySelectionView/ToolFilterCategorySelectionView.swift index c0aaca640b..537b7accba 100644 --- a/godtools/App/Features/ToolsFilter/Presentation/ToolFilterCategorySelectionView/ToolFilterCategorySelectionView.swift +++ b/godtools/App/Features/ToolsFilter/Presentation/ToolFilterCategorySelectionView/ToolFilterCategorySelectionView.swift @@ -48,4 +48,3 @@ struct ToolFilterCategorySelectionView: View { .environment(\.layoutDirection, ApplicationLayout.shared.layoutDirection) } } - diff --git a/godtools/App/Flows/DownloadToolTranslations/DownloadToolTranslationsFlow.swift b/godtools/App/Flows/DownloadToolTranslations/DownloadToolTranslationsFlow.swift index 3f28fd08fb..2aa086edbd 100644 --- a/godtools/App/Flows/DownloadToolTranslations/DownloadToolTranslationsFlow.swift +++ b/godtools/App/Flows/DownloadToolTranslations/DownloadToolTranslationsFlow.swift @@ -133,4 +133,3 @@ class DownloadToolTranslationsFlow: Flow { downloadToolProgressModal = nil } } - diff --git a/godtools/App/Flows/Flow+PresentNativeMailApp/Flow+PresentNativeMailApp.swift b/godtools/App/Flows/Flow+PresentNativeMailApp/Flow+PresentNativeMailApp.swift index 5d29c2e6c6..1975255f61 100644 --- a/godtools/App/Flows/Flow+PresentNativeMailApp/Flow+PresentNativeMailApp.swift +++ b/godtools/App/Flows/Flow+PresentNativeMailApp/Flow+PresentNativeMailApp.swift @@ -38,4 +38,3 @@ extension Flow { navigationController.present(view, animated: true) } } - diff --git a/godtools/App/Services/Renderer/Navigation/MobileContentRendererNavigation.swift b/godtools/App/Services/Renderer/Navigation/MobileContentRendererNavigation.swift index 4928a9c15e..8f6d6b3764 100644 --- a/godtools/App/Services/Renderer/Navigation/MobileContentRendererNavigation.swift +++ b/godtools/App/Services/Renderer/Navigation/MobileContentRendererNavigation.swift @@ -184,4 +184,3 @@ extension MobileContentRendererNavigation: MobileContentRendererNavigationDelega } } - diff --git a/godtools/App/Services/Renderer/Renderer/MobileContentRenderer.swift b/godtools/App/Services/Renderer/Renderer/MobileContentRenderer.swift index 3ba72e850c..206f92530c 100644 --- a/godtools/App/Services/Renderer/Renderer/MobileContentRenderer.swift +++ b/godtools/App/Services/Renderer/Renderer/MobileContentRenderer.swift @@ -70,4 +70,3 @@ class MobileContentRenderer { ) } } - diff --git a/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentButton/Models/MobileContentButtonIcon.swift b/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentButton/Models/MobileContentButtonIcon.swift index 1ce9847e03..b91c1b6c14 100644 --- a/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentButton/Models/MobileContentButtonIcon.swift +++ b/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentButton/Models/MobileContentButtonIcon.swift @@ -15,4 +15,3 @@ struct MobileContentButtonIcon { let gravity: Gravity.Horizontal let image: UIImage } - diff --git a/godtools/App/Services/Renderer/Views/MobileContent/Views/Spacer/MobileContentSpacerView.swift b/godtools/App/Services/Renderer/Views/MobileContent/Views/Spacer/MobileContentSpacerView.swift index 019ac841d9..014ab399e0 100644 --- a/godtools/App/Services/Renderer/Views/MobileContent/Views/Spacer/MobileContentSpacerView.swift +++ b/godtools/App/Services/Renderer/Views/MobileContent/Views/Spacer/MobileContentSpacerView.swift @@ -58,4 +58,3 @@ class MobileContentSpacerView: MobileContentView { return .spacer } } - diff --git a/godtools/App/Share/Domain/UseCases/GetToolTranslationsFilesUseCase/ToolTranslationsDomainModel.swift b/godtools/App/Share/Domain/UseCases/GetToolTranslationsFilesUseCase/ToolTranslationsDomainModel.swift index 296ebcdfae..11695d4a71 100644 --- a/godtools/App/Share/Domain/UseCases/GetToolTranslationsFilesUseCase/ToolTranslationsDomainModel.swift +++ b/godtools/App/Share/Domain/UseCases/GetToolTranslationsFilesUseCase/ToolTranslationsDomainModel.swift @@ -13,4 +13,3 @@ struct ToolTranslationsDomainModel { let tool: ResourceModel let languageTranslationManifests: [MobileContentRendererLanguageTranslationManifest] } - diff --git a/godtools/App/Share/SwiftUI Views/SearchBar/SearchBarLegacy.swift b/godtools/App/Share/SwiftUI Views/SearchBar/SearchBarLegacy.swift index ea275edd34..3197c03f2c 100644 --- a/godtools/App/Share/SwiftUI Views/SearchBar/SearchBarLegacy.swift +++ b/godtools/App/Share/SwiftUI Views/SearchBar/SearchBarLegacy.swift @@ -74,4 +74,3 @@ struct SearchBarLegacy: View { } } } - diff --git a/godtools/App/Share/Views/LoadingView/LoadingView.swift b/godtools/App/Share/Views/LoadingView/LoadingView.swift index eef024ce21..7b750d984e 100644 --- a/godtools/App/Share/Views/LoadingView/LoadingView.swift +++ b/godtools/App/Share/Views/LoadingView/LoadingView.swift @@ -43,4 +43,3 @@ class LoadingView: AppViewController { loadingView.startAnimating() } } - diff --git a/godtools/App/Share/Views/Navigation/NavigationBar/NavBarItems/NavBarItem/ButtonsWithImage/AppLottieBarItem.swift b/godtools/App/Share/Views/Navigation/NavigationBar/NavBarItems/NavBarItem/ButtonsWithImage/AppLottieBarItem.swift index 472ace442a..8d9c3ecd8e 100644 --- a/godtools/App/Share/Views/Navigation/NavigationBar/NavBarItems/NavBarItem/ButtonsWithImage/AppLottieBarItem.swift +++ b/godtools/App/Share/Views/Navigation/NavigationBar/NavBarItems/NavBarItem/ButtonsWithImage/AppLottieBarItem.swift @@ -39,4 +39,3 @@ class AppLottieBarItem: NavBarItem { ) } } - From 3cbcaf54046a4ed9b62079c0dc39b43536f6b2c2 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 10:31:37 -0400 Subject: [PATCH 45/58] Fix swift lint indentation_width --- .../DownloadableLanguageItemView.swift | 5 +- .../Share/Common/FileCache/FileCache.swift | 2 +- .../Articles/Cache/ArticleAemCache.swift | 6 +-- .../Parsers/ArticleAemDataParser.swift | 50 +++++++++---------- .../LegacyAppsFlyerDeepLinkValueParser.swift | 4 +- .../ToolPath/ToolPathDeepLinkParser.swift | 3 +- .../ResourcesSHA256FileCache.swift | 3 +- .../TrackDownloadedTranslationsCache.swift | 3 +- .../TranslationsRepository.swift | 5 +- .../UserCountersRepository.swift | 24 ++++----- ...DeepLinkedToolTranslationsToDownload.swift | 3 +- 11 files changed, 45 insertions(+), 63 deletions(-) diff --git a/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/DownloadableLanguageItemView.swift b/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/DownloadableLanguageItemView.swift index cf934fc669..4c949f219e 100644 --- a/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/DownloadableLanguageItemView.swift +++ b/godtools/App/Features/AppLanguage/Presentation/DownloadableLanguages/Subviews/DownloadableLanguageItemView.swift @@ -198,9 +198,8 @@ struct DownloadableLanguageItemView: View { } private func shouldContinueDownloadProgressAnimation() -> Bool { - guard isVisible, - let animationDownloadProgress = animationDownloadProgress - else { + + guard isVisible, let animationDownloadProgress = animationDownloadProgress else { return false } diff --git a/godtools/App/Share/Common/FileCache/FileCache.swift b/godtools/App/Share/Common/FileCache/FileCache.swift index 6ad732c5b0..62a75daa8f 100644 --- a/godtools/App/Share/Common/FileCache/FileCache.swift +++ b/godtools/App/Share/Common/FileCache/FileCache.swift @@ -269,7 +269,7 @@ class FileCache { // delete directory since contents were moved do { - try fileManager.removeItem(at: childDirectory) + try fileManager.removeItem(at: childDirectory) } catch let error { return error diff --git a/godtools/App/Share/Data/ArticlesRepository/Articles/Cache/ArticleAemCache.swift b/godtools/App/Share/Data/ArticlesRepository/Articles/Cache/ArticleAemCache.swift index 34ffaf6dc9..ebd1f6e857 100644 --- a/godtools/App/Share/Data/ArticlesRepository/Articles/Cache/ArticleAemCache.swift +++ b/godtools/App/Share/Data/ArticlesRepository/Articles/Cache/ArticleAemCache.swift @@ -90,11 +90,7 @@ class ArticleAemCache { let dataIsNotCached: Bool let uuidChanged: Bool - if let aemCacheObject = self.getAemCacheObject(realm: realm, aemUri: aemData.aemUri), - let cachedUUID = aemCacheObject.aemData.articleJcrContent?.uuid, - let uuid = aemData.articleJcrContent?.uuid, - !cachedUUID.isEmpty, - !uuid.isEmpty { + if let aemCacheObject = self.getAemCacheObject(realm: realm, aemUri: aemData.aemUri), let cachedUUID = aemCacheObject.aemData.articleJcrContent?.uuid, let uuid = aemData.articleJcrContent?.uuid, !cachedUUID.isEmpty, !uuid.isEmpty { dataIsNotCached = false uuidChanged = cachedUUID != uuid diff --git a/godtools/App/Share/Data/ArticlesRepository/Articles/Downloader/Parsers/ArticleAemDataParser.swift b/godtools/App/Share/Data/ArticlesRepository/Articles/Downloader/Parsers/ArticleAemDataParser.swift index 6cb569bf04..912b650c38 100644 --- a/godtools/App/Share/Data/ArticlesRepository/Articles/Downloader/Parsers/ArticleAemDataParser.swift +++ b/godtools/App/Share/Data/ArticlesRepository/Articles/Downloader/Parsers/ArticleAemDataParser.swift @@ -92,32 +92,30 @@ class ArticleAemDataParser { } /* - - NOTE: - - The below preferred variatons are root level keys found in the json structure that is getting parsed. - - It appears that each variation can be appended to an aem import src url in order to load an html page per platform. - - For example, take the following aem import src url: - - https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers- - - We obtain the json by appending a number representing the maximum amount of levels the json structure will return like so: - - https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers-.10.json (10 levels). - - We can also append variations 'master' or ('godtools' or 'godtools-variation') to the import src url to load an html page like so: - - master - https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers-/master.html - - //godtools - https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers-/godtools.html - - //godtools-variation - https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/can-you-explain-the-trinity--/godtools-variation.html - + NOTE: + + The below preferred variatons are root level keys found in the json structure that is getting parsed. + + It appears that each variation can be appended to an aem import src url in order to load an html page per platform. + + For example, take the following aem import src url: + + https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers- + + We obtain the json by appending a number representing the maximum amount of levels the json structure will return like so: + + https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers-.10.json (10 levels). + + We can also append variations 'master' or ('godtools' or 'godtools-variation') to the import src url to load an html page like so: + + master + https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers-/master.html + + //godtools + https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/does-god-answer-our-prayers-/godtools.html + + //godtools-variation + https://www.cru.org/content/experience-fragments/shared-library/language-masters/en/how-to-know-god/what-is-christianity/can-you-explain-the-trinity--/godtools-variation.html */ private func getPreferredVariation(aemUrl: URL, aemJson: [String: Any]) -> String? { diff --git a/godtools/App/Share/Data/DeepLinkingService/Parsers/Legacy/LegacyAppsFlyerDeepLinkValueParser.swift b/godtools/App/Share/Data/DeepLinkingService/Parsers/Legacy/LegacyAppsFlyerDeepLinkValueParser.swift index 72a5bd6afe..18cad2fda1 100644 --- a/godtools/App/Share/Data/DeepLinkingService/Parsers/Legacy/LegacyAppsFlyerDeepLinkValueParser.swift +++ b/godtools/App/Share/Data/DeepLinkingService/Parsers/Legacy/LegacyAppsFlyerDeepLinkValueParser.swift @@ -21,9 +21,7 @@ class LegacyAppsFlyerDeepLinkValueParser: DeepLinkAppsFlyerParserType { if let deepLinkValue = data["deep_link_value"] as? String { resourceAbbreviation = deepLinkValue } - else if let link = data["link"] as? String, - let linkComponents = URLComponents(string: link), - let deepLinkValue = linkComponents.queryItems?.first(where: { $0.name == "deep_link_value" })?.value { + else if let link = data["link"] as? String, let linkComponents = URLComponents(string: link), let deepLinkValue = linkComponents.queryItems?.first(where: { $0.name == "deep_link_value" })?.value { resourceAbbreviation = deepLinkValue } diff --git a/godtools/App/Share/Data/DeepLinkingService/Parsers/ToolPath/ToolPathDeepLinkParser.swift b/godtools/App/Share/Data/DeepLinkingService/Parsers/ToolPath/ToolPathDeepLinkParser.swift index c8806de464..9d737c4fb5 100644 --- a/godtools/App/Share/Data/DeepLinkingService/Parsers/ToolPath/ToolPathDeepLinkParser.swift +++ b/godtools/App/Share/Data/DeepLinkingService/Parsers/ToolPath/ToolPathDeepLinkParser.swift @@ -24,8 +24,7 @@ class ToolPathDeepLinkParser: DeepLinkUrlParserType { return nil } - guard let resourceAbbreviation = pathComponents[safe: toolPathIndex + 2], - let language = pathComponents[safe: toolPathIndex + 3] else { + guard let resourceAbbreviation = pathComponents[safe: toolPathIndex + 2], let language = pathComponents[safe: toolPathIndex + 3] else { return nil } diff --git a/godtools/App/Share/Data/ResourcesSHA256FileCache/ResourcesSHA256FileCache.swift b/godtools/App/Share/Data/ResourcesSHA256FileCache/ResourcesSHA256FileCache.swift index 53b735d3ca..efd265f0a7 100644 --- a/godtools/App/Share/Data/ResourcesSHA256FileCache/ResourcesSHA256FileCache.swift +++ b/godtools/App/Share/Data/ResourcesSHA256FileCache/ResourcesSHA256FileCache.swift @@ -180,8 +180,7 @@ class ResourcesSHA256FileCache { continue } - if let existingRealmSHA256File = realm.object(ofType: RealmSHA256File.self, forPrimaryKey: filenameWithPathExtension), - !existingRealmSHA256File.translations.contains(realmTranslation) { + if let existingRealmSHA256File = realm.object(ofType: RealmSHA256File.self, forPrimaryKey: filenameWithPathExtension), !existingRealmSHA256File.translations.contains(realmTranslation) { existingRealmSHA256File.translations.append(realmTranslation) } diff --git a/godtools/App/Share/Data/TrackDownloadedTranslationsRepository/Cache/TrackDownloadedTranslationsCache.swift b/godtools/App/Share/Data/TrackDownloadedTranslationsRepository/Cache/TrackDownloadedTranslationsCache.swift index a6f1a71b73..331ac7059a 100644 --- a/godtools/App/Share/Data/TrackDownloadedTranslationsRepository/Cache/TrackDownloadedTranslationsCache.swift +++ b/godtools/App/Share/Data/TrackDownloadedTranslationsRepository/Cache/TrackDownloadedTranslationsCache.swift @@ -46,8 +46,7 @@ class TrackDownloadedTranslationsCache { let downloadedTranslation: RealmDownloadedTranslation = RealmDownloadedTranslation() - guard let languageId = translation.language?.id, !languageId.isEmpty, - let resourceId = translation.resource?.id, !resourceId.isEmpty else { + guard let languageId = translation.language?.id, !languageId.isEmpty, let resourceId = translation.resource?.id, !resourceId.isEmpty else { return [] } diff --git a/godtools/App/Share/Data/TranslationsRepository/TranslationsRepository.swift b/godtools/App/Share/Data/TranslationsRepository/TranslationsRepository.swift index a56e3d0871..771c885ef8 100644 --- a/godtools/App/Share/Data/TranslationsRepository/TranslationsRepository.swift +++ b/godtools/App/Share/Data/TranslationsRepository/TranslationsRepository.swift @@ -238,10 +238,7 @@ extension TranslationsRepository { let latestDownloadedTranslation: TranslationModel? - if shouldFallbackToLatestDownloadedTranslation, - let resourceId = translation.resource?.id, - let languageId = translation.language?.id, - let latestTrackedDownloadedTranslation = self.trackDownloadedTranslationsRepository.getLatestDownloadedTranslation(resourceId: resourceId, languageId: languageId) { + if shouldFallbackToLatestDownloadedTranslation, let resourceId = translation.resource?.id, let languageId = translation.language?.id, let latestTrackedDownloadedTranslation = self.trackDownloadedTranslationsRepository.getLatestDownloadedTranslation(resourceId: resourceId, languageId: languageId) { latestDownloadedTranslation = self.getTranslation(id: latestTrackedDownloadedTranslation.translationId) } diff --git a/godtools/App/Share/Data/UserCountersRepository/UserCountersRepository.swift b/godtools/App/Share/Data/UserCountersRepository/UserCountersRepository.swift index 7b16a31bce..d893f30d12 100644 --- a/godtools/App/Share/Data/UserCountersRepository/UserCountersRepository.swift +++ b/godtools/App/Share/Data/UserCountersRepository/UserCountersRepository.swift @@ -33,21 +33,19 @@ class UserCountersRepository { } func getUserCountersChanged(reloadFromRemote: Bool) -> AnyPublisher { + + if reloadFromRemote { - if reloadFromRemote { - - fetchRemoteUserCounters() - .sink(receiveCompletion: { _ in - - }, receiveValue: { _ in - - }) - .store(in: &cancellables) - - } - - return cache.getUserCountersChanged() + fetchRemoteUserCounters() + .sink(receiveCompletion: { _ in + }, receiveValue: { _ in + + }) + .store(in: &cancellables) } + + return cache.getUserCountersChanged() + } func getUserCounters() -> [UserCounterDataModel] { diff --git a/godtools/App/Share/Domain/UseCases/GetToolTranslationsFilesUseCase/DetermineToolTranslationsToDownload/DetermineDeepLinkedToolTranslationsToDownload.swift b/godtools/App/Share/Domain/UseCases/GetToolTranslationsFilesUseCase/DetermineToolTranslationsToDownload/DetermineDeepLinkedToolTranslationsToDownload.swift index 65ad8848b7..937b12647a 100644 --- a/godtools/App/Share/Domain/UseCases/GetToolTranslationsFilesUseCase/DetermineToolTranslationsToDownload/DetermineDeepLinkedToolTranslationsToDownload.swift +++ b/godtools/App/Share/Domain/UseCases/GetToolTranslationsFilesUseCase/DetermineToolTranslationsToDownload/DetermineDeepLinkedToolTranslationsToDownload.swift @@ -60,8 +60,7 @@ class DetermineDeepLinkedToolTranslationsToDownload: DetermineToolTranslationsTo return primaryTranslation } - else if let appLanguage = userAppLanguageRepository.getCachedLanguage(), - let appLanguageTranslation = translationsRepository.getLatestTranslation(resourceId: resource.id, languageCode: appLanguage.languageId) { + else if let appLanguage = userAppLanguageRepository.getCachedLanguage(), let appLanguageTranslation = translationsRepository.getLatestTranslation(resourceId: resource.id, languageCode: appLanguage.languageId) { return appLanguageTranslation } From f63b0323dfc2126691a7c60eeeb80d0161e4f9b3 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 11:40:01 -0400 Subject: [PATCH 46/58] Fix swift lint no_space_in_method_call --- .../AppleAuthentication+AuthenticationProviderInterface.swift | 2 +- .../GetToolDetailsLearnToShareToolIsAvailableRepository.swift | 2 +- .../ToolSettingsChooseLanguageView.swift | 2 +- .../ToolSettingsOptions/ToolSettingsOptionsView.swift | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/AppleAuthentication+AuthenticationProviderInterface.swift b/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/AppleAuthentication+AuthenticationProviderInterface.swift index 6572840fef..6df2eb9f54 100644 --- a/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/AppleAuthentication+AuthenticationProviderInterface.swift +++ b/godtools/App/Features/Account/Data/UserAuthentication/AuthenticationProvider/Providers/AppleAuthentication+AuthenticationProviderInterface.swift @@ -55,7 +55,7 @@ extension AppleAuthentication: AuthenticationProviderInterface { func authenticatePublisher(presentingViewController: UIViewController) -> AnyPublisher { return authenticatePublisher() - .flatMap ({ (response: AppleAuthenticationResponse) -> AnyPublisher in + .flatMap({ (response: AppleAuthenticationResponse) -> AnyPublisher in if response.isCancelled { return Fail(error: NSError.userCancelledError()) diff --git a/godtools/App/Features/ToolDetails/Data-DomainInterface/GetToolDetailsLearnToShareToolIsAvailableRepository.swift b/godtools/App/Features/ToolDetails/Data-DomainInterface/GetToolDetailsLearnToShareToolIsAvailableRepository.swift index affea26241..d19676639e 100644 --- a/godtools/App/Features/ToolDetails/Data-DomainInterface/GetToolDetailsLearnToShareToolIsAvailableRepository.swift +++ b/godtools/App/Features/ToolDetails/Data-DomainInterface/GetToolDetailsLearnToShareToolIsAvailableRepository.swift @@ -30,7 +30,7 @@ class GetToolDetailsLearnToShareToolIsAvailableRepository: GetToolDetailsLearnTo let includeRelatedFiles: Bool = false return translationsRepository.getTranslationManifestFromCache(translation: translation, manifestParserType: manifestParserType, includeRelatedFiles: includeRelatedFiles) - .catch ({ (cacheError: Error) -> AnyPublisher in + .catch({ (cacheError: Error) -> AnyPublisher in return self.translationsRepository.getTranslationManifestFromRemote( translation: translation, diff --git a/godtools/App/Features/ToolSettings/Presentation/ToolSettings/Subviews/ToolSettingsChooseLanguage/ToolSettingsChooseLanguageView.swift b/godtools/App/Features/ToolSettings/Presentation/ToolSettings/Subviews/ToolSettingsChooseLanguage/ToolSettingsChooseLanguageView.swift index 993072a0d0..f8eff5599f 100644 --- a/godtools/App/Features/ToolSettings/Presentation/ToolSettings/Subviews/ToolSettingsChooseLanguage/ToolSettingsChooseLanguageView.swift +++ b/godtools/App/Features/ToolSettings/Presentation/ToolSettings/Subviews/ToolSettingsChooseLanguage/ToolSettingsChooseLanguageView.swift @@ -28,7 +28,7 @@ struct ToolSettingsChooseLanguageView: View { var body: some View { VStack(alignment: .leading, spacing: 0) { - VStack (alignment: .leading, spacing: 4) { + VStack(alignment: .leading, spacing: 4) { Text(viewModel.chooseLanguageTitle) .foregroundColor(ColorPalette.gtGrey.color) .font(FontLibrary.sfProTextRegular.font(size: 19)) diff --git a/godtools/App/Features/ToolSettings/Presentation/ToolSettings/Subviews/ToolSettingsOptions/ToolSettingsOptionsView.swift b/godtools/App/Features/ToolSettings/Presentation/ToolSettings/Subviews/ToolSettingsOptions/ToolSettingsOptionsView.swift index 62a877b2b1..476344700a 100644 --- a/godtools/App/Features/ToolSettings/Presentation/ToolSettings/Subviews/ToolSettingsOptions/ToolSettingsOptionsView.swift +++ b/godtools/App/Features/ToolSettings/Presentation/ToolSettings/Subviews/ToolSettingsOptions/ToolSettingsOptionsView.swift @@ -24,8 +24,8 @@ struct ToolSettingsOptionsView: View { var body: some View { - VStack (alignment: .leading, spacing: 0) { - ScrollView (.horizontal, showsIndicators: false) { + VStack(alignment: .leading, spacing: 0) { + ScrollView(.horizontal, showsIndicators: false) { HStack { ToolSettingsOptionView( From f7140bd225d94b70d8d5ca88108fc197563f7e93 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 11:43:38 -0400 Subject: [PATCH 47/58] Fix swift lint return_arrow_whitespace --- .swiftlint.yml | 6 ++++-- .../ToolsFilterFeatureDataLayerDependencies.swift | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index e143870505..64dfa656e1 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -2,19 +2,21 @@ disabled_rules: # rule identifiers turned on by default to exclude from running - empty_enum_arguments #disabling for now as this touches many files. - function_body_length #disabling for now as this touches many files. + - function_parameter_count #disabling for now as this touches many files. - multiple_closures_with_trailing_closure #disabling for now as this touches many files. - opening_brace #disabling for now as this touches many files. - redundant_string_enum_value - statement_position #disabling for now as this touches many files. + - todo #disabling for now as this touches many files. - trailing_whitespace #disabling for now as this touches many files. Command swiftlint --fix is a way to fix whitespace. - unused_closure_parameter #disabling for now as this touches many files. opt_in_rules: # some rules are turned off by default, so you need to opt-in - closure_end_indentation - - closure_spacing + # - closure_spacing #disabling for now as this touches many files. - collection_alignment - comma_inheritance - conditional_returns_on_newline - - convenience_type + # - convenience_type #disabling for now as this touches many files. - discouraged_none_name - discouraged_object_literal # - empty_count #disabling for now as this touches many files. diff --git a/godtools/App/Features/ToolsFilter/DependencyContainer/ToolsFilterFeatureDataLayerDependencies.swift b/godtools/App/Features/ToolsFilter/DependencyContainer/ToolsFilterFeatureDataLayerDependencies.swift index 7078d6d8e2..5d48f98d17 100644 --- a/godtools/App/Features/ToolsFilter/DependencyContainer/ToolsFilterFeatureDataLayerDependencies.swift +++ b/godtools/App/Features/ToolsFilter/DependencyContainer/ToolsFilterFeatureDataLayerDependencies.swift @@ -77,7 +77,7 @@ class ToolsFilterFeatureDataLayerDependencies { return getToolFilterCategoriesRepository() } - func getToolFilterCategoriesInterfaceStringsRepositoryInterface() -> GetToolFilterCategoriesInterfaceStringsRepositoryInterface { + func getToolFilterCategoriesInterfaceStringsRepositoryInterface() -> GetToolFilterCategoriesInterfaceStringsRepositoryInterface { return getToolFilterCategoriesInterfaceStringsRepository() } @@ -85,7 +85,7 @@ class ToolsFilterFeatureDataLayerDependencies { return getToolFilterLanguagesRepository() } - func getToolFilterLanguagesInterfaceStringsRepositoryInterface() -> GetToolFilterLanguagesInterfaceStringsRepositoryInterface { + func getToolFilterLanguagesInterfaceStringsRepositoryInterface() -> GetToolFilterLanguagesInterfaceStringsRepositoryInterface { return getToolFilterLanguagesInterfaceStringsRepository() } From 4af129fbe68f565aac856e599d44c6887432f5cd Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 11:45:04 -0400 Subject: [PATCH 48/58] Fix swift lint syntactic_sugar --- .../Features/Dashboard/Presentation/Tools/ToolsViewModel.swift | 2 +- .../Presentation/ToolDetails/ToolDetailsViewModel.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/godtools/App/Features/Dashboard/Presentation/Tools/ToolsViewModel.swift b/godtools/App/Features/Dashboard/Presentation/Tools/ToolsViewModel.swift index b5d2d36935..865cabd5e9 100644 --- a/godtools/App/Features/Dashboard/Presentation/Tools/ToolsViewModel.swift +++ b/godtools/App/Features/Dashboard/Presentation/Tools/ToolsViewModel.swift @@ -14,7 +14,7 @@ class ToolsViewModel: ObservableObject { typealias ToolId = String - private static var favoriteToolCancellables: Dictionary = Dictionary() + private static var favoriteToolCancellables: [ToolId: AnyCancellable?] = Dictionary() private let resourcesRepository: ResourcesRepository private let viewToolsUseCase: ViewToolsUseCase diff --git a/godtools/App/Features/ToolDetails/Presentation/ToolDetails/ToolDetailsViewModel.swift b/godtools/App/Features/ToolDetails/Presentation/ToolDetails/ToolDetailsViewModel.swift index aee500d493..f193e6e71b 100644 --- a/godtools/App/Features/ToolDetails/Presentation/ToolDetails/ToolDetailsViewModel.swift +++ b/godtools/App/Features/ToolDetails/Presentation/ToolDetails/ToolDetailsViewModel.swift @@ -14,7 +14,7 @@ class ToolDetailsViewModel: ObservableObject { typealias ToolId = String - private static var toggleToolFavoritedCancellables: Dictionary = Dictionary() + private static var toggleToolFavoritedCancellables: [ToolId: AnyCancellable?] = Dictionary() private let getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase private let viewToolDetailsUseCase: ViewToolDetailsUseCase From 1763257ab8ceec96e127523afc34f72186b5e07e Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 11:53:55 -0400 Subject: [PATCH 49/58] Fix swift lint for_where --- .../Dashboard/Presentation/Tool/ToolViewModel.swift | 10 ++++++---- .../Analytics/Firebase/FirebaseAnalytics.swift | 6 ++---- .../FirebaseDebugArguments.swift | 6 ++---- .../Renderer/Renderer/MobileContentPageRenderer.swift | 8 +++----- .../ContentAccordion/MobileContentAccordionView.swift | 8 ++++---- .../Views/ContentStack/MobileContentStackView.swift | 7 +++---- .../Views/Tool/Views/Cards/ToolPageCardsView.swift | 6 ++---- .../Downloader/Parsers/ArticleAemDataParser.swift | 7 ++----- .../Data/WebArchiveQueue/WebArchiveQueueResult.swift | 8 ++++---- 9 files changed, 28 insertions(+), 38 deletions(-) diff --git a/godtools/App/Features/Dashboard/Presentation/Tool/ToolViewModel.swift b/godtools/App/Features/Dashboard/Presentation/Tool/ToolViewModel.swift index 0a376bb2d2..56f429377b 100644 --- a/godtools/App/Features/Dashboard/Presentation/Tool/ToolViewModel.swift +++ b/godtools/App/Features/Dashboard/Presentation/Tool/ToolViewModel.swift @@ -125,11 +125,13 @@ class ToolViewModel: MobileContentPagesViewModel { } private func getPageRenderer(language: LanguageDomainModel) -> MobileContentPageRenderer? { - for pageRenderer in renderer.value.pageRenderers { - if pageRenderer.language.localeIdentifier.lowercased() == language.localeIdentifier.lowercased() { - return pageRenderer - } + + let languageLocaleId: String = language.localeIdentifier.lowercased() + + for pageRenderer in renderer.value.pageRenderers where pageRenderer.language.localeIdentifier.lowercased() == languageLocaleId { + return pageRenderer } + return nil } diff --git a/godtools/App/Services/Analytics/Firebase/FirebaseAnalytics.swift b/godtools/App/Services/Analytics/Firebase/FirebaseAnalytics.swift index 83441e7296..b5197a29d3 100644 --- a/godtools/App/Services/Analytics/Firebase/FirebaseAnalytics.swift +++ b/godtools/App/Services/Analytics/Firebase/FirebaseAnalytics.swift @@ -129,10 +129,8 @@ class FirebaseAnalytics { var parameters: [String: Any] = baseParameters if let data = data { - for (key, value) in data { - if parameters[key] == nil { - parameters[key] = value - } + for (key, value) in data where parameters[key] == nil { + parameters[key] = value } } diff --git a/godtools/App/Services/FirebaseDebugArguments/FirebaseDebugArguments.swift b/godtools/App/Services/FirebaseDebugArguments/FirebaseDebugArguments.swift index ce113492df..6c70c8a728 100644 --- a/godtools/App/Services/FirebaseDebugArguments/FirebaseDebugArguments.swift +++ b/godtools/App/Services/FirebaseDebugArguments/FirebaseDebugArguments.swift @@ -31,10 +31,8 @@ class FirebaseDebugArguments { var newArguments: [String] = toArguments - for argument in arguments { - if !newArguments.contains(argument) { - newArguments.append(argument) - } + for argument in arguments where !newArguments.contains(argument) { + newArguments.append(argument) } return newArguments diff --git a/godtools/App/Services/Renderer/Renderer/MobileContentPageRenderer.swift b/godtools/App/Services/Renderer/Renderer/MobileContentPageRenderer.swift index 0fb07706ca..1a4ad7faeb 100644 --- a/godtools/App/Services/Renderer/Renderer/MobileContentPageRenderer.swift +++ b/godtools/App/Services/Renderer/Renderer/MobileContentPageRenderer.swift @@ -69,11 +69,9 @@ class MobileContentPageRenderer { let pageModel: Page = pageModels[pageIndex] - for listener in pageModel.listeners { - - if eventIds.contains(listener) { - return pageIndex - } + for listener in pageModel.listeners where eventIds.contains(listener) { + + return pageIndex } } diff --git a/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentAccordion/MobileContentAccordionView.swift b/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentAccordion/MobileContentAccordionView.swift index 0b1bb8abad..4c09023e08 100644 --- a/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentAccordion/MobileContentAccordionView.swift +++ b/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentAccordion/MobileContentAccordionView.swift @@ -42,11 +42,11 @@ class MobileContentAccordionView: MobileContentView { } var isRevealingSectionText: Bool { - for sectionView in sectionViews { - if !sectionView.contentIsHidden { - return true - } + + for sectionView in sectionViews where !sectionView.contentIsHidden { + return true } + return false } diff --git a/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentStack/MobileContentStackView.swift b/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentStack/MobileContentStackView.swift index f979cc33f6..dd6f76b871 100644 --- a/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentStack/MobileContentStackView.swift +++ b/godtools/App/Services/Renderer/Views/MobileContent/Views/ContentStack/MobileContentStackView.swift @@ -552,10 +552,9 @@ extension MobileContentStackView { } } - for childView in childViews { - if childView.visibilityState == .visible { - addTopAndBottomConstraintsToChildView(childView: childView) - } + for childView in childViews where childView.visibilityState == .visible { + + addTopAndBottomConstraintsToChildView(childView: childView) } childrenParentView.layoutIfNeeded() diff --git a/godtools/App/Services/Renderer/Views/Tool/Views/Cards/ToolPageCardsView.swift b/godtools/App/Services/Renderer/Views/Tool/Views/Cards/ToolPageCardsView.swift index 064de0e083..ea89da4422 100644 --- a/godtools/App/Services/Renderer/Views/Tool/Views/Cards/ToolPageCardsView.swift +++ b/godtools/App/Services/Renderer/Views/Tool/Views/Cards/ToolPageCardsView.swift @@ -553,11 +553,9 @@ extension ToolPageCardsView { setCurrentCardPosition(cardPosition: showingCardAtPosition, animated: animated) - for cardPosition in 0 ..< renderedCards.count { + for cardPosition in 0 ..< renderedCards.count where cardPosition <= showingCardAtPosition { - if cardPosition <= showingCardAtPosition { - cardTopConstraints[cardPosition].constant = getCardTopConstant(state: .showingKeyboard, cardPosition: cardPosition) - } + cardTopConstraints[cardPosition].constant = getCardTopConstant(state: .showingKeyboard, cardPosition: cardPosition) } case .collapseAllCards: diff --git a/godtools/App/Share/Data/ArticlesRepository/Articles/Downloader/Parsers/ArticleAemDataParser.swift b/godtools/App/Share/Data/ArticlesRepository/Articles/Downloader/Parsers/ArticleAemDataParser.swift index 912b650c38..cf51a6030c 100644 --- a/godtools/App/Share/Data/ArticlesRepository/Articles/Downloader/Parsers/ArticleAemDataParser.swift +++ b/godtools/App/Share/Data/ArticlesRepository/Articles/Downloader/Parsers/ArticleAemDataParser.swift @@ -124,12 +124,9 @@ class ArticleAemDataParser { for variation in preferredVariationOrder { - for (rootKey, _) in aemJson { + for (rootKey, _) in aemJson where rootKey == variation { - if rootKey == variation { - - return rootKey - } + return rootKey } } diff --git a/godtools/App/Share/Data/WebArchiveQueue/WebArchiveQueueResult.swift b/godtools/App/Share/Data/WebArchiveQueue/WebArchiveQueueResult.swift index a9bd348196..0b92d0d9a5 100644 --- a/godtools/App/Share/Data/WebArchiveQueue/WebArchiveQueueResult.swift +++ b/godtools/App/Share/Data/WebArchiveQueue/WebArchiveQueueResult.swift @@ -15,11 +15,11 @@ struct WebArchiveQueueResult { let totalAttemptedArchives: Int var networkFailed: Bool { - for operationError in failedArchives { - if operationError.networkFailed { - return true - } + + for operationError in failedArchives where operationError.networkFailed { + return true } + return false } } From faadecbe7610ef19601d38f2cc1325af403abef3 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 11:54:29 -0400 Subject: [PATCH 50/58] Disable cyclomatic_complexity for now --- .swiftlint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.swiftlint.yml b/.swiftlint.yml index 64dfa656e1..6573bd1f34 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,5 +1,6 @@ # By default, SwiftLint uses a set of sensible default rules you can adjust: disabled_rules: # rule identifiers turned on by default to exclude from running + - cyclomatic_complexity #disabling for now as this touches many files. - empty_enum_arguments #disabling for now as this touches many files. - function_body_length #disabling for now as this touches many files. - function_parameter_count #disabling for now as this touches many files. From b7dbd9560d7e3fd8070ce120750a3aa1f68f26b7 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 14:39:30 -0400 Subject: [PATCH 51/58] Fix swift lint comment_spacing --- .../Tools/Subviews/ToolCard/ToolCardView.swift | 2 +- .../UIImage/UIImage+ScalePresevingAspectRatio.swift | 2 +- .../RealmCache/RealmCategoryArticlesCache.swift | 2 +- .../LanguagesRepository/Api/Models/LanguageModel.swift | 2 +- .../SwiftUI Views/VideoView/VideoViewRepresentable.swift | 1 - .../PageNavigationCollectionView.swift | 4 ++-- .../Views/TransparentModal/TransparentModalView.swift | 9 +-------- 7 files changed, 7 insertions(+), 15 deletions(-) diff --git a/godtools/App/Features/Dashboard/Presentation/Tools/Subviews/ToolCard/ToolCardView.swift b/godtools/App/Features/Dashboard/Presentation/Tools/Subviews/ToolCard/ToolCardView.swift index 167972fc5e..0f86e06700 100644 --- a/godtools/App/Features/Dashboard/Presentation/Tools/Subviews/ToolCard/ToolCardView.swift +++ b/godtools/App/Features/Dashboard/Presentation/Tools/Subviews/ToolCard/ToolCardView.swift @@ -168,7 +168,7 @@ struct ToolCardView: View { }) } - }//end ZStack + }// end ZStack .frame(width: cardWidth) .cornerRadius(cornerRadius) .shadow(color: Color.black.opacity(0.25), radius: 4, y: 2) diff --git a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+ScalePresevingAspectRatio.swift b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+ScalePresevingAspectRatio.swift index 5944985ad4..24b3c5b6db 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+ScalePresevingAspectRatio.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UIImage/UIImage+ScalePresevingAspectRatio.swift @@ -9,7 +9,7 @@ import UIKit extension UIImage { - //found here: https://www.advancedswift.com/resize-uiimage-no-stretching-swift/ + // found here: https://www.advancedswift.com/resize-uiimage-no-stretching-swift/ func scalePreservingAspectRatio(targetSize: CGSize) -> UIImage { // Determine the scale factor that preserves aspect ratio diff --git a/godtools/App/Share/Data/ArticlesRepository/Categories/RealmCache/RealmCategoryArticlesCache.swift b/godtools/App/Share/Data/ArticlesRepository/Categories/RealmCache/RealmCategoryArticlesCache.swift index 0962bce34f..6c880a2d62 100644 --- a/godtools/App/Share/Data/ArticlesRepository/Categories/RealmCache/RealmCategoryArticlesCache.swift +++ b/godtools/App/Share/Data/ArticlesRepository/Categories/RealmCache/RealmCategoryArticlesCache.swift @@ -111,6 +111,6 @@ class RealmCategoryArticlesCache { completion(errors) - }//end realm background + }// end realm background } } diff --git a/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift b/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift index a561954ff4..327e49aa68 100644 --- a/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift +++ b/godtools/App/Share/Data/LanguagesRepository/Api/Models/LanguageModel.swift @@ -52,7 +52,7 @@ struct LanguageModel: LanguageModelType, Codable { tempCode = "fil-x-taglish" } - code = tempCode//try attributesContainer?.decodeIfPresent(BCP47LanguageIdentifier.self, forKey: .code) ?? "" // TODO: (GT-2399) Remove tempCode and replace with commented out line. + code = tempCode// try attributesContainer?.decodeIfPresent(BCP47LanguageIdentifier.self, forKey: .code) ?? "" // TODO: (GT-2399) Remove tempCode and replace with commented out line. direction = try attributesContainer?.decodeIfPresent(String.self, forKey: .direction) ?? "" name = try attributesContainer?.decodeIfPresent(String.self, forKey: .name) ?? "" } diff --git a/godtools/App/Share/SwiftUI Views/VideoView/VideoViewRepresentable.swift b/godtools/App/Share/SwiftUI Views/VideoView/VideoViewRepresentable.swift index 36f296117e..28d4666210 100644 --- a/godtools/App/Share/SwiftUI Views/VideoView/VideoViewRepresentable.swift +++ b/godtools/App/Share/SwiftUI Views/VideoView/VideoViewRepresentable.swift @@ -71,7 +71,6 @@ struct VideoViewRepresentable: UIViewRepresentable { if animated { UIView.animate(withDuration: 0.3, delay: 0, options: .curveEaseOut) { - //animations videoViewRep.loadingView.alpha = loadingViewAlpha } completion: { (finished: Bool) in if finished && hidden { diff --git a/godtools/App/Share/Views/PageNavigationCollectionView/PageNavigationCollectionView.swift b/godtools/App/Share/Views/PageNavigationCollectionView/PageNavigationCollectionView.swift index e5ba644982..d798bdd5dc 100644 --- a/godtools/App/Share/Views/PageNavigationCollectionView/PageNavigationCollectionView.swift +++ b/godtools/App/Share/Views/PageNavigationCollectionView/PageNavigationCollectionView.swift @@ -655,8 +655,8 @@ extension PageNavigationCollectionView: UIScrollViewDelegate { func scrollViewDidScroll(_ scrollView: UIScrollView) { - //logMessage(message: "did scroll") - //logMessage(message: " contentOffset.x: \(scrollView.contentOffset.x)") + // logMessage(message: "did scroll") + // logMessage(message: " contentOffset.x: \(scrollView.contentOffset.x)") let currentPage: Int = getPageBasedOnContentOffset(contentOffset: scrollView.contentOffset) diff --git a/godtools/App/Share/Views/TransparentModal/TransparentModalView.swift b/godtools/App/Share/Views/TransparentModal/TransparentModalView.swift index b93a7b593d..071fa1b0bf 100644 --- a/godtools/App/Share/Views/TransparentModal/TransparentModalView.swift +++ b/godtools/App/Share/Views/TransparentModal/TransparentModalView.swift @@ -80,14 +80,7 @@ class TransparentModalView: UIViewController { // overlayButton overlayButton.backgroundColor = .black overlayButton.alpha = 0.4 - - //customModalView.backgroundColor = .white - //customModalView.layer.cornerRadius = modalCornerRadius - //customModalView.layer.shadowOffset = CGSize(width: 1, height: 1) - //customModalView.layer.shadowColor = UIColor.black.cgColor - //customModalView.layer.shadowRadius = 5 - //customModalView.layer.shadowOpacity = 0.6 - + // modalView addModalView(modalView: modalView) } From e0edd4541f77555bf735356b73bb303928b7d444 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 14:42:06 -0400 Subject: [PATCH 52/58] Fix swift lint discouraged_none_name --- .../LearnToShareToolItemAssetContent.swift | 2 +- .../LearnToShareToolItemView.swift | 2 +- .../LearnToShareToolItemViewModel.swift | 2 +- .../PageNavigationCollectionViewCenteredLayout.swift | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/Subviews/LearnToShareToolItem/LearnToShareToolItemAssetContent.swift b/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/Subviews/LearnToShareToolItem/LearnToShareToolItemAssetContent.swift index 39ebdbc196..e6023730fb 100644 --- a/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/Subviews/LearnToShareToolItem/LearnToShareToolItemAssetContent.swift +++ b/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/Subviews/LearnToShareToolItem/LearnToShareToolItemAssetContent.swift @@ -12,5 +12,5 @@ enum LearnToShareToolItemAssetContent { case animation(viewModel: AnimatedViewModel) case image(image: Image) - case none + case noAsset } diff --git a/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/Subviews/LearnToShareToolItem/LearnToShareToolItemView.swift b/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/Subviews/LearnToShareToolItem/LearnToShareToolItemView.swift index c2a6d831e5..787c41b034 100644 --- a/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/Subviews/LearnToShareToolItem/LearnToShareToolItemView.swift +++ b/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/Subviews/LearnToShareToolItem/LearnToShareToolItemView.swift @@ -42,7 +42,7 @@ struct LearnToShareToolItemView: View { .resizable() .scaledToFit() - case .none: + case .noAsset: Rectangle() .fill(.clear) diff --git a/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/Subviews/LearnToShareToolItem/LearnToShareToolItemViewModel.swift b/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/Subviews/LearnToShareToolItem/LearnToShareToolItemViewModel.swift index 68c485fb2f..a23cf35400 100644 --- a/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/Subviews/LearnToShareToolItem/LearnToShareToolItemViewModel.swift +++ b/godtools/App/Features/LearnToShareTool/Presentation/LearnToShareTool/Subviews/LearnToShareToolItem/LearnToShareToolItemViewModel.swift @@ -37,7 +37,7 @@ class LearnToShareToolItemViewModel: ObservableObject { } else { - assetContent = .none + assetContent = .noAsset } } diff --git a/godtools/App/Share/Views/PageNavigationCollectionView/PageNavigationCollectionViewCenteredLayout.swift b/godtools/App/Share/Views/PageNavigationCollectionView/PageNavigationCollectionViewCenteredLayout.swift index c0175f8386..a8bb7d9a5a 100644 --- a/godtools/App/Share/Views/PageNavigationCollectionView/PageNavigationCollectionViewCenteredLayout.swift +++ b/godtools/App/Share/Views/PageNavigationCollectionView/PageNavigationCollectionViewCenteredLayout.swift @@ -12,8 +12,8 @@ class PageNavigationCollectionViewCenteredLayout: UICollectionViewFlowLayout { enum PanDirection { + case directionNotSet case left - case none case right } @@ -26,7 +26,7 @@ class PageNavigationCollectionViewCenteredLayout: UICollectionViewFlowLayout { private var beginningContentOffset: CGPoint? private var lastPanningPoint: CGPoint = .zero - private(set) var panDirection: PageNavigationCollectionViewCenteredLayout.PanDirection = .none + private(set) var panDirection: PageNavigationCollectionViewCenteredLayout.PanDirection = .directionNotSet private(set) var isPanning: Bool = false private weak var pageNavigationCollectionView: PageNavigationCollectionView? @@ -100,6 +100,9 @@ class PageNavigationCollectionViewCenteredLayout: UICollectionViewFlowLayout { switch panDirection { + case .directionNotSet: + targetPage = beginningPage + case .left: if lastPanningPoint.x < beginningPanPoint.x { @@ -109,9 +112,6 @@ class PageNavigationCollectionViewCenteredLayout: UICollectionViewFlowLayout { targetPage = beginningPage } - case .none: - targetPage = beginningPage - case .right: if lastPanningPoint.x > beginningPanPoint.x { From cce117b8e120c0789638a2cbd3392f44b0ecca49 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 14:44:27 -0400 Subject: [PATCH 53/58] Set warning to 1 --- .swiftlint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.swiftlint.yml b/.swiftlint.yml index 6573bd1f34..ffe1987075 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -129,6 +129,7 @@ type_name: allowed_symbols: ["_"] # these are allowed in type names identifier_name: min_length: # only min_length + warning: 1 error: 1 # only error max_length: # warning and error warning: 80 From 1d46813e4488632e213e965af50c078c783ed9a2 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 14:47:08 -0400 Subject: [PATCH 54/58] Fix swift lint legacy_constructor --- .../UIKit/UILabel/UILabel+AttributedString.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UILabel/UILabel+AttributedString.swift b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UILabel/UILabel+AttributedString.swift index 34a6a88c87..9f6971afd4 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UILabel/UILabel+AttributedString.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/UIKit/UILabel/UILabel+AttributedString.swift @@ -18,7 +18,7 @@ extension UILabel { private func getRangeOfString(string: String) -> NSRange { guard let text = self.text else { - return NSMakeRange(0, 0) + return NSRange(location: 0, length: 0) } return (text as NSString).range(of: string) From ef7acca461d82d17382162c69dbd6bd7ae1657dc Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 14:51:44 -0400 Subject: [PATCH 55/58] Update length --- .swiftlint.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index ffe1987075..bc19ca4712 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -4,6 +4,7 @@ disabled_rules: # rule identifiers turned on by default to exclude from running - empty_enum_arguments #disabling for now as this touches many files. - function_body_length #disabling for now as this touches many files. - function_parameter_count #disabling for now as this touches many files. + - inclusive_language - multiple_closures_with_trailing_closure #disabling for now as this touches many files. - opening_brace #disabling for now as this touches many files. - redundant_string_enum_value @@ -112,12 +113,12 @@ force_try: line_length: 1200 # they can set both implicitly with an array type_body_length: - - 300 # warning - - 400 # error + - 500 # warning + - 600 # error # or they can set both explicitly file_length: - warning: 500 - error: 1200 + warning: 1500 + error: 2000 # naming rules can set warnings/errors for min_length and max_length # additionally they can set excluded names type_name: From 0f2f568f91e30b6a5a9bb56892c6a3b4a2a51444 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Tue, 16 Jul 2024 15:27:30 -0400 Subject: [PATCH 56/58] Make public --- .../Collection/Collection+SafeLookup.swift | 2 +- .../Foundation/Locale/Locale+Extensions.swift | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Collection/Collection+SafeLookup.swift b/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Collection/Collection+SafeLookup.swift index 8c3bd31bb7..9a167f4397 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Collection/Collection+SafeLookup.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Collection/Collection+SafeLookup.swift @@ -10,7 +10,7 @@ import Foundation extension Collection where Indices.Iterator.Element == Index { - subscript (safe index: Index) -> Iterator.Element? { + public subscript (safe index: Index) -> Iterator.Element? { return indices.contains(index) ? self[index] : nil } } diff --git a/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Locale/Locale+Extensions.swift b/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Locale/Locale+Extensions.swift index 3c21ca02ab..2b4b2fb718 100644 --- a/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Locale/Locale+Extensions.swift +++ b/godtools/App/Share/Common/SharedAppleExtensions/Foundation/Locale/Locale+Extensions.swift @@ -10,22 +10,22 @@ import Foundation extension Locale { - var isBaseLanguage: Bool { + public var isBaseLanguage: Bool { let isBaseLanguage: Bool = isMissingRegionCode && isMissingScriptCode return isBaseLanguage } - var isEnglishLanguage: Bool { + public var isEnglishLanguage: Bool { return languageCode == "en" } - var isMissingRegionCode: Bool { + public var isMissingRegionCode: Bool { return regionCode?.isEmpty ?? true } - var isMissingScriptCode: Bool { + public var isMissingScriptCode: Bool { return scriptCode?.isEmpty ?? true } @@ -43,15 +43,15 @@ extension Locale { return languageCodesMatch } - func scriptCodeIsEqualToLocaleScriptCode(locale: Locale) -> Bool { + public func scriptCodeIsEqualToLocaleScriptCode(locale: Locale) -> Bool { return locale.scriptCode?.lowercased() == scriptCode?.lowercased() } - func regionCodeIsEqualToLocaleRegionCode(locale: Locale) -> Bool { + public func regionCodeIsEqualToLocaleRegionCode(locale: Locale) -> Bool { return locale.regionCode?.lowercased() == regionCode?.lowercased() } - func isEqualTo(locale: Locale) -> Bool { + public func isEqualTo(locale: Locale) -> Bool { let languageCodesMatch: Bool = languageCodeIsEqualToLocaleLanguageCode(locale: locale) let scriptCodesMatch: Bool = scriptCodeIsEqualToLocaleScriptCode(locale: locale) @@ -60,12 +60,12 @@ extension Locale { return languageCodesMatch && scriptCodesMatch && regionCodesMatch } - func baseLanguageIsEqualToLocaleBaseLanguage(locale: Locale) -> Bool { + public func baseLanguageIsEqualToLocaleBaseLanguage(locale: Locale) -> Bool { return languageCodeIsEqualToLocaleLanguageCode(locale: locale) } - func baseLanguageAndScriptCodesAreEqualTo(locale: Locale) -> Bool { + public func baseLanguageAndScriptCodesAreEqualTo(locale: Locale) -> Bool { let baseLanguagesMatch: Bool = baseLanguageIsEqualToLocaleBaseLanguage(locale: locale) let scriptCodesMatch: Bool = locale.scriptCode?.lowercased() == scriptCode?.lowercased() From 7a6b8767f0d21611b366b54303b9abe28c927ee2 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 16 Jul 2024 23:08:10 +0000 Subject: [PATCH 57/58] [skip ci] Adding latest localization files from OneSky --- godtools/am.lproj/Localizable.strings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/godtools/am.lproj/Localizable.strings b/godtools/am.lproj/Localizable.strings index a92cf81c1e..72f7344a46 100755 --- a/godtools/am.lproj/Localizable.strings +++ b/godtools/am.lproj/Localizable.strings @@ -105,7 +105,7 @@ "toolDetails.about.title" = "ስለ"; /* This means that the tool/resource is not available in the currently selected language. */ -"lessonCard.languageNotAvailable" = "በ %@ ውስጥ አይገኝም"; +"lessonCard.languageNotAvailable" = "በ%@ ቋንቋ የለም"; "menu.deleteAccount" = "መለያ አጥፋ"; "alert.mailAppUnavailable.title" = "የMail መተግበሪያ የለም"; From 38e50de42f07edc938986f766dd7892111d1a257 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Wed, 17 Jul 2024 11:41:14 -0400 Subject: [PATCH 58/58] Including releases/* this way we can distribute a new release build against a previous release --- .github/workflows/create-version.yml | 4 ++-- .github/workflows/run-tests.yml | 4 ++-- .github/workflows/swift-lint.yml | 2 +- .github/workflows/testflight.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/create-version.yml b/.github/workflows/create-version.yml index 0512484b4c..5671485bc7 100644 --- a/.github/workflows/create-version.yml +++ b/.github/workflows/create-version.yml @@ -2,9 +2,9 @@ name: Create Version on: push: - branches: [ main ] + branches: [ main, releases/* ] pull_request: - branches: [ main ] + branches: [ main, releases/* ] workflow_dispatch: inputs: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e90da4b657..27db0cd78f 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -2,9 +2,9 @@ name: Run Tests on: push: - branches: [ develop, master, feature/* ] + branches: [ develop, master, feature/*, releases/* ] pull_request: - branches: [ develop, master, feature/* ] + branches: [ develop, master, feature/*, releases/* ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/.github/workflows/swift-lint.yml b/.github/workflows/swift-lint.yml index a4d9ae573b..8dbb501e91 100644 --- a/.github/workflows/swift-lint.yml +++ b/.github/workflows/swift-lint.yml @@ -2,7 +2,7 @@ name: Swift Lint on: pull_request: - branches: [ develop, master, feature/* ] + branches: [ develop, master, feature/*, releases/* ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/.github/workflows/testflight.yml b/.github/workflows/testflight.yml index a789b9ef49..588a63e0e7 100644 --- a/.github/workflows/testflight.yml +++ b/.github/workflows/testflight.yml @@ -2,7 +2,7 @@ name: Distribute To Testflight on: push: - branches: [ master ] + branches: [ master, releases/* ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: