Browse Source

Removed unused functions

Arnaud Vergnet 4 years ago
parent
commit
81eddd9bdd
2 changed files with 1 additions and 91 deletions
  1. 1
    28
      screens/About/DebugScreen.js
  2. 0
    63
      utils/NotificationsManager.js

+ 1
- 28
screens/About/DebugScreen.js View File

@@ -1,9 +1,8 @@
1 1
 // @flow
2 2
 
3 3
 import * as React from 'react';
4
-import {Alert, Clipboard, ScrollView, View} from "react-native";
4
+import {ScrollView, View} from "react-native";
5 5
 import AsyncStorageManager from "../../utils/AsyncStorageManager";
6
-import NotificationsManager from "../../utils/NotificationsManager";
7 6
 import CustomModal from "../../components/CustomModal";
8 7
 import {Button, Card, List, Subheading, TextInput, Title, withTheme} from 'react-native-paper';
9 8
 
@@ -59,23 +58,6 @@ class DebugScreen extends React.Component<Props, State> {
59 58
         }
60 59
     }
61 60
 
62
-    alertCurrentExpoToken() {
63
-        let token = AsyncStorageManager.getInstance().preferences.expoToken.current;
64
-        Alert.alert(
65
-            'Expo Token',
66
-            token,
67
-            [
68
-                {text: 'Copy', onPress: () => Clipboard.setString(token)},
69
-                {text: 'OK'}
70
-            ]
71
-        );
72
-    }
73
-
74
-    async forceExpoTokenUpdate() {
75
-        await NotificationsManager.forceExpoTokenUpdate();
76
-        this.alertCurrentExpoToken();
77
-    }
78
-
79 61
     showEditModal(item: Object) {
80 62
         this.setState({
81 63
             modalCurrentDisplayItem: item
@@ -144,15 +126,6 @@ class DebugScreen extends React.Component<Props, State> {
144 126
                 <ScrollView style={{padding: 5}}>
145 127
                     <Card style={{margin: 5}}>
146 128
                         <Card.Title
147
-                            title={'Notifications'}
148
-                        />
149
-                        <Card.Content>
150
-                            {DebugScreen.getGeneralItem(() => this.alertCurrentExpoToken(), 'bell', 'Get current Expo Token', '')}
151
-                            {DebugScreen.getGeneralItem(() => this.forceExpoTokenUpdate(), 'bell-ring', 'Force Expo token update', '')}
152
-                        </Card.Content>
153
-                    </Card>
154
-                    <Card style={{margin: 5}}>
155
-                        <Card.Title
156 129
                             title={'Preferences'}
157 130
                         />
158 131
                         <Card.Content>

+ 0
- 63
utils/NotificationsManager.js View File

@@ -29,62 +29,6 @@ export default class NotificationsManager {
29 29
     }
30 30
 
31 31
     /**
32
-     * Async function sending a notification without delay to the user
33
-     *
34
-     * @param title {String} Notification title
35
-     * @param body {String} Notification body text
36
-     * @returns {Promise<import("react").ReactText>} Notification Id
37
-     */
38
-    static async sendNotificationImmediately(title: string, body: string) {
39
-        await NotificationsManager.askPermissions();
40
-        return await Notifications.presentLocalNotificationAsync({
41
-            title: title,
42
-            body: body,
43
-        });
44
-    };
45
-
46
-    /**
47
-     * Async function sending notification at the specified time
48
-     *
49
-     * @param title Notification title
50
-     * @param body Notification body text
51
-     * @param time Time at which we should send the notification
52
-     * @param data Data to send with the notification, used for listeners
53
-     * @param androidChannelID
54
-     * @returns {Promise<import("react").ReactText>} Notification Id
55
-     */
56
-    static async scheduleNotification(title: string, body: string, time: number, data: Object, androidChannelID: string): Promise<string> {
57
-        await NotificationsManager.askPermissions();
58
-        let date = new Date();
59
-        date.setTime(time);
60
-        return Notifications.scheduleLocalNotificationAsync(
61
-            {
62
-                title: title,
63
-                body: body,
64
-                data: data,
65
-                ios: { // configuration for iOS.
66
-                    sound: true
67
-                },
68
-                android: { // configuration for Android.
69
-                    channelId: androidChannelID,
70
-                }
71
-            },
72
-            {
73
-                time: time,
74
-            },
75
-        );
76
-    };
77
-
78
-    /**
79
-     * Async function used to cancel the notification of a specific ID
80
-     * @param notificationID {Number} The notification ID
81
-     * @returns {Promise}
82
-     */
83
-    static async cancelScheduledNotification(notificationID: number) {
84
-        await Notifications.cancelScheduledNotificationAsync(notificationID);
85
-    }
86
-
87
-    /**
88 32
      * Save expo token to allow sending notifications to this device.
89 33
      * This token is unique for each device and won't change.
90 34
      * It only needs to be fetched once, then it will be saved in storage.
@@ -105,13 +49,6 @@ export default class NotificationsManager {
105 49
         }
106 50
     }
107 51
 
108
-    static async forceExpoTokenUpdate() {
109
-        await NotificationsManager.askPermissions();
110
-        let expoToken = await Notifications.getExpoPushTokenAsync();
111
-        // Save token for instant use later on
112
-        AsyncStorageManager.getInstance().savePref(AsyncStorageManager.getInstance().preferences.expoToken.key, expoToken);
113
-    }
114
-
115 52
     static getMachineNotificationWatchlist(callback: Function) {
116 53
         let token = AsyncStorageManager.getInstance().preferences.expoToken.current;
117 54
         if (token !== '') {

Loading…
Cancel
Save