esoftplay 0.0.122 → 0.0.123-a

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 CHANGED
@@ -300,7 +300,7 @@ export default function App() {
300
300
  'react-native-gesture-handler',
301
301
  'react-native-awesome-gallery',
302
302
  'react-native-fast-image',
303
- 'react-native-pinch-zoom-view-movable',
303
+ 'react-native-pan-pinch-view',
304
304
  'react-native-reanimated',
305
305
  'react-native-safe-area-context',
306
306
  'react-native-screens',
package/bin/cli.js CHANGED
@@ -24,7 +24,7 @@ var args = process.argv.slice(2);
24
24
 
25
25
  // console.log(modpath, "sdofsjdofjsd")
26
26
  function execution() {
27
- const cmd = `watchman -j <<< '["trigger","./",{"name":"esp","expression":["allof",["not",["dirname","node_modules"]],["not",["name","index.d.ts"]]],"command":["node","./node_modules/esoftplay/bin/router.js"],"append_files":true}]' && node ./node_modules/esoftplay/bin/router.js`
27
+ const cmd = `watchman watch-project . && watchman -j <<< '["trigger","./",{"name":"esp","expression":["allof",["not",["dirname","node_modules"]],["not",["name","index.d.ts"]]],"command":["node","./node_modules/esoftplay/bin/router.js"],"append_files":true}]' && node ./node_modules/esoftplay/bin/router.js`
28
28
  command(cmd)
29
29
  }
30
30
 
package/bin/router.js CHANGED
@@ -69,17 +69,14 @@ import React, { useEffect } from 'react';
69
69
  import { NavigationContainer } from '@react-navigation/native';
70
70
  import { createNativeStackNavigator } from '@react-navigation/native-stack';
71
71
  \nimport { _global } from "esoftplay";\n
72
- \nimport useGlobalState from "esoftplay/global";\n
73
72
  ${importer}
74
73
  const Stack = createNativeStackNavigator();
75
-
76
74
  const config = require('../../../config.json')
77
75
  import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
78
76
 
79
77
  export default function m(props): any {
80
78
  const { user, initialState, handler } = props
81
79
  const econf = config.config
82
- const [s] = LibNavigation.state().useState()
83
80
  const appOrientation = econf?.orientation ? String(econf.orientation) : 'portrait'
84
81
  return (
85
82
  <NavigationContainer
@@ -451,6 +448,9 @@ declare module "esoftplay" {
451
448
  }`;
452
449
  for (clsName in tmpTask) {
453
450
  let ItemText = ""
451
+ if (clsName == "LibIcon") {
452
+ ItemText += "import { EvilIconsTypes, AntDesignTypes, EvilIconsTypes, FeatherTypes, FontAwesomeTypes, FontistoTypes, FoundationTypes, MaterialIconsTypes, EntypoTypes, OcticonsTypes, ZocialTypes, SimpleLineIconsTypes, IoniconsTypes, MaterialCommunityIconsTypes } from '@expo/vector-icons/build/esoftplay_icons';\n"
453
+ }
454
454
  if (clsName === 'LibCrypt') {
455
455
  tmpTask[clsName]["class"] = "class LibCrypt"
456
456
  tmpTask[clsName]["function"]['encode'] = 'encode(text: string): string;';
@@ -459,7 +459,7 @@ declare module "esoftplay" {
459
459
  if (tmpTask[clsName]["class"]) {
460
460
 
461
461
  if (clsName !== "LibComponent")
462
- ItemText += "import { LibComponent } from 'esoftplay/cache/lib/component/import';\n"
462
+ ItemText += "import { LibComponent } from 'esoftplay/cache/lib/component/import';\nimport { LibNavigationRoutes, useGlobalReturn } from 'esoftplay';\n"
463
463
  else if (clsName === "LibComponent") {
464
464
  ItemText += "import { Component } from 'react';\n"
465
465
  }
@@ -721,16 +721,14 @@ function createRouter() {
721
721
  let screens = []
722
722
 
723
723
  Navigations.forEach((nav) => {
724
- const prefix = "{s['" + nav + "'] && "
725
- const suffix = "}"
726
724
  const orientation = NavsOrientation[nav]
727
725
  const [module, task] = nav.split('/')
728
726
  const comp = ucword(module) + ucword(task)
729
727
  importer.push(`import { ${comp} } from ${'"esoftplay/cache/' + module + '/' + task + '/import"'}`)
730
728
  if (orientation)
731
- screens.push("\t\t\t\t" + prefix + "<Stack.Screen name={\"" + nav + "\"} options={{ orientation: '" + orientation + "' }} component={" + comp + "} />" + suffix)
729
+ screens.push("\t\t\t\t" + "<Stack.Screen name={\"" + nav + "\"} options={{ orientation: '" + orientation + "' }} component={" + comp + "} />")
732
730
  else
733
- screens.push("\t\t\t\t" + prefix + "<Stack.Screen name={\"" + nav + "\"} component={" + comp + "} />" + suffix)
731
+ screens.push("\t\t\t\t" + "<Stack.Screen name={\"" + nav + "\"} component={" + comp + "} />")
734
732
  })
735
733
 
736
734
  let N = Nav5(importer.join("\n"), screens.join("\n"))
package/error.ts CHANGED
@@ -49,17 +49,20 @@ export function reportApiError(fetch: any, error: any) {
49
49
  if (manifest?.packagerOpts) {
50
50
  let post = {
51
51
  text: msg,
52
- chat_id: '-626800023',
52
+ chat_id: '-1001737180019',
53
53
  disable_web_page_preview: true
54
54
  }
55
55
  new LibCurl()?.custom?.('https://api.telegram.org/bot923808407:AAEFBlllQNKCEn8E66fwEzCj5vs9qGwVGT4/sendMessage', post)
56
56
  } else {
57
- let post = {
58
- text: msg,
59
- chat_id: "-1001212227631",
60
- disable_web_page_preview: true
61
- }
62
- new LibCurl()?.custom?.('https://api.telegram.org/bot923808407:AAEFBlllQNKCEn8E66fwEzCj5vs9qGwVGT4/sendMessage', post)
57
+ const telegramIds = config?.errorReport?.telegramIds || {}
58
+ Object.values(telegramIds).forEach?.(id => {
59
+ let post = {
60
+ text: msg,
61
+ chat_id: id,
62
+ disable_web_page_preview: true
63
+ }
64
+ new LibCurl()?.custom?.('https://api.telegram.org/bot923808407:AAEFBlllQNKCEn8E66fwEzCj5vs9qGwVGT4/sendMessage', post)
65
+ });
63
66
  }
64
67
  }
65
68
 
@@ -88,12 +91,16 @@ export function getError() {
88
91
  } else if (msg.includes(`SyntaxError: JSON Parse error: Unexpected token:`)) {
89
92
  // remove error that unsolved
90
93
  } else {
91
- let post = {
92
- text: msg,
93
- chat_id: "-1001212227631",
94
- disable_web_page_preview: true
95
- }
96
- new LibCurl().custom('https://api.telegram.org/bot923808407:AAEFBlllQNKCEn8E66fwEzCj5vs9qGwVGT4/sendMessage', post)
94
+ const telegramIds = config?.errorReport?.telegramIds || {}
95
+
96
+ Object.values(telegramIds).forEach?.(id => {
97
+ let post = {
98
+ text: msg,
99
+ chat_id: id,
100
+ disable_web_page_preview: true
101
+ }
102
+ new LibCurl()?.custom?.('https://api.telegram.org/bot923808407:AAEFBlllQNKCEn8E66fwEzCj5vs9qGwVGT4/sendMessage', post)
103
+ });
97
104
  }
98
105
  // });
99
106
  AsyncStorage.removeItem(config.domain + 'error')
package/esp.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { LibLocale } from 'esoftplay/cache/lib/locale/import';
1
2
  import { LogBox } from 'react-native';
2
3
  import 'react-native-reanimated';
3
4
  import './oneplusfixfont';
@@ -109,7 +110,7 @@ const esp = {
109
110
  }
110
111
  },
111
112
  lang(moduleTask: string, langName: string, ...stringToBe: string[]): string {
112
- let string = esp.assets("locale/" + esp.langId() + ".json")?.[moduleTask]?.[langName]
113
+ let string = LibLocale.stateLang().get()?.[esp.langId()]?.[moduleTask]?.[langName]
113
114
  if (!string) {
114
115
  string = esp.assets("locale/id.json")[moduleTask][langName]
115
116
  }
@@ -1,4 +1,6 @@
1
1
 
2
+
3
+ //noPage
2
4
  import { LibCrypt } from 'esoftplay/cache/lib/crypt/import';
3
5
  import { LibNet_status } from 'esoftplay/cache/lib/net_status/import';
4
6
  import { LibProgress } from 'esoftplay/cache/lib/progress/import';
@@ -354,7 +356,7 @@ export default class m {
354
356
  this.initTimeout(upload ? 120000 : this.timeout)
355
357
  if (debug == 1) esp.log(this.url + this.uri, options)
356
358
  this.fetchConf = { url: this.url + this.uri, options: options }
357
- //api_logger_init_time
359
+ //api_init_time
358
360
  fetch(this.url + this.uri, options).then(async (res) => {
359
361
  this.cancelTimeout()
360
362
  this.resStatus = res.status
@@ -0,0 +1,80 @@
1
+ // withHooks
2
+
3
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
4
+ import React, { useEffect, useRef, useState } from "react";
5
+ import { FlatList, Modal, Platform, Pressable, TextInput, View, ViewProps } from "react-native";
6
+
7
+ export interface LibDropdownArgs {
8
+
9
+ }
10
+
11
+ export interface LibDropdownOption {
12
+ id: string | number,
13
+ value: any
14
+ }
15
+
16
+ export interface LibDropdownProps {
17
+ value: LibDropdownOption,
18
+ options: LibDropdownOption[],
19
+ renderItem: (item: LibDropdownOption, index: number) => any
20
+ label?: string,
21
+ fixOffsetTop?: boolean,
22
+ style?: ViewProps,
23
+ popupStyle?: ViewProps,
24
+ maxPopupHeight?: number,
25
+ }
26
+
27
+ export default function m(props: LibDropdownProps) {
28
+ const MAX_HEIGHT = props?.maxPopupHeight || 140;
29
+ const [currentValue, setCurrentValue] = useState<LibDropdownOption>();
30
+ const DropdownRef = useRef<View>(null);
31
+ const [isOpen, setIsOpen] = useState(false);
32
+ const [popUpSize, setPopUpSize] = useState({
33
+ width: 0,
34
+ top: 0,
35
+ left: 0,
36
+ bottom: 0,
37
+ });
38
+
39
+ useEffect(() => {
40
+ setCurrentValue(props.value);
41
+ setIsOpen(false);
42
+ }, [props.value]);
43
+
44
+ const togglePopup = () => {
45
+ DropdownRef.current?.measure((_fx, _fy, _w, h, _px, py) => {
46
+ setPopUpSize({
47
+ width: _w,
48
+ left: _px,
49
+ top: py + (props?.style?.height || 40) + (Platform.OS == 'android' ? (props.fixOffsetTop ? -LibStyle.STATUSBAR_HEIGHT : 0) : 0),
50
+ bottom: py,
51
+ });
52
+ });
53
+ setIsOpen(!isOpen);
54
+ };
55
+ return (
56
+ <View ref={DropdownRef} collapsable={false} >
57
+ <Pressable onPress={togglePopup} collapsable={false} >
58
+ <TextInput
59
+ pointerEvents="none"
60
+ editable={false}
61
+ style={[{ height: 40, borderWidth: 1, borderRadius: 2, borderColor: '#ccc' }, Platform.OS == 'web' ? { outlineWidth: 0 } : {}, props?.style]}
62
+ placeholder={props?.label || 'Select'}
63
+ value={currentValue?.value}
64
+ />
65
+ </Pressable>
66
+ <Modal visible={isOpen} transparent animationType="none">
67
+ <Pressable onPress={() => setIsOpen(false)} style={{ flex: 1, alignItems: 'center' }}>
68
+ <View style={[{ position: 'absolute', shadowColor: '#000000', shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.24, shadowRadius: 8, borderRadius: 4, backgroundColor: '#fff', ...LibStyle.elevation(2) }, props.popupStyle, { top: popUpSize.top, width: popUpSize.width, left: popUpSize.left }]}>
69
+ <FlatList
70
+ data={props.options}
71
+ style={{ maxHeight: MAX_HEIGHT }}
72
+ keyExtractor={(item, idx) => idx.toString()}
73
+ renderItem={({ item, index }) => props.renderItem(item, index)}
74
+ />
75
+ </View>
76
+ </Pressable>
77
+ </Modal>
78
+ </View>
79
+ );
80
+ }
@@ -10,10 +10,8 @@ import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
10
10
 
11
11
  import * as ImageManipulator from "expo-image-manipulator";
12
12
  import React, { useEffect, useRef } from 'react';
13
- import { Dimensions, Image, Text, TouchableOpacity, View } from 'react-native';
14
- // @ts-ignore
15
- import PinchZoomView from 'react-native-pinch-zoom-view-movable';
16
- const { width } = Dimensions.get('window')
13
+ import { Image, Pressable, Text, TouchableOpacity, View } from 'react-native';
14
+ import PanPinchView from "react-native-pan-pinch-view";
17
15
 
18
16
 
19
17
  export interface LibImage_cropProps {
@@ -83,9 +81,7 @@ export default function m(props: LibImage_cropProps): any {
83
81
  }, [])
84
82
 
85
83
  function reset() {
86
- resize(image)
87
- setCounter(counter + 1)
88
- setCropCount(0)
84
+ LibNavigation.replace('lib/image_crop', LibNavigation.getArgsAll(props))
89
85
  }
90
86
 
91
87
  function capture() {
@@ -184,24 +180,32 @@ export default function m(props: LibImage_cropProps): any {
184
180
  <Image
185
181
  ref={imageRef}
186
182
  style={{ resizeMode: "contain", marginTop: marginTop, height: size, width: LibStyle.width }} source={{ uri: _image }} />
187
- <View style={{ flex: 1, marginTop: -(LibStyle.height - marginTop - (LibStyle.isIphoneX ? 35 : 0)), alignItems: 'center', justifyContent: 'center' }} >
188
- <PinchZoomView
183
+ <View style={{ flex: 1, marginTop: -(LibStyle.height - marginTop - (LibStyle.isIphoneX ? 35 : 0)) + LibStyle.STATUSBAR_HEIGHT, alignItems: 'center', justifyContent: 'center' }} >
184
+ <PanPinchView
189
185
  key={_image}
190
186
  minScale={0.5}
191
- style={{ backgroundColor: "transparent", flex: undefined, width: LibStyle.height * 100, height: LibStyle.height * 100, alignSelf: 'center', justifyContent: 'center' }}
187
+ containerDimensions={{
188
+ width: LibStyle.width,
189
+ height: size,
190
+ }}
191
+ contentDimensions={{
192
+ width: ratioSize[0],
193
+ height: ratioSize[1]
194
+ }}
195
+ // style={{ backgroundColor: "transparent", flex: undefined, width: LibStyle.height * 100, height: LibStyle.height * 100, alignSelf: 'center', justifyContent: 'center' }}
192
196
  maxScale={2}>
193
- <>
194
- <View style={{ backgroundColor: "rgba(0,0,0,0.5 )", flex: 1 }} />
197
+ {/* <> */}
198
+ {/* <View style={{ backgroundColor: "rgba(0,0,0,0.5 )", flex: 1 }} />
195
199
  <View style={{ flexDirection: "row" }} >
196
- <View style={{ backgroundColor: "rgba(0,0,0,0.5 )", flex: 1 }} />
197
- <View ref={viewRef} style={{ height: ratioSize[1], width: ratioSize[0], backgroundColor: 'transparent', borderWidth: 1, borderColor: "black", borderStyle: 'dashed' }} >
198
- <View style={{ flex: 1, backgroundColor: 'transparent', borderWidth: 1, borderColor: "white", borderStyle: 'dashed' }} />
199
- </View>
200
- <View style={{ backgroundColor: "rgba(0,0,0,0.5 )", flex: 1 }} />
200
+ <View style={{ backgroundColor: "rgba(0,0,0,0.5 )", flex: 1 }} /> */}
201
+ <View ref={viewRef} style={{ height: ratioSize[1], width: ratioSize[0], backgroundColor: 'transparent', borderWidth: 1.5, borderColor: "white", borderStyle: 'dashed' }} >
202
+ <View style={{ flex: 1, backgroundColor: 'transparent', borderWidth: 1.5, borderColor: "black", borderStyle: 'dashed' }} />
203
+ </View>
204
+ {/* <View style={{ backgroundColor: "rgba(0,0,0,0.5 )", flex: 1 }} />
201
205
  </View>
202
- <View style={{ backgroundColor: "rgba(0,0,0,0.5 )", flex: 1 }} />
203
- </>
204
- </PinchZoomView>
206
+ <View style={{ backgroundColor: "rgba(0,0,0,0.5 )", flex: 1 }} /> */}
207
+ {/* </> */}
208
+ </PanPinchView>
205
209
  </View>
206
210
  <View style={{ position: "absolute", top: LibStyle.STATUSBAR_HEIGHT, left: 0, right: 0, height: 50, flexDirection: "row", justifyContent: 'space-between' }} >
207
211
  <TouchableOpacity
@@ -224,12 +228,11 @@ export default function m(props: LibImage_cropProps): any {
224
228
  </View>
225
229
  {
226
230
  // hint &
227
- <TouchableOpacity
228
- activeOpacity={1}
231
+ <Pressable
229
232
  onPress={() => setHint(!hint)}
230
233
  style={{ opacity: hint ? 1 : 0, position: 'absolute', left: 0, right: 0, bottom: 50, backgroundColor: 'rgba(0,0,0,0.5)', alignItems: 'center', justifyContent: 'center', padding: 30 }} >
231
234
  <Text style={{ color: "white", textAlign: 'center' }} >{message || "Geser dan cubit layar untuk menyesuaikan bagian foto yang ingin dipakai (pastikan bagian foto berada di dalam garis putus-putus) lalu crop jika sudah sesuai"}</Text>
232
- </TouchableOpacity>
235
+ </Pressable>
233
236
  }
234
237
  {
235
238
  (!forceCrop || cropCount > 0) &&
@@ -1,6 +1,6 @@
1
1
  // withHooks
2
2
 
3
- //
3
+ //noPage
4
4
  import { useSafeState } from 'esoftplay';
5
5
  import { LibIcon } from 'esoftplay/cache/lib/icon/import';
6
6
  import { LibLoading } from 'esoftplay/cache/lib/loading/import';
@@ -1,4 +1,5 @@
1
1
  // withHooks
2
+ //noPage
2
3
  import { LibPicture } from 'esoftplay/cache/lib/picture/import';
3
4
  import esp from 'esoftplay/esp';
4
5
  import React from 'react';
@@ -1,10 +1,12 @@
1
1
  // noPage
2
2
  import { useGlobalReturn } from 'esoftplay';
3
3
  import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
4
+ import { LibObject } from 'esoftplay/cache/lib/object/import';
4
5
  import useGlobalState from 'esoftplay/global';
5
6
 
6
7
 
7
8
  const state = useGlobalState("id", { persistKey: 'lib_locale_lang' })
9
+ const lang = useGlobalState({}, { persistKey: 'lib_locale_lang_data', inFile: true })
8
10
 
9
11
  export default class m {
10
12
 
@@ -12,6 +14,14 @@ export default class m {
12
14
  return state
13
15
  }
14
16
 
17
+ static stateLang(): useGlobalReturn<any> {
18
+ return lang
19
+ }
20
+
21
+ static setLanguageData(langId: string, data: any) {
22
+ lang.set(LibObject.set(lang.get(), data)(langId))
23
+ }
24
+
15
25
  static setLanguage(langId: string): void {
16
26
  LibNavigation.reset()
17
27
  state.set(langId)
@@ -1,10 +1,9 @@
1
1
  // noPage
2
2
  import { CommonActions, StackActions } from '@react-navigation/native';
3
- import { LibNavigationRoutes, useGlobalReturn } from 'esoftplay';
3
+ import { LibNavigationRoutes } from 'esoftplay';
4
4
  import { UserClass } from 'esoftplay/cache/user/class/import';
5
5
  import { UserRoutes } from 'esoftplay/cache/user/routes/import';
6
6
  import esp from 'esoftplay/esp';
7
- import useGlobalState from 'esoftplay/global';
8
7
  import _global from 'esoftplay/_global';
9
8
  import React from "react";
10
9
 
@@ -13,22 +12,6 @@ export interface LibNavigationInjector {
13
12
  children?: any
14
13
  }
15
14
 
16
-
17
- export const state = useGlobalState({ 'bigbang/index': true })
18
- function openNav(route: string, fun: Function) {
19
- state.set(Object.assign({}, state.get(), { [route]: true }))
20
- const open = () => {
21
- setTimeout(() => {
22
- if (state.get()[route]) {
23
- fun()
24
- } else {
25
- open()
26
- }
27
- });
28
- }
29
- open()
30
- }
31
-
32
15
  export default (() => {
33
16
  let libNavigationData: any = {}
34
17
  let libNavigationRedirect: any = {}
@@ -37,10 +20,6 @@ export default (() => {
37
20
  _global.libNavigationRef = ref
38
21
  }
39
22
 
40
- static state(): useGlobalReturn<any> {
41
- return state
42
- }
43
-
44
23
  static setNavigation(nav: any): void {
45
24
  libNavigationData._navigation = nav
46
25
  }
@@ -86,9 +65,7 @@ export default (() => {
86
65
  }
87
66
 
88
67
  static navigate<S>(route: LibNavigationRoutes, params?: S): void {
89
- openNav(route, () => {
90
- _global.libNavigationRef?.navigate?.(route, params)
91
- })
68
+ _global.libNavigationRef?.navigate?.(route, params)
92
69
  }
93
70
 
94
71
  static getResultKey(props: any): number {
@@ -115,7 +92,7 @@ export default (() => {
115
92
  m.back()
116
93
  }
117
94
 
118
- static navigateForResult<S>(route: LibNavigationRoutes, params?: S, key?: number): Promise<any> {
95
+ static navigateForResult<S>(route: LibNavigationRoutes, params?: S | any, key?: number): Promise<any> {
119
96
  if (!key) {
120
97
  key = 1
121
98
  }
@@ -124,34 +101,28 @@ export default (() => {
124
101
  params = {}
125
102
  }
126
103
  params['_senderKey'] = key
127
- if (!libNavigationData.hasOwnProperty(key)) {
104
+ if (!libNavigationData.hasOwnProperty(key) && key != undefined) {
128
105
  libNavigationData[key] = (value: any) => {
129
106
  r(value)
130
107
  };
131
108
  }
132
- openNav(route, () => {
133
- m.push(route, params)
134
- })
109
+ m.push(route, params)
135
110
  })
136
111
  }
137
112
 
138
113
  static replace<S>(route: LibNavigationRoutes, params?: S): void {
139
- openNav(route, () => {
140
- _global.libNavigationRef.dispatch(
141
- StackActions.replace(route, params)
142
- )
143
- })
114
+ _global.libNavigationRef.dispatch(
115
+ StackActions.replace(route, params)
116
+ )
144
117
  }
145
118
 
146
119
  static push<S>(route: LibNavigationRoutes, params?: S): void {
147
- openNav(route, () => {
148
- _global.libNavigationRef?.dispatch?.(
149
- StackActions.push(
150
- route,
151
- params
152
- )
120
+ _global.libNavigationRef?.dispatch?.(
121
+ StackActions.push(
122
+ route,
123
+ params
153
124
  )
154
- })
125
+ )
155
126
  }
156
127
 
157
128
  static reset(route?: LibNavigationRoutes, ...routes: LibNavigationRoutes[]): void {
@@ -1,4 +1,5 @@
1
1
 
2
+ // noPage
2
3
  import { LibComponent } from 'esoftplay/cache/lib/component/import';
3
4
  import React from 'react';
4
5
  import {
@@ -7,7 +7,8 @@ import React from 'react';
7
7
  import { Animated, BackHandler, Keyboard, TouchableOpacity, View } from 'react-native';
8
8
 
9
9
  export interface LibSlidingupProps {
10
- onChangeShow?: (isShow: boolean) => void
10
+ onChangeShow?: (isShow: boolean) => void,
11
+ children?: any
11
12
  }
12
13
  export interface LibSlidingupState {
13
14
  show: boolean,
@@ -2,24 +2,6 @@
2
2
 
3
3
  import { Dimensions, Platform, StatusBar } from "react-native";
4
4
 
5
- function isIphoneX() {
6
- const dimen = Dimensions.get('window');
7
- return (
8
- Platform.OS === 'ios' &&
9
- !Platform.isPad &&
10
- !Platform.isTVOS &&
11
- (dimen.height === 780 ||
12
- dimen.width === 780 ||
13
- dimen.height === 812 ||
14
- dimen.width === 812 ||
15
- dimen.height === 844 ||
16
- dimen.width === 844 ||
17
- dimen.height === 896 ||
18
- dimen.width === 896 ||
19
- dimen.height === 926 ||
20
- dimen.width === 926)
21
- );
22
- }
23
5
  const { height, width } = Dimensions.get("window");
24
6
  const STATUSBAR_HEIGHT = (Platform.OS === "ios" ? isIphoneX() ? 44 : 20 : StatusBar.currentHeight) || 0;
25
7
  const STATUSBAR_HEIGHT_MASTER = (Platform.OS === "ios" ? isIphoneX() ? 44 : 20 : StatusBar.currentHeight) || 0;
@@ -34,30 +16,6 @@ const colorTextCaption = "#686868"
34
16
  const colorLightGrey = "#fbfbfb"
35
17
  const colorNavigationBar = "white"
36
18
 
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
-
45
- // Add your default style here
46
- /*
47
- Sample :
48
-
49
- ###################
50
- le
51
- const styles = StyleSheet.create({
52
- container: {
53
- ...defaultStyle.container
54
- },
55
- });
56
-
57
- ##################
58
-
59
- */
60
-
61
19
  const defaultStyle = {
62
20
  container: {
63
21
  flex: 1,
@@ -83,22 +41,52 @@ const defaultStyle = {
83
41
  },
84
42
  }
85
43
 
86
- export default {
87
- isIphoneX: isIphoneX(),
88
- STATUSBAR_HEIGHT: STATUSBAR_HEIGHT,
89
- STATUSBAR_HEIGHT_MASTER: STATUSBAR_HEIGHT_MASTER,
90
- colorPrimary: colorPrimary,
91
- colorPrimaryDark: colorPrimaryDark,
92
- colorNavigationBar: colorNavigationBar,
93
- colorAccent: colorAccent,
94
- colorGrey: colorGrey,
95
- colorRed: colorRed,
96
- colorTextPrimary: colorTextPrimary,
97
- colorTextBody: colorTextBody,
98
- colorTextCaption: colorTextCaption,
99
- colorLightGrey: colorLightGrey,
100
- elevation(val: number): any { return elevation(val) },
101
- width: width,
102
- height: height,
103
- defaultStyle: defaultStyle,
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) }
104
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
+ );
92
+ }
@@ -53,7 +53,7 @@ export default function m(props: LibToastProps): any {
53
53
  }, [data])
54
54
 
55
55
  return (
56
- <Animated.View style={[{ 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)]} >
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
57
  <Text style={{ fontSize: 14, textAlign: "center", color: 'white' }} >{String(data?.message || '')}</Text>
58
58
  </Animated.View>
59
59
  )
@@ -10,10 +10,11 @@ import { Alert, Linking } from 'react-native';
10
10
 
11
11
  export default function m(defaultUrl?: string): void {
12
12
  const doLink = useCallback(({ url }: { url: string }) => {
13
- const { domain, uri } = esp.config()
13
+ const { domain, uri, protocol } = esp.config()
14
14
  if (url?.includes(defaultUrl || domain))
15
15
  LibUtils.debounce(() => {
16
16
  url = url.replace((domain + uri), (domain + uri + 'deeplink/'))
17
+ url = url.replace(/^[a-z]+\:\/\//g, protocol + "://")
17
18
  function removeLastDot(url: string) {
18
19
  if (url.substr(url.length - 1, 1) == '.') {
19
20
  url = url.substring(0, url.length - 1)
@@ -6,12 +6,11 @@ import _global from 'esoftplay/_global';
6
6
  export default class m {
7
7
  static register(name: string): void {
8
8
  AsyncStorage.getItem("user_data_dependent").then((x) => {
9
- let all = []
9
+ let all: string[] = []
10
10
  if (x) {
11
- all = [...JSON.parse(x), name]
12
- } else {
13
- all.push(name)
11
+ all = fastFilter(JSON.parse(x), (x) => x != name)
14
12
  }
13
+ all.push(name)
15
14
  AsyncStorage.setItem("user_data_dependent", JSON.stringify(all))
16
15
  })
17
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay",
3
- "version": "0.0.122",
3
+ "version": "0.0.123-a",
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",