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

Bugfix for ESR Handling #1067

Closed
wants to merge 49 commits into from
Closed

Conversation

n13
Copy link
Member

@n13 n13 commented Aug 16, 2021

πŸ—ƒ Github Issue Or Explanation for this PR. (What is it supposed to do and Why is needed)

Following changes:

  • Handle incoming ESR:// link
  • Scan QR code that's not a token transfer (any chain action)
  • handling non-transfer transactions in all cases
  • Scan QR code that is a token transfer
  • unifying transactions - there was some duplicate code between send and scanning QR codes
  • Show success dialog on generic transactions
  • Renaming some stuff.

βœ… Checklist

  • I have tested all my changes.

πŸ•΅οΈβ€β™‚οΈ Notes for Code Reviewer

Tested the following cases

  • Scan QR Code on "receive" - transfer SEEDS transaction
  • Scan QR code on gratitude transaction
  • Handle incoming ESR link for transaction while app is running
  • Handle incoming ESR link when app is not running (cold start)

esr://gmN0S9_Eeqy57zv_9xn9eU3hL_bxCbUs-jptJqsXY3-Jtawgk9sHycTQh0qBNwwZgICRoSCIq3n-2VQGEW-tIitFI0ZGBghggtKKMIECk6CZXqWhpwXS8osUiktSc3ISixTK84uygYYwAAA

Some more minor fixes and improvements

πŸ™ˆ Screenshots

IMG_7043

UPDATED confirm dialog with fixed time

Simulator Screen Shot - iPhone 8 - 2021-08-16 at 14 09 40

πŸ‘―β€β™€οΈ Paired with

