Skip to content

Commit

Permalink
Release 0.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Ma committed Apr 5, 2018
1 parent a3f93c4 commit 0dba849
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 7 deletions.
25 changes: 23 additions & 2 deletions dist/index.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ var UnsplashWrapper = function () {
return _this2.unsplash.search.photos(search, page, perPage).then(_this2.processResponse);
};

this.getPhoto = function (id) {
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
width = _ref2.width,
height = _ref2.height;

return _this2.unsplash.photos.getPhoto(id, width, height).then(_this2.processResponse);
};

this.downloadPhoto = function (photo) {
return _this2.unsplash.photos.downloadPhoto(photo).then(_this2.processResponse);
};
Expand Down Expand Up @@ -857,9 +865,17 @@ var UnsplashPicker = function (_React$Component) {

_this.downloadPhoto = function (photo) {
_this.setState({ loadingPhoto: photo });
return _this.state.unsplash.downloadPhoto(photo).then(function (r) {
var preferredSize = _this.props.preferredSize;

var download = _this.state.unsplash.downloadPhoto(photo);

var downloadPromise = preferredSize ? _this.state.unsplash.getPhoto(photo.id, preferredSize).then(function (r) {
return r.urls.custom;
}) : download.then(function (r) {
return r.url;
}).then(fetch).catch(function (e) {
});

return downloadPromise.then(fetch).catch(function (e) {
return _this.setState({ error: e.message, isLoadingSearch: false });
});
};
Expand Down Expand Up @@ -1124,6 +1140,10 @@ UnsplashPicker.propTypes = {
highlightColor: string$8,
onFinishedUploading: func$5,
defaultSearch: string$8,
preferredSize: shape$4({
width: number$3.isRequired,
height: number$3.isRequired
}),
__debug_chaosMonkey: bool
};
UnsplashPicker.defaultProps = {
Expand All @@ -1134,6 +1154,7 @@ UnsplashPicker.defaultProps = {
highlightColor: "#00adf0",
onFinishedUploading: noop,
defaultSearch: "",
preferredSize: null,
__debug_chaosMonkey: false
};

Expand Down
25 changes: 23 additions & 2 deletions dist/index.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ var UnsplashWrapper = function () {
return _this2.unsplash.search.photos(search, page, perPage).then(_this2.processResponse);
};

this.getPhoto = function (id) {
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
width = _ref2.width,
height = _ref2.height;

return _this2.unsplash.photos.getPhoto(id, width, height).then(_this2.processResponse);
};

this.downloadPhoto = function (photo) {
return _this2.unsplash.photos.downloadPhoto(photo).then(_this2.processResponse);
};
Expand Down Expand Up @@ -851,9 +859,17 @@ var UnsplashPicker = function (_React$Component) {

_this.downloadPhoto = function (photo) {
_this.setState({ loadingPhoto: photo });
return _this.state.unsplash.downloadPhoto(photo).then(function (r) {
var preferredSize = _this.props.preferredSize;

var download = _this.state.unsplash.downloadPhoto(photo);

var downloadPromise = preferredSize ? _this.state.unsplash.getPhoto(photo.id, preferredSize).then(function (r) {
return r.urls.custom;
}) : download.then(function (r) {
return r.url;
}).then(fetch).catch(function (e) {
});

return downloadPromise.then(fetch).catch(function (e) {
return _this.setState({ error: e.message, isLoadingSearch: false });
});
};
Expand Down Expand Up @@ -1118,6 +1134,10 @@ UnsplashPicker.propTypes = {
highlightColor: string$8,
onFinishedUploading: func$5,
defaultSearch: string$8,
preferredSize: shape$4({
width: number$3.isRequired,
height: number$3.isRequired
}),
__debug_chaosMonkey: bool
};
UnsplashPicker.defaultProps = {
Expand All @@ -1128,6 +1148,7 @@ UnsplashPicker.defaultProps = {
highlightColor: "#00adf0",
onFinishedUploading: noop,
defaultSearch: "",
preferredSize: null,
__debug_chaosMonkey: false
};

Expand Down
25 changes: 23 additions & 2 deletions dist/index.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2857,6 +2857,14 @@
return _this2.unsplash.search.photos(search, page, perPage).then(_this2.processResponse);
};

this.getPhoto = function (id) {
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
width = _ref2.width,
height = _ref2.height;

return _this2.unsplash.photos.getPhoto(id, width, height).then(_this2.processResponse);
};

this.downloadPhoto = function (photo) {
return _this2.unsplash.photos.downloadPhoto(photo).then(_this2.processResponse);
};
Expand Down Expand Up @@ -4337,9 +4345,17 @@

_this.downloadPhoto = function (photo) {
_this.setState({ loadingPhoto: photo });
return _this.state.unsplash.downloadPhoto(photo).then(function (r) {
var preferredSize = _this.props.preferredSize;

var download = _this.state.unsplash.downloadPhoto(photo);

var downloadPromise = preferredSize ? _this.state.unsplash.getPhoto(photo.id, preferredSize).then(function (r) {
return r.urls.custom;
}) : download.then(function (r) {
return r.url;
}).then(fetch).catch(function (e) {
});

return downloadPromise.then(fetch).catch(function (e) {
return _this.setState({ error: e.message, isLoadingSearch: false });
});
};
Expand Down Expand Up @@ -4604,6 +4620,10 @@
highlightColor: string$8,
onFinishedUploading: func$5,
defaultSearch: string$8,
preferredSize: shape$4({
width: number$3.isRequired,
height: number$3.isRequired
}),
__debug_chaosMonkey: bool
};
UnsplashPicker.defaultProps = {
Expand All @@ -4614,6 +4634,7 @@
highlightColor: "#00adf0",
onFinishedUploading: noop,
defaultSearch: "",
preferredSize: null,
__debug_chaosMonkey: false
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unsplash-react",
"version": "0.1.4",
"version": "0.1.5",
"description": "Upload images from unsplash into your app",
"source": "src/index.js",
"main": "dist/index.cjs.js",
Expand Down

0 comments on commit 0dba849

Please sign in to comment.