-
Notifications
You must be signed in to change notification settings - Fork 31
Updating docs with API changes #769
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,14 +2,33 @@ | |
|
|
||
| This customizable sheet allows users to update their avatars. Available for both UIKit and SwiftUI. | ||
|
|
||
| ### Quick Editor Preview | ||
| ## Quick Editor Preview | ||
|
|
||
| The Quick Editor offers different scopes that allow users to edit various sections of their Gravatar profile. | ||
|
|
||
| See ``QuickEditorScopeOption`` for more info. | ||
|
|
||
| #### Avatar Picker scope | ||
|
|
||
| Layout 1 | Layout 2 | Layout 3 | | ||
| ----- | ------ | ----- | | ||
|  |  |  | | ||
| Full height sheet | Expandable sheet | Intrinsic height sheet, horizontal scroll | | ||
|
|
||
| ### Quick Editor - SwiftUI | ||
| #### About editor scope | ||
|
|
||
| Layout 1 | Layout 2 | Layout 3 | | ||
| ----- | ------ | ----- | | ||
|  |  |  | | ||
| Full height sheet | Expandable sheet | Intrinsic height sheet | | ||
|
|
||
| #### Avatar picker & About editor scope | ||
|
|
||
| This scope combines the Avatar picker and the About editor, allowing to switch between them directly in the Quick Editor UI. | ||
|
|
||
|  | ||
|
|
||
| ## Quick Editor - SwiftUI | ||
|
|
||
| SDK offers a modifier function to display the QuickEditor sheet. QuickEditor starts the OAuth flow internally to capture an access token. Please refer to <doc:GravatarOAuth> about how to configure the SDK about this. | ||
|
|
||
|
|
@@ -30,16 +49,23 @@ var body: some View { | |
| .gravatarQuickEditorSheet( | ||
| isPresented: $isPresenting, | ||
| email: "[email protected]", | ||
| scope: .avatarPicker(.init(contentLayout: .horizontal)), | ||
| avatarUpdatedHandler: { | ||
| // informs that the avatar has changed | ||
| scopeOption: .avatarPicker(.horizontalInstrinsicHeight), | ||
| updateHandler: { updateType in | ||
| switch updateType { | ||
| case is QuickEditorUpdate.Avatar: | ||
| // Selected avatar has changed | ||
| case let update as QuickEditorUpdate.AboutInfo: | ||
| // About profile info has been updated | ||
| // `update.profile` contains the updated profile | ||
| default: break | ||
| } | ||
| }, | ||
| onDismiss: { | ||
| // sheet was dismissed | ||
| } | ||
| ) | ||
| .preferredColorScheme(.light) // Sets a preferred color scheme; omit to use the system default. | ||
| } | ||
| .preferredColorScheme(.light) //set the preferred color scheme if you like, or omit this line to let the system settings apply. | ||
| } | ||
|
|
||
| // [...] | ||
|
|
@@ -66,23 +92,30 @@ var body: some View { | |
| .gravatarQuickEditorSheet( | ||
| isPresented: $isPresenting, | ||
| email: "[email protected]", | ||
| authToken: authToken, // Pass the auth token | ||
| scope: .avatarPicker(.init(contentLayout: .horizontal)), | ||
| avatarUpdatedHandler: { | ||
| // informs that the avatar has changed | ||
| authToken: authToken, // Passes the authentication token | ||
| scopeOption: .avatarPicker(.horizontalInstrinsicHeight), | ||
| updateHandler: { updateType in | ||
| switch updateType { | ||
| case is QuickEditorUpdate.Avatar: | ||
| // Selected avatar has changed | ||
| case let update as QuickEditorUpdate.AboutInfo: | ||
| // About profile info has been updated | ||
| // `update.profile` contains the updated profile | ||
| default: break | ||
| } | ||
| }, | ||
| onDismiss: { | ||
| // sheet was dismissed | ||
| } | ||
| ) | ||
| .preferredColorScheme(.light) // Sets a preferred color scheme; omit to use the system default. | ||
| } | ||
| .preferredColorScheme(.light) //set the preferred color scheme if you like, or omit this line to let the system settings apply. | ||
| } | ||
| ``` | ||
|
|
||
| Refer to ``AvatarPickerContentLayout`` to see all the content layout options. | ||
|
|
||
| ### Quick Editor - UIKit | ||
| ## Quick Editor - UIKit | ||
|
|
||
| Similarly, ``QuickEditorPresenter`` can be used to display the QuickEditor in UIKit. | ||
|
|
||
|
|
@@ -91,19 +124,30 @@ import GravatarUI | |
|
|
||
| // [...] | ||
|
|
||
| // Example with About editor scope | ||
| let presenter = QuickEditorPresenter( | ||
| email: Email("[email protected]"), | ||
| scope: .avatarPicker(AvatarPickerConfiguration(contentLayout: .horizontal)), | ||
| scopeOption: .aboutEditor(), | ||
| configuration: .init( | ||
| interfaceStyle: colorScheme | ||
| ) | ||
| ) | ||
| presenter.present(in: self, | ||
| onAvatarUpdated: { [weak self] in | ||
| // Informs that the avatar has changed | ||
| } , onDismiss: { [weak self] in | ||
| // sheet was dismissed | ||
| }) | ||
| presenter.present( | ||
| in: self, | ||
| onUpdate: { [weak self] updateType in | ||
| switch updateType { | ||
| case is QuickEditorUpdate.Avatar: | ||
| // Selected avatar has changed | ||
| case let update as QuickEditorUpdate.AboutInfo: | ||
| // About profile info has been updated | ||
| default: | ||
| break | ||
| } | ||
| }, | ||
| onDismiss: { [weak self] in | ||
| // sheet was dismissed | ||
| } | ||
| ) | ||
| ``` | ||
|
|
||
| ### Delete the OAuth token | ||
|
|
||
Binary file added
BIN
+209 KB
...s/GravatarUI/GravatarUI.docc/Resources/QEExamples/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+184 KB
Sources/GravatarUI/GravatarUI.docc/Resources/QEExamples/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+155 KB
Sources/GravatarUI/GravatarUI.docc/Resources/QEExamples/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+185 KB
Sources/GravatarUI/GravatarUI.docc/Resources/QEExamples/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.03 MB
Sources/GravatarUI/GravatarUI.docc/Resources/QEExamples/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.62 MB
...es/GravatarUI/GravatarUI.docc/Resources/QEExamples/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.