-
Notifications
You must be signed in to change notification settings - Fork 106
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
feat(Bonus Pagamenti Digitali): [#175011093,#175011182] Add bancomat entrypoint and stub navigation #2269
feat(Bonus Pagamenti Digitali): [#175011093,#175011182] Add bancomat entrypoint and stub navigation #2269
Conversation
…mat-entrypoint-and-stub-navigation
Affected stories
|
…mat-entrypoint-and-stub-navigation
Codecov Report
@@ Coverage Diff @@
## master #2269 +/- ##
==========================================
- Coverage 47.92% 47.86% -0.06%
==========================================
Files 543 554 +11
Lines 15788 16031 +243
Branches 3159 3200 +41
==========================================
+ Hits 7566 7674 +108
- Misses 8180 8315 +135
Partials 42 42
Continue to review full report at Codecov.
|
* the navigation stack return to the screen from which the saga was invoked | ||
* @param g | ||
*/ | ||
export function* withResetNavigationStack<T>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be an enhancement?
In this way we can call withResetNavigationStack
by passing also the parameters taken by g
export function* withResetNavigationStack<T>(
g: (...args: any) => Generator<Effect, T>,
args?: Array<any>
): Generator<Effect, T, any> {
const currentNavigationStackSize: ReturnType<typeof navigationHistorySizeSelector> = yield select(
navigationHistorySizeSelector
);
const res: T = yield call(() => (args ? g(...args) : g()));
const newNavigationStackSize: ReturnType<typeof navigationHistorySizeSelector> = yield select(
navigationHistorySizeSelector
);
const deltaNavigation = newNavigationStackSize - currentNavigationStackSize;
if (deltaNavigation > 1) {
yield put(navigationHistoryPop(deltaNavigation - 1));
}
yield put(NavigationActions.back());
return res;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My idea, in case of a saga with some parameters was to use:
const res: SagaCallReturnType<typeof executeWorkUnit> = yield call(
withResetNavigationStack,
() => bancomatWorkUnit("Hola, ¿que tal?")
);
In order to preserve the type of the arguments of the g
method. Using args?: Array<any>
I could pass any types and any size of parameters which may not match the signature.
What you think?
…mat-entrypoint-and-stub-navigation
Short description
This pr adds an entry point for the
add bancomat as payment method
and a base template to orchestrate single unit of work.List of changes proposed in this pull request
PaymentMethodsList.tsx
in order to acceptspaymentMethods?: ReadonlyArray<IPaymentMethod>;
AddPaymentMethodScreen.tsx
in order to add theadd bancomat
entry point (only whenbpdEnabled
and!inPayment.isSome()
).WorkUnit
to model the information needed to execute a single work unit.withResetNavigationStack
utility saga to execute another saga and restore the navigation stack after the execution.executeWorkUnit
, a saga used to execute a single work unit.navigationHistorySizeSelector
to read from the store the size of the navigation stack.bancomatWorkUnit
to execute theadd bancomat to wallet
work unit.addBancomatToWalletGeneric
to concat the operation ofadd bancomat to wallet
and goto wallethomescreen (placeholder, will be refined in the next iterations).