Skip to content

Commit

Permalink
Contributors screen (#2652)
Browse files Browse the repository at this point in the history
A new "Contributors" screen in Settings to recognize and show gratitude to Ivy Wallet's contributors.
  • Loading branch information
nicolegeorgieva committed Sep 20, 2023
1 parent 78eb731 commit de56dee
Show file tree
Hide file tree
Showing 15 changed files with 445 additions and 12 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ dependencies {
implementation(projects.screenBalance)
implementation(projects.screenFeatures)
implementation(projects.screenAttributions)
implementation(projects.screenContributors)

implementation(libs.bundles.kotlin)
implementation(libs.bundles.ktor)
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/ivy/IvyNavGraph.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.ivy.attributions.AttributionsScreenImpl
import com.ivy.balance.BalanceScreen
import com.ivy.budgets.BudgetScreen
import com.ivy.categories.CategoriesScreen
import com.ivy.contributors.ContributorsScreenImpl
import com.ivy.exchangerates.ExchangeRatesScreen
import com.ivy.features.FeaturesScreenImpl
import com.ivy.importdata.csv.CSVScreen
Expand All @@ -19,6 +20,7 @@ import com.ivy.navigation.BalanceScreen
import com.ivy.navigation.BudgetScreen
import com.ivy.navigation.CSVScreen
import com.ivy.navigation.CategoriesScreen
import com.ivy.navigation.ContributorsScreen
import com.ivy.navigation.EditPlannedScreen
import com.ivy.navigation.EditTransactionScreen
import com.ivy.navigation.ExchangeRatesScreen
Expand Down Expand Up @@ -77,5 +79,6 @@ fun BoxWithConstraintsScope.IvyNavGraph(screen: Screen?) {
is CSVScreen -> CSVScreen(screen = screen)
FeaturesScreen -> FeaturesScreenImpl()
AttributionsScreen -> AttributionsScreenImpl()
ContributorsScreen -> ContributorsScreenImpl()
}
}
4 changes: 3 additions & 1 deletion ivy-navigation/src/main/java/com/ivy/navigation/Screens.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,6 @@ data object ExchangeRatesScreen : Screen

data object FeaturesScreen : Screen

data object AttributionsScreen : Screen
data object AttributionsScreen : Screen

data object ContributorsScreen : Screen
10 changes: 5 additions & 5 deletions ivy-resources/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,10 @@
<string name="left_to_spend">Оставащи</string>
<string name="budget_exceeded_by">Надвишен с</string>
<string name="buffer_exceeded_by">Надвишен с</string>
<string name="set_transaction_type">Тип транзацкия</string>
<string name="set_transaction_type">Тип транзакция</string>
<string name="transfer">Трансфер</string>
<string name="selected">Избран</string>
<string name="search_currency">Търсене (USD, EUR, GBP, BTC, и тн.)</string>
<string name="search_currency">Търсене (USD, EUR, GBP, BTC, и т.н.)</string>
<string name="pre_selected">Пре-избран</string>
<string name="crypto">Crypto</string>
<string name="exchange_rate">Курс</string>
Expand All @@ -289,7 +289,7 @@
<string name="create_budget">Създай бюджет</string>
<string name="budget_name">Име на бюджет</string>
<string name="budget_amount_uppercase">РАЗМЕР БЮДЖЕТ</string>
<string name="confirm_budget_deletion_warning">Наистина ли искате да изтриете този бюдбет: "%1$s"?</string>
<string name="confirm_budget_deletion_warning">Наистина ли искате да изтриете този бюджет: "%1$s"?</string>
<string name="edit_savings_goal">Редактирай цел</string>
<string name="choose_icon">Избери иконка</string>
<string name="choose_month">Избери месец</string>
Expand All @@ -309,7 +309,7 @@
<string name="new_loan">Нов заем</string>
<string name="loan_name">Име на заем</string>
<string name="associated_account">Свързана сметка</string>
<string name="create_main_transaction">Създай транзацкия</string>
<string name="create_main_transaction">Създай транзакция</string>
<string name="enter_loan_amount_uppercase">РАЗМЕР НА ЗАЕМА</string>
<string name="confirm_account_change_warning">"Важно: You are trying to change the account associated with the loan with an account of different currency, \nAll the loan records will be re-calculated based on today's exchanges rates "</string>
<string name="loan_type">Тип заем</string>
Expand All @@ -321,7 +321,7 @@
<string name="mark_as_interest">Маркирай като лихва</string>
<string name="recalculate_amount_with_today_exchange_rates">Преизчисляване на стойност спрямо актуален курс</string>
<string name="enter_record_amount_uppercase">СТОЙНОСТ НА ЗАПИСА</string>
<string name="record_deletion_warning">Сигурни ли сте че искате да изтриете този запис: "%1$s"?</string>
<string name="record_deletion_warning">Сигурни ли сте, че искате да изтриете този запис: "%1$s"?</string>
<string name="account_change_warning">"Важно: You are trying to change the account associated with the loan record with an account of different currency\nThe amount will be re-calculated based on today's exchanges rates "</string>
<string name="edit_name">Смени име</string>
<string name="plan_for">Планирано за</string>
Expand Down
2 changes: 1 addition & 1 deletion ivy-resources/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
<string name="roadmap">Roadmap</string>
<string name="request_a_feature">Request a feature</string>
<string name="contact_support">Contact support</string>
<string name="project_contributors">Project Contributors</string>
<string name="project_contributors">Contributors</string>
<string name="account_uppercase">ACCOUNT</string>
<string name="logout">Logout</string>
<string name="login">Login</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
Expand Down Expand Up @@ -100,6 +101,7 @@ private fun AttributionsContent(
) {
LazyColumn(
modifier = Modifier
.fillMaxSize()
.padding(paddingValues)
.padding(horizontal = 16.dp, vertical = 4.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)
Expand Down
18 changes: 18 additions & 0 deletions screen-contributors/build.gradle.kts
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)
}
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
)
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
}
}
}
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
}
Loading

0 comments on commit de56dee

Please sign in to comment.