-
Notifications
You must be signed in to change notification settings - Fork 559
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A new "Contributors" screen in Settings to recognize and show gratitude to Ivy Wallet's contributors.
- Loading branch information
1 parent
78eb731
commit de56dee
Showing
15 changed files
with
445 additions
and
12 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
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,18 @@ | ||
plugins { | ||
id("ivy.feature") | ||
} | ||
|
||
android { | ||
namespace = "com.ivy.contributors" | ||
} | ||
|
||
dependencies { | ||
implementation(projects.ivyCore) | ||
implementation(projects.ivyResources) | ||
implementation(projects.ivyDesign) | ||
implementation(projects.ivyNavigation) | ||
implementation(projects.ivyCoreUi) | ||
|
||
implementation(libs.bundles.ktor) | ||
implementation(projects.tempLegacyCode) | ||
} |
8 changes: 8 additions & 0 deletions
8
screen-contributors/src/main/java/com/ivy/contributors/Contributor.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,8 @@ | ||
package com.ivy.contributors | ||
|
||
data class Contributor( | ||
val name: String, | ||
val photoUrl: String, | ||
val contributionsCount: String, | ||
val githubProfileUrl: String | ||
) |
38 changes: 38 additions & 0 deletions
38
screen-contributors/src/main/java/com/ivy/contributors/ContributorsDataSource.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,38 @@ | ||
package com.ivy.contributors | ||
|
||
import androidx.annotation.Keep | ||
import io.ktor.client.HttpClient | ||
import io.ktor.client.call.body | ||
import io.ktor.client.request.get | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.withContext | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import javax.inject.Inject | ||
|
||
class ContributorsDataSource @Inject constructor( | ||
private val httpClient: HttpClient | ||
) { | ||
@Keep | ||
@Serializable | ||
data class ContributorDto( | ||
val login: String, | ||
@SerialName("avatar_url") | ||
val avatarUrl: String, | ||
val contributions: Int, | ||
@SerialName("html_url") | ||
val link: String | ||
) | ||
|
||
suspend fun fetchContributors(): List<ContributorDto>? { | ||
return try { | ||
withContext(Dispatchers.IO) { | ||
httpClient | ||
.get("https://api.github.com/repos/Ivy-Apps/ivy-wallet/contributors") | ||
.body<List<ContributorDto>>() | ||
} | ||
} catch (e: Exception) { | ||
null | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
screen-contributors/src/main/java/com/ivy/contributors/ContributorsEvent.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,5 @@ | ||
package com.ivy.contributors | ||
|
||
sealed interface ContributorsEvent { | ||
data object TryAgainButtonClicked : ContributorsEvent | ||
} |
Oops, something went wrong.