add callback param for doAuthenticate that returns the status #85

Merged
neb-b merged 2 commits from status-callback into master 2020-03-16 23:01:03 +01:00
3 changed files with 32 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, callbackForUsersWhoAreSharingData) {
const payload = { const payload = {
app_version: appVersion app_version: appVersion
}; };
@ -1292,11 +1292,15 @@ function doInstallNew(appVersion, os = null, firebaseToken = null) {
payload.operating_system = os || version.os_system; payload.operating_system = os || version.os_system;
payload.platform = version.platform; payload.platform = version.platform;
Lbryio.call('install', 'new', payload); Lbryio.call('install', 'new', payload);
if (callbackForUsersWhoAreSharingData) {
callbackForUsersWhoAreSharingData(status);
}
}); });
}); });
} // TODO: Call doInstallNew separately so we don't have to pass appVersion and os_system params? } // 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, callbackForUsersWhoAreSharingData) {
return dispatch => { return dispatch => {
dispatch({ dispatch({
type: AUTHENTICATION_STARTED type: AUTHENTICATION_STARTED
@ -1314,7 +1318,7 @@ function doAuthenticate(appVersion, os = null, firebaseToken = null, shareUsageD
if (shareUsageData) { if (shareUsageData) {
dispatch(doRewardList()); dispatch(doRewardList());
dispatch(doFetchInviteStatus()); dispatch(doFetchInviteStatus());
doInstallNew(appVersion, os, firebaseToken); doInstallNew(appVersion, os, firebaseToken, callbackForUsersWhoAreSharingData);
} }
}); });
}).catch(error => { }).catch(error => {
@ -2698,7 +2702,6 @@ function doGetSync(passedPassword, callback) {
} }
handleCallback(syncAttemptError); handleCallback(syncAttemptError);
return;
} else if (data.hasSyncedWallet) { } else if (data.hasSyncedWallet) {
const error = 'Error getting synced wallet'; const error = 'Error getting synced wallet';
dispatch({ dispatch({

9
dist/bundle.js vendored
View file

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

View file

@ -45,7 +45,12 @@ export function doFetchInviteStatus() {
}; };
} }
export function doInstallNew(appVersion, os = null, firebaseToken = null) { export function doInstallNew(
appVersion,
os = null,
firebaseToken = null,
callbackForUsersWhoAreSharingData
) {
const payload = { app_version: appVersion }; const payload = { app_version: appVersion };
if (firebaseToken) { if (firebaseToken) {
payload.firebase_token = firebaseToken; payload.firebase_token = firebaseToken;
@ -59,12 +64,22 @@ export function doInstallNew(appVersion, os = null, firebaseToken = null) {
payload.operating_system = os || version.os_system; payload.operating_system = os || version.os_system;
payload.platform = version.platform; payload.platform = version.platform;
Lbryio.call('install', 'new', payload); Lbryio.call('install', 'new', payload);
if (callbackForUsersWhoAreSharingData) {
callbackForUsersWhoAreSharingData(status);
}
}); });
}); });
} }
// TODO: Call doInstallNew separately so we don't have to pass appVersion and os_system params? // 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,
callbackForUsersWhoAreSharingData
) {
return dispatch => { return dispatch => {
dispatch({ dispatch({
type: ACTIONS.AUTHENTICATION_STARTED, type: ACTIONS.AUTHENTICATION_STARTED,
@ -81,7 +96,7 @@ export function doAuthenticate(appVersion, os = null, firebaseToken = null, shar
if (shareUsageData) { if (shareUsageData) {
dispatch(doRewardList()); dispatch(doRewardList());
dispatch(doFetchInviteStatus()); dispatch(doFetchInviteStatus());
doInstallNew(appVersion, os, firebaseToken); doInstallNew(appVersion, os, firebaseToken, callbackForUsersWhoAreSharingData);
} }
}); });
}) })