aboutsummaryrefslogtreecommitdiff
path: root/src/screens/onboarding
diff options
context:
space:
mode:
authorShravya Ramesh <37447613+shravyaramesh@users.noreply.github.com>2020-12-29 11:41:57 -0800
committerGitHub <noreply@github.com>2020-12-29 14:41:57 -0500
commit05cd91206a6ce3361097d9eb408a447eae3d120e (patch)
tree1b8c5ba82358c3f9b393ea42d03b6c9c7219ce7f /src/screens/onboarding
parentefaa41884b5aa4b4704380eb3615d3801958a775 (diff)
[TMA-288] notifications frontend infra (#154)
* Configured settings to enable remote notifications * Added FCM services * Added background message handler + api calls * minor fixes * minor changes requested from pr
Diffstat (limited to 'src/screens/onboarding')
-rw-r--r--src/screens/onboarding/CategorySelection.tsx3
-rw-r--r--src/screens/onboarding/Login.tsx3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/screens/onboarding/CategorySelection.tsx b/src/screens/onboarding/CategorySelection.tsx
index f92b7e39..b9677ed4 100644
--- a/src/screens/onboarding/CategorySelection.tsx
+++ b/src/screens/onboarding/CategorySelection.tsx
@@ -21,7 +21,7 @@ import {MOMENT_CATEGORIES} from '../../constants';
import {OnboardingStackParams} from '../../routes';
import {StackNavigationProp} from '@react-navigation/stack';
import {getTokenOrLogout, userLogin} from '../../utils';
-import {postMomentCategories} from '../../services';
+import {fcmService, postMomentCategories} from '../../services';
import {updateMomentCategories} from '../../store/actions/momentCategories';
import {ScrollView} from 'react-native-gesture-handler';
@@ -135,6 +135,7 @@ const CategorySelection: React.FC<CategorySelectionProps> = ({
const token = await getTokenOrLogout(dispatch);
await postMomentCategories(selectedCategories, token);
userLogin(dispatch, {userId: userId, username: username});
+ fcmService.sendFcmTokenToServer();
} else {
dispatch(updateMomentCategories(selectedCategories, true, userId));
navigation.goBack();
diff --git a/src/screens/onboarding/Login.tsx b/src/screens/onboarding/Login.tsx
index 1315fdf5..3e59b00e 100644
--- a/src/screens/onboarding/Login.tsx
+++ b/src/screens/onboarding/Login.tsx
@@ -12,7 +12,7 @@ import {
KeyboardAvoidingView,
Platform,
} from 'react-native';
-
+import {fcmService} from '../../services';
import {OnboardingStackParams} from '../../routes/onboarding';
import {Background, TaggInput, SubmitButton} from '../../components';
import {usernameRegex, LOGIN_ENDPOINT} from '../../constants';
@@ -164,6 +164,7 @@ const Login: React.FC<LoginProps> = ({navigation}: LoginProps) => {
await AsyncStorage.setItem('userId', data.UserID);
await AsyncStorage.setItem('username', username);
userLogin(dispatch, {userId: data.UserID, username});
+ fcmService.sendFcmTokenToServer();
} catch (err) {
setUser(NO_USER);
console.log(data);