esoftplay 0.0.128 → 0.0.129

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.
@@ -62,9 +62,6 @@
62
62
  "lib/notification": {
63
63
  "permission": "Please enable notifications permissions"
64
64
  },
65
- "lib/roll": {
66
- "failed": "Failed to access"
67
- },
68
65
  "lib/updater": {
69
66
  "alert_info": "Informasi",
70
67
  "alert_msg": "Pembaharuan berhasil diinstall",
@@ -96,9 +93,5 @@
96
93
  },
97
94
  "use/deeplink": {
98
95
  "msg_err": "Oops...!"
99
- },
100
- "user/login": {
101
- "username": "username",
102
- "pass": "password"
103
96
  }
104
97
  }
package/bin/cli.js CHANGED
@@ -172,16 +172,17 @@ function switchStatusAssets(status) {
172
172
 
173
173
  fs.readdirSync(DIR + '/modules/').forEach((mod) => {
174
174
  const path = DIR + '/modules/' + mod
175
- fs.readdirSync(path).forEach((file) => {
176
- if (status.includes('d'))
177
- if (file.match(/^.*.debug.*/g)) {
178
- copyFileFromTo(path + '/' + file, path + '/' + file.replace('.debug.', '.'))
179
- }
180
- if (status.includes('l'))
181
- if (file.match(/^.*.live.*/g)) {
182
- copyFileFromTo(path + '/' + file, path + '/' + file.replace('.live.', '.'))
183
- }
184
- })
175
+ if (fs.statSync(path).isDirectory())
176
+ fs.readdirSync(path).forEach((file) => {
177
+ if (status.includes('d'))
178
+ if (file.match(/^.*.debug.*/g)) {
179
+ copyFileFromTo(path + '/' + file, path + '/' + file.replace('.debug.', '.'))
180
+ }
181
+ if (status.includes('l'))
182
+ if (file.match(/^.*.live.*/g)) {
183
+ copyFileFromTo(path + '/' + file, path + '/' + file.replace('.live.', '.'))
184
+ }
185
+ })
185
186
  })
186
187
 
187
188
  }
package/bin/locale.js CHANGED
@@ -1,18 +1,42 @@
1
+ //@ts-check
1
2
  const fs = require('fs')
2
3
  const merge = require('lodash/merge')
4
+ const idJsonPath ="./assets/locale/id.json"
3
5
 
4
6
  function readAsJson(path) {
5
7
  let out = ""
6
8
  try { out = JSON.parse(fs.readFileSync(path, { encoding: 'utf8' })) } catch (e) { }
7
9
  return out;
8
10
  }
