-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send push notifications according to users local timezone (#154)
Resolves #138
- Loading branch information
Showing
18 changed files
with
365 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,4 +149,4 @@ | |
"typescript": "3.7.4", | ||
"typescript-tslint-plugin": "^0.5.5" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
// @generated | ||
// This file was automatically generated and should not be edited. | ||
|
||
import { SettingInput } from "./globalTypes"; | ||
|
||
// ==================================================== | ||
// GraphQL mutation operation: PushTimezone | ||
// ==================================================== | ||
|
||
export interface PushTimezone { | ||
/** | ||
* Updates a setting | ||
*/ | ||
putSetting: boolean | null; | ||
} | ||
|
||
export interface PushTimezoneVariables { | ||
input: SettingInput; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { NormalizedCacheObject } from 'apollo-cache-inmemory'; | ||
import { ApolloClient } from 'apollo-client'; | ||
import gql from 'graphql-tag'; | ||
import { AsyncStorage } from 'react-native'; | ||
import { cachedAolloClient } from '../../apollo/bootstrapApollo'; | ||
import { I18N } from '../../i18n/translation'; | ||
import { SettingName } from '../../model/graphql/globalTypes'; | ||
import { PushTimezone, PushTimezoneVariables } from '../../model/graphql/PushTimezone'; | ||
|
||
const TIMEZONE_KEY = 'setting:timezone'; | ||
|
||
export function* pushTimezone() { | ||
const client: ApolloClient<NormalizedCacheObject> = cachedAolloClient(); | ||
|
||
const kownTimezone = yield AsyncStorage.getItem(TIMEZONE_KEY); | ||
const value = I18N.timezone; | ||
|
||
if (kownTimezone !== value) { | ||
yield client.mutate<PushTimezone, PushTimezoneVariables>({ | ||
mutation: gql` | ||
mutation PushTimezone($input: SettingInput!) { | ||
putSetting (setting: $input) | ||
}`, | ||
variables: { | ||
input: { | ||
value, | ||
name: SettingName.timezone, | ||
}, | ||
}, | ||
}); | ||
|
||
yield AsyncStorage.setItem(TIMEZONE_KEY, value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.