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

Align interface to Android #31

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Conversation

pauljohanneskraft
Copy link

@pauljohanneskraft pauljohanneskraft commented Sep 25, 2024

Align interface to Android

♻️ Current situation & Problem

During the implementation of SpeziContact for Android, we discussed the following changes to the interface, where iOS may benefit as well.

See StanfordSpezi/SpeziKt#104

⚙️ Release Notes

Add a bullet point list summary of the feature and possible migration guides if this is a breaking change so this section can be added to the release notes.
Include code snippets that provide examples of the feature implemented or links to the documentation if it appends or changes the public interface.

📚 Documentation

Please ensure that you properly document any additions in conformance to Spezi Documentation Guide.
You can use this section to describe your solution, but we encourage contributors to document your reasoning and changes using in-line documentation.

✅ Testing

Please ensure that the PR meets the testing requirements set by CodeCov and that new functionality is appropriately tested.
This section describes important information about the tests and why some elements might not be testable.

📝 Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

@pauljohanneskraft pauljohanneskraft self-assigned this Sep 25, 2024
@pauljohanneskraft pauljohanneskraft added the enhancement New feature or request label Sep 25, 2024
Copy link

codecov bot commented Sep 25, 2024

Codecov Report

Attention: Patch coverage is 70.45455% with 26 lines in your changes missing coverage. Please review.

Project coverage is 75.59%. Comparing base (f50a5b8) to head (c49d294).

Files with missing lines Patch % Lines
...es/SpeziContact/Models/ContactOption+Website.swift 37.50% 10 Missing ⚠️
...urces/SpeziContact/Contact Views/ContactView.swift 0.00% 7 Missing ⚠️
...urces/SpeziContact/Models/ContactOption+Text.swift 66.67% 5 Missing ⚠️
...urces/SpeziContact/Models/ContactOption+Call.swift 89.48% 2 Missing ⚠️
...rces/SpeziContact/Models/ContactOption+Email.swift 90.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #31      +/-   ##
==========================================
- Coverage   78.69%   75.59%   -3.09%     
==========================================
  Files           4        9       +5     
  Lines         319      340      +21     
==========================================
+ Hits          251      257       +6     
- Misses         68       83      +15     
Files with missing lines Coverage Δ
.../SpeziContact/Extensions/UIApplication+Alert.swift 100.00% <100.00%> (ø)
Sources/SpeziContact/Models/ContactOption.swift 100.00% <ø> (+13.05%) ⬆️
...urces/SpeziContact/Models/ContactOption+Call.swift 89.48% <89.48%> (ø)
...rces/SpeziContact/Models/ContactOption+Email.swift 90.00% <90.00%> (ø)
...urces/SpeziContact/Models/ContactOption+Text.swift 66.67% <66.67%> (ø)
...urces/SpeziContact/Contact Views/ContactView.swift 76.15% <0.00%> (-1.99%) ⬇️
...es/SpeziContact/Models/ContactOption+Website.swift 37.50% <37.50%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f50a5b8...c49d294. Read the comment docs.

Copy link
Member

@PSchmiedmayer PSchmiedmayer 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 for working on this @pauljohanneskraft!

I only had minor comments; happy to see this merged 🚀



/// A type handling the action to be performed by a ContactOption.
public protocol ContactOptionAction {
Copy link
Member

Choose a reason for hiding this comment

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

We should probably enforce that this type is sendable?

Sources/SpeziContact/Models/ContactOption.swift Outdated Show resolved Hide resolved


/// Encodes a way to get in contact with an individual and usually connected to a `Contact`.
/// - Parameters:
/// - image: The image representing the `ContactOption` in the user interface.
/// - title: The title representing the `ContactOption` in the user interface.
/// - action: The action that should be taken when a user chooses to use the `ContactOption`.
public init(image: Image, title: String, action: @escaping @MainActor () -> Void) {
public init(image: Image, title: String, action: any ContactOptionAction) {
Copy link
Member

Choose a reason for hiding this comment

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

I think we should still keep the closure-base initializer; it would allow us to only tag a minor version increment and might still be useful for a Swift-style API? We could mark it as deprecated in case we don't want to have the same overload for the Android API but at least would make this a non-breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants