-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding docc bundle to GravatarUI * Updating example profile * Lint * Update example profile view
- Loading branch information
Showing
28 changed files
with
168 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,6 +1,13 @@ | ||
# This is manifest file for the Swift Package Index for it to auto-generate and | ||
# host DocC documentation. | ||
# | ||
# For reference see https://swiftpackageindex.com/swiftpackageindex/spimanifest/documentation/spimanifest/commonusecases#Host-DocC-documentation-in-the-Swift-Package-Index | ||
|
||
version: 1 | ||
builder: | ||
configs: | ||
- documentation_targets: [Gravatar, GravatarUI] | ||
- documentation_targets: | ||
- GravatarUI | ||
- Gravatar | ||
platform: ios | ||
custom_documentation_parameters: [--include-extended-types] |
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# ``GravatarUI`` | ||
|
||
Gravatar iOS SDK | ||
|
||
@Metadata { | ||
@PageImage( | ||
purpose: icon, | ||
source: "gravatar-sdk" | ||
) | ||
} | ||
|
||
## Overview | ||
|
||
An “avatar” is an image that represents you online—a little picture that appears next to your name when you interact with websites. | ||
|
||
A Gravatar is a Globally Recognized Avatar. You upload an image and create your public profile just once, and then when you participate in any Gravatar-enabled site, your Gravatar image and public profile will automatically follow you there. | ||
|
||
This SDK offers an easy way to present Gravatar user's visually in your app. | ||
|
||
### How to: | ||
|
||
We offer a variety of profile view layouts for different usecases. As an example, you can use a ```ProfileView``` to be added to your UI in this way: | ||
|
||
```swift | ||
// 1. Get an instance of a ProfileService | ||
let service = ProfileService() | ||
// 2. Get the user's profile: | ||
let profile = try await service.fetch(with: .email("user@email.com")) | ||
// 3. Get the instance of a ProfileView: | ||
let profileView = ProfileView() | ||
// 4. Set the profile to the view: | ||
profileView.update(with: profile) | ||
``` | ||
`ProfileView` will look like this: | ||
![Profile view example](profileView.view) | ||
|
||
## Topics | ||
|
||
### Profile views | ||
|
||
- ``ProfileView`` | ||
- ``ProfileSummaryView`` | ||
- ``LargeProfileView`` | ||
- ``LargeProfileSummaryView`` |
Binary file added
BIN
+158 KB
...I/GravatarUI.docc/Resources/ProfileExamples/largeProfileSummaryView.view@2x.png
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
+159 KB
...vatarUI.docc/Resources/ProfileExamples/largeProfileSummaryView.view~dark@2x.png
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
+176 KB
...avatarUI/GravatarUI.docc/Resources/ProfileExamples/largeProfileView.view@2x.png
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
+177 KB
...rUI/GravatarUI.docc/Resources/ProfileExamples/largeProfileView.view~dark@2x.png
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
+58.3 KB
...atarUI/GravatarUI.docc/Resources/ProfileExamples/profileSummaryView.view@2x.png
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
+58.9 KB
...I/GravatarUI.docc/Resources/ProfileExamples/profileSummaryView.view~dark@2x.png
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
+79.4 KB
...es/GravatarUI/GravatarUI.docc/Resources/ProfileExamples/profileView.view@2x.png
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
+80.3 KB
...avatarUI/GravatarUI.docc/Resources/ProfileExamples/profileView.view~dark@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import Gravatar | ||
import GravatarUI | ||
import SnapshotTesting | ||
import XCTest | ||
|
||
final class ProfileViewSnapshots: XCTestCase { | ||
enum Constants { | ||
static let width: CGFloat = 320 | ||
} | ||
|
||
override func setUp() async throws { | ||
try await super.setUp() | ||
// isRecording = true | ||
} | ||
|
||
func testProfileView() throws { | ||
for interfaceStyle in UIUserInterfaceStyle.allCases { | ||
let profileView = ProfileView() | ||
profileView.update(with: TestProfileCardModel.exampleModel) | ||
let containerView = wrap(profileView) | ||
containerView.overrideUserInterfaceStyle = interfaceStyle | ||
let postfix = interfaceStyle == .dark ? "view-dark" : "view" | ||
assertSnapshot(of: containerView, as: .image, named: postfix, testName: "profileView") | ||
} | ||
} | ||
|
||
func testProfileSummaryView() throws { | ||
for interfaceStyle in UIUserInterfaceStyle.allCases { | ||
let profileView = ProfileSummaryView() | ||
profileView.update(with: TestProfileCardModel.exampleModel) | ||
let containerView = wrap(profileView) | ||
containerView.overrideUserInterfaceStyle = interfaceStyle | ||
let postfix = interfaceStyle == .dark ? "view-dark" : "view" | ||
assertSnapshot(of: containerView, as: .image, named: postfix, testName: "profileSummaryView") | ||
} | ||
} | ||
|
||
func testLargeProfileView() throws { | ||
for interfaceStyle in UIUserInterfaceStyle.allCases { | ||
let profileView = LargeProfileView() | ||
profileView.update(with: TestProfileCardModel.exampleModel) | ||
let containerView = wrap(profileView) | ||
containerView.overrideUserInterfaceStyle = interfaceStyle | ||
let postfix = interfaceStyle == .dark ? "view-dark" : "view" | ||
assertSnapshot(of: containerView, as: .image, named: postfix, testName: "largeProfileView") | ||
} | ||
} | ||
|
||
func testLargeProfileSummaryView() throws { | ||
for interfaceStyle in UIUserInterfaceStyle.allCases { | ||
let profileView = LargeProfileSummaryView() | ||
profileView.update(with: TestProfileCardModel.exampleModel) | ||
let containerView = wrap(profileView) | ||
containerView.overrideUserInterfaceStyle = interfaceStyle | ||
let postfix = interfaceStyle == .dark ? "view-dark" : "view" | ||
assertSnapshot(of: containerView, as: .image, named: postfix, testName: "largeProfileSummaryView") | ||
} | ||
} | ||
|
||
private func wrap(_ view: BaseProfileView) -> UIView { | ||
view.avatarImageView.backgroundColor = .systemBlue | ||
view.avatarImageView.image = ImageHelper.exampleAvatarImage | ||
view.translatesAutoresizingMaskIntoConstraints = false | ||
view.widthAnchor.constraint(equalToConstant: Constants.width).isActive = true | ||
|
||
return view.wrapInSuperView(with: Constants.width) | ||
} | ||
} | ||
|
||
extension TestProfileCardModel { | ||
fileprivate static let exampleModel = TestProfileCardModel( | ||
accountsList: [ | ||
TestAccountModel(display: "Gravatar", shortname: "gravatar"), | ||
TestAccountModel(display: "WordPress", shortname: "wordpress"), | ||
TestAccountModel(display: "Tumblr", shortname: "tumblr"), | ||
TestAccountModel(display: "GitHub", shortname: "github"), | ||
], | ||
aboutMe: "Engineer at heart, problem-solver by nature. Passionate about innovation and pushing boundaries. Let's build something incredible together.", | ||
displayName: "John Appleseed", | ||
fullName: "John Appleseed", | ||
userName: "username", | ||
jobTitle: "Engineer", | ||
pronouns: "he/him", | ||
currentLocation: "Atlanta GA", | ||
avatarIdentifier: .email("email@domain.com"), | ||
profileURL: URL(string: "https://gravatar.com/profile") | ||
) | ||
} |
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
+159 KB
...ITests/__Snapshots__/ProvileViewSnapshots/largeProfileSummaryView.view-dark.png
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
+158 KB
...atarUITests/__Snapshots__/ProvileViewSnapshots/largeProfileSummaryView.view.png
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
+177 KB
...avatarUITests/__Snapshots__/ProvileViewSnapshots/largeProfileView.view-dark.png
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
+176 KB
Tests/GravatarUITests/__Snapshots__/ProvileViewSnapshots/largeProfileView.view.png
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
+58.9 KB
...atarUITests/__Snapshots__/ProvileViewSnapshots/profileSummaryView.view-dark.png
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
+58.3 KB
.../GravatarUITests/__Snapshots__/ProvileViewSnapshots/profileSummaryView.view.png
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
+80.3 KB
Tests/GravatarUITests/__Snapshots__/ProvileViewSnapshots/profileView.view-dark.png
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
+79.4 KB
Tests/GravatarUITests/__Snapshots__/ProvileViewSnapshots/profileView.view.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.