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

Delete account 2nd and 3rd confirmation #2641

Merged

Conversation

mohammednawas8
Copy link
Contributor

Pull Request (PR) Checklist

Please check if your pull request fulfills the following requirements:

  • The PR is submitted to the main branch.
  • I've read the Contribution Guidelines.
  • I've read the Architecture Guidelines.
  • My code builds and is tested on a real Android device.
  • I confirm that I've run the code locally and everything works as expected.

What's changed?

Describe with a few bullets what's new:

  • a Adding 2nd confirmation sheet before being able to delete an account
  • b Adding a 3rd confirmation sheet before being able to delete an account

💡 Tip: Please, attach screenshots and screen recordings. It helps a lot!

Risk Factors

What may go wrong if we merge your PR?

  • a
  • b
  • c

In what cases your code won't work?

  • a
  • b
  • c

Does this PR closes any GitHub Issues?

Check Ivy Wallet Issues.

Replace {ISSUE_NUMBER} with the id/number of the issue that you've fixed.

Copy link
Collaborator

@ILIYANGERMANOV ILIYANGERMANOV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Seems like it's the same code as the other PR

@mohammednawas8
Copy link
Contributor Author

it is the exact same code with a little bit of enhancement

@mohammednawas8
Copy link
Contributor Author

I am not sure why Detekt fails

@ILIYANGERMANOV
Copy link
Collaborator

Run

./gradlew detektBaseline

and commit the generated baseline file

@ILIYANGERMANOV
Copy link
Collaborator

It fails with valid errors but they are caused by the shitty legacy code so it's not your changes.

@ILIYANGERMANOV
Copy link
Collaborator

ILIYANGERMANOV commented Sep 17, 2023

Just for reference:

