add flag for dispatching doInstallNew from doAuthenticate (#87)
* add doInstallNewWithParams action * return dispatch for doInstallNewWithParams
This commit is contained in:
parent
f82ef0e5cc
commit
54906cb768
4 changed files with 81 additions and 5 deletions
26
dist/bundle.es.js
vendored
26
dist/bundle.es.js
vendored
|
@ -1298,9 +1298,27 @@ function doInstallNew(appVersion, os = null, firebaseToken = null, callbackForUs
|
|||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function doInstallNewWithParams(appVersion, installationId, nodeId, lbrynetVersion, os, platform, firebaseToken = null) {
|
||||
return dispatch => {
|
||||
const payload = {
|
||||
app_version: appVersion
|
||||
};
|
||||
|
||||
if (firebaseToken) {
|
||||
payload.firebase_token = firebaseToken;
|
||||
}
|
||||
|
||||
payload.app_id = installationId;
|
||||
payload.node_id = nodeId;
|
||||
payload.daemon_version = lbrynetVersion;
|
||||
payload.operating_system = os;
|
||||
payload.platform = platform;
|
||||
Lbryio.call('install', 'new', payload);
|
||||
};
|
||||
} // TODO: Call doInstallNew separately so we don't have to pass appVersion and os_system params?
|
||||
|
||||
function doAuthenticate(appVersion, os = null, firebaseToken = null, shareUsageData = true, callbackForUsersWhoAreSharingData) {
|
||||
function doAuthenticate(appVersion, os = null, firebaseToken = null, shareUsageData = true, callbackForUsersWhoAreSharingData, callInstall = true) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: AUTHENTICATION_STARTED
|
||||
|
@ -1318,7 +1336,10 @@ function doAuthenticate(appVersion, os = null, firebaseToken = null, shareUsageD
|
|||
if (shareUsageData) {
|
||||
dispatch(doRewardList());
|
||||
dispatch(doFetchInviteStatus());
|
||||
doInstallNew(appVersion, os, firebaseToken, callbackForUsersWhoAreSharingData);
|
||||
|
||||
if (callInstall) {
|
||||
doInstallNew(appVersion, os, firebaseToken, callbackForUsersWhoAreSharingData);
|
||||
}
|
||||
}
|
||||
});
|
||||
}).catch(error => {
|
||||
|
@ -3659,6 +3680,7 @@ exports.doFilteredOutpointsSubscribe = doFilteredOutpointsSubscribe;
|
|||
exports.doGenerateAuthToken = doGenerateAuthToken;
|
||||
exports.doGetSync = doGetSync;
|
||||
exports.doInstallNew = doInstallNew;
|
||||
exports.doInstallNewWithParams = doInstallNewWithParams;
|
||||
exports.doRemoveUnreadSubscription = doRemoveUnreadSubscription;
|
||||
exports.doRemoveUnreadSubscriptions = doRemoveUnreadSubscriptions;
|
||||
exports.doResetSync = doResetSync;
|
||||
|
|
28
dist/bundle.js
vendored
28
dist/bundle.js
vendored
|
@ -173,6 +173,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
|
||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doInstallNew", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_11__["doInstallNew"]; });
|
||||
|
||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doInstallNewWithParams", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_11__["doInstallNewWithParams"]; });
|
||||
|
||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doAuthenticate", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_11__["doAuthenticate"]; });
|
||||
|
||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doUserFetch", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_11__["doUserFetch"]; });
|
||||
|
@ -4827,6 +4829,7 @@ var selectYouTubeImportVideosComplete = Object(reselect__WEBPACK_IMPORTED_MODULE
|
|||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doFetchInviteStatus", function() { return doFetchInviteStatus; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doInstallNew", function() { return doInstallNew; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doInstallNewWithParams", function() { return doInstallNewWithParams; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doAuthenticate", function() { return doAuthenticate; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserFetch", function() { return doUserFetch; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserCheckEmailVerified", function() { return doUserCheckEmailVerified; });
|
||||
|
@ -4927,6 +4930,25 @@ function doInstallNew(appVersion) {
|
|||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function doInstallNewWithParams(appVersion, installationId, nodeId, lbrynetVersion, os, platform) {
|
||||
var firebaseToken = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
||||
return function (dispatch) {
|
||||
var payload = {
|
||||
app_version: appVersion
|
||||
};
|
||||
|
||||
if (firebaseToken) {
|
||||
payload.firebase_token = firebaseToken;
|
||||
}
|
||||
|
||||
payload.app_id = installationId;
|
||||
payload.node_id = nodeId;
|
||||
payload.daemon_version = lbrynetVersion;
|
||||
payload.operating_system = os;
|
||||
payload.platform = platform;
|
||||
lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].call('install', 'new', payload);
|
||||
};
|
||||
} // TODO: Call doInstallNew separately so we don't have to pass appVersion and os_system params?
|
||||
|
||||
function doAuthenticate(appVersion) {
|
||||
|
@ -4934,6 +4956,7 @@ function doAuthenticate(appVersion) {
|
|||
var firebaseToken = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
||||
var shareUsageData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
var callbackForUsersWhoAreSharingData = arguments.length > 4 ? arguments[4] : undefined;
|
||||
var callInstall = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
|
||||
return function (dispatch) {
|
||||
dispatch({
|
||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_STARTED"]
|
||||
|
@ -4951,7 +4974,10 @@ function doAuthenticate(appVersion) {
|
|||
if (shareUsageData) {
|
||||
dispatch(Object(redux_actions_rewards__WEBPACK_IMPORTED_MODULE_2__["doRewardList"])());
|
||||
dispatch(doFetchInviteStatus());
|
||||
doInstallNew(appVersion, os, firebaseToken, callbackForUsersWhoAreSharingData);
|
||||
|
||||
if (callInstall) {
|
||||
doInstallNew(appVersion, os, firebaseToken, callbackForUsersWhoAreSharingData);
|
||||
}
|
||||
}
|
||||
});
|
||||
})["catch"](function (error) {
|
||||
|
|
|
@ -47,6 +47,7 @@ export {
|
|||
export {
|
||||
doFetchInviteStatus,
|
||||
doInstallNew,
|
||||
doInstallNewWithParams,
|
||||
doAuthenticate,
|
||||
doUserFetch,
|
||||
doUserEmailNew,
|
||||
|
|
|
@ -72,13 +72,38 @@ export function doInstallNew(
|
|||
});
|
||||
}
|
||||
|
||||
export function doInstallNewWithParams(
|
||||
appVersion,
|
||||
installationId,
|
||||
nodeId,
|
||||
lbrynetVersion,
|
||||
os,
|
||||
platform,
|
||||
firebaseToken = null
|
||||
) {
|
||||
return dispatch => {
|
||||
const payload = { app_version: appVersion };
|
||||
if (firebaseToken) {
|
||||
payload.firebase_token = firebaseToken;
|
||||
}
|
||||
|
||||
payload.app_id = installationId;
|
||||
payload.node_id = nodeId;
|
||||
payload.daemon_version = lbrynetVersion;
|
||||
payload.operating_system = os;
|
||||
payload.platform = platform;
|
||||
Lbryio.call('install', 'new', payload);
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: Call doInstallNew separately so we don't have to pass appVersion and os_system params?
|
||||
export function doAuthenticate(
|
||||
appVersion,
|
||||
os = null,
|
||||
firebaseToken = null,
|
||||
shareUsageData = true,
|
||||
callbackForUsersWhoAreSharingData
|
||||
callbackForUsersWhoAreSharingData,
|
||||
callInstall = true
|
||||
) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
|
@ -96,7 +121,9 @@ export function doAuthenticate(
|
|||
if (shareUsageData) {
|
||||
dispatch(doRewardList());
|
||||
dispatch(doFetchInviteStatus());
|
||||
doInstallNew(appVersion, os, firebaseToken, callbackForUsersWhoAreSharingData);
|
||||
if (callInstall) {
|
||||
doInstallNew(appVersion, os, firebaseToken, callbackForUsersWhoAreSharingData);
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue