esoftplay 0.0.126 → 0.0.127-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
@@ -82,10 +82,7 @@ if (fs.existsSync(packjson)) {
82
82
  } catch (error) { }
83
83
  if (!$appjson.expo.hasOwnProperty('runtimeVersion')) {
84
84
  $appjson.expo.runtimeVersion = 1
85
- }
86
- if (!$appjson.expo.hasOwnProperty('android')) {
87
85
  $appjson.expo.android = {
88
- "useNextNotificationsApi": true,
89
86
  "package": "com.domain",
90
87
  "versionCode": 1,
91
88
  "intentFilters": [
@@ -120,7 +117,12 @@ if (fs.existsSync(packjson)) {
120
117
  "associatedDomains": [
121
118
  "applinks:*.domain.com",
122
119
  "applinks:domain.com"
123
- ]
120
+ ],
121
+ "infoPlist": {
122
+ "LSApplicationQueriesSchemes": [
123
+ "itms-apps"
124
+ ]
125
+ }
124
126
  }
125
127
 
126
128
  fs.writeFile(appjson, JSON.stringify($appjson, null, 2), (err) => {
@@ -369,22 +371,24 @@ export default function App() {
369
371
  // fs.writeFileSync('../@firebase/app/dist/index.rn.cjs.js', firebaseText)
370
372
  // }
371
373
  // /* end AsyncStorage @firebase section */
372
- if (fs.existsSync('../@expo/vector-icons')) {
373
- let esoftplayIcon = ''
374
- fs.readdir('../@expo/vector-icons/build', (err, files) => {
375
- const dfiles = files.filter((file) => file.includes('d.ts'))
376
- dfiles.map((dfile, i) => {
377
- const rdfile = fs.readFileSync('../@expo/vector-icons/build/' + dfile, { encoding: 'utf8' })
378
- const names = (/import\("\.\/createIconSet"\)\.Icon<((.*))\,.*>/g).exec(rdfile);
379
- if (names && names[1].includes('|')) {
380
- esoftplayIcon += 'export type ' + dfile.replace('.d.ts', 'Types') + ' = ' + names[1] + '\n';
381
- }
374
+ if (appjson)
375
+
376
+ if (fs.existsSync('../@expo/vector-icons')) {
377
+ let esoftplayIcon = ''
378
+ fs.readdir('../@expo/vector-icons/build', (err, files) => {
379
+ const dfiles = files.filter((file) => file.includes('d.ts'))
380
+ dfiles.map((dfile, i) => {
381
+ const rdfile = fs.readFileSync('../@expo/vector-icons/build/' + dfile, { encoding: 'utf8' })
382
+ const names = (/import\("\.\/createIconSet"\)\.Icon<((.*))\,.*>/g).exec(rdfile);
383
+ if (names && names[1].includes('|')) {
384
+ esoftplayIcon += 'export type ' + dfile.replace('.d.ts', 'Types') + ' = ' + names[1] + '\n';
385
+ }
386
+ })
387
+ fs.writeFileSync('../@expo/vector-icons/build/esoftplay_icons.ts', esoftplayIcon)
382
388
  })
383
- fs.writeFileSync('../@expo/vector-icons/build/esoftplay_icons.ts', esoftplayIcon)
384
- })
385
- } else {
386
- console.log("@expo/vector-icons not installed")
387
- }
389
+ } else {
390
+ console.log("@expo/vector-icons not installed")
391
+ }
388
392
  console.log('Please wait until processes has finished...');
389
393
  });
390
394
  }
package/bin/cli.js CHANGED
@@ -15,7 +15,6 @@ const confjson = DIR + "config.json"
15
15
  const conflive = DIR + "config.live.json"
16
16
  const confdebug = DIR + "config.debug.json"
17
17
  const gitignore = DIR + ".gitignore"
18
-
19
18
  const gplist = DIR + "GoogleService-Info.plist"
20
19
  const gplistlive = DIR + "GoogleService-Info.live.plist"
21
20
  const gplistdebug = DIR + "GoogleService-Info.debug.plist"
@@ -132,6 +131,61 @@ switch (args[0]) {
132
131
  break;
133
132
  }
134
133
 
134
+ function switchStatusAssets(status) {
135
+
136
+ const iconpng = DIR + "assets/icon.png"
137
+ const icondebug = DIR + "assets/icon.debug.png"
138
+ const iconlive = DIR + "assets/icon.live.png"
139
+
140
+ const icon_iospng = DIR + "assets/icon_ios.png"
141
+ const icon_iosdebug = DIR + "assets/icon_ios.debug.png"
142
+ const icon_ioslive = DIR + "assets/icon_ios.live.png"
143
+
144
+ const iconNotifpng = DIR + "assets/iconNotif.png"
145
+ const iconNotifdebug = DIR + "assets/iconNotif.debug.png"
146
+ const iconNotiflive = DIR + "assets/iconNotif.live.png"
147
+
148
+ const splashpng = DIR + "assets/splash.png"
149
+ const splashdebug = DIR + "assets/splash.debug.png"
150
+ const splashlive = DIR + "assets/splash.live.png"
151
+
152
+
153
+ function copyFileFromTo(from, to) {
154
+ if (fs.existsSync(from)) {
155
+ if (fs.existsSync(to))
156
+ command('rm ' + to)
157
+ command('cp ' + from + ' ' + to)
158
+ }
159
+ }
160
+ if (status.includes('l')) {
161
+ copyFileFromTo(iconlive, iconpng)
162
+ copyFileFromTo(icon_ioslive, icon_iospng)
163
+ copyFileFromTo(splashlive, splashpng)
164
+ copyFileFromTo(iconNotiflive, iconNotifpng)
165
+ }
166
+ if (status.includes('d')) {
167
+ copyFileFromTo(icondebug, iconpng)
168
+ copyFileFromTo(icon_iosdebug, icon_iospng)
169
+ copyFileFromTo(splashdebug, splashpng)
170
+ copyFileFromTo(iconNotifdebug, iconNotifpng)
171
+ }
172
+
173
+ fs.readdirSync(DIR + '/modules/').forEach((mod) => {
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
+ })
185
+ })
186
+
187
+ }
188
+
135
189
  function excludeModules() {
136
190
  let cjson = readToJSON(confjson)
137
191
  if (cjson.config.hasOwnProperty('excludeModules')) {
@@ -451,6 +505,7 @@ function readToJSON(path) {
451
505
  return isJSON ? JSON.parse(txt) : txt
452
506
  }
453
507
 
508
+
454
509
  function publish(notes) {
455
510
  jsEng(appjson, true)
456
511
  jsEng(appdebug, true)
@@ -540,8 +595,26 @@ function publish(notes) {
540
595
  esplibs.forEach((key) => {
541
596
  stringBuilder += ("\n" + key + ": " + pack.dependencies[key])
542
597
  })
543
- stringBuilder += (notes != '' ? ("\n\n- " + notes) : '')
544
- tm(stringBuilder)
598
+ const { exec } = require('child_process');
599
+ exec("publisher=$(npx expo whoami &); echo $publisher;", (error, stdout, stderr) => {
600
+ if (error) {
601
+ console.error(`exec error: ${error}`);
602
+ return;
603
+ }
604
+ let accountName = stdout.trim();
605
+ stringBuilder += "\npublisher: @" + accountName + "\n"
606
+ stringBuilder += (notes != '' ? ("\n\n- " + notes) : '')
607
+ tm(stringBuilder)
608
+ if (notes.startsWith('*') && ajson.config.publish_id) {
609
+ const config = readToJSON(confjson).config;
610
+ const ajson = readToJSON(appjson);
611
+ const url = config.publish_uri + ajson.config.publish_id
612
+ const fetch = require('node-fetch')
613
+ console.log("PROCESSING FORCE UPDATE")
614
+ fetch(url).then((res) => JSON.stringify(res.json(), undefined, 2)).then(consoleSucces)
615
+ }
616
+ });
617
+
545
618
  }
546
619
  }
547
620
 
@@ -915,10 +988,20 @@ function switchStatus(status) {
915
988
  let valid = true
916
989
  if (valid)
917
990
  valid = copyFromTo(status.includes("l") ? applive : appdebug, appjson)
918
- if (valid)
991
+ if (valid) {
919
992
  valid = copyFromTo(status.includes("l") ? conflive : confdebug, confjson)
993
+
994
+ const cjson = readToJSON(confjson)
995
+ if (cjson.hasOwnProperty('config')) {
996
+ if (cjson.config.hasOwnProperty('build')) {
997
+ const [usr, pwd] = cjson.config.build
998
+ command(`expo logout && expo login -u ${usr} -p ${pwd}`)
999
+ }
1000
+ }
1001
+ }
920
1002
  if (valid && fs.existsSync(gplist))
921
1003
  valid = copyFromTo(status.includes("l") ? gplistlive : gplistdebug, gplistlive)
1004
+ switchStatusAssets(status)
922
1005
  if (!valid) {
923
1006
  consoleError('TERJADI KESALAHAN')
924
1007
  checkApp()
package/esp.ts CHANGED
@@ -186,9 +186,9 @@ const esp = {
186
186
  theme: ["light", "dark"],
187
187
  comment_login: 1,
188
188
  notification: 0,
189
- isDebug: __DEV__ ? 1 : 0,
190
189
  ...app.config
191
190
  }
191
+
192
192
  if (!config.hasOwnProperty('url') || config.url.length == 0) {
193
193
  config.url = config.protocol + "://" + config.api + "." + config.domain + config.uri;
194
194
  }
@@ -3,9 +3,9 @@
3
3
  import { useSafeState } from 'esoftplay';
4
4
 
5
5
 
6
- import React, { useCallback } from 'react';
6
+ import React, { useEffect } from 'react';
7
7
  import { Pressable } from 'react-native';
8
- import Animated, { interpolate, useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
8
+ import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
9
9
 
10
10
 
11
11
  export interface LibCollapsArgs {
@@ -17,42 +17,51 @@ export interface LibCollapsProps {
17
17
  style?: any
18
18
  }
19
19
  export default function m(props: LibCollapsProps): any {
20
- const animHeight = useSharedValue(-1)
21
- const bodyHeight = useSharedValue(1)
22
20
  const [expand, setExpand] = useSafeState(props.show)
21
+ const opacity = useSharedValue(0);
22
+ const translateY = useSharedValue(-10);
23
23
 
24
- const heightStyle = useAnimatedStyle(() => {
24
+ const animatedStyle = useAnimatedStyle(() => {
25
25
  return {
26
- overflow: 'hidden',
27
- height: interpolate(animHeight.value,
28
- [0, 1, 2],
29
- [0, bodyHeight.value, bodyHeight.value * 2]),
30
- opacity: interpolate(animHeight.value,
31
- [-1, 0],
32
- [0, 1])
26
+ opacity: opacity.value,
27
+ transform: [{ translateY: translateY.value }],
28
+ };
29
+ });
30
+
31
+ useEffect(() => {
32
+ if (expand) {
33
+ toggleAnimation()
33
34
  }
34
- })
35
+ }, [expand])
36
+
37
+ const toggleAnimation = () => {
38
+ opacity.value = withTiming(opacity.value === 0 ? 1 : 0, { duration: 300 }, (status) => {
39
+ if (opacity.value == 0 && status) {
40
+ runOnJS(setExpand)(false)
41
+ }
42
+ });
43
+ translateY.value = withTiming(opacity.value !== 0 ? -10 : 0, { duration: 300})
44
+ };
35
45
 
36
- const toggle = useCallback(() => {
37
- animHeight.value = animHeight.value == 0 ? withSpring(1) : withTiming(0)
38
- setExpand(animHeight.value != 1)
39
- }, [])
46
+ function toggle() {
47
+ if (!expand) {
48
+ setExpand(true)
49
+ } else {
50
+ toggleAnimation()
51
+ }
52
+ }
40
53
 
41
54
  return (
42
- <Animated.View style={{ overflow: 'hidden' }} >
43
- <Pressable onPress={toggle} >
55
+ <Animated.View>
56
+ <Pressable onPress={toggle} style={{zIndex:11}} >
44
57
  {props.header(expand)}
45
58
  </Pressable>
46
- <Animated.View
47
- onLayout={({ nativeEvent: { layout: { height } } }) => {
48
- if (height && animHeight.value == -1) {
49
- bodyHeight.value = height + 5
50
- animHeight.value = props.show ? 1 : 0
51
- }
52
- }}
53
- style={[heightStyle]}>
54
- {props.children}
55
- </Animated.View>
59
+ {expand &&
60
+ <Animated.View
61
+ style={[{ paddingBottom: expand ? 10 : 0, zIndex:10 }, animatedStyle]}>
62
+ {props.children}
63
+ </Animated.View>
64
+ }
56
65
  </Animated.View>
57
66
  )
58
67
  }
@@ -5,7 +5,7 @@ import { LibTheme } from 'esoftplay/cache/lib/theme/import';
5
5
  import { LibUtils } from 'esoftplay/cache/lib/utils/import';
6
6
 
7
7
  import React from 'react';
8
- import { TextInput, View } from 'react-native';
8
+ import { Platform, TextInput, View } from 'react-native';
9
9
 
10
10
  export interface LibInputProps {
11
11
  icon?: (color: string) => any,
@@ -122,7 +122,7 @@ export default class m extends LibComponent<LibInputProps, LibInputState>{
122
122
  for (let i = 0; i < rMask.length; i++) {
123
123
  const iMask = rMask[i];
124
124
  if (iMask == '#') {
125
- if (rText[i - _addRange] != undefined) {
125
+ if (rText?.[i - _addRange] != undefined) {
126
126
  maskedText += _addMaskChar + rText[i - _addRange]
127
127
  }
128
128
  else {
@@ -222,7 +222,7 @@ export default class m extends LibComponent<LibInputProps, LibInputState>{
222
222
  allowFontScaling={false}
223
223
  {...this.props}
224
224
  style={[{
225
- outlineWidth: 0,
225
+ outlineWidth: Platform.OS == 'web' ? 0 : undefined,
226
226
  paddingVertical: 8,
227
227
  marginBottom: 2,
228
228
  paddingRight: suffix ? (suffix.length * 14) : 0,
@@ -3,6 +3,7 @@ import { useGlobalReturn } from 'esoftplay';
3
3
  import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
4
4
  import { LibObject } from 'esoftplay/cache/lib/object/import';
5
5
  import useGlobalState from 'esoftplay/global';
6
+ import { NativeModules, Platform } from 'react-native';
6
7
 
7
8
 
8
9
  const state = useGlobalState("id", { persistKey: 'lib_locale_lang' })
@@ -26,4 +27,16 @@ export default class m {
26
27
  LibNavigation.reset()
27
28
  state.set(langId)
28
29
  }
30
+
31
+ static getDeviceLanguange(): string {
32
+ const appLanguage =
33
+ Platform.OS === 'ios'
34
+ ? NativeModules.SettingsManager.settings.AppleLocale ||
35
+ NativeModules.SettingsManager.settings.AppleLanguages[0]
36
+ : NativeModules.I18nManager.localeIdentifier;
37
+
38
+ const fixAppLanguage = appLanguage.search(/-|_/g) !== -1 ? appLanguage.slice(0, 2) : appLanguage;
39
+ let def = fixAppLanguage == 'in' ? 'id' : fixAppLanguage
40
+ return def
41
+ }
29
42
  }
@@ -7,6 +7,7 @@ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
7
7
  import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
8
8
  import { LibStyle } from 'esoftplay/cache/lib/style/import';
9
9
  import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
10
+ import { LibUpdaterProperty } from 'esoftplay/cache/lib/updater/import';
10
11
 
11
12
  import Constants from 'expo-constants';
12
13
  import React from 'react';
@@ -21,15 +22,10 @@ export interface LibVersionState {
21
22
  export default class m extends LibComponent<LibVersionProps, LibVersionState> {
22
23
 
23
24
  static appVersion(): string {
24
- let version: any = (Platform.OS == 'android' ? Constants.manifest.android.versionCode : Constants.manifest.ios.buildNumber)
25
+ let version: any = (Platform.OS == 'android' ? Constants?.manifest?.android?.versionCode : Constants?.manifest?.ios?.buildNumber)
25
26
  return version
26
27
  }
27
28
 
28
- static isAutoUpdate(): boolean {
29
- let enabled: any = esp.appjson().expo.updates.enabled
30
- return enabled == true
31
- }
32
-
33
29
  static showDialog(title: string, message: string, link: string, onOk: (link: string) => void, onCancel: () => void): void {
34
30
  LibDialog.confirm(title, message, 'Update', () => onOk(link), 'Nanti', onCancel)
35
31
  }
@@ -43,28 +39,30 @@ export default class m extends LibComponent<LibVersionProps, LibVersionState> {
43
39
  }
44
40
 
45
41
  static toStore(link: string): void {
46
- Linking.canOpenURL(link) && Linking.openURL(link)
42
+ Linking.openURL(link)
47
43
  }
48
44
 
49
45
  static onDone(res: any, msg: string): void {
50
- const { title, version, android, ios } = res
46
+ const { title, version, android, ios, isForceUpdate } = res
47
+
51
48
  function isAvailableNewVersion(newVersion: string): boolean {
52
49
  let oldVersion = m.appVersion()
53
50
  return newVersion > oldVersion
54
51
  }
55
-
56
52
  if (isAvailableNewVersion(version)) {
57
53
  LibNavigation.backToRoot()
58
54
  LibNavigation.replace("lib/version", { res, msg: msg == 'success' ? 'Update to a new version now' : msg })
59
55
  }
60
-
56
+ if (isForceUpdate == 1) {
57
+ LibUpdaterProperty.check((isNew) => { if (isNew) LibUpdaterProperty.install() })
58
+ }
61
59
  }
62
60
  static check(): void {
63
61
  new LibCurl("public_version", null, m.onDone)
64
62
  }
65
63
 
66
64
  render(): any {
67
- const { res: { title, version, android, ios }, msg } = LibNavigation.getArgsAll(this.props)
65
+ const { res: { title, version, android, ios }, msg } = LibNavigation.getArgsAll<any>(this.props)
68
66
  const link = Platform.OS == 'ios' ? ios : android
69
67
  return (
70
68
  <ImageBackground source={esp.assets("splash.png")} blurRadius={100} style={{ flex: 1, justifyContent: 'center', alignItems: 'center', borderStartColor: 'white', paddingHorizontal: 17 }} >
@@ -72,7 +70,7 @@ export default class m extends LibComponent<LibVersionProps, LibVersionState> {
72
70
  <LibTextstyle textStyle="headline" text={title || 'A new version is available'} style={{ textAlign: 'center', marginTop: 10 }} />
73
71
  <LibTextstyle textStyle="callout" text={msg} style={{ textAlign: 'center', marginTop: 10, color: '#333' }} />
74
72
  <TouchableOpacity
75
- onPress={() => { Linking.canOpenURL(link) && Linking.openURL(link) }}
73
+ onPress={() => { Linking.openURL(link) }}
76
74
  style={{ marginTop: 20, borderRadius: 10, paddingHorizontal: 17, paddingVertical: 10, backgroundColor: LibStyle.colorPrimary }} >
77
75
  <LibTextstyle textStyle="body" text="Update Sekarang" />
78
76
  </TouchableOpacity>
@@ -1,6 +1,7 @@
1
1
  // noPage
2
2
  import AsyncStorage from '@react-native-async-storage/async-storage';
3
3
  import _global from 'esoftplay/_global';
4
+ import Storage from 'esoftplay/storage';
4
5
 
5
6
  export default class m {
6
7
  static register(name: string): void {
@@ -28,7 +29,11 @@ export default class m {
28
29
  if (_global?.useGlobalUserDelete) {
29
30
  Object.values?.(_global?.useGlobalUserDelete)?.map?.((func) => func?.())
30
31
  }
31
- if (x) AsyncStorage.multiRemove(JSON.parse(x))
32
+ if (x) {
33
+ AsyncStorage.multiRemove(JSON.parse(x))
34
+ const arx = JSON.parse(x)
35
+ arx.forEach((ix) => { Storage.removeItem(ix) })
36
+ }
32
37
  })
33
38
  }
34
39
  }
@@ -16,6 +16,10 @@ export default class m extends LibComponent<UserMainProps, UserMainState> {
16
16
  }
17
17
 
18
18
  render(): any {
19
- return null
19
+ return (
20
+ <>
21
+ {/* <LibAuto_update /> */}
22
+ </>
23
+ )
20
24
  }
21
25
  }
@@ -51,7 +51,7 @@ function setFonts(): Promise<void> {
51
51
  }
52
52
 
53
53
 
54
- const route = useGlobalState<any>(undefined, { persistKey: 'user_index_routes_initial' })
54
+ const route = useGlobalState<any>(undefined, { persistKey: 'user_index_routes_initial', inFile: true })
55
55
  export default function m(props: UserIndexProps): any {
56
56
  const [loading, setLoading] = useSafeState(true)
57
57
  const user = UserClass.state().useSelector(s => s)
@@ -105,8 +105,6 @@ export default function m(props: UserIndexProps): any {
105
105
 
106
106
  }
107
107
  }
108
-
109
-
110
108
  LibUpdaterProperty.check()
111
109
  }, [])
112
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay",
3
- "version": "0.0.126",
3
+ "version": "0.0.127-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",
package/state.ts CHANGED
@@ -8,7 +8,8 @@ export default function useRefState<T = any>(defaultValue?: T): UseRefStateResul
8
8
 
9
9
  const updateState = useCallback((value: T | undefined) => {
10
10
  if (isMountedRef.current) {
11
- setState(value);
11
+ setState(value)
12
+ // InteractionManager.runAfterInteractions(() => setState(value))
12
13
  }
13
14
  }, []);
14
15