-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathtypes.ts
152 lines (139 loc) · 3.42 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/**
* Represents the mute switch status of the ring.
* @export
* @interface RingMuteSwitchStatus
* @property {boolean} isMuted - Indicates if the ring is muted.
* @property {boolean} initialQuery - Represents the initial query status.
*/
export type RingMuteSwitchStatus = {
isMuted: boolean;
initialQuery: boolean;
};
/**
* Called when there is a ring mute switch event.
* @export
* @callback
* @param {RingMuteSwitchStatus} status - The current mute switch status.
*/
export type RingMuteSwitchEventCallback = (
status: RingMuteSwitchStatus
) => void;
/**
* Used to set the interval check.
* @export
* @callback
* @param {number} newInterval - The new interval to be set.
*/
export type setCheckIntervalType = (newInterval: number) => void;
/**
* Categories of AV Audio sessions.
* @export
*/
export type AVAudioSessionCategory =
| 'Ambient'
| 'SoloAmbient'
| 'Playback'
| 'Record'
| 'PlayAndRecord'
| 'AudioProcessing'
| 'MultiRoute'
| 'Alarm';
/**
* Modes of AV Audio sessions.
* @export
*/
export type AVAudioSessionMode =
| 'Default'
| 'VoiceChat'
| 'VideoChat'
| 'GameChat'
| 'VideoRecording'
| 'Measurement'
| 'MoviePlayback'
| 'SpokenAudio';
/**
* Types of volume on Android.
* @export
*/
export type AndroidVolumeTypes =
| 'music'
| 'call'
| 'system'
| 'ring'
| 'alarm'
| 'notification';
/**
* The configuration settings for setting the volume.
* @export
* @interface VolumeManagerSetVolumeConfig
* @property {boolean} playSound - Indicates whether to play a sound on volume change. Default is false.
* @property {AndroidVolumeTypes} type - Defines the type of volume to change. Only applicable to Android. Default is 'music'.
* @property {boolean} showUI - Indicates whether to show the native volume UI. Default is false.
*/
export interface VolumeManagerSetVolumeConfig {
playSound?: boolean;
type?: AndroidVolumeTypes;
showUI?: boolean;
}
/**
* Represents the volume result.
* @export
* @interface VolumeResult
* @property {number} volume - The volume level. Both for iOS and Android. Defaults to music.
* @property {AndroidVolumeTypes} type - The type of volume. Android only.
*/
export interface VolumeResult {
// Both iOS and Android (defaults to type music for android)
volume: number;
// Android only
type?: AndroidVolumeTypes;
}
// Accepted Ringer Mode values
export const RINGER_MODE = {
silent: 0,
vibrate: 1,
normal: 2,
} as const;
/**
* Represents the ringer mode.
* @export
* @typedef {0 | 1 | 2} RingerModeType
*/
export type RingerModeType = (typeof RINGER_MODE)[keyof typeof RINGER_MODE];
/**
* Modes for the device.
* @export
* @enum {string}
*/
export enum Mode {
SILENT = 'SILENT',
VIBRATE = 'VIBRATE',
NORMAL = 'NORMAL',
MUTED = 'MUTED',
}
/**
* Represents the silent status of the ringer.
* @export
* @interface RingerSilentStatus
* @property {boolean} status - Indicates if the ringer is silent.
* @property {Mode} mode - The current mode of the device.
*/
export type RingerSilentStatus = {
status: boolean;
mode: Mode;
};
/**
* Called when there is a ringer event.
* @export
* @callback
* @param {RingerSilentStatus} event - The ringer event.
*/
export type RingerEventCallback = (event: RingerSilentStatus) => void;
/**
* Represents a subscription to an event that has a method to remove it.
* @export
* @interface EmitterSubscriptionNoop
*/
export interface EmitterSubscriptionNoop {
remove(): void;
}