Issues (7)

Helpers/newChannel.js (3 issues)

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{
0 ignored issues
show
Comprehensibility introduced by
else is not necessary here since all if branches return, consider removing it to reduce nesting and make code more readable.
Loading history...
18
                                alert('newChannel is not supported on IOS')
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{
0 ignored issues
show
Comprehensibility introduced by
else is not necessary here since all if branches return, consider removing it to reduce nesting and make code more readable.
Loading history...
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{
0 ignored issues
show
Comprehensibility introduced by
else is not necessary here since all if branches return, consider removing it to reduce nesting and make code more readable.
Loading history...
42
                                alert('newChannel is not supported on IOS')
43
                              }
44
                        break;
45
46
          }
47
48
    },
49
50
51
}
52
53
export default newChanneler;