Telefonica / webview-bridge

Novum JavaScript Bridge
MIT License
27 stars 7 forks source link

New method to retrieve if user has Pincode activated. #125

Closed dagonco closed 7 months ago

dagonco commented 7 months ago

Based on the migration from Profile to the web, from the native part it must be exposed through the bridge whether the user has Pincode activated or not. Link to the PRD.

Get Pincode Info

getPincodeInfo: () => Promise<{status: "enabled" | "disabled"}>
Request → {type: "GET_PINCODE_INFO", id: string} 
Response → {type: "GET_PINCODE_INFO", id: string, payload: {status: "enabled" | "disabled"}}

[!NOTE] Any status different than "enabled" (like unknown, not supported, etc) will be reported as "disabled"

DavidMarinCalleja commented 7 months ago

Hi, we were discussing in the team about this bridge method and the comment came up to try to give a more generic/scalable solution. I mean that instead of returning a boolean value maybe we could be interested in something more generic like an enum where initially the values could be:

enum {
   case PIN_ENABLED
   case PIN_DISABLED
}

I do not have current uses cases but perhaps in the future we might be interested in returning in this function values like:

PIN_NOT_SUPPORTED
PIN_AND_BIOMETRY_IS_ENABLED

Updated: I upload a sample response

Response -> {type: "GET_PINCODE_INFO", payload: {"status": "PIN_ENABLED"}}

amegias commented 7 months ago

Hi, we were discussing in the team about this bridge method and the comment came up to try to give a more generic/scalable solution. I mean that instead of returning a boolean value maybe we could be interested in something more generic like an enum where initially the values could be:

enum {
   case PIN_ENABLED
   case PIN_DISABLED
}

I do not have current uses cases but perhaps in the future we might be interested in returning in this function values like:

PIN_NOT_SUPPORTED
PIN_AND_BIOMETRY_IS_ENABLED

Updated: I upload a sample response

Response -> {type: "GET_PINCODE_INFO", payload: {"status": "PIN_ENABLED"}}

Agree with @DavidMarinCalleja

Btw, I would simplify the tokens: Response -> {type: "GET_PINCODE_INFO", payload: {"status": "enabled" | "disabled"}}

[!NOTE] disabled for any unknown status

dagonco commented 7 months ago

Sure, that looks much better! We could go that way, thanks! 🚀

pladaria commented 7 months ago

Please update the issue description with the final proposal

pladaria commented 7 months ago

LGTM. Some suggestions:

Please, specify the possible status values in the function return type:

getPincodeInfo: () => Promise<{status: "enabled" | "disabled"}>

Also document that any status different than "enabled" (like unknown, not supported, etc) will be reported as "disabled"

Minor thing: the id was missing in the response:

Request → {type: "GET_PINCODE_INFO", id: string} 
Response → {type: "GET_PINCODE_INFO", id: string, payload: {status: "enabled" | "disabled"}}
atabel commented 7 months ago

LGTM. Jira ticket for web implementation: https://jira.tid.es/browse/WEB-1760