Issues (7)

Helpers/newChannel.js (1 issue)

1
2
import {Platform} from 'react-native';
3
import { Notifications } from 'expo';
4
import * as Permissions from 'expo-permissions';
5
6
const newChanneler = {
7
    // create a new channel
8
    newChannel: ( name, isSound )=>{
9
                  switch(isSound){
10
                      case false:
11
                       if (Platform.OS === 'android') {
12
                          Notifications.createChannelAndroidAsync(name, {
13
                            name: name,
14
                            sound: false,
15
                          });
16
                          return true;
17
                        }else{
18
                                alert('newChannel is not supported on IOS')
0 ignored issues
show
Debugging Code Best Practice introduced by
The alert UI element is often considered obtrusive and is generally only used as a temporary measure. Consider replacing it with another UI element.
Loading history...
19
                              }
20
                        break;
21
22
                   case true:
23
                       if (Platform.OS === 'android') {
24
                          Notifications.createChannelAndroidAsync(name, {
25
                            name: name,
26
                            sound: true,
27
                          });
28
                           return true;
29
                        }else{
30
                                alert('newChannel is not supported on IOS')
31
                              }
32
                        break;
33
34
                       default:
35
                             if (Platform.OS === 'android') {
36
                                Notifications.createChannelAndroidAsync(name, {
37
                                  name: name,
38
                                  sound: false,
39
                                });
40
                                 return true;
41
                              }else{
42
                                alert('newChannel is not supported on IOS')
43
                              }
44
                        break;
45
46
          }
47
48
    },
49
50
51
}
52
53
export default newChanneler;