Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue 2650 #2652

Merged
merged 22 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
462fe44
Setup the contributors screen module, connect it to main directory an…
nicolegeorgieva Sep 19, 2023
6ebec7a
WIP: ContributorsScreen
nicolegeorgieva Sep 19, 2023
7216422
WIP: ContributorsScreen
nicolegeorgieva Sep 19, 2023
edaff5f
Create ContributorsDataSource class. Refactor ContributorsViewModel
nicolegeorgieva Sep 19, 2023
77225d1
Refactor ContributorsViewModel
nicolegeorgieva Sep 19, 2023
db11f64
Support images and improve UI
nicolegeorgieva Sep 19, 2023
2bf4066
Merge branch 'main' into fix-issue-2650
nicolegeorgieva Sep 19, 2023
a096355
WIP: ContributorsViewModel and ContributorsScreen
nicolegeorgieva Sep 20, 2023
3bfe4ee
Refactor ContributorsScreen
nicolegeorgieva Sep 20, 2023
332c696
Refactor ContributorsViewModel
nicolegeorgieva Sep 20, 2023
492ffb9
Refactor ContributorsViewModel
nicolegeorgieva Sep 20, 2023
77712a3
Refactor ContributorsViewModel
nicolegeorgieva Sep 20, 2023
c3e8d9e
Refactor Attributions Screen
nicolegeorgieva Sep 20, 2023
d7d1ad9
Refactor Contributors Screen
nicolegeorgieva Sep 20, 2023
ad95171
Merge branch 'main' into fix-issue-2650
nicolegeorgieva Sep 20, 2023
0ee2194
Improve UI
nicolegeorgieva Sep 20, 2023
1ecddfc
Improve UI
nicolegeorgieva Sep 20, 2023
db45be5
Improve UI - add GitHub button
nicolegeorgieva Sep 20, 2023
db8b49d
Update error message
nicolegeorgieva Sep 20, 2023
dbc50e4
Fix Detekt error
nicolegeorgieva Sep 20, 2023
c889696
Apply PR feedback
nicolegeorgieva Sep 20, 2023
ae865a2
Fine tune error state
nicolegeorgieva Sep 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
}
}
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 photo: String,
nicolegeorgieva marked this conversation as resolved.
Show resolved Hide resolved
val contributions: String,
nicolegeorgieva marked this conversation as resolved.
Show resolved Hide resolved
val link: String
nicolegeorgieva marked this conversation as resolved.
Show resolved Hide resolved
)
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