lbry.tv hybrid mode #132
11 changed files with 81 additions and 97 deletions
|
@ -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",
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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,27 +67,25 @@ class SplashScreen extends React.PureComponent {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
updateStatus() {
|
authenticateWithoutSdk() {
|
||||||
const { authenticate } = this.props;
|
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;
|
const { liteMode } = this.state;
|
||||||
|
|
||||||
if (liteMode) {
|
// authenticate immediately
|
||||||
// authenticate immediately
|
this.authenticateWithoutSdk();
|
||||||
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);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
navigateToMain = () => {
|
navigateToMain = () => {
|
||||||
|
@ -121,40 +120,50 @@ 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) {
|
||||||
this.setState({ shouldAuthenticate: false }, () => {
|
if (daemonReady || authWithoutSdk) {
|
||||||
// call install new after successful authentication
|
this.setState({ shouldAuthenticate: false }, () => {
|
||||||
if (liteMode) {
|
// call install new after successful authentication
|
||||||
const { installationId, nodeId, lbrynetVersion, platform } = liteModeParams;
|
if (authWithoutSdk) {
|
||||||
installNewWithParams(
|
const { installationId, nodeId, lbrynetVersion, platform } = liteModeParams;
|
||||||
appVersion,
|
installNewWithParams(
|
||||||
installationId,
|
appVersion,
|
||||||
nodeId,
|
installationId,
|
||||||
lbrynetVersion,
|
nodeId,
|
||||||
Platform.OS,
|
lbrynetVersion,
|
||||||
platform,
|
Platform.OS,
|
||||||
firebaseToken,
|
platform,
|
||||||
);
|
firebaseToken,
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// user is authenticated, navigate to the main view
|
// user is authenticated, navigate to the main view
|
||||||
if (user.has_verified_email) {
|
if (user.has_verified_email) {
|
||||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||||
getSync(walletPassword, () => {
|
getSync(walletPassword, () => {
|
||||||
this.getUserSettings();
|
this.getUserSettings();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
this.navigateToMain();
|
||||||
this.navigateToMain();
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
this.navigateToMain();
|
this.navigateToMain();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 = () => {
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue