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",
"@expo/vector-icons": "^8.1.0",
"gfycat-style-urls": "^1.0.3",
"lbry-redux": "lbryio/lbry-redux#84e697079968364fe526020086c8a44f4d2ef391",
"lbryinc": "lbryio/lbryinc#28afb9b06c3d142bad8347939c043a21b6cb1ae1",
"lbry-redux": "lbryio/lbry-redux#81f58e3ac7b0a5f8447cc97af36dc7f130bdc6fa",
"lbryinc": "lbryio/lbryinc#021ac75d9aa2db488cfff8e9be320402f038f955",
"lodash": ">=4.17.11",
"merge": ">=1.2.1",
"moment": "^2.22.1",

View file

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

View file

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

View file

@ -32,11 +32,8 @@ const select = (state, props) => ({
});
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)),
});
export default connect(
select,
perform,
)(ClaimResultItem);
export default connect(select, perform)(ClaimResultItem);

View file

@ -31,11 +31,8 @@ const select = (state, props) => ({
});
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)),
});
export default connect(
select,
perform,
)(FileItem);
export default connect(select, perform)(FileItem);

View file

@ -32,11 +32,8 @@ const select = (state, props) => ({
});
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)),
});
export default connect(
select,
perform,
)(FileListItem);
export default connect(select, perform)(FileListItem);

View file

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

View file

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

View file

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

View file

@ -23,6 +23,7 @@ class SplashScreen extends React.PureComponent {
};
state = {
authWithoutSdk: false,
accountUnlockFailed: false,
appVersion: null,
daemonReady: false,
@ -53,7 +54,7 @@ class SplashScreen extends React.PureComponent {
liteModeParams: {
installationId: installIdContent,
nodeId: null,
lbrynetVersion: '0.62.0',
lbrynetVersion: '0.64.0',
platform,
},
},
@ -66,27 +67,25 @@ class SplashScreen extends React.PureComponent {
});
};
updateStatus() {
authenticateWithoutSdk() {
const { authenticate } = this.props;
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
this.setState({ appVersion, shouldAuthenticate: true, authWithoutSdk: true });
NativeModules.Firebase.getMessagingToken()
.then(firebaseToken => {
this.setState({ firebaseToken }, () => authenticate(appVersion, Platform.OS, firebaseToken, false));
})
.catch(() => {
authenticate(appVersion, Platform.OS, null, false);
});
});
}
updateStatus() {
const { liteMode } = this.state;
if (liteMode) {
// authenticate immediately
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
this.setState({ appVersion, shouldAuthenticate: true });
NativeModules.Firebase.getMessagingToken()
.then(firebaseToken => {
this.setState({ firebaseToken }, () => authenticate(appVersion, Platform.OS, firebaseToken, false));
})
.catch(() => {
authenticate(appVersion, Platform.OS, null, false);
});
});
} else {
Lbry.status().then(status => {
this._updateStatusCallback(status);
});
}
// authenticate immediately
this.authenticateWithoutSdk();
}
navigateToMain = () => {
@ -121,40 +120,50 @@ class SplashScreen extends React.PureComponent {
componentWillReceiveProps(nextProps) {
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;
if (liteMode && user && user.id) {
this.navigateToLiteMode();
} else if (daemonReady && shouldAuthenticate && user && user.id) {
this.setState({ shouldAuthenticate: false }, () => {
// call install new after successful authentication
if (liteMode) {
const { installationId, nodeId, lbrynetVersion, platform } = liteModeParams;
installNewWithParams(
appVersion,
installationId,
nodeId,
lbrynetVersion,
Platform.OS,
platform,
firebaseToken,
);
}
} else if (shouldAuthenticate && user && user.id) {
if (daemonReady || authWithoutSdk) {
this.setState({ shouldAuthenticate: false }, () => {
// call install new after successful authentication
if (authWithoutSdk) {
const { installationId, nodeId, lbrynetVersion, platform } = liteModeParams;
installNewWithParams(
appVersion,
installationId,
nodeId,
lbrynetVersion,
Platform.OS,
platform,
firebaseToken,
);
}
// user is authenticated, navigate to the main view
if (user.has_verified_email) {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
getSync(walletPassword, () => {
this.getUserSettings();
// user is authenticated, navigate to the main view
if (user.has_verified_email) {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
getSync(walletPassword, () => {
this.getUserSettings();
});
});
});
this.navigateToMain();
return;
}
this.navigateToMain();
return;
}
this.navigateToMain();
});
this.navigateToMain();
});
}
}
}
@ -357,11 +366,7 @@ class SplashScreen extends React.PureComponent {
}
// Only connect after checking initial launch url / notification launch target
if (liteMode) {
this.initLiteMode();
} else {
this.lbryConnect();
}
this.initLiteMode();
});
});
@ -377,6 +382,8 @@ class SplashScreen extends React.PureComponent {
}
lbryConnect = () => {
this.updateStatus(); // skip lbry.connect for now (unless dht flag is enabled)
/*
Lbry.connect()
.then(() => {
this.updateStatus();
@ -390,6 +397,7 @@ class SplashScreen extends React.PureComponent {
),
});
});
*/
};
handleContinueAnywayPressed = () => {

View file

@ -4591,17 +4591,17 @@ latest-version@^3.0.0:
dependencies:
package-json "^4.0.0"
lbry-redux@lbryio/lbry-redux#84e697079968364fe526020086c8a44f4d2ef391:
lbry-redux@lbryio/lbry-redux#81f58e3ac7b0a5f8447cc97af36dc7f130bdc6fa:
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:
proxy-polyfill "0.1.6"
reselect "^3.0.0"
uuid "^3.3.2"
lbryinc@lbryio/lbryinc#28afb9b06c3d142bad8347939c043a21b6cb1ae1:
lbryinc@lbryio/lbryinc#021ac75d9aa2db488cfff8e9be320402f038f955:
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:
reselect "^3.0.0"