Text('Date1: '.i18n, style: Theme.of(context).textTheme.subtitle2),
const SizedBox(width: 16),
Text(
DateFormat('dd MMMM yyyy at HH:mm').format(transaction.timestamp ?? DateTime.now()),
Copy link
Member Author

Choose a reason for hiding this comment

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

There's a fix for the date format in another PR

factory AppState.initial(GuardianRecoveryRequestData? showGuardianApproveOrDenyScreen) {
factory AppState.initial({
GuardianRecoveryRequestData? showGuardianApproveOrDenyScreen,
// ScanESRResultData? signingRequest,
Copy link
Collaborator

Choose a reason for hiding this comment

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

commented code needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed

lib/v2/screens/app/interactor/viewmodels/app_state.dart Outdated Show resolved Hide resolved
}
}

class DialogRow extends StatelessWidget {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be on its one file.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree

Made a separate PR for this here #1070

@@ -2,6 +2,12 @@ class SendConfirmationArguments {
final String account;
final String name;
final Map<String, dynamic> data;
final int pops;
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is pops? Why do we need this?

Copy link
Member Author

Choose a reason for hiding this comment

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

We need pops because the screen is shown from different screens, sometimes we need 2 pop() calls, sometimes 3

showDialog<void>(
context: context,
barrierDismissible: false, // user must tap button
builder: (BuildContext buildContext) => SendTransactionSuccessDialog(
onCloseButtonPressed: () {
builder: (BuildContext buildContext) => SendTransactionSuccessDialog.fromPageCommand(
Copy link
Collaborator

Choose a reason for hiding this comment

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

oh i see why pop is needed, this is so hacky.
There must be a better way to implement this?
can we navigate to a path in the stack? /homePage

Copy link
Member Author

Choose a reason for hiding this comment

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

IDK! it was like that before!

lib/v2/screens/app/app.dart Outdated Show resolved Hide resolved
AppBloc(this._deeplinkBloc)
: super(AppState.initial(
showGuardianApproveOrDenyScreen: _deeplinkBloc.state.guardianRecoveryRequestData,
// signingRequest: _deeplinkBloc.state.signingRequest,
Copy link
Collaborator

Choose a reason for hiding this comment

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

commented code

lib/v2/screens/app/interactor/viewmodels/app_state.dart Outdated Show resolved Hide resolved
@@ -46,16 +50,21 @@ class AppState extends Equatable {
hasNotification: hasNotification ?? this.hasNotification,
showGuardianRecoveryAlert: showGuardianRecoveryAlert ?? this.showGuardianRecoveryAlert,
showGuardianApproveOrDenyScreen: showGuardianApproveOrDenyScreen,
// signingRequest: signingRequest ?? this.signingRequest,
Copy link
Collaborator

Choose a reason for hiding this comment

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

commented code

import 'package:seeds/v2/constants/app_colors.dart';
import 'package:seeds/v2/i18n/transfer/transfer.i18n.dart';

class CustomTransactionSuccessDialog extends StatelessWidget {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we have a dialog class we extend from when creating dialogs.

Is this dialog different? Should this extend from our base dialogs?

Copy link
Member Author

Choose a reason for hiding this comment

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

I did not change this at all - I just made a second one based on TransactionSuccessDialog

I didn't want to change inheritance, or anything about it, since I did not want to break it.

@gguijarro-c-chwy
Copy link
Collaborator

image

Could each of these changes have been on its own PR instead of all into one large pr?

@gguijarro-c-chwy
Copy link
Collaborator

@RaulUrtecho and @gguij004 this PR is changing a lot of files and touching very important areas of the code.
Can you guys review this PR and run it.

@n13
Copy link
Member Author

n13 commented Aug 16, 2021

Addressed all issues - waiting for more reviews

Tested deep links also, works fine because the ESR handler does nothing on non-esr links

@RaulUrtecho
Copy link
Collaborator

I agree with Gery, the PR is very big, it would be good to do it in parts to better understand how each one was resolved.

@gguijarro-c-chwy
Copy link
Collaborator

@n13 I am not understanding this PR. and i truly believe this can be split into smaller more manageable prs.

I will not approve this PR and the other guys in the team and not comfortable doing so either.

Lets try to split this into smaller PRs, i am here all day tomorrow to chat about it.

Copy link
Collaborator

@gguij004 gguij004 left a comment

Choose a reason for hiding this comment

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

Hi Team, I agree 100% this pr can be split. However we can sometimes get carry away and start coding until flow is fix. I did test flow and it works just the code itsefl is hard to test due to the amount of changes. I also find something weird weird about the send animation, it now stop at the appBar, not sure if is related to this pr.

@n13
Copy link
Member Author

n13 commented Aug 17, 2021

Hi Team, I agree 100% this pr can be split. However we can sometimes get carry away and start coding until flow is fix. I did test flow and it works just the code itsefl is hard to test due to the amount of changes. I also find something weird weird about the send animation, it now stop at the appBar, not sure if is related to this pr.

It was stopping at the app bar before too in this situation, that bug was already in there!!

So you can't have it both ways, don't fix anything or the PR gets too big, and complain about bugs that were already there.

@RaulUrtecho RaulUrtecho self-requested a review August 17, 2021 01:23
@gguij004
Copy link
Collaborator

Hi Team, I agree 100% this pr can be split. However we can sometimes get carry away and start coding until flow is fix. I did test flow and it works just the code itsefl is hard to test due to the amount of changes. I also find something weird weird about the send animation, it now stop at the appBar, not sure if is related to this pr.

It was stopping at the app bar before too in this situation, that bug was already in there!!

So you can't have it both ways, don't fix anything or the PR gets too big, and complain about bugs that were already there.

Not a bug, is up to the designer. My bad idk why I was thinking you had it different on another pr

Copy link
Collaborator

@RaulUrtecho RaulUrtecho left a comment

Choose a reason for hiding this comment

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

Since Grabriel confirms it works.

@n13
Copy link
Member Author

n13 commented Aug 17, 2021

Hi Team, I agree 100% this pr can be split. However we can sometimes get carry away and start coding until flow is fix. I did test flow and it works just the code itsefl is hard to test due to the amount of changes. I also find something weird weird about the send animation, it now stop at the appBar, not sure if is related to this pr.

It was stopping at the app bar before too in this situation, that bug was already in there!!
So you can't have it both ways, don't fix anything or the PR gets too big, and complain about bugs that were already there.

Not a bug, is up to the designer. My bad idk why I was thinking you had it different on another pr

I think it should go all the way to the top, for sure, but it's a minor issue and unrelated to this PR.

@n13
Copy link
Member Author

n13 commented Aug 17, 2021

@n13 I am not understanding this PR. and i truly believe this can be split into smaller more manageable prs.

I will not approve this PR and the other guys in the team and not comfortable doing so either.

Lets try to split this into smaller PRs, i am here all day tomorrow to chat about it.

I think we unnecessarily delay things here without providing a better product, and leaving our users hanging with this bug.

I also disagree, I don't see a way to split it meaningfully in smaller PRs.

That is, yes, I can see about ... IDK 2 or 3 things that could be moved into their own PRs but the main chunk of code would still be pretty big, I don't think it will make it a lot smaller.

Certainly happy to try and move these things into their own PR

Just thinking that if we split it up like that, we also increase risks of adding new bugs and breaking things again that are already working in this PR.

Let's talk about it when you're online.

@n13 n13 mentioned this pull request Aug 17, 2021
1 task
@n13
Copy link
Member Author

n13 commented Aug 17, 2021

this PR was too big and messy, split up into 4 PRs and merged. Closing this.

@n13 n13 closed this Aug 17, 2021
@n13 n13 mentioned this pull request Nov 3, 2021
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants