forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Expensify#32180 from fabioh8010/ts/lib/PushNotific…
…ation [TS migration] Migrate 'PushNotification' lib to TypeScript
- Loading branch information
Showing
18 changed files
with
188 additions
and
103 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
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
6 changes: 5 additions & 1 deletion
6
...fication/ForegroundNotifications/index.js → ...fication/ForegroundNotifications/index.ts
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 |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import ForegroundNotificationsModule from './types'; | ||
|
||
/** | ||
* Configures notification handling while in the foreground on iOS and Android. This is a no-op on other platforms. | ||
*/ | ||
export default { | ||
const ForegroundNotifications: ForegroundNotificationsModule = { | ||
configureForegroundNotifications: () => {}, | ||
disableForegroundNotifications: () => {}, | ||
}; | ||
|
||
export default ForegroundNotifications; |
6 changes: 6 additions & 0 deletions
6
src/libs/Notification/PushNotification/ForegroundNotifications/types.ts
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,6 @@ | ||
type ForegroundNotificationsModule = { | ||
configureForegroundNotifications: () => void; | ||
disableForegroundNotifications: () => void; | ||
}; | ||
|
||
export default ForegroundNotificationsModule; |
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
src/libs/Notification/PushNotification/NotificationType.ts
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,28 @@ | ||
import {OnyxServerUpdate} from '@src/types/onyx/OnyxUpdatesFromServer'; | ||
|
||
const NotificationType = { | ||
REPORT_COMMENT: 'reportComment', | ||
} as const; | ||
|
||
type NotificationDataMap = { | ||
[NotificationType.REPORT_COMMENT]: ReportCommentNotificationData; | ||
}; | ||
|
||
type NotificationData = ReportCommentNotificationData; | ||
|
||
type ReportCommentNotificationData = { | ||
title: string; | ||
type: typeof NotificationType.REPORT_COMMENT; | ||
reportID: number; | ||
reportActionID: string; | ||
shouldScrollToLastUnread?: boolean; | ||
roomName?: string; | ||
onyxData?: OnyxServerUpdate[]; | ||
}; | ||
|
||
/** | ||
* See https://github.com/Expensify/Web-Expensify/blob/main/lib/MobilePushNotifications.php for the various | ||
* types of push notifications sent by our API. | ||
*/ | ||
export default NotificationType; | ||
export type {NotificationDataMap, NotificationData, ReportCommentNotificationData}; |
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
6 changes: 5 additions & 1 deletion
6
...shNotification/backgroundRefresh/index.js → ...shNotification/backgroundRefresh/index.ts
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 |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import BackgroundRefresh from './types'; | ||
|
||
/** | ||
* Runs our reconnectApp action if the app is in the background. | ||
* | ||
* We use this to refresh the app in the background after receiving a push notification (native only). Since the full app | ||
* wakes on iOS and by extension runs reconnectApp already, this is a no-op on everything but Android. | ||
*/ | ||
export default function backgroundRefresh() {} | ||
const backgroundRefresh: BackgroundRefresh = () => {}; | ||
|
||
export default backgroundRefresh; |
3 changes: 3 additions & 0 deletions
3
src/libs/Notification/PushNotification/backgroundRefresh/types.ts
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,3 @@ | ||
type BackgroundRefresh = () => void; | ||
|
||
export default BackgroundRefresh; |
Oops, something went wrong.