From 81eddd9bddd8fecc6e11c1d450dea7e5b1d6af1d Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Sun, 22 Mar 2020 10:22:57 +0100 Subject: [PATCH] Removed unused functions --- screens/About/DebugScreen.js | 29 +--------------- utils/NotificationsManager.js | 63 ----------------------------------- 2 files changed, 1 insertion(+), 91 deletions(-) diff --git a/screens/About/DebugScreen.js b/screens/About/DebugScreen.js index 09df31e..7c4700b 100644 --- a/screens/About/DebugScreen.js +++ b/screens/About/DebugScreen.js @@ -1,9 +1,8 @@ // @flow import * as React from 'react'; -import {Alert, Clipboard, ScrollView, View} from "react-native"; +import {ScrollView, View} from "react-native"; import AsyncStorageManager from "../../utils/AsyncStorageManager"; -import NotificationsManager from "../../utils/NotificationsManager"; import CustomModal from "../../components/CustomModal"; import {Button, Card, List, Subheading, TextInput, Title, withTheme} from 'react-native-paper'; @@ -59,23 +58,6 @@ class DebugScreen extends React.Component { } } - alertCurrentExpoToken() { - let token = AsyncStorageManager.getInstance().preferences.expoToken.current; - Alert.alert( - 'Expo Token', - token, - [ - {text: 'Copy', onPress: () => Clipboard.setString(token)}, - {text: 'OK'} - ] - ); - } - - async forceExpoTokenUpdate() { - await NotificationsManager.forceExpoTokenUpdate(); - this.alertCurrentExpoToken(); - } - showEditModal(item: Object) { this.setState({ modalCurrentDisplayItem: item @@ -142,15 +124,6 @@ class DebugScreen extends React.Component { {this.getModalContent()} - - - - {DebugScreen.getGeneralItem(() => this.alertCurrentExpoToken(), 'bell', 'Get current Expo Token', '')} - {DebugScreen.getGeneralItem(() => this.forceExpoTokenUpdate(), 'bell-ring', 'Force Expo token update', '')} - - } Notification Id - */ - static async sendNotificationImmediately(title: string, body: string) { - await NotificationsManager.askPermissions(); - return await Notifications.presentLocalNotificationAsync({ - title: title, - body: body, - }); - }; - - /** - * Async function sending notification at the specified time - * - * @param title Notification title - * @param body Notification body text - * @param time Time at which we should send the notification - * @param data Data to send with the notification, used for listeners - * @param androidChannelID - * @returns {Promise} Notification Id - */ - static async scheduleNotification(title: string, body: string, time: number, data: Object, androidChannelID: string): Promise { - await NotificationsManager.askPermissions(); - let date = new Date(); - date.setTime(time); - return Notifications.scheduleLocalNotificationAsync( - { - title: title, - body: body, - data: data, - ios: { // configuration for iOS. - sound: true - }, - android: { // configuration for Android. - channelId: androidChannelID, - } - }, - { - time: time, - }, - ); - }; - - /** - * Async function used to cancel the notification of a specific ID - * @param notificationID {Number} The notification ID - * @returns {Promise} - */ - static async cancelScheduledNotification(notificationID: number) { - await Notifications.cancelScheduledNotificationAsync(notificationID); - } - /** * Save expo token to allow sending notifications to this device. * This token is unique for each device and won't change. @@ -105,13 +49,6 @@ export default class NotificationsManager { } } - static async forceExpoTokenUpdate() { - await NotificationsManager.askPermissions(); - let expoToken = await Notifications.getExpoPushTokenAsync(); - // Save token for instant use later on - AsyncStorageManager.getInstance().savePref(AsyncStorageManager.getInstance().preferences.expoToken.key, expoToken); - } - static getMachineNotificationWatchlist(callback: Function) { let token = AsyncStorageManager.getInstance().preferences.expoToken.current; if (token !== '') {