Skip to content

Conversation

@ValentinaIancu-Gini
Copy link
Contributor

@ValentinaIancu-Gini ValentinaIancu-Gini commented Dec 10, 2025

Pull Request Description

PP-1940

This pull request refactors code to reduce SonarQube issues related to duplicating string literals. The changes extract inline localized strings and image references into centralized private Strings and Images structs within their respective classes, and introduce a new giniLocalized() convenience function to simplify localization calls.

  • Introduced giniLocalized() helper functions in both CaptureSDK and BankSDK as convenience wrappers around the more verbose localization methods
  • Extracted duplicate string literals into private Strings structs across multiple view controllers and data sources
  • Refactored QRCode-related classes by extracting CorrectQRCodeTextContainer and IncorrectQRCodeTextContainer into separate files with their own string constants
  • Changed several enum types to struct for Constants and Images containers (more appropriate since they're just namespaces)

…g localization

- Add convenience wrapper around `NSLocalizedStringPreferredGiniBankFormat` to improve code readability and reduce verbosity when accessing localized strings throughout the BankSDK

PP-1940
…er` to reduce duplication of literals

PP-1940
…odel` to reduce duplication of literals

PP-1940
…ring localization

- Add convenience wrapper around `NSLocalizedStringPreferredFormat` to improve code readability and reduce verbosity when accessing localized strings throughout the GiniCaptureSDK

PP-1940
…uplication of literals

- use the newly introduced `giniLocalized` method for better visibility and readability
PP-1940
…chant+PaymentComponentsStringsProvider`

PP-1940
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors code to reduce SonarQube issues related to duplicating string literals. The changes extract inline localized strings and image references into centralized private Strings and Images structs within their respective classes, and introduce a new giniLocalized() convenience function to simplify localization calls.

  • Introduced giniLocalized() helper functions in both CaptureSDK and BankSDK as convenience wrappers around the more verbose localization methods
  • Extracted duplicate string literals into private Strings structs across multiple view controllers and data sources
  • Refactored QRCode-related classes by extracting CorrectQRCodeTextContainer and IncorrectQRCodeTextContainer into separate files with their own string constants
  • Changed several enum types to struct for Constants and Images containers (more appropriate since they're just namespaces)

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
GiniMerchant+PaymentComponentsStringsProvider.swift Updated localization comments to be more specific (e.g., "answer 1", "question 1")
HelpFormatsDataSource.swift Major refactoring to use centralized Strings and Images structs instead of inline literals
QRCodeOverlay.swift Extracted nested classes to separate files, added Strings/Images structs
IncorrectQRCodeTextContainer.swift New file containing extracted class with Strings struct
CorrectQRCodeTextContainer.swift New file containing extracted class with Strings struct
CameraPreviewView.swift Removed author attribution comment
CameraViewController.swift Refactored to use Strings struct and new giniLocalized helper
AnalysisViewController.swift Changed Constants from enum to struct
GiniCaptureUtils.swift Added new giniLocalized() convenience function
EducationFlowContent.swift Changed Images from enum to struct
SettingsViewController+SwitchOptionModel.swift Consolidated duplicate return statements using comma-separated case patterns
DigitalInvoiceOnboardingViewController.swift Refactored to use Strings struct and giniLocalized helper
DigitalInvoiceHelpViewModel.swift Refactored to use Strings struct
GiniBankUtils.swift Added new giniLocalized() convenience function
Comments suppressed due to low confidence (1)

CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Camera/Views/QRCodeOverlay/QRCodeOverlay.swift:327

  • Typo in comment: "Retrievenig" should be "Retrieving".

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants