-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Avatar is not visible when the profile is disabled but the Avata…
…r is set to public (#568) * Add Avatar component that takes Email and load the avatar directly from it * Use the new Avatar component in the ProfileCard * Generate new screenshots
- Loading branch information
1 parent
873de57
commit b0733e3
Showing
17 changed files
with
95 additions
and
12 deletions.
There are no files selected for viewing
Binary file modified
BIN
+0 Bytes
(100%)
...ravatar.quickeditor.ui.avatarpicker.AvatarPickerTest.avatarPickerListLoaded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
...tar.quickeditor.ui.avatarpicker.AvatarPickerTest.avatarPickerListLoadedDark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
.../com.gravatar.quickeditor.ui.components.ProfileCardTest.profileCardDarkMode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
...com.gravatar.quickeditor.ui.components.ProfileCardTest.profileCardLightMode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
...orazzi/com.gravatar.quickeditor.ui.oauth.OAuthPageTest.oAuthPageAuthorizing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
...sts/roborazzi/com.gravatar.quickeditor.ui.oauth.OAuthPageTest.oAuthPageDark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
...ts/roborazzi/com.gravatar.quickeditor.ui.oauth.OAuthPageTest.oAuthPageLight.png
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 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 |
---|---|---|
|
@@ -21,20 +21,21 @@ import androidx.compose.ui.platform.LocalDensity | |
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.gravatar.AvatarQueryOptions | ||
import com.gravatar.DefaultAvatarOption | ||
import com.gravatar.ImageRating | ||
import com.gravatar.extensions.avatarUrl | ||
import com.gravatar.extensions.defaultProfile | ||
import com.gravatar.restapi.models.Profile | ||
import com.gravatar.types.Email | ||
import com.gravatar.ui.GravatarTheme | ||
import com.gravatar.ui.components.ComponentState | ||
import com.gravatar.ui.components.ProfileSummary | ||
import com.gravatar.ui.components.atomic.Avatar | ||
import com.gravatar.ui.components.atomic.ViewProfileButton | ||
import com.gravatar.ui.components.transform | ||
|
||
@Composable | ||
internal fun ProfileCard( | ||
profile: ComponentState<Profile>?, | ||
email: Email, | ||
modifier: Modifier = Modifier, | ||
avatarCacheBuster: String? = null, | ||
) { | ||
|
@@ -49,16 +50,15 @@ internal fun ProfileCard( | |
avatar = { | ||
val sizePx = with(LocalDensity.current) { 72.dp.roundToPx() } | ||
Avatar( | ||
state = profile.transform { | ||
avatarUrl( | ||
AvatarQueryOptions { | ||
preferredSize = sizePx | ||
rating = ImageRating.X | ||
}, | ||
).url(avatarCacheBuster).toString() | ||
email = email, | ||
avatarQueryOptions = AvatarQueryOptions { | ||
preferredSize = sizePx | ||
rating = ImageRating.X | ||
defaultAvatarOption = DefaultAvatarOption.Status404 | ||
}, | ||
size = 72.dp, | ||
modifier = Modifier.clip(CircleShape), | ||
cacheBuster = avatarCacheBuster, | ||
) | ||
}, | ||
viewProfile = { state -> | ||
|
@@ -106,6 +106,7 @@ private fun ProfileCardPreview() { | |
profile = ComponentState.Loaded( | ||
defaultProfile(hash = "dfadf", "John Travolta"), | ||
), | ||
email = Email("[email protected]"), | ||
modifier = Modifier.padding(20.dp), | ||
) | ||
} | ||
|
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
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