use lbry.tv for resolve and claim_search

This commit is contained in:
Akinwale Ariwodola 2020-03-17 22:58:29 +01:00
parent 4645a8f412
commit 65ef911773
11 changed files with 81 additions and 97 deletions

View file

@ -15,8 +15,8 @@
"base-64": "^0.1.0", "base-64": "^0.1.0",
"@expo/vector-icons": "^8.1.0", "@expo/vector-icons": "^8.1.0",
"gfycat-style-urls": "^1.0.3", "gfycat-style-urls": "^1.0.3",
"lbry-redux": "lbryio/lbry-redux#84e697079968364fe526020086c8a44f4d2ef391", "lbry-redux": "lbryio/lbry-redux#81f58e3ac7b0a5f8447cc97af36dc7f130bdc6fa",
"lbryinc": "lbryio/lbryinc#28afb9b06c3d142bad8347939c043a21b6cb1ae1", "lbryinc": "lbryio/lbryinc#021ac75d9aa2db488cfff8e9be320402f038f955",
"lodash": ">=4.17.11", "lodash": ">=4.17.11",
"merge": ">=1.2.1", "merge": ">=1.2.1",
"moment": "^2.22.1", "moment": "^2.22.1",

View file

@ -16,10 +16,7 @@ const select = (state, props) => ({
}); });
const perform = dispatch => ({ const perform = dispatch => ({
resolveUri: uri => dispatch(doResolveUri(uri)), resolveUri: uri => dispatch(doResolveUri(uri, 'https://api.lbry.tv/api/v1/proxy')),
}); });
export default connect( export default connect(select, perform)(ChannelIconItem);
select,
perform
)(ChannelIconItem);

View file

@ -20,10 +20,7 @@ const select = state => ({
}); });
const perform = dispatch => ({ const perform = dispatch => ({
claimSearch: options => dispatch(doClaimSearch(options)), claimSearch: options => dispatch(doClaimSearch(options, 'https://api.lbry.tv/api/v1/proxy')),
}); });
export default connect( export default connect(select, perform)(ClaimList);
select,
perform,
)(ClaimList);

View file

@ -32,11 +32,8 @@ const select = (state, props) => ({
}); });
const perform = dispatch => ({ const perform = dispatch => ({
resolveUri: uri => dispatch(doResolveUri(uri)), resolveUri: uri => dispatch(doResolveUri(uri, 'https://api.lbry.tv/api/v1/proxy')),
setPlayerVisible: (visible, uri) => dispatch(doSetPlayerVisible(visible, uri)), setPlayerVisible: (visible, uri) => dispatch(doSetPlayerVisible(visible, uri)),
}); });
export default connect( export default connect(select, perform)(ClaimResultItem);
select,
perform,
)(ClaimResultItem);

View file

@ -31,11 +31,8 @@ const select = (state, props) => ({
}); });
const perform = dispatch => ({ const perform = dispatch => ({
resolveUri: uri => dispatch(doResolveUri(uri)), resolveUri: uri => dispatch(doResolveUri(uri, 'https://api.lbry.tv/api/v1/proxy')),
setPlayerVisible: (visible, uri) => dispatch(doSetPlayerVisible(visible, uri)), setPlayerVisible: (visible, uri) => dispatch(doSetPlayerVisible(visible, uri)),
}); });
export default connect( export default connect(select, perform)(FileItem);
select,
perform,
)(FileItem);

View file

@ -32,11 +32,8 @@ const select = (state, props) => ({
}); });
const perform = dispatch => ({ const perform = dispatch => ({
resolveUri: uri => dispatch(doResolveUri(uri)), resolveUri: uri => dispatch(doResolveUri(uri, 'https://api.lbry.tv/api/v1/proxy')),
setPlayerVisible: (visible, uri) => dispatch(doSetPlayerVisible(visible, uri)), setPlayerVisible: (visible, uri) => dispatch(doSetPlayerVisible(visible, uri)),
}); });
export default connect( export default connect(select, perform)(FileListItem);
select,
perform,
)(FileListItem);

View file

@ -18,12 +18,9 @@ const select = (state, props) => ({
}); });
const perform = dispatch => ({ const perform = dispatch => ({
resolveUri: uri => dispatch(doResolveUri(uri)), resolveUri: uri => dispatch(doResolveUri(uri, 'https://api.lbry.tv/api/v1/proxy')),
subscribe: subscription => doChannelSubscribe(subscription), subscribe: subscription => doChannelSubscribe(subscription),
unsubscribe: subscription => doChannelUnsubscribe(subscription), unsubscribe: subscription => doChannelUnsubscribe(subscription),
}); });
export default connect( export default connect(select, perform)(SuggestedSubscriptionItem);
select,
perform,
)(SuggestedSubscriptionItem);

View file

@ -13,10 +13,7 @@ const select = state => ({
}); });
const perform = dispatch => ({ const perform = dispatch => ({
claimSearch: options => dispatch(doClaimSearch(options)), claimSearch: options => dispatch(doClaimSearch(options, 'https://api.lbry.tv/api/v1/proxy')),
}); });
export default connect( export default connect(select, perform)(SuggestedSubscriptions);
select,
perform
)(SuggestedSubscriptions);

View file

@ -21,10 +21,7 @@ const select = state => ({
}); });
const perform = dispatch => ({ const perform = dispatch => ({
claimSearch: options => dispatch(doClaimSearch(options)), claimSearch: options => dispatch(doClaimSearch(options, 'https://api.lbry.tv/api/v1/proxy')),
}); });
export default connect( export default connect(select, perform)(SuggestedSubscriptionsGrid);
select,
perform,
)(SuggestedSubscriptionsGrid);

View file

