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

[16][6][13] Refactoring / Switchcraft integration / Support for Alerts #15

Merged
merged 3 commits into from
Mar 15, 2022

Conversation

AZielinsky95
Copy link
Contributor

@AZielinsky95 AZielinsky95 commented Mar 11, 2022

For #16 #6 #13

Summary:

Alerts

This PR introduces a bunch of changes to support a dynamic alert system within the DebugMenu, including support for displaying the SwitchCraft alert.

DebugTextFieldAlertAction allows us to surface an alert with a textField, useful for things like testing voucher redemptions for example.

DebugMenuView will now display an alert whenever its dataSource configures the DebugAlert object. Useful to surface whether a network call succeeded or not.

DebugHostControllerAction allows us to execute a closure that operates on a UIHostingController. This is useful for presenting any UIViewController or custom UIAlertController without needing to create a SwiftUI wrapper each time.
This action is what allows us to use Switchcrafts display(from parentVC: UIViewController) from a SwiftUI view.

Other Changes

I also completed a few points from #13 in this PR. Password entry now takes a binding that toggles the visibility of the debug menu entry point instead of directly navigating to it. DebugMenuAccessConfig introduced to provide passwordSHA and longPressGesture duration. (Will expand to include gesture type etc. in the future ). Moved visibility toggle / password config to global DebugMenuStore instance in example project.

Other:

  • Refactor PasswordEntryAlertWrapper to be used as TextFieldAlertWrapper
  • Clean up project / organized files in folders
  • DebugMenu package min version set to iOS 14

Note

I was unsure how we wanted to integrate Switchcraft and after some thought decided it may be best to not have it be tightly coupled to this library. The DebugHostControllerAction allows us to easily display the Switchcraft alert without forcing us to use the library.

This way we can have a package collection that includes this framework and Switchcraft without this framework listing Switchcraft as a dependency. Let me know if anyone has any thoughts on this / thinks we should just rewrite a SwiftUI solution.

Enter Code Alert DebugAlert Switchcraft Alert
Simulator Screen Shot - iPhone 12 - 2022-03-10 at 15 43 39 Simulator Screen Shot - iPhone 12 - 2022-03-10 at 15 43 46 Simulator Screen Shot - iPhone 12 - 2022-03-10 at 15 43 34

- Refactor PasswordEntryAlertWrapper to be used as TextFieldAlertWrapper
- General refactors
- Clean up project
- Support for Alert actions
- DebugMenuView can now surface an alert as a response
- Min version set to iOS 14
- DebugMenuAccessConfig
- Switchcraft integration to example project
@AZielinsky95 AZielinsky95 changed the title [6][13] Refactoring / Switchcraft integration / Support for Alerts [16][6][13] Refactoring / Switchcraft integration / Support for Alerts Mar 11, 2022
@AZielinsky95 AZielinsky95 merged commit 553b829 into main Mar 15, 2022
@nbrooke nbrooke removed their assignment Mar 15, 2022
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.

3 participants