xref: /MusicFree/src/constants/commonConst.ts (revision 15900d057ad4df766b2f9ea5b48f92a8ce2664db)
1import Animated, {Easing} from 'react-native-reanimated';
2
3export const internalSymbolKey = Symbol.for('$');
4// 加入播放列表/歌单的时间
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    MediaMetaKeys: 'media-meta-keys',
38    PluginMetaKey: 'plugin-meta',
39    MediaCache: 'media-cache',
40    LocalMusicSheet: 'local-music-sheet',
41};
42
43export const CacheControl = {
44    Cache: 'cache',
45    NoCache: 'no-cache',
46    NoStore: 'no-store',
47};
48
49export const supportLocalMediaType = [
50    '.mp3',
51    '.flac',
52    '.wma',
53    '.wav',
54    '.m4a',
55    '.ogg',
56    '.acc',
57    '.aac',
58    '.ape',
59    '.opus',
60];
61
62/** 全局事件 */
63export enum EDeviceEvents {
64    /** 刷新歌词 */
65    REFRESH_LYRIC = 'refresh-lyric',
66}
67
68const ANIMATION_EASING: Animated.EasingFunction = Easing.out(Easing.exp);
69const ANIMATION_DURATION = 150;
70
71const animationFast = {
72    duration: ANIMATION_DURATION,
73    easing: ANIMATION_EASING,
74};
75
76const animationNormal = {
77    duration: 250,
78    easing: ANIMATION_EASING,
79};
80
81const animationSlow = {
82    duration: 500,
83    easing: ANIMATION_EASING,
84};
85
86export const timingConfig = {
87    animationFast,
88    animationNormal,
89    animationSlow,
90};
91