Skip to content

Commit

Permalink
Add Gravatar library dependency and use it to replace GravatarUtils t…
Browse files Browse the repository at this point in the history
…hat will be removed from WordPress-Utils
  • Loading branch information
maxme committed Apr 3, 2024
1 parent 0e9b52c commit fbddbe0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
16 changes: 13 additions & 3 deletions WordPressLoginFlow/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ repositories {
includeGroup "org.wordpress"
includeGroup "org.wordpress.fluxc"
includeGroup "org.wordpress.wellsql"
includeGroup "com.gravatar"
}
}
mavenCentral()
Expand All @@ -32,11 +33,19 @@ android {

namespace "org.wordpress.android.login"

compileSdkVersion rootProject.compileSdkVersion
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8

}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
compileSdk 34

defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
minSdkVersion 24
targetSdkVersion 33

vectorDrawables.useSupportLibrary = true
}
Expand All @@ -49,6 +58,7 @@ dependencies {
implementation ("org.wordpress:utils:$wordpressUtilsVersion") {
exclude group: "com.android.volley"
}
implementation ("com.gravatar:gravatar:$gravatarSdkVersion")

implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation "androidx.vectordrawable:vectordrawable-animated:$androidxVectorDrawableAnimatedVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import com.bumptech.glide.load.engine.GlideException
import com.bumptech.glide.request.RequestListener
import com.bumptech.glide.request.RequestOptions
import com.bumptech.glide.request.target.Target
import com.gravatar.AvatarQueryOptions
import com.gravatar.AvatarUrl
import com.gravatar.DefaultAvatarOption.Status404
import com.gravatar.types.Email
import org.wordpress.android.login.R
import org.wordpress.android.util.GravatarUtils
import org.wordpress.android.util.GravatarUtils.DefaultImage.STATUS_404

object AvatarHelper {
@JvmStatic fun loadAvatarFromEmail(
Expand All @@ -21,7 +23,8 @@ object AvatarHelper {
listener: AvatarRequestListener
) {
val avatarSize = fragment.resources.getDimensionPixelSize(R.dimen.avatar_sz_login)
val avatarUrl = GravatarUtils.gravatarFromEmail(email, avatarSize, STATUS_404)
val avatarUrl = email?.let { AvatarUrl(Email(email),
AvatarQueryOptions(preferredSize = avatarSize, defaultAvatarOption = Status404)).url().toString() }
loadAvatarFromUrl(fragment, avatarUrl, avatarView, listener)
}

Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ext {
wordpressLintVersion = '2.0.0'
wordpressUtilsVersion = '3.5.0'
wordpressFluxCVersion = 'trunk-ed60798b4d96ec19863c74b0f525e2e20f4525db'
gravatarSdkVersion = '0.2.0'

// main
androidxAppCompatVersion = '1.6.1'
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pluginManagement {
gradle.ext.kotlinVersion = '1.8.0'
gradle.ext.kotlinVersion = '1.9.10'
gradle.ext.agpVersion = '8.1.0'
gradle.ext.automatticPublishToS3Version = '0.8.0'

Expand All @@ -11,7 +11,7 @@ pluginManagement {
}
repositories {
maven {
url 'https://a8c-libs.s3.amazonaws.com/android'
url 'https://a8c-libs.s3.amazonaws.com/android'
content {
includeGroup "com.automattic.android"
includeGroup "com.automattic.android.publish-to-s3"
Expand Down

0 comments on commit fbddbe0

Please sign in to comment.