-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add incoming url detection logic, mapped to openItem * Add custom protocol handling * Add missing return statements * Add .postArray() method to cope with JSON array posting * Change redux architecture to fetch on demand Change redux state architecture to fetch/resolve items on demand Our data architecture was modelled around a single view that holds items found nearby. With the addtional of deep linking and the ability to render items that may not be nearby we needed to decouple 'nearby items' from 'items' in our app state and provide way to load item data when an item hasn't come from the scanner. * Remove redundant metadata fetcher * Show loading indicator when resolving item * Protect against navigator not being defined yet * Remove dead module * Change to use proper async redux actions for data retrieval * Fix loading spinner styling * Listen for deep-links when app is running * Add support for POSTing JSON arrays * Fix incorrect props mapping * Yarn lock not up-to-date for some reason * Remove expiring logic as needs to be moved to native scanners * Moved network status logic into redux store * Fix refresh logic to be based on 'nearbyItems' not 'items' * Add missing file for network checks * Remove unused callback * Fix tests * Add native linking logic for ios * yarn.lock not updated * Fix broken unit-tests * Rename files to match class names * Use InteractionsManager to prevent render whilst animating * Fix naming inconsistency * Don't change state when distance hasn't changed * Update yarn.lock * Fix broken test * Remove redundant code
- Loading branch information
1 parent
3a2e9e6
commit 2d46b77
Showing
37 changed files
with
1,132 additions
and
867 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Dependencies | ||
*/ | ||
|
||
const { searchServiceUrl } = require('../../config'); | ||
const debug = require('../debug')('get-item'); | ||
const api = require('.'); | ||
|
||
/** | ||
* Exports | ||
*/ | ||
|
||
module.exports = function(url) { | ||
return Promise.all([ | ||
fetchBeaconData(url), | ||
fetchMetadata(url), | ||
]) | ||
|
||
.then(results => { | ||
var item = results[0][0]; | ||
var metadata = results[1][0]; | ||
|
||
return { | ||
...item, | ||
metadata, | ||
}; | ||
}); | ||
}; | ||
|
||
function fetchMetadata(url) { | ||
return api.postArray('metadata', [url]); | ||
} | ||
|
||
function fetchBeaconData(url) { | ||
debug('fetch beacon data', url); | ||
const request = new Request(searchServiceUrl, { | ||
method: 'post', | ||
headers: new Headers({ 'Content-Type': 'application/json;charset=utf-8' }), | ||
body: JSON.stringify([url]), | ||
}); | ||
|
||
return fetch(request) | ||
.then(res => res.json()) | ||
.catch(() => { | ||
debug('no beacon data', url); | ||
return []; | ||
}); | ||
} |
File renamed without changes.
Oops, something went wrong.