Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Pp 749 gini demo app tl show attachments #784

Open
wants to merge 92 commits into
base: main
Choose a base branch
from

Conversation

ValentinaIancu-Gini
Copy link
Contributor

I've implemented the TransactionList screen to showcase the TDs feature.

Additionally, changes have been made to GiniAPILibrary to support requests using a documentId instead of the entire document object.

The TDs protocols have been updated by introducing new methods and properties required for the TransactionList. Some modifications were also made to the public protocol, including renaming and removing elements. However, these changes are not breaking, as this feature is not yet used in production.

For demo purposes, I chose to store transaction information in a JSON file, which led to the introduction of the FileManagerHelper class.

Changes were also made to the Demo screen of our example app:

A new Settings button was added (top right corner) to improve clarity and visibility.
A new button was introduced to display the TransactionList screen.
Colors were adjusted to align with the new design of this screen.

…ata to a file and update any existing data

PP-749
… info to show the transactionlist with attached documents

PP-749
…and `documentPage for documentId` In DocumentService

PP-749
…attached transaction documents and be accessed from outside of the SDK

PP-749
…o be accessed from outside of the SDK

PP-749
… transaction date in the list of transactions

PP-749
…oded name for other types of documents e.g `Document.png`

PP-749
… extractions in the invoice preview screen

PP-749
@ValentinaIancu-Gini ValentinaIancu-Gini self-assigned this Feb 20, 2025
…:gini/gini-mobile-ios into PP-749-Gini-Demo-app-TL-show-attachments
…to have `updateTransactionDocsViewModel` method to be used in multiple places

- reduce duplicate code
PP-749
# Conflicts:
#	BankSDK/GiniBankSDK/Sources/GiniBankSDK/Core/GiniBankNetworkingScreenApiCoordinator.swift
#	BankSDK/GiniBankSDKExample/GiniBankSDKExample.xcodeproj/project.pbxproj
@ValentinaIancu-Gini ValentinaIancu-Gini changed the base branch from main to Release-3.13.0 March 6, 2025 11:04
@ValentinaIancu-Gini ValentinaIancu-Gini changed the base branch from Release-3.13.0 to main March 6, 2025 11:05
…d DocumentServiceHelper

- Added `DocumentServiceProviding` protocol to standardize document service interactions.
- Introduced `DocumentServiceHelper` to handle document page fetching and processing.
- Improved error handling and code reuse across the SDK.

PP-749
…g and DocumentServiceHelper

- Conformed `GiniBank` to `DocumentServiceProviding` for standardized document handling.
- Replaced redundant document fetching logic with `DocumentServiceHelper`.
- Simplified `loadDocumentData(for:)` and related methods to improve maintainability.
- Ensured proper error handling and UI updates on the main thread.

PP-749
…to use DocumentServiceHelper

- Conformed `GiniBankNetworkingScreenApiCoordinator` to `DocumentServiceProviding`.
- Removed duplicated document fetching methods in favor of `DocumentServiceHelper`.
- Simplified `loadDocumentPagesAndHandleErrors(for:with:)` and other related methods.
- Improved maintainability and ensured consistent document processing across the SDK.

PP-749
Copy link

sonarqubecloud bot commented Mar 6, 2025

Quality Gate Passed Quality Gate passed

Issues
0 New issues
7 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

Copy link
Collaborator

@zladzeyka zladzeyka left a comment

Choose a reason for hiding this comment

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

Thank you @ValentinaIancu-Gini, left you a couple of suggestions


/// Initializes a `GiniTransactionDoc` instance.
///
/// - Parameters:
Copy link
Collaborator

Choose a reason for hiding this comment

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

[Suggestion]: I've noticed we used in our code base different comment styles,
majority uses "
/**
Initializes a new instance of GiniHealth.

 This initializer creates a GiniHealth instance by first constructing a Client object with the provided client credentials (id, secret, domain)
 
 - Parameters:
 - id: The client ID provided by Gini when you register your application. This is a unique identifier for your application.
 - secret: The client secret provided by Gini alongside the client ID. This is used to authenticate your application to the Gini API.
 - domain: The domain associated with your client credentials. This is used to scope the client credentials to a specific domain.
 - pinningConfig: Configuration for certificate pinning. Format ["PinnedDomains" : ["PublicKeyHashes"]]
 - logLevel: The log level. `LogLevel.none` by default.
 */
 "

Copy link
Collaborator

Choose a reason for hiding this comment

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

[Suggestion]: Please check the comment style we use in majority cases
"
/**
Initializes a new instance of GiniHealth.

 This initializer creates a GiniHealth instance by first constructing a Client object with the provided client credentials (id, secret, domain)
 
 - Parameters:
 - id: The client ID provided by Gini when you register your application. This is a unique identifier for your application.
 - secret: The client secret provided by Gini alongside the client ID. This is used to authenticate your application to the Gini API.
 - domain: The domain associated with your client credentials. This is used to scope the client credentials to a specific domain.
 - pinningConfig: Configuration for certificate pinning. Format ["PinnedDomains" : ["PublicKeyHashes"]]
 - logLevel: The log level. `LogLevel.none` by default.
 */
 "

/// Retrieves the current view model for transaction documents.
/// - Returns: An optional `TransactionDocsViewModel` instance if available.
func getTransactionDocsViewModel() -> TransactionDocsViewModel?

/// Updates the `TransactionDocsViewModel` with new images and extracted data for a specific document.
Copy link
Collaborator

Choose a reason for hiding this comment

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

[Suggestion]: Please check the comment style

private var cameraInputImage: UIImage? {
return UIImage(named: "cameraInput")?.tintedImageWithColor(iconColor)
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change

var image: UIImage {
return UIImage(named: rawValue).require(hint: "Image with name \(rawValue) missing")
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change

containerView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor,
constant: -Constants.containerHorizontalPadding),
containerView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 8),
containerView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -8),
Copy link
Collaborator

Choose a reason for hiding this comment

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

[Suggestion]: Please wrap the magic numbers into constants

paymentRecipientLabel.textColor = GiniColor(light: .GiniBank.dark1, dark: .GiniBank.light1).uiColor()
paymentRecipientLabel.font = UIFont.systemFont(ofSize: 17)

paymentPurposeLabel.font = UIFont.systemFont(ofSize: 13)
Copy link
Collaborator

Choose a reason for hiding this comment

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

[Suggestion]: could you please wrap the numbers into Constants extension

}

// Read the file
guard let data = try? Data(contentsOf: fileURL) else { return [] }
Copy link
Collaborator

Choose a reason for hiding this comment

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

[Clarification]: what if we add FileManager.default.fileExists(atPath: fileURL.path) condition together in line 33, do we still need to create an empty file?

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