add callback param for doAuthenticate that returns the status

This commit is contained in:
Sean Yesmunt 2020-03-12 12:19:42 -04:00
parent 275f35b31e
commit b27a99aaa3
3 changed files with 27 additions and 9 deletions

11
dist/bundle.es.js vendored
View file

@ -1275,7 +1275,7 @@ function doFetchInviteStatus() {
});
};
}
function doInstallNew(appVersion, os = null, firebaseToken = null) {
function doInstallNew(appVersion, os = null, firebaseToken = null, callback) {
const payload = {
app_version: appVersion
};
@ -1292,11 +1292,15 @@ function doInstallNew(appVersion, os = null, firebaseToken = null) {
payload.operating_system = os || version.os_system;
payload.platform = version.platform;
Lbryio.call('install', 'new', payload);
if (callback) {
callback(status);
}
});
});
} // 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) {
function doAuthenticate(appVersion, os = null, firebaseToken = null, shareUsageData = true, callback) {
return dispatch => {
dispatch({
type: AUTHENTICATION_STARTED
@ -1314,7 +1318,7 @@ function doAuthenticate(appVersion, os = null, firebaseToken = null, shareUsageD
if (shareUsageData) {
dispatch(doRewardList());
dispatch(doFetchInviteStatus());
doInstallNew(appVersion, os, firebaseToken);
doInstallNew(appVersion, os, firebaseToken, callback);
}
});
}).catch(error => {
@ -2698,7 +2702,6 @@ function doGetSync(passedPassword, callback) {
}
handleCallback(syncAttemptError);
return;
} else if (data.hasSyncedWallet) {
const error = 'Error getting synced wallet';
dispatch({

9
dist/bundle.js vendored
View file

@ -4904,6 +4904,7 @@ function doFetchInviteStatus() {
function doInstallNew(appVersion) {
var os = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var firebaseToken = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var callback = arguments.length > 3 ? arguments[3] : undefined;
var payload = {
app_version: appVersion
};
@ -4920,6 +4921,10 @@ function doInstallNew(appVersion) {
payload.operating_system = os || version.os_system;
payload.platform = version.platform;
lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].call('install', 'new', payload);
if (callback) {
callback(status);
}
});
});
} // TODO: Call doInstallNew separately so we don't have to pass appVersion and os_system params?
@ -4928,6 +4933,7 @@ function doAuthenticate(appVersion) {
var os = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var firebaseToken = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var shareUsageData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
var callback = arguments.length > 4 ? arguments[4] : undefined;
return function (dispatch) {
dispatch({
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_STARTED"]
@ -4945,7 +4951,7 @@ function doAuthenticate(appVersion) {
if (shareUsageData) {
dispatch(Object(redux_actions_rewards__WEBPACK_IMPORTED_MODULE_2__["doRewardList"])());
dispatch(doFetchInviteStatus());
doInstallNew(appVersion, os, firebaseToken);
doInstallNew(appVersion, os, firebaseToken, callback);
}
});
})["catch"](function (error) {
@ -6467,7 +6473,6 @@ function doGetSync(passedPassword, callback) {
}
handleCallback(syncAttemptError);
return;
} else if (data.hasSyncedWallet) {
var error = 'Error getting synced wallet';
dispatch({

View file

@ -45,7 +45,7 @@ export function doFetchInviteStatus() {
};
}
export function doInstallNew(appVersion, os = null, firebaseToken = null) {
export function doInstallNew(appVersion, os = null, firebaseToken = null, callback) {
const payload = { app_version: appVersion };
if (firebaseToken) {
payload.firebase_token = firebaseToken;
@ -59,12 +59,22 @@ export function doInstallNew(appVersion, os = null, firebaseToken = null) {
payload.operating_system = os || version.os_system;
payload.platform = version.platform;
Lbryio.call('install', 'new', payload);
if (callback) {
callback(status);
}
});
});
}
// 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) {
export function doAuthenticate(
appVersion,
os = null,
firebaseToken = null,
shareUsageData = true,
callback
) {
return dispatch => {
dispatch({
type: ACTIONS.AUTHENTICATION_STARTED,
@ -81,7 +91,7 @@ export function doAuthenticate(appVersion, os = null, firebaseToken = null, shar
if (shareUsageData) {
dispatch(doRewardList());
dispatch(doFetchInviteStatus());
doInstallNew(appVersion, os, firebaseToken);
doInstallNew(appVersion, os, firebaseToken, callback);
}
});
})