-
Notifications
You must be signed in to change notification settings - Fork 2
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
[#168485266] Removed 'any' and typed enums #7
Conversation
Removed 'any' and typed enums
Removed null params
Catch exception on listening nfc
Catch start and stop listening nfc
Fix no-void
@@ -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" |
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.
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
cieidsdk/index.js
Outdated
@@ -75,12 +75,8 @@ class CieManager { | |||
return Promise.reject("not implemented"); | |||
} | |||
return new Promise((resolve, reject) => { |
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.
return new Promise((resolve, reject) => { | |
return new Promise((resolve, _) => { |
Since reject won't be used.
Place a comment here describing what is happening
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.
new Promise(resolve => {
cieidsdk/index.js
Outdated
@@ -90,12 +86,8 @@ class CieManager { | |||
return Promise.reject("not implemented"); | |||
} | |||
return new Promise((resolve, reject) => { |
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.
Same of above
Fix promise and added comments
Fixed promise constructor
val nameEvent: String | ||
} | ||
|
||
enum class EventTag : EventValue { | ||
//tag | ||
ON_TAG_DISCOVERED_NOT_CIE, |
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.
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
Typed enums and check bridge methods