esoftplay 0.0.182 → 0.0.183
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/bin/build.js +2 -6
- package/global.ts +11 -3
- package/package.json +1 -1
package/bin/build.js
CHANGED
|
@@ -168,11 +168,11 @@ if (fs.existsSync(packjson)) {
|
|
|
168
168
|
|
|
169
169
|
const easconfg = `{
|
|
170
170
|
"cli": {
|
|
171
|
-
"version": ">= 0.52.0"
|
|
171
|
+
"version": ">= 0.52.0",
|
|
172
|
+
"appVersionSource": "local"
|
|
172
173
|
},
|
|
173
174
|
"build": {
|
|
174
175
|
"development": {
|
|
175
|
-
"bun": "1.1.0",
|
|
176
176
|
"developmentClient": true,
|
|
177
177
|
"distribution": "internal",
|
|
178
178
|
"ios": {
|
|
@@ -181,13 +181,11 @@ if (fs.existsSync(packjson)) {
|
|
|
181
181
|
"channel": "default"
|
|
182
182
|
},
|
|
183
183
|
"development_build": {
|
|
184
|
-
"bun": "1.1.0",
|
|
185
184
|
"developmentClient": true,
|
|
186
185
|
"distribution": "internal",
|
|
187
186
|
"channel": "default"
|
|
188
187
|
},
|
|
189
188
|
"preview": {
|
|
190
|
-
"bun": "1.1.0",
|
|
191
189
|
"distribution": "internal",
|
|
192
190
|
"ios": {
|
|
193
191
|
"simulator": true
|
|
@@ -195,7 +193,6 @@ if (fs.existsSync(packjson)) {
|
|
|
195
193
|
"channel": "default"
|
|
196
194
|
},
|
|
197
195
|
"preview_build": {
|
|
198
|
-
"bun": "1.1.0",
|
|
199
196
|
"distribution": "internal",
|
|
200
197
|
"android": {
|
|
201
198
|
"buildType": "apk"
|
|
@@ -203,7 +200,6 @@ if (fs.existsSync(packjson)) {
|
|
|
203
200
|
"channel": "default"
|
|
204
201
|
},
|
|
205
202
|
"production": {
|
|
206
|
-
"bun": "1.1.0",
|
|
207
203
|
"channel": "default"
|
|
208
204
|
}
|
|
209
205
|
},
|
package/global.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface useGlobalReturn<T> {
|
|
|
14
14
|
reset: () => void,
|
|
15
15
|
listen: (cb: (value: T) => void) => () => void
|
|
16
16
|
sync: () => () => void,
|
|
17
|
+
useAutoSyncOnNetworkChanges: () => void,
|
|
17
18
|
connect: (props: useGlobalConnect<T>) => any,
|
|
18
19
|
useSelector: (selector: (state: T) => any) => any;
|
|
19
20
|
}
|
|
@@ -189,7 +190,6 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
|
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
if (o?.useAutoSync && taskSync && Array.isArray(newValue)) {
|
|
192
|
-
// taskSync[0](newValue.filter((item: any) => item.synced != 1));
|
|
193
193
|
_sync()
|
|
194
194
|
}
|
|
195
195
|
|
|
@@ -225,6 +225,15 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
|
|
|
225
225
|
return l;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
+
function useAutoSyncOnNetworkChanges() {
|
|
229
|
+
esp.mod("lib/net_status").subscriber.useSubscribe(({ isInternetReachable, isOnline }) => {
|
|
230
|
+
if (isInternetReachable && isOnline) {
|
|
231
|
+
_sync()
|
|
232
|
+
}
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
}
|
|
236
|
+
|
|
228
237
|
function get(param?: string, ...params: string[]): any {
|
|
229
238
|
loadFromDisk()
|
|
230
239
|
let out: any = value;
|
|
@@ -259,7 +268,6 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
|
|
|
259
268
|
const children = props.render(state)
|
|
260
269
|
return children ? R.cloneElement(children) : null
|
|
261
270
|
}
|
|
262
|
-
|
|
263
271
|
|
|
264
|
-
return { useState, get, set, useSelector, reset: del, connect: _connect, sync: _sync, listen: listen };
|
|
272
|
+
return { useState, get, set, useSelector, reset: del, connect: _connect, sync: _sync, listen: listen, useAutoSyncOnNetworkChanges };
|
|
265
273
|
}
|