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

[#168485266] Removed 'any' and typed enums #7

Merged
merged 7 commits into from
Sep 24, 2019

Conversation

Edigio
Copy link
Contributor

@Edigio Edigio commented Sep 19, 2019

Typed enums and check bridge methods

Removed 'any' and typed enums
@Edigio Edigio changed the base branch from master to ipzs_review September 19, 2019 13:28
@Edigio Edigio requested a review from Undermaken September 20, 2019 08:27
Catch exception on listening nfc
Catch start and stop listening nfc
@@ -45,7 +45,7 @@ class MainActivity : AppCompatActivity(), Callback {
//configurazione cieidsdk
CieIDSdk.start(this, this)
//passare il pin inserito dall'utente
CieIDSdk.pin = "81813213"
CieIDSdk.pin = "18629880"
Copy link
Contributor

Choose a reason for hiding this comment

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

It's more safe to set this variable to empty. (this repository will be public)

Take note, for others stories, we want a native check about pin: it must be ^[0-9]{8}$ and if it isn't raise an exception describing the error

@@ -75,12 +75,8 @@ class CieManager {
return Promise.reject("not implemented");
}
return new Promise((resolve, reject) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return new Promise((resolve, reject) => {
return new Promise((resolve, _) => {

Since reject won't be used.
Place a comment here describing what is happening

Copy link
Contributor

Choose a reason for hiding this comment

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

new Promise(resolve => {

@@ -90,12 +86,8 @@ class CieManager {
return Promise.reject("not implemented");
}
return new Promise((resolve, reject) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same of above

Fix promise and added comments
@Edigio Edigio requested a review from Undermaken September 20, 2019 15:18
Fixed promise constructor
@Edigio Edigio marked this pull request as ready for review September 20, 2019 15:30
val nameEvent: String
}

enum class EventTag : EventValue {
//tag
ON_TAG_DISCOVERED_NOT_CIE,
Copy link
Contributor

Choose a reason for hiding this comment

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

all these enums must be mapped into index.d.ts

example

export type EventValue = 'ON_TAG_DISCOVERED_NOT_CIE' | 'ON_TAG_DISCOVERED' | 'ON_TAG_LOST' .. ...;

[...]

setEventListner(callback: (event: EventValue) => void): void;

(setEventListner should be changed in onEvent)

this is should be done for all events that onEvent function can send and for onError too we have, on React Native side, raise an Error with same description of native side. Indeed now a onError function is missing, you should add it.

interface Callback {

    fun onSuccess(url: String)
    fun onError(e: Throwable)
    fun onEvent(event: Event)
}

At the end check all these Promises I did Promise<never> (i.e startListeningNFC). I guess they can be improved

@fventola-ipzs fventola-ipzs merged commit 42c9731 into ipzs_review Sep 24, 2019
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.

4 participants