See https://mrmans0n.github.io/compose-rules/rules/#ordering-composable-parameters-properly for more information. [ComposableParamOrder]
/home/runner/work/ivy-wallet/ivy-wallet/screen-transactions/src/main/java/com/ivy/transactions/ItemStatisticScreen.kt:209:39: The function UI(period: TimePeriod, baseCurrency: String, currency: String, account: Account?, category: Category?, accountNameConfirmation: TextFieldValue, updateAccountNameConfirmation: (String) -> Unit, enableDeletionButton: Boolean, categories: ImmutableList<Category>, accounts: ImmutableList<Account>, balance: Double, balanceBaseCurrency: Double?, income: Double, expenses: Double, initWithTransactions: Boolean, treatTransfersAsIncomeExpense: Boolean, history: ImmutableList<TransactionHistoryItem>, upcomingExpanded: Boolean, setUpcomingExpanded: (Boolean) -> Unit, upcomingIncome: Double, upcomingExpenses: Double, upcoming: ImmutableList<Transaction>, overdueExpanded: Boolean, setOverdueExpanded: (Boolean) -> Unit, overdueIncome: Double, overdueExpenses: Double, overdue: ImmutableList<Transaction>, onPreviousMonth: () -> Unit, onNextMonth: () -> Unit, onSetPeriod: (TimePeriod) -> Unit, onEditAccount: (Account, Double) -> Unit, onEditCategory: (Category) -> Unit, onDelete: () -> Unit, onPayOrGet: (Transaction) -> Unit, onSkipTransaction: (Transaction) -> Unit, onSkipAllTransactions: (List<Transaction>) -> Unit) has too many parameters. The current threshold is set to 12. [LongParameterList]
/home/runner/work/ivy-wallet/ivy-wallet/screen-transactions/src/main/java/com/ivy/transactions/ItemStatisticScreen.kt:209:37: The function UI is too long (246). The maximum length is 120. [LongMethod]
/home/runner/work/ivy-wallet/ivy-wallet/temp-legacy-code/src/main/java/com/ivy/legacy/legacy/ui/theme/modal/DeleteModal.kt:160:36: Missing spacing before "{" [SpacingAroundCurly]
/home/runner/work/ivy-wallet/ivy-wallet/temp-legacy-code/src/main/java/com/ivy/legacy/legacy/ui/theme/modal/DeleteModal.kt:1[61](https://github.com/Ivy-Apps/ivy-wallet/actions/runs/6213370280/job/16864357481?pr=2641#step:6:62):19: This expression contains a magic number. Consider defining it to a well named constant. [MagicNumber]

To run Detekt locally run:

./gradlew detekt

@mohammednawas8
Copy link
Contributor Author

This is what i got when i run ./gradlew detekt

Property 'style>OptionalWhenBraces' is deprecated. Same functionality is implemented in BracesOnWhenStatements.
/Users/user/Desktop/ivy-wallet/temp-legacy-code/src/main/java/com/ivy/legacy/legacy/ui/theme/modal/DeleteModal.kt:83:29: This @Composable function emits content but doesn't have a modifier parameter.

See https://mrmans0n.github.io/compose-rules/rules/#when-should-i-expose-modifier-parameters for more information. [ModifierMissing]
/Users/user/Desktop/ivy-wallet/temp-legacy-code/src/main/java/com/ivy/legacy/legacy/ui/theme/modal/DeleteModal.kt:83:29: Parameters in a composable function should be ordered following this pattern: params without defaults, modifiers, params with defaults and optionally, a trailing function that might not have a default param.
Current params are: [id: UUID = UUID.randomUUID(), title: String, description: String, accountName: TextFieldValue, hint: String = stringResource(id = R.string.account_name), visible: Boolean, enableDeletionButton: Boolean, buttonText: String = stringResource(R.string.delete), iconStart: Int = R.drawable.ic_delete, onAccountNameChange: (String) -> Unit, dismiss: () -> Unit, onDelete: () -> Unit] but should be [title: String, description: String, accountName: TextFieldValue, visible: Boolean, enableDeletionButton: Boolean, onAccountNameChange: (String) -> Unit, dismiss: () -> Unit, id: UUID = UUID.randomUUID(), hint: String = stringResource(id = R.string.account_name), buttonText: String = stringResource(R.string.delete), iconStart: Int = R.drawable.ic_delete, onDelete: () -> Unit].

See https://mrmans0n.github.io/compose-rules/rules/#ordering-composable-parameters-properly for more information. [ComposableParamOrder]
/Users/user/Desktop/ivy-wallet/screen-transactions/src/main/java/com/ivy/transactions/ItemStatisticScreen.kt:209:39: The function UI(period: TimePeriod, baseCurrency: String, currency: String, account: Account?, category: Category?, accountNameConfirmation: TextFieldValue, updateAccountNameConfirmation: (String) -> Unit, enableDeletionButton: Boolean, categories: ImmutableList<Category>, accounts: ImmutableList<Account>, balance: Double, balanceBaseCurrency: Double?, income: Double, expenses: Double, initWithTransactions: Boolean, treatTransfersAsIncomeExpense: Boolean, history: ImmutableList<TransactionHistoryItem>, upcomingExpanded: Boolean, setUpcomingExpanded: (Boolean) -> Unit, upcomingIncome: Double, upcomingExpenses: Double, upcoming: ImmutableList<Transaction>, overdueExpanded: Boolean, setOverdueExpanded: (Boolean) -> Unit, overdueIncome: Double, overdueExpenses: Double, overdue: ImmutableList<Transaction>, onPreviousMonth: () -> Unit, onNextMonth: () -> Unit, onSetPeriod: (TimePeriod) -> Unit, onEditAccount: (Account, Double) -> Unit, onEditCategory: (Category) -> Unit, onDelete: () -> Unit, onPayOrGet: (Transaction) -> Unit, onSkipTransaction: (Transaction) -> Unit, onSkipAllTransactions: (List<Transaction>) -> Unit) has too many parameters. The current threshold is set to 12. [LongParameterList]
/Users/user/Desktop/ivy-wallet/screen-transactions/src/main/java/com/ivy/transactions/ItemStatisticScreen.kt:209:37: The function UI is too long (246). The maximum length is 120. [LongMethod]
/Users/user/Desktop/ivy-wallet/temp-legacy-code/src/main/java/com/ivy/legacy/legacy/ui/theme/modal/DeleteModal.kt:160:36: Missing spacing before "{" [SpacingAroundCurly]
/Users/user/Desktop/ivy-wallet/temp-legacy-code/src/main/java/com/ivy/legacy/legacy/ui/theme/modal/DeleteModal.kt:161:19: This expression contains a magic number. Consider defining it to a well named constant. [MagicNumber]


> Task :detekt FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':detekt'.
> Analysis failed with 6 weighted issues.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 6s
1 actionable task: 1 executed
Configuration cache entry reused.

@ILIYANGERMANOV
Copy link
Collaborator

Run

./gradlew detektBaseline

and commit the generated baseline file

this is the simplest way to solve the Detekt problem,
then commit the confit/detekt/baseline file but not from Android Studio cuz it automatically reformats and breaks it

@mohammednawas8
Copy link
Contributor Author

why does git rebase from my current branch to origin/master shows all files changed?

@ILIYANGERMANOV
Copy link
Collaborator

I just pressed "Update branch" in the GitHub UI. @mohammednawas8 just abort any rebases and just git pull

@ILIYANGERMANOV
Copy link
Collaborator

Btw, rebasing via the GitHub UI is very easy

@mohammednawas8
Copy link
Contributor Author

Im doing via Android Studio, i will try the github ui

@ILIYANGERMANOV
Copy link
Collaborator

Im doing via Android Studio, i will try the github ui

Idk, I don't use this UI. Now you need:

  • abort rebases
  • revert local changes
  • git pull

And you're good to go 👍

@ILIYANGERMANOV
Copy link
Collaborator

The final step would be to add a Detekt baseline.
To do so via

./gradlew detektBasline

Copy link
Collaborator

@ILIYANGERMANOV ILIYANGERMANOV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for going through all rebasing and CI trouble 🏆 💯 Sorry, for the bad experience- - thanks to you, we made some Lint checks better

ivy-resources/src/main/res/values/strings.xml Outdated Show resolved Hide resolved
@ILIYANGERMANOV
Copy link
Collaborator

You'll need to add Lint baseline, run:

./gradlew lintR

run the above until Lint turns green locally. The commit all the baselines XMLs generated by Lint.
Or alternatively fix the 4 errors that Lint have found. One is your code and 3 are in the legacy code

@mohammednawas8
Copy link
Contributor Author

mohammednawas8 commented Sep 21, 2023

These are the changes i can commit after i deleted translatable = false and run ./gradlew lintR
Screenshot 2023-09-21 at 5 20 21 PM

@mohammednawas8
Copy link
Contributor Author

and when i run ./gradlew lint i get BUILD SUCCESSFUL

@ILIYANGERMANOV
Copy link
Collaborator

and when i run ./gradlew lint i get BUILD SUCCESSFUL

Try:

./gradlew clean
./gradlew lintR

and then write

git status

there must be changed baseline files

@mohammednawas8
Copy link
Contributor Author

that's weird i did clean the project and run ./gradlew lintR but the baseline.xml file did not change

@ILIYANGERMANOV
Copy link
Collaborator

Weird 🤔 Maybe the Lint configuration is somehow broken - it worked on my machine. Would it be easier just to fix the Lint errors reported in this HTML at the bottom?
https://github.com/Ivy-Apps/ivy-wallet/actions/runs/6262649561

There are 4 of them

@ILIYANGERMANOV
Copy link
Collaborator

Btw, the baseline files are many because each module has its own baseline

@ILIYANGERMANOV
Copy link
Collaborator

Hey @mohammednawas8 I got good news for you! Update your branch using the GitHub "Update branch" button.

After you pull the update you'll have:

./scripts/lintBasline.sh

that will solve your Lint problems

@mohammednawas8
Copy link
Contributor Author

Hey, i have been a little busy
I will update update the branch tomorrow and push the changes and hopefully CI don't complain

@ILIYANGERMANOV
Copy link
Collaborator

Hey things seems good, just run:

./scripts/lintBasline.sh

And this should create a new lintBaseline.

To do that manually:

  • remove the current baseline from :app
  • run ./gradlew lintR twice
  • commit the new baseline (from the terminal cuz Android Studio auto-format breaks it)
  • but better just use the provided script

@mohammednawas8
Copy link
Contributor Author

Finally 🎉

@ILIYANGERMANOV ILIYANGERMANOV merged commit 1a4c4c6 into Ivy-Apps:main Sep 26, 2023
@ILIYANGERMANOV
Copy link
Collaborator

Congrats @mohammednawas8!! 🎉 And thank you for your patience :D Thanks to you, I'll try to improve the CI for future contributions

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Delete Acccount 3rd confirmation
2 participants