-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20590 from wordpress-mobile/maxime/remove-gravata…
…r-utils-from-wputils-squashed Replace GravatarUtils from WPUtils, use Gravatar-SDK-Android instead
- Loading branch information
Showing
44 changed files
with
298 additions
and
400 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
67 changes: 0 additions & 67 deletions
67
WordPress/src/androidTest/java/org/wordpress/android/networking/GravatarApiTest.java
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
WordPress/src/androidTest/java/org/wordpress/android/util/WPAvatarUtilsTest.kt
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,43 @@ | ||
package org.wordpress.android.util | ||
|
||
import com.gravatar.DefaultAvatarOption | ||
import dagger.hilt.android.testing.HiltAndroidTest | ||
import junit.framework.TestCase.assertEquals | ||
import org.junit.Test | ||
|
||
@HiltAndroidTest | ||
class WPAvatarUtilsTest { | ||
@Test | ||
fun rewriteAvatarUrlReplaceNonGravatarUrlToPhotonUrl() { | ||
assertEquals( | ||
"https://i0.wp.com/example.com/image.jpg?strip=info&quality=65&resize=100,100&ssl=1", | ||
WPAvatarUtils.rewriteAvatarUrl("https://example.com/image.jpg", 100) | ||
) | ||
} | ||
|
||
@Test | ||
fun rewriteAvatarUrlDropQueryParamsFromGravatarUrlAndAddDefaults() { | ||
assertEquals( | ||
"https://www.gravatar.com/avatar/" + | ||
"31c5543c1734d25c7206f5fd591525d0295bec6fe84ff82f946a34fe970a1e66?d=mp&s=100", | ||
WPAvatarUtils.rewriteAvatarUrl( | ||
"https://www.gravatar.com/avatar/" + | ||
"31c5543c1734d25c7206f5fd591525d0295bec6fe84ff82f946a34fe970a1e66?d=wavatar&s=1000", | ||
100 | ||
) | ||
) | ||
} | ||
|
||
@Test | ||
fun rewriteAvatarUrlAddDefaultsToGravatarUrl() { | ||
assertEquals( | ||
"https://www.gravatar.com/avatar/" + | ||
"31c5543c1734d25c7206f5fd591525d0295bec6fe84ff82f946a34fe970a1e66?d=404&s=200", | ||
WPAvatarUtils.rewriteAvatarUrl( | ||
"https://www.gravatar.com/avatar/" + | ||
"31c5543c1734d25c7206f5fd591525d0295bec6fe84ff82f946a34fe970a1e66", | ||
200, DefaultAvatarOption.Status404 | ||
) | ||
) | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
WordPress/src/main/java/org/wordpress/android/modules/GravatarModule.kt
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,17 @@ | ||
package org.wordpress.android.modules | ||
|
||
import com.gravatar.services.AvatarService | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@InstallIn(SingletonComponent::class) | ||
@Module | ||
class GravatarModule { | ||
@Singleton | ||
@Provides | ||
fun provideGravatarApi( | ||
): AvatarService = AvatarService() | ||
} |
139 changes: 0 additions & 139 deletions
139
WordPress/src/main/java/org/wordpress/android/networking/GravatarApi.java
This file was deleted.
Oops, something went wrong.
41 changes: 0 additions & 41 deletions
41
WordPress/src/main/java/org/wordpress/android/networking/StreamingRequest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.