FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

refactor(image-source): throw if source is not a correct native instance by vchimev · Pull Request #5273 · NativeScript/NativeScript · GitHub

refactor(image-source): throw if source is not a correct native instance - #5273

Merged
vchimev merged 3 commits into
masterfrom
vchimev/img-src
Jan 23, 2018
Merged

vchimev merged 3 commits into
masterfrom
vchimev/img-src

Conversation

vchimev commented Jan 15, 2018

Copy link
Copy Markdown
Contributor

ghost assigned vchimev Jan 15, 2018
ghost added the in progress label Jan 15, 2018

ns-bot commented Jan 15, 2018

Copy link
Copy Markdown

Please sign CLA at http://www.nativescript.org/cla

ns-bot added the cla: no label Jan 15, 2018

ns-bot commented Jan 15, 2018

Copy link
Copy Markdown

CLA signature found, happy contributing!

DimitarTachev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

We could also think about removing the return value. Why do we need false when we pass null, instead of a simple void method? @PanayotCankov @hshristov

}

public setNativeSource(source: any): boolean {
if (!(source instanceof android.graphics.Bitmap)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

In this way, the method will no longer return false, it will throw an exception instead. It could be something like:

if (source && !(source instanceof android.graphics.Bitmap))

public setNativeSource(source: any): boolean {
if (source instanceof UIImage) {
this.ios = source;
if (!(source instanceof UIImage)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

In this way, the method will no longer return false, it will throw an exception instead. It could be something like:

if (source && !(source instanceof UIImage))

vchimev commented Jan 16, 2018

Copy link
Copy Markdown
Contributor Author

Thank you, @DimitarTachev!

public setNativeSource(source: any): boolean {
if (source instanceof UIImage) {
this.ios = source;
public setNativeSource(source: any): void {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This is a change in the public API -> mark this as breaking change if it is really needed.
Also the definitions (image-source.d.ts) should be updated

vchimev Jan 19, 2018
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Done, thanks.

BREAKING CHANGE:

Change the return type of `setNativeSource` method from `boolean` to `void`.

vchimev commented Jan 19, 2018
edited
Loading

Copy link
Copy Markdown
Contributor Author

Changes are done, branch is rebased and able to merge after green CI.

vchimev merged commit 58d61ca into master Jan 23, 2018
vchimev deleted the vchimev/img-src branch January 23, 2018 14:57

lock Bot commented Aug 26, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock Bot locked and limited conversation to collaborators Aug 26, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL