Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #874 from ILIYANGERMANOV/develop
Browse files Browse the repository at this point in the history
Developer Guidelines + Translations (not tested)
  • Loading branch information
ILIYANGERMANOV authored May 8, 2022
2 parents 00f5951 + 1689c3e commit 67cc24a
Show file tree
Hide file tree
Showing 22 changed files with 1,256 additions and 92 deletions.
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Pull Request (PR) Checklist
Please check if your pull request fulfills the following requirements:
- [ ] The PR is submitted to the `develop` branch.
- [ ] I understand the **[Ivy Developer Guidelines](../docs/Developer-Guidelines.md)**.
- [ ] I've read the **[Contribution Guidelines](https://github.com/ILIYANGERMANOV/ivy-wallet/blob/main/CONTRIBUTING.md)**.
- [ ] The code builds and is tested on an actual Android device.
- [ ] I confirm that I've run the code locally and everything works as expected.
Expand Down
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Contributing to Ivy Wallet

## [Ivy Developer Guidelines](docs/Developer-Guidelines.md)

A short and helpful guide on Android Architecture, Functional Reactive Programming (FRP) and Ivy best practices - [Ivy Developer Guidelines](docs/Developer-Guidelines.md).

> Tip: Read it -> make proposals -> make the project better! :rocket:
## 1. Fork the repo

**[How To Fork Guide by GitHub](https://docs.github.com/en/get-started/quickstart/fork-a-repo)**
Expand Down
15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,11 @@ tell us how we can create a better environment for developers & creators to work

### [Ivy Telegram News](https://t.me/ivywallet)

## What's next? :rocket:
## [Ivy Developer Guidelines](docs/Developer-Guidelines.md)

We need your help! Let us know what you think :)
A short and helpful guide on Android Architecture, Functional Reactive Programming (FRP) and Ivy best practices - [Ivy Developer Guidelines](docs/Developer-Guidelines.md).

Our plan is:

