esoftplay 0.0.140-b → 0.0.140-d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/error.ts +4 -5
- package/global.ts +3 -2
- package/package.json +1 -1
- package/subscribe.ts +2 -6
package/error.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
2
1
|
import Constants from 'expo-constants';
|
|
3
2
|
import { Platform } from 'react-native';
|
|
4
3
|
import { LibCurl } from './cache/lib/curl/import';
|
|
5
4
|
import { UserClass } from './cache/user/class/import';
|
|
6
5
|
import esp from './esp';
|
|
6
|
+
import FastStorage from './mmkv';
|
|
7
7
|
import { default as UserRoutes } from './modules/user/routes';
|
|
8
8
|
let pack = require('../../package.json');
|
|
9
9
|
let app = require('../../app.json');
|
|
@@ -35,7 +35,7 @@ export function setError(error?: any) {
|
|
|
35
35
|
time: getTime()
|
|
36
36
|
};
|
|
37
37
|
try {
|
|
38
|
-
|
|
38
|
+
FastStorage.setItem(`${config?.domain}error`, JSON.stringify(_e));
|
|
39
39
|
} catch (e) {
|
|
40
40
|
console.error(e);
|
|
41
41
|
}
|
|
@@ -87,7 +87,6 @@ export function sendTm(message: string, chat_id?: string, bot?: string, res?: (r
|
|
|
87
87
|
let config = esp?.config?.()
|
|
88
88
|
_chatids = Object.values(config?.errorReport?.telegramIds)
|
|
89
89
|
}
|
|
90
|
-
console.log(_chatids)
|
|
91
90
|
_chatids.forEach((cid: string) => {
|
|
92
91
|
let post = {
|
|
93
92
|
text: message,
|
|
@@ -101,7 +100,7 @@ export function sendTm(message: string, chat_id?: string, bot?: string, res?: (r
|
|
|
101
100
|
|
|
102
101
|
export function getError() {
|
|
103
102
|
let config = esp?.config?.()
|
|
104
|
-
|
|
103
|
+
FastStorage.getItem(config?.domain + 'error').then((e: any) => {
|
|
105
104
|
if (e) {
|
|
106
105
|
let _e = JSON.parse(e)
|
|
107
106
|
let msg = [
|
|
@@ -137,7 +136,7 @@ export function getError() {
|
|
|
137
136
|
});
|
|
138
137
|
}
|
|
139
138
|
// });
|
|
140
|
-
|
|
139
|
+
FastStorage.removeItem(config.domain + 'error')
|
|
141
140
|
}
|
|
142
141
|
})
|
|
143
142
|
}
|
package/global.ts
CHANGED
|
@@ -31,7 +31,8 @@ export interface useGlobalOption {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export interface useGlobalConnect<T> {
|
|
34
|
-
|
|
34
|
+
selector?: (props: T) => any,
|
|
35
|
+
render: (props: any) => any,
|
|
35
36
|
}
|
|
36
37
|
export let userDataReset: Function[] = []
|
|
37
38
|
let timeoutFinish: NodeJS.Timeout
|
|
@@ -225,7 +226,7 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
|
|
|
225
226
|
};
|
|
226
227
|
|
|
227
228
|
function _connect(props: useGlobalConnect<T>): any {
|
|
228
|
-
const
|
|
229
|
+
const state = props.selector ? useSelector(props.selector) : useState()[0]
|
|
229
230
|
const children = props.render(state)
|
|
230
231
|
return children ? R.cloneElement(children) : null
|
|
231
232
|
}
|
package/package.json
CHANGED
package/subscribe.ts
CHANGED
|
@@ -22,10 +22,6 @@ export default function useGlobalSubscriber(defaultValue?: any): useGlobalSubscr
|
|
|
22
22
|
value = defaultValue;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const trigger = (newValue?: any) => {
|
|
26
|
-
notify(newValue);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
25
|
function useSubscribe(func: Function) {
|
|
30
26
|
React.useLayoutEffect(() => {
|
|
31
27
|
subscribers.add(func)
|
|
@@ -35,7 +31,7 @@ export default function useGlobalSubscriber(defaultValue?: any): useGlobalSubscr
|
|
|
35
31
|
}
|
|
36
32
|
}, [])
|
|
37
33
|
|
|
38
|
-
return
|
|
34
|
+
return notify;
|
|
39
35
|
}
|
|
40
36
|
|
|
41
37
|
function notify(newValue?: any) {
|
|
@@ -51,6 +47,6 @@ export default function useGlobalSubscriber(defaultValue?: any): useGlobalSubscr
|
|
|
51
47
|
getValue,
|
|
52
48
|
useSubscribe,
|
|
53
49
|
reset,
|
|
54
|
-
trigger
|
|
50
|
+
trigger: notify
|
|
55
51
|
};
|
|
56
52
|
}
|