Merge pull request #69 from lbryio/fcm

add firebaseToken argument
This commit is contained in:
Akinwale Ariwodola 2019-10-15 10:22:14 +01:00 committed by GitHub
commit 367d987e1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 7 deletions

11
dist/bundle.es.js vendored
View file

@ -1161,10 +1161,15 @@ function doFetchInviteStatus() {
});
};
}
function doInstallNew(appVersion, os = null) {
function doInstallNew(appVersion, os = null, firebaseToken = null) {
const payload = {
app_version: appVersion
};
if (firebaseToken) {
payload.firebase_token = firebaseToken;
}
lbryRedux.Lbry.status().then(status => {
payload.app_id = status.installation_id;
payload.node_id = status.lbry_id;
@ -1177,7 +1182,7 @@ function doInstallNew(appVersion, os = null) {
});
} // TODO: Call doInstallNew separately so we don't have to pass appVersion and os_system params?
function doAuthenticate(appVersion, os = null) {
function doAuthenticate(appVersion, os = null, firebaseToken = null) {
return dispatch => {
dispatch({
type: AUTHENTICATION_STARTED
@ -1192,7 +1197,7 @@ function doAuthenticate(appVersion, os = null) {
});
dispatch(doRewardList());
dispatch(doFetchInviteStatus());
doInstallNew(appVersion, os);
doInstallNew(appVersion, os, firebaseToken);
}).catch(error => {
dispatch({
type: AUTHENTICATION_FAILURE,

9
dist/bundle.js vendored
View file

@ -2631,9 +2631,15 @@ 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 payload = {
app_version: appVersion
};
if (firebaseToken) {
payload.firebase_token = firebaseToken;
}
lbry_redux__WEBPACK_IMPORTED_MODULE_0__["Lbry"].status().then(function (status) {
payload.app_id = status.installation_id;
payload.node_id = status.lbry_id;
@ -2648,6 +2654,7 @@ function doInstallNew(appVersion) {
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;
return function (dispatch) {
dispatch({
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_STARTED"]
@ -2662,7 +2669,7 @@ function doAuthenticate(appVersion) {
});
dispatch(Object(redux_actions_rewards__WEBPACK_IMPORTED_MODULE_2__["doRewardList"])());
dispatch(doFetchInviteStatus());
doInstallNew(appVersion, os);
doInstallNew(appVersion, os, firebaseToken);
})["catch"](function (error) {
dispatch({
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_FAILURE"],

View file

@ -37,8 +37,12 @@ export function doFetchInviteStatus() {
};
}
export function doInstallNew(appVersion, os = null) {
export function doInstallNew(appVersion, os = null, firebaseToken = null) {
const payload = { app_version: appVersion };
if (firebaseToken) {
payload.firebase_token = firebaseToken;
}
Lbry.status().then(status => {
payload.app_id = status.installation_id;
payload.node_id = status.lbry_id;
@ -52,7 +56,7 @@ export function doInstallNew(appVersion, os = null) {
}
// TODO: Call doInstallNew separately so we don't have to pass appVersion and os_system params?
export function doAuthenticate(appVersion, os = null) {
export function doAuthenticate(appVersion, os = null, firebaseToken = null) {
return dispatch => {
dispatch({
type: ACTIONS.AUTHENTICATION_STARTED,
@ -67,7 +71,7 @@ export function doAuthenticate(appVersion, os = null) {
});
dispatch(doRewardList());
dispatch(doFetchInviteStatus());
doInstallNew(appVersion, os);
doInstallNew(appVersion, os, firebaseToken);
})
.catch(error => {
dispatch({