esoftplay 0.0.112-b → 0.0.112-e

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
@@ -5,6 +5,7 @@ const fs = require('fs');
5
5
  const DIR = "../../"
6
6
  const packjson = DIR + "package.json"
7
7
  const appjson = DIR + "app.json"
8
+ const easjson = DIR + "eas.json"
8
9
  const confjson = DIR + "config.json"
9
10
  const gitignore = DIR + ".gitignore"
10
11
  const babelconfig = DIR + "babel.config.js"
@@ -116,6 +117,35 @@ if (fs.existsSync(packjson)) {
116
117
  fs.writeFileSync(pathJSTimer, JSTimers)
117
118
  }
118
119
 
120
+ const easconfg = `{
121
+ "cli": {
122
+ "version": ">= 0.52.0"
123
+ },
124
+ "build": {
125
+ "development": {
126
+ "developmentClient": true,
127
+ "distribution": "internal",
128
+ "ios": {
129
+ "simulator": true
130
+ }
131
+ },
132
+ "preview": {
133
+ "distribution": "internal",
134
+ "ios": {
135
+ "simulator": true
136
+ }
137
+ },
138
+ "production": {}
139
+ },
140
+ "submit": {
141
+ "production": {}
142
+ }
143
+ }`
144
+
145
+ fs.writeFile(easjson, easconfg, (err) => {
146
+ if (err) throw err;
147
+ console.log('eas.json has been updated');
148
+ })
119
149
 
120
150
  const babelconf = `module.exports = function (api) {
121
151
  api.cache(true);
@@ -210,6 +240,7 @@ yarn-error.log\n\
210
240
  import * as ErrorReport from 'esoftplay/error';
211
241
  import * as Notifications from 'expo-notifications';
212
242
  import React, { useEffect, useRef } from 'react';
243
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
213
244
  import { enableScreens } from 'react-native-screens';
214
245
  const { globalIdx } = require('esoftplay/global');
215
246
  enableScreens();
@@ -224,7 +255,11 @@ export default function App() {
224
255
  ErrorReport.getError()
225
256
  }, [])
226
257
 
227
- return <Home />
258
+ return (
259
+ <GestureHandlerRootView style={{ flex: 1 }}>
260
+ <Home />
261
+ </GestureHandlerRootView>
262
+ )
228
263
  }`;