1. Make Ivy Wallet free! :heavy_check_mark:
1. Create [Ivy Telegram Community](https://t.me/+ETavgioAvWg4NThk). :heavy_check_mark:
1. Create a crypto donations mechanism (BTC, ETH, ADA, SOL...)
1. Use the donations to setup a dev fund where contributors can earn money by helping the project.
1. Create a proposal and voting system using Cardano (ADA) smart contracts.
1. So far, so good! Let us know what do you think should be next?

Correct us, if we're wrong! Share your opinion. Be the change. :star:
> Tip: Read it -> make proposals -> make the project better! :rocket:
## The Ivy Wallet App

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ class ExchangeAct @Inject constructor(
private val exchangeRateDao: ExchangeRateDao,
) : FPAction<ExchangeAct.Input, Option<BigDecimal>>() {
override suspend fun Input.compose(): suspend () -> Option<BigDecimal> = suspend {
io {
exchange(
data = data,
amount = amount,
getExchangeRate = exchangeRateDao::findByBaseCurrencyAndCurrency then {
it?.toDomain()
}
)
}
exchange(
data = data,
amount = amount,
getExchangeRate = exchangeRateDao::findByBaseCurrencyAndCurrency then {
it?.toDomain()
}
)
}

data class Input(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class PlannedPaymentsLogic(
suspend fun payOrGet(
transaction: Transaction,
syncTransaction: Boolean = true,
skipTransaction: Boolean = false,
onUpdateUI: (paidTransaction: Transaction) -> Unit
) {
if (transaction.dueDate == null || transaction.dateTime != null) return
Expand All @@ -166,7 +167,11 @@ class PlannedPaymentsLogic(
}

ioThread {
transactionDao.save(paidTransaction.toEntity())
if (skipTransaction)
transactionDao.flagDeleted(paidTransaction.id)
else
transactionDao.save(paidTransaction.toEntity())


if (plannedPaymentRule != null && plannedPaymentRule.oneTime) {
//delete paid oneTime planned payment rules
Expand All @@ -177,7 +182,7 @@ class PlannedPaymentsLogic(
onUpdateUI(paidTransaction)

ioThread {
if (syncTransaction) {
if (syncTransaction && !skipTransaction) {
transactionUploader.sync(paidTransaction)
}

Expand Down
11 changes: 8 additions & 3 deletions app/src/main/java/com/ivy/wallet/ui/home/HomeTab.kt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ fun BoxWithConstraintsScope.HomeTab(screen: Main) {
onDismissCustomerJourneyCard = viewModel::dismissCustomerJourneyCard,
onSelectNextMonth = viewModel::nextMonth,
onSelectPreviousMonth = viewModel::previousMonth,
onSkipTransaction = viewModel::skipTransaction
)
}

Expand Down Expand Up @@ -147,6 +148,7 @@ private fun BoxWithConstraintsScope.UI(
onDismissCustomerJourneyCard: (CustomerJourneyCardData) -> Unit = {},
onSelectNextMonth: () -> Unit = {},
onSelectPreviousMonth: () -> Unit = {},
onSkipTransaction: (Transaction) -> Unit = {},
) {
val ivyContext = ivyWalletCtx()

Expand Down Expand Up @@ -255,7 +257,8 @@ private fun BoxWithConstraintsScope.UI(
customerJourneyCards = customerJourneyCards,

onPayOrGet = onPayOrGet,
onDismiss = onDismissCustomerJourneyCard
onDismiss = onDismissCustomerJourneyCard,
onSkipTransaction = onSkipTransaction
)
}

Expand Down Expand Up @@ -352,7 +355,8 @@ fun HomeLazyColumn(

history: List<TransactionHistoryItem>,
onPayOrGet: (Transaction) -> Unit,
onDismiss: (CustomerJourneyCardData) -> Unit
onDismiss: (CustomerJourneyCardData) -> Unit,
onSkipTransaction: (Transaction) -> Unit = {},
) {
val ivyContext = ivyWalletCtx()
val nav = navigation()
Expand Down Expand Up @@ -448,7 +452,8 @@ fun HomeLazyColumn(
emptyStateText = stringRes(
R.string.no_transactions_description,
period.toDisplayLong(ivyContext.startDayOfMonth)
)
),
onSkipTransaction = onSkipTransaction
)
}
}
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/java/com/ivy/wallet/ui/home/HomeViewModel.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ivy.wallet.ui.home

import android.util.Log
import androidx.lifecycle.viewModelScope
import com.ivy.design.l0_system.Theme
import com.ivy.design.navigation.Navigation
Expand Down Expand Up @@ -302,18 +303,25 @@ class HomeViewModel @Inject constructor(
load(period = period)
}

fun payOrGet(transaction: Transaction) {
fun payOrGet(transaction: Transaction, skipTransaction: Boolean = false) {
viewModelScope.launch {
TestIdlingResource.increment()

plannedPaymentsLogic.payOrGet(transaction = transaction) {
plannedPaymentsLogic.payOrGet(
transaction = transaction,
skipTransaction = skipTransaction
) {
load()
}

TestIdlingResource.decrement()
}
}

fun skipTransaction(transaction: Transaction) {
payOrGet(transaction, true)
}

fun dismissCustomerJourneyCard(card: CustomerJourneyCardData) {
customerJourneyLogic.dismissCard(card)
load()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.ivy.wallet.ui.planned.list

import androidx.compose.foundation.layout.*
import androidx.compose.ui.res.stringResource
import androidx.compose.foundation.lazy.*
import androidx.compose.material.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -111,7 +113,7 @@ private fun LazyListScope.plannedPaymentItems(
SectionDivider(
expanded = oneTimeExpanded,
setExpanded = setOneTimeExpanded,
title = "One time payments",
title = stringResource(R.string.one_time_payments),
titleColor = UI.colors.pureInverse,
baseCurrency = currency,
income = oneTimeIncome,
Expand Down Expand Up @@ -143,7 +145,7 @@ private fun LazyListScope.plannedPaymentItems(
SectionDivider(
expanded = recurringExpanded,
setExpanded = setRecurringExpanded,
title = "Recurring payments",
title = stringResource(R.string.recurring_payments),
titleColor = UI.colors.pureInverse,
baseCurrency = currency,
income = recurringIncome,
Expand Down Expand Up @@ -212,7 +214,7 @@ private fun LazyItemScope.NoPlannedPaymentsEmptyState() {
Spacer(Modifier.height(24.dp))

Text(
text = "No planned payments",
text = stringResource(R.string.no_planned_payments),
style = UI.typo.b1.style(
color = Gray,
fontWeight = FontWeight.ExtraBold
Expand All @@ -222,7 +224,7 @@ private fun LazyItemScope.NoPlannedPaymentsEmptyState() {
Spacer(Modifier.height(8.dp))

Text(
text = "You don't have any planed payments.\nPress the '⚡' bottom at the bottom to add one.",
text = stringResource(R.string.no_planned_payments_description),
style = UI.typo.b2.style(
color = Gray,
fontWeight = FontWeight.Medium,
Expand Down
20 changes: 11 additions & 9 deletions app/src/main/java/com/ivy/wallet/ui/reports/ReportScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
Expand All @@ -22,11 +23,13 @@ import androidx.lifecycle.viewmodel.compose.viewModel
import com.google.accompanist.insets.systemBarsPadding
import com.ivy.design.api.navigation
import com.ivy.design.l0_system.UI
import androidx.compose.ui.res.stringResource
import com.ivy.design.l0_system.style
import com.ivy.wallet.R
import com.ivy.wallet.domain.data.TransactionType
import com.ivy.wallet.domain.data.core.Account
import com.ivy.wallet.domain.data.core.Category
import com.ivy.wallet.stringRes
import com.ivy.wallet.ui.IvyWalletPreview
import com.ivy.wallet.ui.PieChartStatistic
import com.ivy.wallet.ui.Report
Expand Down Expand Up @@ -80,7 +83,7 @@ private fun BoxWithConstraintsScope.UI(
contentAlignment = Alignment.Center
) {
Text(
text = "Generating report...",
text = stringResource(R.string.generating_report),
style = UI.typo.b1.style(
fontWeight = FontWeight.ExtraBold,
color = Orange
Expand Down Expand Up @@ -114,7 +117,7 @@ private fun BoxWithConstraintsScope.UI(
modifier = Modifier.padding(
start = 32.dp
),
text = "Reports",
text = stringResource(R.string.reports),
style = UI.typo.h2.style(
fontWeight = FontWeight.ExtraBold
)
Expand Down Expand Up @@ -207,9 +210,8 @@ private fun BoxWithConstraintsScope.UI(
onPayOrGet = {
onEventHandler.invoke(ReportScreenEvent.OnPayOrGet(transaction = it))
},
emptyStateTitle = "No transactions",

emptyStateText = "You don't have any transactions for your filter."
emptyStateTitle = stringRes(R.string.no_transactions),
emptyStateText = stringRes(R.string.no_transactions_for_your_filter)
)
} else {
item {
Expand Down Expand Up @@ -263,7 +265,7 @@ private fun NoFilterEmptyState(
Spacer(Modifier.height(8.dp))

Text(
text = "No Filter",
text = stringResource(R.string.no_filter),
style = UI.typo.b1.style(
color = Gray,
fontWeight = FontWeight.ExtraBold
Expand All @@ -274,7 +276,7 @@ private fun NoFilterEmptyState(

Text(
modifier = Modifier.padding(horizontal = 32.dp),
text = "To generate a report you must first set a valid filter.",
text = stringResource(R.string.invalid_filter_warning),
style = UI.typo.b2.style(
color = Gray,
fontWeight = FontWeight.Medium,
Expand All @@ -286,7 +288,7 @@ private fun NoFilterEmptyState(

IvyButton(
iconStart = R.drawable.ic_filter_xs,
text = "Set Filter"
text = stringResource(R.string.set_filter)
) {
setFilterOverlayVisible(true)
}
Expand All @@ -311,7 +313,7 @@ private fun Toolbar(

//Export CSV
IvyOutlinedButton(
text = "Export",
text = stringResource(R.string.export),
iconTint = Green,
textColor = Green,
solidBackground = true,
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/java/com/ivy/wallet/ui/search/SearchScreen.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ivy.wallet.ui.search

import androidx.compose.ui.res.stringResource
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
Expand All @@ -14,6 +15,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand All @@ -25,6 +27,7 @@ import com.ivy.wallet.R
import com.ivy.wallet.domain.data.TransactionHistoryItem
import com.ivy.wallet.domain.data.core.Account
import com.ivy.wallet.domain.data.core.Category
import com.ivy.wallet.stringRes
import com.ivy.wallet.ui.IvyWalletPreview
import com.ivy.wallet.ui.Search
import com.ivy.wallet.ui.ivyWalletCtx
Expand Down Expand Up @@ -123,8 +126,8 @@ private fun UI(
history = transactions,
onPayOrGet = { },
dateDividerMarginTop = 16.dp,
emptyStateTitle = "No transactions",
emptyStateText = "You don't have any transactions for \"${searchQueryTextFieldValue.text}\" query."
emptyStateTitle = stringRes(R.string.no_transactions),
emptyStateText = stringRes(R.string.no_transactions_for_query, searchQueryTextFieldValue.text)
)

item {
Expand Down Expand Up @@ -169,7 +172,7 @@ private fun SearchInput(
.padding(vertical = 12.dp)
.focusRequester(searchFocus),
value = searchQueryTextFieldValue,
hint = "Search transactions",
hint = stringResource(R.string.search_transactions),
onValueChanged = {
onSetSearchQueryTextField(it)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
Expand Down Expand Up @@ -337,13 +338,23 @@ private fun CategoryAmountCard(
) {
Spacer(Modifier.width(20.dp))

ItemIconMDefaultIcon(
ItemIconM(
modifier = Modifier.background(categoryColor, CircleShape),
iconName = category?.icon,
defaultIcon = R.drawable.ic_custom_category_m,
tint = findContrastTextColor(categoryColor)
tint = findContrastTextColor(categoryColor),
iconContentScale = ContentScale.None,
Default = {
ItemIconMDefaultIcon(
modifier = Modifier.background(categoryColor, CircleShape),
iconName = category?.icon,
defaultIcon = R.drawable.ic_custom_category_m,
tint = findContrastTextColor(categoryColor)
)
}
)



Spacer(Modifier.width(16.dp))

Column(
Expand Down
Loading

0 comments on commit 67cc24a

Please sign in to comment.