aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-02-09 16:27:34 -0500
committerIvan Chen <ivan@tagg.id>2021-02-11 17:46:32 -0500
commit5db2a2b38225a143e23ab635dbecadfb424a4546 (patch)
tree9d60d6378a0b52734bc6edc9db97bd3c6da95b8a /src
parentd494b27509066f4d1b61078f1fe6457f20d5f449 (diff)
added onboarded flag to store
Diffstat (limited to 'src')
-rw-r--r--src/services/UserProfileService.ts2
-rw-r--r--src/store/actions/user.ts19
-rw-r--r--src/store/initialStates.ts1
-rw-r--r--src/store/reducers/userReducer.ts5
-rw-r--r--src/types/types.ts1
5 files changed, 28 insertions, 0 deletions
diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts
index 3bca66f3..ce9bdda5 100644
--- a/src/services/UserProfileService.ts
+++ b/src/services/UserProfileService.ts
@@ -51,6 +51,7 @@ export const loadProfileInfo = async (token: string, userId: string) => {
university_class,
profile_completion_stage,
sp_swipe_tutorial,
+ // onboarded_sugggested_people,
friendship_status,
friendship_requester_id,
} = info;
@@ -70,6 +71,7 @@ export const loadProfileInfo = async (token: string, userId: string) => {
university_class,
profile_completion_stage,
sp_swipe_tutorial,
+ onboarded_sugggested_people: false,
friendship_status,
friendship_requester_id,
};
diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts
index 990f9260..bfbe9c80 100644
--- a/src/store/actions/user.ts
+++ b/src/store/actions/user.ts
@@ -12,6 +12,7 @@ import {
setIsOnboardedUser,
setNewNotificationReceived,
setNewVersionAvailable,
+ setOnboardedSuggestedPeople,
setReplyPosted,
socialEdited,
userDetailsFetched,
@@ -90,6 +91,24 @@ export const updateProfileCompletionStage = (
}
};
+// TODO: this should be called after a successful upload of a first SP image
+export const updateOnboardedSuggestedPeople = (
+ onboarded: boolean,
+ callback: () => {},
+): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
+ dispatch,
+) => {
+ try {
+ dispatch({
+ type: setOnboardedSuggestedPeople.type,
+ payload: {onboarded},
+ });
+ callback();
+ } catch (error) {
+ console.log(error);
+ }
+};
+
export const updateIsOnboardedUser = (
isOnboardedUser: boolean,
): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async (
diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts
index 93b1bc6e..31b39e82 100644
--- a/src/store/initialStates.ts
+++ b/src/store/initialStates.ts
@@ -22,6 +22,7 @@ export const NO_PROFILE: ProfileType = {
//Default to an invalid value and ignore it gracefully while showing tutorials / popups.
profile_completion_stage: -1,
sp_swipe_tutorial: 0,
+ onboarded_sugggested_people: false,
snapchat: '',
tiktok: '',
friendship_status: 'no_record',
diff --git a/src/store/reducers/userReducer.ts b/src/store/reducers/userReducer.ts
index 773977db..ea14c9ab 100644
--- a/src/store/reducers/userReducer.ts
+++ b/src/store/reducers/userReducer.ts
@@ -50,6 +50,10 @@ const userDataSlice = createSlice({
state.profile.sp_swipe_tutorial = action.payload.sp_swipe_tutorial;
},
+ setOnboardedSuggestedPeople: (state, action) => {
+ state.profile.onboarded_sugggested_people = action.payload.onboarded;
+ },
+
setIsOnboardedUser: (state, action) => {
state.isOnboardedUser = action.payload.isOnboardedUser;
},
@@ -73,6 +77,7 @@ export const {
userDetailsFetched,
socialEdited,
profileCompletionStageUpdated,
+ setOnboardedSuggestedPeople,
setIsOnboardedUser,
setNewVersionAvailable,
setNewNotificationReceived,
diff --git a/src/types/types.ts b/src/types/types.ts
index fe16fb8e..19eaa8f0 100644
--- a/src/types/types.ts
+++ b/src/types/types.ts
@@ -24,6 +24,7 @@ export interface ProfileType {
university_class: number;
profile_completion_stage: number;
sp_swipe_tutorial: number;
+ onboarded_sugggested_people: boolean;
birthday: Date | undefined;
snapchat: string;
tiktok: string;