9
- if (!fs.existsSync("./assets/locale/id.json")) {
10
- fs.writeFileSync("./assets/locale/id.json", JSON.stringify({}, undefined, 2))
11
+ if (!fs.existsSync("./assets/locale")) {
12
+ fs.mkdirSync("./assets/locale")
11
13
  }
12
- if (fs.existsSync("./assets/locale/id.json")) {
14
+ if (!fs.existsSync(idJsonPath)) {
15
+ fs.writeFileSync(idJsonPath, JSON.stringify({}, undefined, 2))
16
+ }
17
+ if (fs.existsSync(idJsonPath)) {
13
18
  let masterLocale = readAsJson('./node_modules/esoftplay/assets/locale/id.json')
14
- let projectLang = readAsJson("./assets/locale/id.json")
19
+ let projectLang = readAsJson(idJsonPath)
15
20
  let _lg = merge(masterLocale, projectLang)
16
21
  masterLocale = { ..._lg }
17
- fs.writeFileSync("./assets/locale/id.json", JSON.stringify(masterLocale, undefined, 2))
22
+ fs.writeFileSync(idJsonPath, JSON.stringify(sortObject(masterLocale), undefined, 2), { encoding: 'utf8' })
23
+ }
24
+
25
+ function sortObject(obj) {
26
+ if (typeof obj !== "object" || obj === null) {
27
+ return obj;
28
+ }
29
+
30
+ if (Array.isArray(obj)) {
31
+ return obj.map(sortObject);
32
+ }
33
+
34
+ let sortedKeys = Object.keys(obj).sort();
35
+ let sortedObj = {};
36
+
37
+ for (let key of sortedKeys) {
38
+ sortedObj[key] = sortObject(obj[key]);
39
+ }
40
+
41
+ return sortedObj;
18
42
  }
package/bin/router.js CHANGED
@@ -389,9 +389,11 @@ import { AntDesignTypes, EntypoTypes, EvilIconsTypes, FeatherTypes, FontAwesomeT
389
389
 
390
390
  declare module "esoftplay" {
391
391
  var _global: any;
392
+ function useGlobalSubscriber<S>(initialState?: S): useGlobalSubscribeReturn<S>;
393
+ function useLazyState<S>(initialState?: S): [S, (newValue: S) => () => void, () => S];
392
394
  function useGlobalState<S>(initialState?: S, option?: useGlobalOption): useGlobalReturn<S>;
393
395
  function usePersistState<S>(key: string, initialState?: S | (() => S)): [S, (a: S | ((b: S )=> S)) => S | undefined, (a?: (x: S) => void) => void, () => void];
394
- function useSafeState<S>(initialState?: S | (() => S)): [S, (a: S | ((b: S )=> S)) => S | undefined];
396
+ function useSafeState<S>(initialState?: S | (() => S)): [S, (a: S | ((b: S )=> S)) => S | undefined, ()=>S];
395
397
  function applyStyle<T>(style: T): T;
396
398
  function usePersistState<S>(key: string, initialState?: S | (() => S)): [S, (a: S) => void, (a?: (x: S)=> void) => void, () => void];
397
399
  namespace esp {
@@ -433,7 +435,7 @@ declare module "esoftplay" {
433
435
  }
434
436
 
435
437
  interface useGlobalReturn<T> {
436
- useState: () => [T, (newState: T) => void, () => void],
438
+ useState: () => [T, (newState: T) => void, () => void, () => T],
437
439
  get: (param?: string, ...params: string[]) => T,
438
440
  set: (x: T) => void,
439
441
  reset: () => void,
@@ -447,11 +449,19 @@ declare module "esoftplay" {
447
449
  listener?: (data: any) => void,
448
450
  isUserData?: boolean
449
451
  }
452
+
453
+ interface useGlobalSubscribeReturn {
454
+ getValue: () => any,
455
+ reset: () => void,
456
+ useSubscribe: Function,
457
+ trigger: (newValue?: any) => void
458
+ }
459
+
450
460
  interface useGlobalConnect<T> {
451
461
  render: (props: T) => any,
452
462
  }`;
453
463
  for (clsName in tmpTask) {
454
- let ItemText = ""
464
+ let ItemText = "\nimport { useGlobalSubscribeReturn } from 'esoftplay';\nimport { useGlobalReturn } from 'esoftplay';\n"
455
465
  if (clsName == "LibIcon") {
456
466
  ItemText += "import { EvilIconsTypes, AntDesignTypes, EvilIconsTypes, FeatherTypes, FontAwesomeTypes, FontistoTypes, FoundationTypes, MaterialIconsTypes, EntypoTypes, OcticonsTypes, ZocialTypes, SimpleLineIconsTypes, IoniconsTypes, MaterialCommunityIconsTypes } from '@expo/vector-icons/build/esoftplay_icons';\n"
457
467
  }
@@ -535,19 +545,22 @@ declare module "esoftplay" {
535
545
  const [module, task] = clsName.split(/(?=[A-Z])/)
536
546
  const nav = module?.toLowerCase() + '/' + task?.toLowerCase()
537
547
 
538
- if (module && !fs.existsSync(tmpDir + module?.toLowerCase()))
539
- fs.mkdirSync(tmpDir + module.toLowerCase());
548
+ if (!nav.includes('.')) {
540
549
 
541
- if (!fs.existsSync(tmpDir + nav))
542
- fs.mkdirSync(tmpDir + nav)
550
+ if (module && !fs.existsSync(tmpDir + module?.toLowerCase()))
551
+ fs.mkdirSync(tmpDir + module.toLowerCase());
543
552
 
544
- PreText += "import '" + tmpDir + nav + "/import.d';\n"
545
- if (isChange(tmpDir + nav + '/import.d.ts', ItemText)) {
546
- fs.writeFile(tmpDir + nav + '/import.d.ts', ItemText, { flag: 'w' }, function (err) {
547
- if (err) {
548
- return console.log(err);
549
- }
550
- });
553
+ if (!fs.existsSync(tmpDir + nav))
554
+ fs.mkdirSync(tmpDir + nav)
555
+
556
+ PreText += "import '" + tmpDir + nav + "/import.d';\n"
557
+ if (isChange(tmpDir + nav + '/import.d.ts', ItemText)) {
558
+ fs.writeFile(tmpDir + nav + '/import.d.ts', ItemText, { flag: 'w' }, function (err) {
559
+ if (err) {
560
+ return console.log(err);
561
+ }
562
+ });
563
+ }
551
564
  }
552
565
  }
553
566
  Text += "\n\ttype LibNavigationRoutes = \"" + Navigations.join("\" |\n\t\t\t \"") + "\"\n"
@@ -638,7 +651,7 @@ function createRouter() {
638
651
  "import React from 'react'\n" +
639
652
  "const _" + ucword(module) + ucword(task) + " = React.lazy(() => import('../../../../." + Modules[module][task] + "')); \n" +
640
653
  "import * as " + ucword(module) + ucword(task) + SuffixHooksProperty + " from '../../../../." + Modules[module][task] + "';\n" +
641
- "const UpdatedComponent = (OriginalComponent) => { function "+ucword(module) + ucword(task)+"Component(props) { return ( <React.Suspense><OriginalComponent {...props} /></React.Suspense> ) } return "+ucword(module) + ucword(task)+"Component; };\n" +
654
+ "const UpdatedComponent = (OriginalComponent) => { function " + ucword(module) + ucword(task) + "Component(props) { return ( <React.Suspense><OriginalComponent {...props} /></React.Suspense> ) } return " + ucword(module) + ucword(task) + "Component; };\n" +
642
655
  "const " + ucword(module) + ucword(task) + " = stable(UpdatedComponent(_" + ucword(module) + ucword(task) + ")); \n" +
643
656
  "export { " + ucword(module) + ucword(task) + SuffixHooksProperty + ", " + ucword(module) + ucword(task) + " };\n"
644
657
  } else if (UseLibs.includes(nav)) {
@@ -652,18 +665,20 @@ function createRouter() {
652
665
  item += "export { _" + ucword(module) + ucword(task) + " as " + ucword(module) + ucword(task) + " };\n"
653
666
  }
654
667
 
655
- if (!fs.existsSync(tmpDir + module))
656
- fs.mkdirSync(tmpDir + module);
668
+ if (!nav.includes('.')) {
669
+ if (!fs.existsSync(tmpDir + module))
670
+ fs.mkdirSync(tmpDir + module);
657
671
 
658
- if (!fs.existsSync(tmpDir + nav))
659
- fs.mkdirSync(tmpDir + nav)
672
+ if (!fs.existsSync(tmpDir + nav))
673
+ fs.mkdirSync(tmpDir + nav)
660
674
 
661
- if (isChange(tmpDir + nav + "/import." + fileExt, item)) {
662
- fs.writeFile(tmpDir + nav + '/import.' + fileExt, item, { flag: 'w' }, function (err) {
663
- if (err) {
664
- return console.log(err);
665
- }
666
- });
675
+ if (isChange(tmpDir + nav + "/import." + fileExt, item)) {
676
+ fs.writeFile(tmpDir + nav + '/import.' + fileExt, item, { flag: 'w' }, function (err) {
677
+ if (err) {
678
+ return console.log(err);
679
+ }
680
+ });
681
+ }
667
682
  }
668
683
 
669
684
  // if (module == 'lib' && task == 'component') {
@@ -752,4 +767,4 @@ function createRouter() {
752
767
  return console.log(err);
753
768
  }
754
769
  });
755
- }
770
+ }
package/error.ts CHANGED
@@ -27,7 +27,8 @@ export function setError(error?: any) {
27
27
  const _e = {
28
28
  user,
29
29
  error: String(error),
30
- routes: routesName
30
+ routes: routesName,
31
+ time: new Date().toISOString()
31
32
  };
32
33
  try {
33
34
  AsyncStorage.setItem(`${config?.domain}error`, JSON.stringify(_e));
@@ -46,6 +47,7 @@ export function reportApiError(fetch: any, error: any) {
46
47
  'slug: ' + "#" + manifest?.slug,
47
48
  'error: ' + error,
48
49
  '\n\n\ndev: ' + Platform.OS + ' - ' + Constants.deviceName,
50
+ 'time: ' + new Date().toISOString(),
49
51
  'app/pub_id: ' + Constants.appOwnership + '/' + (config?.publish_id || '-'),
50
52
  'user_id: ' + user?.id || user?.user_id || '-',
51
53
  'username: ' + user?.username || '-',
@@ -82,6 +84,7 @@ export function getError() {
82
84
  'slug: ' + "#" + manifest?.slug,
83
85
  'error: \n' + _e.error,
84
86
  '\n\nname: ' + manifest?.name + ' - sdk' + pack?.dependencies?.expo,
87
+ 'time: \n' + _e?.time,
85
88
  'domain: ' + config.domain + config.uri,
86
89
  'package: ' + (Platform.OS == 'ios' ? manifest?.ios?.bundleIdentifier : manifest?.android?.package) + ' - v' + (Platform.OS == 'ios' ? app.expo.ios.buildNumber : app.expo.android.versionCode),
87
90
  'device: ' + Platform.OS + ' | ' + Constants.deviceName,
package/esp.ts CHANGED
@@ -122,7 +122,7 @@ const esp = {
122
122
  function sprintf(string: string, index: number): string {
123
123
  if (stringToBe[index] != undefined) {
124
124
  string = string.replace("%s", stringToBe[index])
125
- if (string.includes("%s")) {
125
+ if (string?.includes?.("%s")) {
126
126
  return sprintf(string, index + 1)
127
127
  }
128
128
  }
package/global.ts CHANGED
@@ -7,7 +7,7 @@ const isEqual = require('react-fast-compare');
7
7
 
8
8
 
9
9
  export interface useGlobalReturn<T> {
10
- useState: () => [T, (newState: T) => void, () => void],
10
+ useState: () => [T, (newState: T) => void, () => void, () => T],
11
11
  get: (param?: string, ...params: string[]) => T,
12
12
  set: (x: T) => void,
13
13
  reset: () => void,
@@ -154,14 +154,15 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
154
154
  }
155
155
 
156
156
 
157
- function useState(): [T, (newState: T) => void, () => void] {
157
+ function useState(): [T, (newState: T) => void, () => T] {
158
158
  let [l, s] = R.useState<T>(value);
159
159
 
160
160
  let sl = R.useCallback((ns: T) => { s(ns) }, []);
161
161
 
162
+
162
163
  subscribe(sl)
163
164
 
164
- return [l, set, del];
165
+ return [l, set, () => value];
165
166
  };
166
167
 
167
168
  function _connect(props: useGlobalConnect<T>): any {
package/lazy.ts CHANGED
@@ -1,23 +1,30 @@
1
- import { useLayoutEffect, useRef, useState } from 'react';
1
+ import { useEffect, useRef, useState } from 'react';
2
2
 
3
- export default function useLazyState<T>(initialState: T): [T, (newValue: T) => () => void] {
3
+ export default function useLazyState<T>(initialState?: T): [T, (newValue: T) => () => void, () => T] {
4
4
  const [, rerender] = useState({})
5
5
  const dispatch = () => { rerender({}) }
6
6
  const value = useRef(initialState)
7
7
  const isMounted = useRef(true)
8
+
9
+ const getter = () => {
10
+ return value.current
11
+ }
12
+
8
13
  const setter = (newValue: T) => {
9
- if (isMounted.current)
14
+ if (isMounted.current) {
10
15
  value.current = newValue;
16
+ }
11
17
  return () => {
12
- if (isMounted.current)
18
+ if (isMounted.current) {
13
19
  dispatch()
20
+ }
14
21
  }
15
22
  }
16
23
 
17
- useLayoutEffect(() => {
24
+ useEffect(() => {
18
25
  isMounted.current = true
19
26
  return () => { isMounted.current = false }
20
27
  }, [])
21
28
 
22
- return [value.current, setter]
29
+ return [value.current, setter, getter]
23
30
  }
@@ -4,7 +4,8 @@ import { LibComponent } from 'esoftplay/cache/lib/component/import';
4
4
  import isEqual from 'react-fast-compare';
5
5
 
6
6
  export interface LibEffectProps {
7
- deps?: any[]
7
+ deps?: any[],
8
+ children: any
8
9
  }
9
10
  export interface LibEffectState {
10
11
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  import { useIsFocused } from '@react-navigation/native';
5
5
  import React, { useEffect } from 'react';
6
- import { View } from 'react-native';
6
+ import { InteractionManager, View } from 'react-native';
7
7
 
8
8
  export interface LibFocusProps {
9
9
  isFocused?: boolean
@@ -18,14 +18,13 @@ export interface LibFocusState {
18
18
  }
19
19
 
20
20
  export default function m(props: LibFocusProps): any {
21
- console.warn("LibFocus now DEPRECATED, will be remove on next update")
22
21
  const isFocused = useIsFocused()
23
22
 
24
23
  useEffect(() => {
25
24
  if (isFocused) {
26
- props?.onFocus?.()
25
+ InteractionManager.runAfterInteractions(props?.onFocus)
27
26
  } else {
28
- props?.onBlur?.()
27
+ InteractionManager.runAfterInteractions(props?.onBlur)
29
28
  }
30
29
  }, [isFocused]);
31
30
 
@@ -13,15 +13,18 @@ export interface LibNet_statusState {
13
13
  zeroHeight: any
14
14
  }
15
15
 
16
- const state = useGlobalState({ isOnline: true })
16
+ const state = useGlobalState({
17
+ isOnline: true,
18
+ isInternetReachable: true
19
+ })
17
20
 
18
21
  class net_status extends LibComponent<LibNet_statusProps, LibNet_statusState> {
19
22
  static state(): useGlobalReturn<any> {
20
23
  return state
21
24
  }
22
25
 
23
- static setOnline(isOnline: boolean): void {
24
- state.set({ isOnline: isOnline })
26
+ static setOnline(isOnline: boolean, isInternetReachable: boolean): void {
27
+ state.set({ isOnline: isOnline, isInternetReachable: isInternetReachable })
25
28
  }
26
29
 
27
30
  timeout
@@ -36,7 +39,7 @@ class net_status extends LibComponent<LibNet_statusProps, LibNet_statusState> {
36
39
  componentDidMount(): void {
37
40
  super.componentDidMount()
38
41
  this.unsubscribe = NetInfo.addEventListener(state => {
39
- this.onChangeConnectivityStatus(state.isConnected, state.isInternetReachable)
42
+ this.onChangeConnectivityStatus(!!state.isConnected, state.isInternetReachable)
40
43
  });
41
44
  }
42
45
 
@@ -46,8 +49,8 @@ class net_status extends LibComponent<LibNet_statusProps, LibNet_statusState> {
46
49
  }
47
50
 
48
51
  onChangeConnectivityStatus(isConnected: boolean, isInternetReachable): void {
49
- let isOnline = (isConnected == true && isInternetReachable == true) ? true : false
50
- net_status.setOnline(isOnline)
52
+ let isOnline = isConnected && isInternetReachable
53
+ net_status.setOnline(isConnected, isInternetReachable)
51
54
  if (isOnline) {
52
55
  this.timeout = setTimeout(() => {
53
56
  this.setState({ zeroHeight: 1 })
@@ -190,7 +190,7 @@ export default class m {
190
190
  unread: nUnread
191
191
  })
192
192
  Notifications.setBadgeCountAsync(nUnread)
193
- const idsToPush = splitArray(ids, 200)
193
+ const idsToPush = splitArray(ids, 20)
194
194
  idsToPush.forEach((ids) => {
195
195
  readAll(ids)
196
196
  })
@@ -1,20 +1,61 @@
1
1
  // noPage
2
-
3
2
  import { Dimensions, Platform, StatusBar } from "react-native";
3
+ function isIphoneX() {
4
+ const dimen = Dimensions.get('window');
5
+ const dimenHeight = [780, 812, 844, 852, 896, 926, 932, 1170]
6
+ return (
7
+ Platform.OS === 'ios' &&
8
+ !Platform.isPad &&
9
+ !Platform.isTV &&
10
+ (dimenHeight.includes(dimen.height) || dimenHeight.includes(dimen.width))
11
+ );
12
+ }
13
+ /* LIVE */
4
14
 
5
15
  const { height, width } = Dimensions.get("window");
6
16
  const STATUSBAR_HEIGHT = (Platform.OS === "ios" ? isIphoneX() ? 44 : 20 : StatusBar.currentHeight) || 0;
7
17
  const STATUSBAR_HEIGHT_MASTER = (Platform.OS === "ios" ? isIphoneX() ? 44 : 20 : StatusBar.currentHeight) || 0;
8
- const colorPrimary = "#3E50B4"
9
- const colorPrimaryDark = "#3E50B4"
10
- const colorAccent = "#FFF"
11
- const colorGrey = "#F1F1F3"
12
- const colorRed = "darkred"
13
- const colorTextPrimary = "#353535"
14
- const colorTextBody = "#353535"
15
- const colorTextCaption = "#686868"
16
- const colorLightGrey = "#fbfbfb"
17
- const colorNavigationBar = "white"
18
+ const colorPrimary = "#FFC523";
19
+ const colorPrimaryMarket = "#A62287";
20
+ const colorPrimaryMart = "#40CEFF";
21
+ const colorPrimaryDark = "#FFC523";
22
+ const colorAccent = "#FFF";
23
+ const colorGrey = "#F1F1F3";
24
+ const colorTextPrimary = "#9e9e9e";
25
+ const headerHeight = 56
26
+ const colorBgGrey = '#EEF1F8';
27
+
28
+ const colorBrown = '#704728'
29
+ const colorBrownLight = '#C5906C'
30
+ const colorRed = "#dc143c";
31
+ const colorBlue = "#3EA4DC";
32
+ const colorGreen = "#2CB159";
33
+ const colorLightGrey = "#EDEDED";
34
+ const colorTextBody = "#909090";
35
+ const colorTextCaption = "#BEBEBE";
36
+
37
+ function elevation(value: any): any {
38
+ if (Platform.OS === "ios") {
39
+ if (value == 0) return {}
40
+ return { shadowColor: "black", shadowOffset: { width: 0, height: value / 2 }, shadowRadius: value, shadowOpacity: 0.24 }
41
+ }
42
+ return { elevation: value }
43
+ }
44
+ // Add your default style here
45
+ /*
46
+ Sample :
47
+
48
+ ###################
49
+ le
50
+ const styles = StyleSheet.create({
51
+ container: {
52
+ ...defaultStyle.container
53
+ },
54
+ });
55
+
56
+ ##################
57
+
58
+ */
18
59
 
19
60
  const defaultStyle = {
20
61
  container: {
@@ -41,52 +82,29 @@ const defaultStyle = {
41
82
  },
42
83
  }
43
84
 
44
- export default class m {
45
- static isIphoneX = isIphoneX()
46
- static STATUSBAR_HEIGHT = STATUSBAR_HEIGHT
47
- static STATUSBAR_HEIGHT_MASTER = STATUSBAR_HEIGHT_MASTER
48
- static colorPrimary = colorPrimary
49
- static colorPrimaryDark = colorPrimaryDark
50
- static colorNavigationBar = colorNavigationBar
51
- static colorAccent = colorAccent
52
- static colorGrey = colorGrey
53
- static colorRed = colorRed
54
- static colorTextPrimary = colorTextPrimary
55
- static colorTextBody = colorTextBody
56
- static colorTextCaption = colorTextCaption
57
- static colorLightGrey = colorLightGrey
58
- static width = width
59
- static height = height
60
- static defaultStyle = defaultStyle
61
- static elevation = (val: number): any => { return elevation(val) }
62
- }
63
-
64
-
65
- function elevation(value: any): any {
66
- if (Platform.OS === "ios") {
67
- if (value == 0) return {}
68
- return { shadowColor: "black", shadowOffset: { width: 0, height: value / 2 }, shadowRadius: value, shadowOpacity: 0.24 }
69
- } else if (Platform.OS == 'web') {
70
- return { boxShadow: `${0 * value}px ${0.5 * value}px ${value}px ${'rgba(0,0,0,0.24)'}` }
71
- }
72
-
73
- return { elevation: value }
74
- }
75
- function isIphoneX() {
76
- const dimen = Dimensions.get('window');
77
- return (
78
- Platform.OS === 'ios' &&
79
- !Platform.isPad &&
80
- !Platform.isTVOS &&
81
- (dimen.height === 780 ||
82
- dimen.width === 780 ||
83
- dimen.height === 812 ||
84
- dimen.width === 812 ||
85
- dimen.height === 844 ||
86
- dimen.width === 844 ||
87
- dimen.height === 896 ||
88
- dimen.width === 896 ||
89
- dimen.height === 926 ||
90
- dimen.width === 926)
91
- );
85
+ export default class Style {
86
+ static isIphoneX: boolean = isIphoneX();
87
+ static STATUSBAR_HEIGHT: number = STATUSBAR_HEIGHT;
88
+ static STATUSBAR_HEIGHT_MASTER: number = STATUSBAR_HEIGHT_MASTER;
89
+ static colorPrimary: string = colorPrimary;
90
+ static colorPrimaryDark: string = colorPrimaryDark;
91
+ static colorPrimaryMarket: string = colorPrimaryMarket;
92
+ static colorPrimaryMart: string = colorPrimaryMart;
93
+ static colorAccent: string = colorAccent;
94
+ static colorGrey: string = colorGrey;
95
+ static colorBrownLight: string = colorBrownLight;
96
+ static colorBgGrey: string = colorBgGrey;
97
+ static colorBrown: string = colorBrown;
98
+ static colorGreen: string = colorGreen;
99
+ static colorBlue: string = colorBlue;
100
+ static colorRed: string = colorRed;
101
+ static colorTextPrimary: string = colorTextPrimary;
102
+ static colorTextBody: string = colorTextBody;
103
+ static colorTextCaption: string = colorTextCaption;
104
+ static colorLightGrey: string = colorLightGrey;
105
+ static elevation(val: number): any { return elevation(val) };
106
+ static width: number = width;
107
+ static height: number = height;
108
+ static defaultStyle: any = defaultStyle;
109
+ static headerHeight: number = headerHeight;
92
110
  }
@@ -1,9 +1,12 @@
1
1
  // withHooks
2
2
  // noPage
3
+
4
+ // nunggu update master, margin sebelah kanan kegeser
5
+
3
6
  import { LibStyle } from 'esoftplay/cache/lib/style/import';
4
7
  import useGlobalState from 'esoftplay/global';
5
8
  import React, { useEffect } from 'react';
6
- import { Text } from 'react-native';
9
+ import { Text, View } from 'react-native';
7
10
  import Animated, { interpolate, useAnimatedProps, useSharedValue, withTiming } from 'react-native-reanimated';
8
11
 
9
12
  export interface LibToastProps {
@@ -53,8 +56,10 @@ export default function m(props: LibToastProps): any {
53
56
  }, [data])
54
57
 
55
58
  return (
56
- <Animated.View style={[{ maxWidth: Math.min(500, LibStyle.width - 30), position: 'absolute', top: LibStyle.STATUSBAR_HEIGHT + 70, left: 0, right: 0, marginVertical: 4, marginHorizontal: 13, borderRadius: 4, borderWidth: 1, borderColor: '#505050', backgroundColor: '#323232', paddingVertical: 13, paddingHorizontal: 16, }, style, LibStyle.elevation(2)]} >
57
- <Text style={{ fontSize: 14, textAlign: "center", color: 'white' }} >{String(data?.message || '')}</Text>
59
+ <Animated.View pointerEvents={'none'} style={[{ flex: 1, position: 'absolute', justifyContent: 'center', alignContent: 'center', alignItems: 'center', top: LibStyle.STATUSBAR_HEIGHT + 20, left: 0, right: 0, }, style, LibStyle.elevation(2)]} >
60
+ <View style={{ maxWidth: Math.min(500, LibStyle.width - 30), minWidth: Math.min(500, LibStyle.width - 30), marginHorizontal: 15, marginVertical: 4, borderRadius: 4, borderWidth: 1, borderColor: '#505050', backgroundColor: '#323232', paddingVertical: 13, paddingHorizontal: 16, }} >
61
+ <Text style={{ fontSize: 14, textAlign: "center", color: 'white' }} >{String(data?.message || '')}</Text>
62
+ </View>
58
63
  </Animated.View>
59
64
  )
60
65
  }
@@ -147,6 +147,7 @@ export default class eutils {
147
147
  }
148
148
 
149
149
  static number(toNumber: string | number): string {
150
+ if (!toNumber) toNumber = '0'
150
151
  var toNumb = typeof toNumber === "number" ? toNumber.toFixed(0).replace(/(\d)(?=(\d{3})+$)/g, "$1,") : parseInt(toNumber).toFixed(0).replace(/(\d)(?=(\d{3})+$)/g, "$1,")
151
152
  return String(toNumb).replace(/,/g, ".");
152
153
  }
@@ -4,6 +4,7 @@ import { esp, useSafeState } from 'esoftplay';
4
4
  import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
5
5
  import { LibIcon } from 'esoftplay/cache/lib/icon/import';
6
6
  import { LibImage } from 'esoftplay/cache/lib/image/import';
7
+ import { LibLocale } from 'esoftplay/cache/lib/locale/import';
7
8
  import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
8
9
  import { LibNet_status } from 'esoftplay/cache/lib/net_status/import';
9
10
  import { LibProgress } from 'esoftplay/cache/lib/progress/import';
@@ -19,6 +20,7 @@ import { UserHook } from 'esoftplay/cache/user/hook/import';
19
20
  import { UserLoading } from 'esoftplay/cache/user/loading/import';
20
21
  import { UserRoutes } from 'esoftplay/cache/user/routes/import';
21
22
  import useGlobalState from 'esoftplay/global';
23
+ import moment from 'esoftplay/moment';
22
24
  import * as Font from "expo-font";
23
25
  import React, { useEffect, useLayoutEffect } from 'react';
24
26
  import { Platform, Pressable, View } from 'react-native';
@@ -53,6 +55,8 @@ function setFonts(): Promise<void> {
53
55
 
54
56
  const route = useGlobalState<any>(undefined, { persistKey: 'user_index_routes_initial', inFile: true })
55
57
  export default function m(props: UserIndexProps): any {
58
+ const [langId] = LibLocale.state().useState()
59
+ moment().locale(langId)
56
60
  const [loading, setLoading] = useSafeState(true)
57
61
  const user = UserClass.state().useSelector(s => s)
58
62
  const ready = React.useRef(0)
package/moment.ts CHANGED
@@ -56,10 +56,11 @@ export default function moment(date?: string | Date | any) {
56
56
  const out = dayjs(_date).tz(timeZone)
57
57
  return moment(out)
58
58
  },
59
- locale: (locale_id: "af" | "am" | "ar-dz" | "ar-kw" | "ar-ly" | "ar-ma" | "ar-sa" | "ar-tn" | "ar" | "az" | "be" | "bg" | "bi" | "bm" | "bn" | "bo" | "br" | "bs" | "ca" | "cs" | "cv" | "cy" | "da" | "de-at" | "de-ch" | "de" | "dv" | "el" | "en-au" | "en-ca" | "en-gb" | "en-ie" | "en-il" | "en-in" | "en-nz" | "en-sg" | "en-tt" | "en" | "eo" | "es-do" | "es-pr" | "es-us" | "es" | "fi" | "fo" | "fr-ca" | "fr-ch" | "fr" | "fy" | "ga" | "gd" | "gl" | "gom-latn" | "gu" | "he" | "hi" | "hr" | "ht" | "hu" | "hy-am" | "id" | "is" | "it-ch" | "it" | "ja" | "jv" | "ka" | "kk" | "km" | "kn" | "ko" | "ku" | "ky" | "lb" | "lo" | "lt" | "lv" | "me" | "mi" | "mk" | "ml" | "mn" | "mr" | "ms-my" | "ms" | "mt" | "my" | "nb" | "ne" | "nl-be" | "nl" | "nn" | "oc-lnc" | "pa-in" | "pl" | "pt-br" | "pt" | "ro" | "ru" | "rw" | "sd" | "se" | "si" | "sk" | "sl" | "sq" | "sr-cyrl" | "sr" | "ss" | "sv-fi" | "sv" | "sw" | "ta" | "te" | "tet" | "tg" | "th" | "tk" | "tl-ph" | "tlh" | "tr" | "tzl" | "tzm-latn" | "tzm" | "ug-cn" | "uk" | "ur" | "uz-latn" | "uz" | "vi" | "x-pseudo" | "yo" | "zh-cn" | "zh-hk" | "zh-tw" | "zh" | "et" | "eu" | "fa") => {
59
+ locale: (locale_id: string) => {
60
60
  require('dayjs/locale/en')
61
61
  require('dayjs/locale/id')
62
- const out = dayjs.locale('id')
62
+ require('dayjs/locale/id')
63
+ const out = dayjs.locale(locale_id)
63
64
  return moment(out)
64
65
  },
65
66
  /* last chain */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay",
3
- "version": "0.0.128",
3
+ "version": "0.0.129",
4
4
  "description": "embedding data from esoftplay framework (web based) into mobile app",
5
5
  "main": "cache/index.js",
6
6
  "types": "../../index.d.ts",
package/state.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { useCallback, useEffect, useRef, useState } from 'react';
2
2
 
3
- type UseRefStateResult<T> = [T | undefined, (value: T | undefined) => void];
3
+ type useSafeStateReturn<T> = [T | undefined, (value: T | undefined) => void, () => T];
4
4
 
5
- export default function useRefState<T = any>(defaultValue?: T): UseRefStateResult<T> {
5
+ export default function useSafeState<T = any>(defaultValue?: T): useSafeStateReturn<T> {
6
6
  const isMountedRef = useRef<boolean>(true);
7
7
  const [state, setState] = useState<T | undefined>(defaultValue);
8
8
 
@@ -13,6 +13,10 @@ export default function useRefState<T = any>(defaultValue?: T): UseRefStateResul
13
13
  }
14
14
  }, []);
15
15
 
16
+ const getter = () => {
17
+ return state
18
+ }
19
+
16
20
  useEffect(() => {
17
21
  isMountedRef.current = true;
18
22
  return () => {
@@ -20,5 +24,5 @@ export default function useRefState<T = any>(defaultValue?: T): UseRefStateResul
20
24
  };
21
25
  }, []);
22
26
 
23
- return [state, updateState];
27
+ return [state, updateState, getter];
24
28
  }
package/subscribe.ts CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  import React from 'react';
4
4
 
5
- export interface UseSubscribeReturn {
6
- getValue: (value?: any) => void,
5
+ export interface useGlobalSubscriberReturn {
6
+ getValue: () => any,
7
7
  reset: () => void,
8
8
  useSubscribe: Function,
9
9
  trigger: (newValue?: any) => void
10
10
  }
11
11
 
12
- export default function useGlobalSubscriber(defaultValue?: any): UseSubscribeReturn {
12
+ export default function useGlobalSubscriber(defaultValue?: any): useGlobalSubscriberReturn {
13
13
  const subscribers = new Set<Function>();
14
14
  let value = defaultValue;
15
15