229
264
  let expoLib = [
230
265
  '@expo/vector-icons',
@@ -257,6 +292,7 @@ export default function App() {
257
292
  'react-fast-compare',
258
293
  'react-native-gesture-handler',
259
294
  'react-native-awesome-gallery',
295
+ 'react-native-fast-image',
260
296
  'react-native-picker-scrollview',
261
297
  'react-native-pinch-zoom-view-movable',
262
298
  'react-native-reanimated',
package/bin/cli.js CHANGED
@@ -5,6 +5,8 @@ const fs = require('fs');
5
5
  const exec = require('child_process').execSync;
6
6
  const path = require('path');
7
7
  const os = require('os')
8
+ const readline = require('readline');
9
+
8
10
 
9
11
  const DIR = "./"
10
12
  const appjson = DIR + "app.json"
@@ -557,21 +559,109 @@ function command(command) {
557
559
  }
558
560
 
559
561
  function build() {
560
- if (args[0] == "build") {
561
- askPerm("Yakin akan membuild app " + (args[1] ? args[1] : "") + (args[2] ? " " + (args[2]) : "") + "?", () => {
562
- if (args[1] == "debug" || args[1] == "live") {
563
- switchStatus(args[1])
564
- console.log('+ status ' + args[1])
562
+ const types = [
563
+ {
564
+ name: "1. IOS (Debug) - Simulator",
565
+ cmd: "eas build --platform ios --profile development",
566
+ pre: () => {
567
+ jsEng(appjson, false)
568
+ jsEng(appdebug, false)
569
+ jsEng(applive, false)
570
+ consoleSucces("Hermes dinonaktifkan")
565
571
  }
566
- if (args[2] == "offline" || args[2] == "online") {
567
- switchMode(args[2])
568
- console.log('+ mode ' + args[2])
572
+ },
573
+ {
574
+ name: "2. IOS (Test) - Simulator",
575
+ cmd: "eas build --platform ios --profile preview",
576
+ pre: () => {
577
+ jsEng(appjson, true)
578
+ jsEng(appdebug, true)
579
+ jsEng(applive, true)
580
+ consoleSucces("Hermes diaktifkan")
569
581
  }
570
- command("expo build:android")
571
- command("expo build:ios")
572
- command("expo build:android -t app-bundle")
573
- consoleError("silahkan cek build pada halaman https://expo.io/builds")
574
- })
582
+ },
583
+ {
584
+ name: "3. IOS (Release) - ipa",
585
+ cmd: "eas build --platform ios --profile production",
586
+ pre: () => {
587
+ jsEng(appjson, true)
588
+ jsEng(appdebug, true)
589
+ jsEng(applive, true)
590
+ consoleSucces("Hermes diaktifkan")
591
+ }
592
+ },
593
+ {
594
+ name: "4. Android (Debug) - apk",
595
+ cmd: "eas build --platform android --profile development",
596
+ pre: () => {
597
+ jsEng(appjson, false)
598
+ jsEng(appdebug, false)
599
+ jsEng(applive, false)
600
+ consoleSucces("Hermes dinonaktifkan")
601
+ }
602
+ },
603
+ {
604
+ name: "5. Android (Test) - apk",
605
+ cmd: "eas build --platform android --profile preview",
606
+ pre: () => {
607
+ jsEng(appjson, true)
608
+ jsEng(appdebug, true)
609
+ jsEng(applive, true)
610
+ consoleSucces("Hermes dinonaktifkan")
611
+ }
612
+ },
613
+ {
614
+ name: "6. Android (Release) - aab",
615
+ cmd: "eas build --platform android --profile production",
616
+ pre: () => {
617
+ jsEng(appjson, true)
618
+ jsEng(appdebug, true)
619
+ jsEng(applive, true)
620
+ consoleSucces("Hermes dinonaktifkan")
621
+ }
622
+ }
623
+ ]
624
+
625
+ function jsEng(file, isHermes) {
626
+ if (fs.existsSync(file)) {
627
+ var txt = fs.readFileSync(file, 'utf8');
628
+ let isJSON = txt.startsWith('{') || txt.startsWith('[')
629
+ if (!isJSON) {
630
+ consoleError('app.json tidak valid')
631
+ return
632
+ }
633
+ let app = JSON.parse(txt)
634
+ app.expo.jsEngine = isHermes ? "hermes" : "jsc"
635
+ fs.writeFileSync(file, JSON.stringify(app, undefined, 2))
636
+ } else {
637
+ consoleError(file)
638
+ }
639
+ }
640
+
641
+ if (args[0] == "build") {
642
+ let d
643
+ const rl = readline.createInterface({
644
+ input: process.stdin,
645
+ output: process.stdout
646
+ });
647
+
648
+ rl.question("Pilih build type :\n\n" + types.map((x) => x.name).join("\n") + '\n\nMasukkan nomor build type: ', function (idx) {
649
+ d = types[idx - 1]
650
+ rl.close();
651
+ });
652
+
653
+ rl.on("close", function () {
654
+ if (d) {
655
+ let cmd = d.cmd
656
+ let pre = d.pre
657
+ if (pre) { pre() }
658
+ consoleSucces("⚙⚙⚙ ... \n" + cmd)
659
+ command(cmd);
660
+ } else {
661
+ consoleError("Build type tidak ditemukan")
662
+ }
663
+ });
664
+
575
665
  }
576
666
  }
577
667
 
@@ -625,6 +715,7 @@ function doInc(file) {
625
715
  consoleSucces(file + " Versi yang lama " + app.expo.version)
626
716
  app.expo.android.versionCode = lastVersion + 1
627
717
  app.expo.ios.buildNumber = String(lastVersion + 1)
718
+ app.expo.runtimeVersion = lastVersion + 1
628
719
  app.expo.version = args[1] || ('0.' + String(lastVersion + 1))
629
720
  consoleSucces(file + " Berhasil diupdate ke versi " + app.expo.version)
630
721
  fs.writeFileSync(file, JSON.stringify(app, undefined, 2))
@@ -669,6 +760,7 @@ function help() {
669
760
  "\n - u|update : untuk update esp module ke versi terakhir",
670
761
  "\n - u|update all : untuk update semua esp module ke versi terakhir",
671
762
  "\n - start : start esoftplay framework",
763
+ "\n - b|build : untuk build app .ipa .apk .aab",
672
764
  "\n - f|file : untuk check status file",
673
765
  "\n - c|check : untuk check status",
674
766
  "\n - create-master [moduleName] : untuk create master module terpisah",
@@ -681,7 +773,6 @@ function help() {
681
773
  "\n - p|publish [notes] : untuk mempublish dan menambahkan id",
682
774
  "\n - bcl|backup-config-live : untuk backup config live",
683
775
  "\n - bcd|backup-config-debug : untuk backup config debug",
684
- // "\n - b|build : untuk build app .ipa .apk .aab",
685
776
  // "\n - build debug : untuk build app .ipa .apk .aab status DEBUG",
686
777
  // "\n - build debug offline : untuk build app .ipa .apk .aab status DEBUG mode OFFLINE",
687
778
  // "\n - build debug online : untuk build app .ipa .apk .aab status DEBUG mode ONLINE",
@@ -24,8 +24,6 @@ export default class ecurl {
24
24
  cancel: "Tutup"
25
25
  }
26
26
 
27
- abort = axios.CancelToken.source();
28
-
29
27
  constructor(uri?: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number) {
30
28
  this.header = {}
31
29
  this.maxRetry = 2;
@@ -58,10 +56,10 @@ export default class ecurl {
58
56
  protected initTimeout(customTimeout?: number): void {
59
57
  this.cancelTimeout()
60
58
  this.timeoutContext = setTimeout(() => {
61
- if (this.abort?.cancel) {
62
- this.closeConnection()
63
- LibProgress.hide()
64
- }
59
+ // if (this.abort?.cancel) {
60
+ // this.closeConnection()
61
+ // LibProgress.hide()
62
+ // }
65
63
  }, customTimeout ?? this.timeout);
66
64
  }
67
65
 
@@ -130,7 +128,7 @@ export default class ecurl {
130
128
  }
131
129
 
132
130
  protected closeConnection(): void {
133
- this?.abort?.cancel('Oops, Sepertinya ada gangguan jaringan... Silahkan coba beberapa saat lagi');
131
+ // this?.abort?.cancel('Oops, Sepertinya ada gangguan jaringan... Silahkan coba beberapa saat lagi');
134
132
  }
135
133
 
136
134
  protected onDone(result: any, msg?: string): void {
@@ -166,7 +164,6 @@ export default class ecurl {
166
164
  }
167
165
  let ps = Object.keys(_post).map((key) => encodeURIComponent(key) + '=' + encodeURIComponent(_post[key])).join('&');
168
166
  var options: any = {
169
- signal: this.signal,
170
167
  method: "POST",
171
168
  headers: {
172
169
  ...this.header,
@@ -285,7 +282,6 @@ export default class ecurl {
285
282
  }
286
283
  await this.setHeader()
287
284
  var options: any = {
288
- signal: this.signal,
289
285
  method: !this.post ? "GET" : "POST",
290
286
  headers: {
291
287
  ...this.header,
@@ -376,7 +372,6 @@ export default class ecurl {
376
372
  else
377
373
  this.header["Content-Type"] = "application/x-www-form-urlencoded;charset=UTF-8"
378
374
  var options: any = {
379
- signal: this.signal,
380
375
  method: !this.post ? "GET" : "POST",
381
376
  headers: this.header,
382
377
  body: this.post,
@@ -537,6 +532,15 @@ export default class ecurl {
537
532
  }
538
533
 
539
534
  protected getTimeByTimeZone(timeZone: string): number {
540
- return moment(new Date()).tz(timeZone).toMiliseconds();
535
+ let localTimezoneOffset = new Date().getTimezoneOffset()
536
+ let serverTimezoneOffset = -420 // -420 for Asia/Jakarta
537
+ let diff
538
+ if (localTimezoneOffset < serverTimezoneOffset) {
539
+ diff = localTimezoneOffset - serverTimezoneOffset
540
+ } else {
541
+ diff = (serverTimezoneOffset - localTimezoneOffset) * -1
542
+ }
543
+ let time = new Date().getTime() + (diff * 60 * 1000 * -1);
544
+ return time;
541
545
  }
542
546
  }
@@ -4,7 +4,8 @@
4
4
  import { esp, LibStyle, LibWorker, LibWorkloop, useSafeState } from 'esoftplay';
5
5
  import * as FileSystem from 'expo-file-system';
6
6
  import React, { useMemo } from 'react';
7
- import { Image, PixelRatio, Platform, View } from 'react-native';
7
+ import { PixelRatio, Platform, View } from 'react-native';
8
+ import FastImage from 'react-native-fast-image'
8
9
  const sh = require("shorthash")
9
10
 
10
11
  export interface LibPictureSource {
@@ -86,6 +87,18 @@ export default function m(props: LibPictureProps): any {
86
87
  let { width, height } = props.style
87
88
  const valid = b_uri?.includes?.(esp.config('domain'))
88
89
 
90
+ let resizeMode
91
+ if (props?.style?.resizeMode == 'cover')
92
+ resizeMode = FastImage.resizeMode.cover
93
+ else if (props?.style?.resizeMode == 'contain')
94
+ resizeMode = FastImage.resizeMode.contain
95
+ else if (props?.resizeMode == 'cover')
96
+ resizeMode = FastImage.resizeMode.cover
97
+ else if (props?.resizeMode == 'contain')
98
+ resizeMode = FastImage.resizeMode.contain
99
+ else
100
+ resizeMode = FastImage.resizeMode.cover
101
+
89
102
  if (props.source.hasOwnProperty("uri") && (!width || !height)) {
90
103
  if (width) {
91
104
  height = width
@@ -120,11 +133,11 @@ export default function m(props: LibPictureProps): any {
120
133
  if (typeof props.source != 'number' && !b_uri) {
121
134
  return <View style={props.style} />
122
135
  }
123
- return <Image {...props} />
136
+ return <FastImage {...props} resizeMode={resizeMode} />
124
137
  }
125
138
 
126
139
  if (!valid || (!props.source.hasOwnProperty("uri"))) {
127
- return <Image {...props} />
140
+ return <FastImage {...props} resizeMode={resizeMode} />
128
141
  }
129
142
 
130
143
  if (uri == '') {
@@ -134,6 +147,6 @@ export default function m(props: LibPictureProps): any {
134
147
  }
135
148
 
136
149
  return (
137
- <Image key={b_uri + uri} {...props} source={{ uri: uri }} style={props.style} />
150
+ <FastImage key={b_uri + uri} {...props} source={{ uri: uri }} style={props.style} resizeMode={resizeMode} />
138
151
  )
139
152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay",
3
- "version": "0.0.112-b",
3
+ "version": "0.0.112-e",
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",