Skip to content

Commit

Permalink
minor change in remove all activity
Browse files Browse the repository at this point in the history
  • Loading branch information
MayankSingh173 committed Jul 7, 2021
1 parent 33aa82a commit d3e078e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const App = () => {
AppState.addEventListener('change', async (state) => {
if (state === 'background' || state === 'inactive') {
//Remove activeOnGroup so that we can send notifications if there's any
await removeActivityFromUser(firebaseUser.uid);
await removeActivityFromUser(firebaseUser);
}
});

Expand Down
7 changes: 4 additions & 3 deletions src/utils/User/Methods/removeActivity.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import firestore from '@react-native-firebase/firestore';
import {UserInterface} from '../../../models/User/User';
import {writeAsync} from '../../Firestore/write';

export const removeActivityFromUser = async (uid: string) => {
export const removeActivityFromUser = async (firebaseUser: UserInterface) => {
try {
if (uid !== '') {
if (firebaseUser.activeOnGroup) {
await writeAsync(
'users',
uid,
firebaseUser.uid,
{activeOnGroup: firestore.FieldValue.delete()},
true,
);
Expand Down

0 comments on commit d3e078e

Please sign in to comment.