xref: /MusicFree/src/constants/commonConst.ts (revision 6613e77203923e5b1742a49281bfa5de03fc1440)
1import {Easing, EasingFunction} from 'react-native-reanimated';
2
3export const internalSymbolKey = Symbol.for('$');
4// 加入播放列表的时间;app内使用,无法被序列化
5export const timeStampSymbol = Symbol.for('time-stamp');
6// 加入播放列表的辅助顺序
7export const sortIndexSymbol = Symbol.for('sort-index');
8export const internalSerializeKey = '$';
9export const localMusicSheetId = 'local-music-sheet';
10export const musicHistorySheetId = 'history-music-sheet';
11
12export const localPluginPlatform = '本地';
13export const localPluginHash = 'local-plugin-hash';
14
15export const internalFakeSoundKey = 'fake-key';
16
17const emptyFunction = () => {};
18Object.freeze(emptyFunction);
19export {emptyFunction};
20
21export enum RequestStateCode {
22    /** 空闲 */
23    IDLE = 0b00000000,
24    PENDING_FIRST_PAGE = 0b00000010,
25    LOADING = 0b00000010,
26    /** 检索中 */
27    PENDING_REST_PAGE = 0b00000011,
28    /** 部分结束 */
29    PARTLY_DONE = 0b00000100,
30    /** 全部结束 */
31    FINISHED = 0b0001000,
32    /** 出错了 */
33    ERROR = 0b10000000,
34}
35
36export const StorageKeys = {
37    /** @deprecated */
38    MediaMetaKeys: 'media-meta-keys',
39    PluginMetaKey: 'plugin-meta',
40    MediaCache: 'media-cache',
41    LocalMusicSheet: 'local-music-sheet',
42};
43
44export const CacheControl = {
45    Cache: 'cache',
46    NoCache: 'no-cache',
47    NoStore: 'no-store',
48};
49
50export const supportLocalMediaType = [
51    '.mp3',
52    '.flac',
53    '.wma',
54    '.wav',
55    '.m4a',
56    '.ogg',
57    '.acc',
58    '.aac',
59    '.ape',
60    '.opus',
61];
62
63/** 全局事件 */
64export enum EDeviceEvents {
65    /** 刷新歌词 */
66    REFRESH_LYRIC = 'refresh-lyric',
67}
68
69const ANIMATION_EASING: EasingFunction = Easing.out(Easing.exp);
70const ANIMATION_DURATION = 150;
71
72const animationFast = {
73    duration: ANIMATION_DURATION,
74    easing: ANIMATION_EASING,
75};
76
77const animationNormal = {
78    duration: 250,
79    easing: ANIMATION_EASING,
80};
81
82const animationSlow = {
83    duration: 500,
84    easing: ANIMATION_EASING,
85};
86
87export const timingConfig = {
88    animationFast,
89    animationNormal,
90    animationSlow,
91};
92
93export const enum SortType {
94    // 未排序
95    None = 'None',
96    // 按标题排序
97    Title = 'title',
98    // 按作者排序
99    Artist = 'artist',
100    // 按专辑名排序
101    Album = 'album',
102    // 按时间排序
103    Newest = 'time',
104    // 按时间逆序
105    Oldest = 'time-rev',
106}
107
108export const enum ResumeMode {
109    Append = 'append',
110    Overwrite = 'overwrite',
111    OverwriteDefault = 'overwrite-default',
112}
113