@ -23,6 +23,7 @@ class SplashScreen extends React.PureComponent {
}; };
state = { state = {
authWithoutSdk: false,
accountUnlockFailed: false, accountUnlockFailed: false,
appVersion: null, appVersion: null,
daemonReady: false, daemonReady: false,
@ -53,7 +54,7 @@ class SplashScreen extends React.PureComponent {
liteModeParams: { liteModeParams: {
installationId: installIdContent, installationId: installIdContent,
nodeId: null, nodeId: null,
lbrynetVersion: '0.62.0', lbrynetVersion: '0.64.0',
platform, platform,
}, },
}, },
@ -66,14 +67,10 @@ class SplashScreen extends React.PureComponent {
}); });
}; };
updateStatus() { authenticateWithoutSdk() {
const { authenticate } = this.props; const { authenticate } = this.props;
const { liteMode } = this.state;
if (liteMode) {
// authenticate immediately
NativeModules.VersionInfo.getAppVersion().then(appVersion => { NativeModules.VersionInfo.getAppVersion().then(appVersion => {
this.setState({ appVersion, shouldAuthenticate: true }); this.setState({ appVersion, shouldAuthenticate: true, authWithoutSdk: true });
NativeModules.Firebase.getMessagingToken() NativeModules.Firebase.getMessagingToken()
.then(firebaseToken => { .then(firebaseToken => {
this.setState({ firebaseToken }, () => authenticate(appVersion, Platform.OS, firebaseToken, false)); this.setState({ firebaseToken }, () => authenticate(appVersion, Platform.OS, firebaseToken, false));
@ -82,11 +79,13 @@ class SplashScreen extends React.PureComponent {
authenticate(appVersion, Platform.OS, null, false); authenticate(appVersion, Platform.OS, null, false);
}); });
}); });
} else {
Lbry.status().then(status => {
this._updateStatusCallback(status);
});
} }
updateStatus() {
const { liteMode } = this.state;
// authenticate immediately
this.authenticateWithoutSdk();
} }
navigateToMain = () => { navigateToMain = () => {
@ -121,15 +120,24 @@ class SplashScreen extends React.PureComponent {
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
const { getSync, installNewWithParams } = this.props; const { getSync, installNewWithParams } = this.props;
const { daemonReady, shouldAuthenticate, liteMode, liteModeParams, appVersion, firebaseToken } = this.state; const {
daemonReady,
authWithoutSdk,
shouldAuthenticate,
liteMode,
liteModeParams,
appVersion,
firebaseToken,
} = this.state;
const { user } = nextProps; const { user } = nextProps;
if (liteMode && user && user.id) { if (liteMode && user && user.id) {
this.navigateToLiteMode(); this.navigateToLiteMode();
} else if (daemonReady && shouldAuthenticate && user && user.id) { } else if (shouldAuthenticate && user && user.id) {
if (daemonReady || authWithoutSdk) {
this.setState({ shouldAuthenticate: false }, () => { this.setState({ shouldAuthenticate: false }, () => {
// call install new after successful authentication // call install new after successful authentication
if (liteMode) { if (authWithoutSdk) {
const { installationId, nodeId, lbrynetVersion, platform } = liteModeParams; const { installationId, nodeId, lbrynetVersion, platform } = liteModeParams;
installNewWithParams( installNewWithParams(
appVersion, appVersion,
@ -157,6 +165,7 @@ class SplashScreen extends React.PureComponent {
}); });
} }
} }
}
navigateToLiteMode = () => { navigateToLiteMode = () => {
const { navigation } = this.props; const { navigation } = this.props;
@ -357,11 +366,7 @@ class SplashScreen extends React.PureComponent {
} }
// Only connect after checking initial launch url / notification launch target // Only connect after checking initial launch url / notification launch target
if (liteMode) {
this.initLiteMode(); this.initLiteMode();
} else {
this.lbryConnect();
}
}); });
}); });
@ -377,6 +382,8 @@ class SplashScreen extends React.PureComponent {
} }
lbryConnect = () => { lbryConnect = () => {
this.updateStatus(); // skip lbry.connect for now (unless dht flag is enabled)
/*
Lbry.connect() Lbry.connect()
.then(() => { .then(() => {
this.updateStatus(); this.updateStatus();
@ -390,6 +397,7 @@ class SplashScreen extends React.PureComponent {
), ),
}); });
}); });
*/
}; };
handleContinueAnywayPressed = () => { handleContinueAnywayPressed = () => {

View file

@ -4591,17 +4591,17 @@ latest-version@^3.0.0:
dependencies: dependencies:
package-json "^4.0.0" package-json "^4.0.0"
lbry-redux@lbryio/lbry-redux#84e697079968364fe526020086c8a44f4d2ef391: lbry-redux@lbryio/lbry-redux#81f58e3ac7b0a5f8447cc97af36dc7f130bdc6fa:
version "0.0.1" version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/84e697079968364fe526020086c8a44f4d2ef391" resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/81f58e3ac7b0a5f8447cc97af36dc7f130bdc6fa"
dependencies: dependencies:
proxy-polyfill "0.1.6" proxy-polyfill "0.1.6"
reselect "^3.0.0" reselect "^3.0.0"
uuid "^3.3.2" uuid "^3.3.2"
lbryinc@lbryio/lbryinc#28afb9b06c3d142bad8347939c043a21b6cb1ae1: lbryinc@lbryio/lbryinc#021ac75d9aa2db488cfff8e9be320402f038f955:
version "0.0.1" version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/28afb9b06c3d142bad8347939c043a21b6cb1ae1" resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/021ac75d9aa2db488cfff8e9be320402f038f955"
dependencies: dependencies:
reselect "^3.0.0" reselect "^3.0.0"