esoftplay 0.0.113 → 0.0.114
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 +14 -29
- package/bin/cli.js +8 -7
- package/bin/router.js +2 -0
- package/error.ts +16 -12
- package/esp.ts +26 -3
- package/modules/lib/curl.ts +27 -7
- package/modules/lib/datepicker.tsx +4 -5
- package/modules/lib/document.ts +1 -1
- package/modules/{content → lib}/gallery.tsx +3 -3
- package/modules/lib/image.tsx +2 -2
- package/modules/lib/infinite.tsx +4 -3
- package/modules/lib/roll.tsx +1 -1
- package/modules/lib/scrollpicker.tsx +219 -0
- package/modules/lib/timepicker.tsx +5 -6
- package/modules/{content → lib}/video.tsx +3 -3
- package/modules/lib/worker.tsx +4 -4
- package/modules/lib/workloop.tsx +1 -0
- package/modules/lib/workview.tsx +1 -1
- package/modules/main/index.tsx +19 -0
- package/modules/use/curl.ts +1 -1
- package/modules/user/class.ts +1 -1
- package/modules/user/index.tsx +19 -8
- package/modules/user/login.tsx +1 -1
- package/package.json +1 -1
- package/modules/content/audio.tsx +0 -126
- package/modules/content/bookmark.tsx +0 -81
- package/modules/content/category.tsx +0 -59
- package/modules/content/category_list.tsx +0 -52
- package/modules/content/comment.tsx +0 -173
- package/modules/content/comment_item.tsx +0 -60
- package/modules/content/config.tsx +0 -79
- package/modules/content/detail.tsx +0 -150
- package/modules/content/header.tsx +0 -49
- package/modules/content/index.tsx +0 -52
- package/modules/content/item.tsx +0 -112
- package/modules/content/item_header.tsx +0 -59
- package/modules/content/list.tsx +0 -60
- package/modules/content/search.tsx +0 -37
- package/modules/lib/menu.tsx +0 -51
- package/modules/lib/menusub.tsx +0 -58
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { LibComponent } from 'esoftplay';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import {
|
|
6
|
+
Dimensions,
|
|
7
|
+
Platform, ScrollView, StyleSheet,
|
|
8
|
+
Text,
|
|
9
|
+
View
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
|
|
12
|
+
export interface LibScrollpickerProps {
|
|
13
|
+
itemHeight: number;
|
|
14
|
+
wrapperHeight: number;
|
|
15
|
+
selectedIndex: number;
|
|
16
|
+
style?: any;
|
|
17
|
+
highlightColor: string;
|
|
18
|
+
wrapperColor: string;
|
|
19
|
+
renderItem: (item: any, index: number, isSelected: boolean) => any;
|
|
20
|
+
onValueChange: (value: any, index: number) => void;
|
|
21
|
+
dataSource: any[];
|
|
22
|
+
}
|
|
23
|
+
export interface LibScrollpickerState {
|
|
24
|
+
selectedIndex: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const deviceWidth = Dimensions.get('window').width;
|
|
29
|
+
const deviceHeight = Dimensions.get('window').height;
|
|
30
|
+
|
|
31
|
+
export default class m extends LibComponent<LibScrollpickerProps, LibScrollpickerState> {
|
|
32
|
+
itemHeight = 30;
|
|
33
|
+
wrapperHeight = this.itemHeight * 5;
|
|
34
|
+
timer: any;
|
|
35
|
+
sview: any = React.createRef<ScrollView>();
|
|
36
|
+
isScrollTo = false;
|
|
37
|
+
dragStarted = false;
|
|
38
|
+
momentumStarted = false;
|
|
39
|
+
|
|
40
|
+
constructor(props: LibScrollpickerProps) {
|
|
41
|
+
super(props);
|
|
42
|
+
this.itemHeight = this.props.itemHeight || 30;
|
|
43
|
+
this.wrapperHeight = this.props.wrapperHeight || (this.props.style ? this.props.style.height : 0) || this.itemHeight * 5;
|
|
44
|
+
this.state = {
|
|
45
|
+
selectedIndex: this.props.selectedIndex || 0
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
componentDidMount() {
|
|
50
|
+
super.componentDidMount()
|
|
51
|
+
if (this.props.selectedIndex) {
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
this.scrollToIndex(this.props.selectedIndex);
|
|
54
|
+
}, 0);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
componentWillUnmount() {
|
|
59
|
+
this.timer && clearTimeout(this.timer);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
render() {
|
|
63
|
+
let { header, footer } = this._renderPlaceHolder();
|
|
64
|
+
let highlightWidth = (this.props.style ? this.props.style.width : 0) || deviceWidth;
|
|
65
|
+
let highlightColor = this.props.highlightColor || '#333';
|
|
66
|
+
let wrapperStyle: any = {
|
|
67
|
+
height: this.wrapperHeight,
|
|
68
|
+
flex: 1,
|
|
69
|
+
backgroundColor: this.props.wrapperColor || '#fafafa',
|
|
70
|
+
overflow: 'hidden',
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
let highlightStyle: any = {
|
|
74
|
+
position: 'absolute',
|
|
75
|
+
top: (this.wrapperHeight - this.itemHeight) / 2,
|
|
76
|
+
height: this.itemHeight,
|
|
77
|
+
width: highlightWidth,
|
|
78
|
+
borderTopColor: highlightColor,
|
|
79
|
+
borderBottomColor: highlightColor,
|
|
80
|
+
borderTopWidth: StyleSheet.hairlineWidth,
|
|
81
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<View style={wrapperStyle}>
|
|
86
|
+
<View style={highlightStyle}></View>
|
|
87
|
+
<ScrollView
|
|
88
|
+
ref={(sview) => { this.sview = sview; }}
|
|
89
|
+
bounces={false}
|
|
90
|
+
showsVerticalScrollIndicator={false}
|
|
91
|
+
onMomentumScrollBegin={this._onMomentumScrollBegin.bind(this)}
|
|
92
|
+
onMomentumScrollEnd={this._onMomentumScrollEnd.bind(this)}
|
|
93
|
+
onScrollBeginDrag={this._onScrollBeginDrag.bind(this)}
|
|
94
|
+
onScrollEndDrag={this._onScrollEndDrag.bind(this)}
|
|
95
|
+
>
|
|
96
|
+
{header}
|
|
97
|
+
{this.props.dataSource.map(this._renderItem.bind(this))}
|
|
98
|
+
{footer}
|
|
99
|
+
</ScrollView>
|
|
100
|
+
</View>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
_renderPlaceHolder() {
|
|
105
|
+
let h = (this.wrapperHeight - this.itemHeight) / 2;
|
|
106
|
+
let header = <View style={{ height: h, flex: 1, }}></View>;
|
|
107
|
+
let footer = <View style={{ height: h, flex: 1, }}></View>;
|
|
108
|
+
return { header, footer };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
_renderItem(data: any, index: number) {
|
|
112
|
+
let isSelected = index === this.state.selectedIndex;
|
|
113
|
+
let item = <Text style={isSelected ? [styles.itemText, styles.itemTextSelected] : styles.itemText}>{data}</Text>;
|
|
114
|
+
|
|
115
|
+
if (this.props.renderItem) {
|
|
116
|
+
item = this.props.renderItem(data, index, isSelected);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<View style={[styles.itemWrapper, { height: this.itemHeight }]} key={index}>
|
|
121
|
+
{item}
|
|
122
|
+
</View>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
_scrollFix(e: any, t?: string) {
|
|
126
|
+
let y = 0;
|
|
127
|
+
let h = this.itemHeight;
|
|
128
|
+
if (e.nativeEvent.contentOffset) {
|
|
129
|
+
y = e.nativeEvent.contentOffset.y;
|
|
130
|
+
}
|
|
131
|
+
let selectedIndex = Math.round(y / h);
|
|
132
|
+
let _y = selectedIndex * h;
|
|
133
|
+
if (_y !== y) {
|
|
134
|
+
// using scrollTo in ios, onMomentumScrollEnd will be invoked
|
|
135
|
+
if (Platform.OS === 'ios') {
|
|
136
|
+
this.isScrollTo = true;
|
|
137
|
+
}
|
|
138
|
+
this.sview.scrollTo({ y: _y });
|
|
139
|
+
}
|
|
140
|
+
if (this.state.selectedIndex === selectedIndex) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
// onValueChange
|
|
144
|
+
if (this.props.onValueChange) {
|
|
145
|
+
let selectedValue = this.props.dataSource[selectedIndex];
|
|
146
|
+
this.setState({
|
|
147
|
+
selectedIndex: selectedIndex,
|
|
148
|
+
});
|
|
149
|
+
this.props.onValueChange(selectedValue, selectedIndex);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
_onScrollBeginDrag() {
|
|
153
|
+
this.dragStarted = true;
|
|
154
|
+
if (Platform.OS === 'ios') {
|
|
155
|
+
this.isScrollTo = false;
|
|
156
|
+
}
|
|
157
|
+
this.timer && clearTimeout(this.timer);
|
|
158
|
+
}
|
|
159
|
+
_onScrollEndDrag(e: any) {
|
|
160
|
+
this.dragStarted = false;
|
|
161
|
+
// if not used, event will be garbaged
|
|
162
|
+
let _e = {
|
|
163
|
+
nativeEvent: {
|
|
164
|
+
contentOffset: {
|
|
165
|
+
y: e.nativeEvent.contentOffset.y,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
this.timer && clearTimeout(this.timer);
|
|
170
|
+
this.timer = setTimeout(
|
|
171
|
+
() => {
|
|
172
|
+
if (!this.momentumStarted && !this.dragStarted) {
|
|
173
|
+
this._scrollFix(_e, 'timeout');
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
10
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
_onMomentumScrollBegin(e: any) {
|
|
180
|
+
this.momentumStarted = true;
|
|
181
|
+
this.timer && clearTimeout(this.timer);
|
|
182
|
+
}
|
|
183
|
+
_onMomentumScrollEnd(e: any) {
|
|
184
|
+
this.momentumStarted = false;
|
|
185
|
+
if (!this.isScrollTo && !this.momentumStarted && !this.dragStarted) {
|
|
186
|
+
this._scrollFix(e);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
scrollToIndex(ind: number) {
|
|
191
|
+
this.setState({
|
|
192
|
+
selectedIndex: ind,
|
|
193
|
+
});
|
|
194
|
+
let y = this.itemHeight * ind;
|
|
195
|
+
this.sview.scrollTo({ y: y });
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
getSelected() {
|
|
199
|
+
let selectedIndex = this.state.selectedIndex;
|
|
200
|
+
let selectedValue = this.props.dataSource[selectedIndex];
|
|
201
|
+
return selectedValue;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
let styles = StyleSheet.create({
|
|
208
|
+
itemWrapper: {
|
|
209
|
+
height: 30,
|
|
210
|
+
justifyContent: 'center',
|
|
211
|
+
alignItems: 'center',
|
|
212
|
+
},
|
|
213
|
+
itemText: {
|
|
214
|
+
color: '#999',
|
|
215
|
+
},
|
|
216
|
+
itemTextSelected: {
|
|
217
|
+
color: '#333',
|
|
218
|
+
},
|
|
219
|
+
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
// noPage
|
|
3
3
|
|
|
4
|
-
import { LibStyle, useSafeState } from 'esoftplay';
|
|
4
|
+
import { LibScrollpicker, LibStyle, useSafeState } from 'esoftplay';
|
|
5
5
|
import { LinearGradient } from 'expo-linear-gradient';
|
|
6
6
|
import React, { useEffect, useRef } from 'react';
|
|
7
7
|
import { Text, TouchableOpacity, View } from 'react-native';
|
|
8
|
-
import ScrollPicker from 'react-native-picker-scrollview';
|
|
9
8
|
|
|
10
9
|
export interface LibTimepickerProps {
|
|
11
10
|
/* hh:mm:ss */
|
|
@@ -54,7 +53,7 @@ export default function m(props: LibTimepickerProps): any {
|
|
|
54
53
|
} else if (minTime && selectedTime < minTime) {
|
|
55
54
|
toTime = minTime;
|
|
56
55
|
}
|
|
57
|
-
if (toTime != null){
|
|
56
|
+
if (toTime != null) {
|
|
58
57
|
scrollTo(toTime);
|
|
59
58
|
setSelectedTime(toTime);
|
|
60
59
|
}
|
|
@@ -79,7 +78,7 @@ export default function m(props: LibTimepickerProps): any {
|
|
|
79
78
|
<View style={{ width: 180, flex: 1, height: 175, alignSelf: 'center' }} >
|
|
80
79
|
<View style={{ height: 175, flexDirection: 'row', alignItems: 'center' }} >
|
|
81
80
|
<View style={{ width: showHour ? undefined : 0, flex: showHour ? 1 : 0, }} >
|
|
82
|
-
<
|
|
81
|
+
<LibScrollpicker
|
|
83
82
|
ref={refHour}
|
|
84
83
|
dataSource={time.hours}
|
|
85
84
|
selectedIndex={time.hours.indexOf(sHour)}
|
|
@@ -93,7 +92,7 @@ export default function m(props: LibTimepickerProps): any {
|
|
|
93
92
|
</View>
|
|
94
93
|
<Text style={{ width: showHourMinute ? undefined : 0, fontSize: 30, marginBottom: 5 }} >:</Text>
|
|
95
94
|
<View style={{ width: showHourMinute ? undefined : 0, flex: showHourMinute ? 1 : 0 }} >
|
|
96
|
-
<
|
|
95
|
+
<LibScrollpicker
|
|
97
96
|
ref={refMinute}
|
|
98
97
|
dataSource={time.minutes}
|
|
99
98
|
selectedIndex={time.minutes.indexOf(sMinute)}
|
|
@@ -107,7 +106,7 @@ export default function m(props: LibTimepickerProps): any {
|
|
|
107
106
|
</View>
|
|
108
107
|
<Text style={{ width: showHourMinuteSecond ? undefined : 0, fontSize: 30, marginBottom: 5 }} >:</Text>
|
|
109
108
|
<View style={{ width: showHourMinuteSecond ? undefined : 0, flex: showHourMinuteSecond ? 1 : 0, }} >
|
|
110
|
-
<
|
|
109
|
+
<LibScrollpicker
|
|
111
110
|
ref={refSecond}
|
|
112
111
|
dataSource={time.seconds}
|
|
113
112
|
selectedIndex={time.seconds.indexOf(sSecond)}
|
|
@@ -6,14 +6,14 @@ import React from 'react';
|
|
|
6
6
|
import { ActivityIndicator, StyleSheet, View } from 'react-native';
|
|
7
7
|
import { WebView } from 'react-native-webview';
|
|
8
8
|
|
|
9
|
-
export interface
|
|
9
|
+
export interface LibVideoArgs {
|
|
10
10
|
|
|
11
11
|
}
|
|
12
|
-
export interface
|
|
12
|
+
export interface LibVideoProps {
|
|
13
13
|
code: string,
|
|
14
14
|
style?: any
|
|
15
15
|
}
|
|
16
|
-
export default function m(props:
|
|
16
|
+
export default function m(props: LibVideoProps): any {
|
|
17
17
|
const code = props.code
|
|
18
18
|
|
|
19
19
|
if (!code) {
|
package/modules/lib/worker.tsx
CHANGED
|
@@ -48,7 +48,7 @@ export default class m extends Component<LibWorkerProps, LibWorkerState> {
|
|
|
48
48
|
return `"` + param + `"`
|
|
49
49
|
return param
|
|
50
50
|
})
|
|
51
|
-
return (`window.ReactNativeWebView.postMessage(JSON.stringify({ data: ` + name + `(` + _params.join(", ") + `), id: ` + id + ` }))
|
|
51
|
+
return (`window.ReactNativeWebView.postMessage(JSON.stringify({ data: ` + name + `(` + _params.join(", ") + `), id: ` + id + ` }));true;`)
|
|
52
52
|
}
|
|
53
53
|
, '', res)
|
|
54
54
|
}
|
|
@@ -73,7 +73,7 @@ export default class m extends Component<LibWorkerProps, LibWorkerState> {
|
|
|
73
73
|
return `"` + param + `"`
|
|
74
74
|
return param
|
|
75
75
|
})
|
|
76
|
-
return (`(async () => window.ReactNativeWebView.postMessage(JSON.stringify({ data: await ` + name + `(` + _params.join(", ") + `), id: ` + id + ` })))()
|
|
76
|
+
return (`(async () => window.ReactNativeWebView.postMessage(JSON.stringify({ data: await ` + name + `(` + _params.join(", ") + `), id: ` + id + ` })))();true;`)
|
|
77
77
|
}
|
|
78
78
|
, '', res)
|
|
79
79
|
}
|
|
@@ -102,7 +102,7 @@ export default class m extends Component<LibWorkerProps, LibWorkerState> {
|
|
|
102
102
|
return `"` + param + `"`
|
|
103
103
|
return param
|
|
104
104
|
})
|
|
105
|
-
return (`(async () => window.ReactNativeWebView.postMessage(JSON.stringify({ data: await ` + nameFunction + `(` + _params.join(", ") + `), id: ` + id + ` })))()
|
|
105
|
+
return (`(async () => window.ReactNativeWebView.postMessage(JSON.stringify({ data: await ` + nameFunction + `(` + _params.join(", ") + `), id: ` + id + ` })))();true;`)
|
|
106
106
|
}
|
|
107
107
|
, '', res)
|
|
108
108
|
}
|
|
@@ -122,7 +122,7 @@ export default class m extends Component<LibWorkerProps, LibWorkerState> {
|
|
|
122
122
|
return param
|
|
123
123
|
})
|
|
124
124
|
|
|
125
|
-
const out = nameFunction + `\nwindow.ReactNativeWebView.postMessage(JSON.stringify({ data: tempFunction` + `(` + _params.join(",") + `), id: ` + id + ` }))
|
|
125
|
+
const out = nameFunction + `\nwindow.ReactNativeWebView.postMessage(JSON.stringify({ data: tempFunction` + `(` + _params.join(",") + `), id: ` + id + ` }));true;`
|
|
126
126
|
return out
|
|
127
127
|
}
|
|
128
128
|
, '', res)
|
package/modules/lib/workloop.tsx
CHANGED
package/modules/lib/workview.tsx
CHANGED
|
@@ -23,7 +23,7 @@ export default function m(props: LibWorkviewProps): any {
|
|
|
23
23
|
ref={_global.LibWorkerBase}
|
|
24
24
|
style={{ width: 0, height: 0 }}
|
|
25
25
|
javaScriptEnabled={true}
|
|
26
|
-
injectedJavaScript={`\nwindow.ReactNativeWebView.postMessage("BaseWorkerIsReady")\n` + _global.injectedJavaScripts.join('\n') + '\
|
|
26
|
+
injectedJavaScript={`\nwindow.ReactNativeWebView.postMessage("BaseWorkerIsReady")\n` + _global.injectedJavaScripts.join('\n') + '\ntrue;'}
|
|
27
27
|
originWhitelist={["*"]}
|
|
28
28
|
source={{ uri: esp.config("protocol") + "://" + esp.config("domain") + esp.config("uri") + "dummyPageToBypassCORS" }}
|
|
29
29
|
onMessage={LibWorker.onMessage('BaseWorkerIsReady')}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// withHooks
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Text, View } from 'react-native';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export interface MainIndexArgs {
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
export interface MainIndexProps {
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
export default function m(props: MainIndexProps): any {
|
|
14
|
+
return (
|
|
15
|
+
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }} >
|
|
16
|
+
<Text>{"Hellow Esoftplay developer, jangan lupa bismillah dulu. (-̀ᴗ-́)و ̑̑"}</Text>
|
|
17
|
+
</View>
|
|
18
|
+
)
|
|
19
|
+
}
|
package/modules/use/curl.ts
CHANGED
package/modules/user/class.ts
CHANGED
package/modules/user/index.tsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { esp, LibDialog, LibImage, LibNet_status, LibProgress, LibStyle, LibToast, LibUpdaterProperty, LibVersion, LibWorker, LibWorkloop, LibWorkview, UseDeeplink, UserClass, UserLoading, UserMain, UserRoutes, useSafeState, _global } from 'esoftplay';
|
|
5
5
|
import * as Font from "expo-font";
|
|
6
|
-
import React, { useEffect
|
|
6
|
+
import React, { useEffect } from "react";
|
|
7
7
|
import { View } from "react-native";
|
|
8
8
|
import Navs from "../../cache/navs";
|
|
9
9
|
|
|
@@ -30,9 +30,11 @@ function setFonts(): Promise<void> {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
|
|
33
34
|
export default function m(props: UserIndexProps): any {
|
|
34
35
|
const [loading, setLoading] = useSafeState(true)
|
|
35
36
|
const user = UserClass.state().useSelector(s => s)
|
|
37
|
+
const ready = React.useRef(0)
|
|
36
38
|
UseDeeplink()
|
|
37
39
|
//@ts-ignore
|
|
38
40
|
const initialState = __DEV__ ? _global.nav__state : undefined
|
|
@@ -45,10 +47,25 @@ export default function m(props: UserIndexProps): any {
|
|
|
45
47
|
UserRoutes.set(currentState)
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
useEffect(() => {
|
|
49
51
|
// const timeout = setTimeout(() => {
|
|
50
52
|
// setLoading(false)
|
|
51
53
|
// }, 15 * 1000);
|
|
54
|
+
(async () => {
|
|
55
|
+
await setFonts()
|
|
56
|
+
ready.current += 1
|
|
57
|
+
if (ready.current >= 2) {
|
|
58
|
+
setLoading(false)
|
|
59
|
+
}
|
|
60
|
+
})()
|
|
61
|
+
|
|
62
|
+
UserClass.isLogin(async () => {
|
|
63
|
+
ready.current += 1
|
|
64
|
+
if (ready.current >= 2) {
|
|
65
|
+
setLoading(false)
|
|
66
|
+
}
|
|
67
|
+
LibUpdaterProperty.check((isNew) => { })
|
|
68
|
+
})
|
|
52
69
|
if (esp.config('firebase').hasOwnProperty('apiKey')) {
|
|
53
70
|
try {
|
|
54
71
|
const chatFirebase = require('../chatting/firebase')?.default
|
|
@@ -58,12 +75,6 @@ export default function m(props: UserIndexProps): any {
|
|
|
58
75
|
|
|
59
76
|
}
|
|
60
77
|
}
|
|
61
|
-
UserClass.isLogin(async () => {
|
|
62
|
-
await setFonts()
|
|
63
|
-
LibUpdaterProperty.check((isNew) => { })
|
|
64
|
-
// clearTimeout(timeout)
|
|
65
|
-
setLoading(false)
|
|
66
|
-
})
|
|
67
78
|
}, [])
|
|
68
79
|
|
|
69
80
|
useEffect(() => {
|
package/modules/user/login.tsx
CHANGED
|
@@ -90,7 +90,7 @@ export default class euserLogin extends LibComponent<UserLoginProps, UserLoginSt
|
|
|
90
90
|
},
|
|
91
91
|
(msg) => {
|
|
92
92
|
// console.log("gagal => " + msg, email)
|
|
93
|
-
this.onFailedLogin(msg.
|
|
93
|
+
this.onFailedLogin(msg.message)
|
|
94
94
|
this.setState({ isLoading: false, email: "" })
|
|
95
95
|
}, 1
|
|
96
96
|
)
|
package/package.json
CHANGED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
// noPage
|
|
2
|
-
|
|
3
|
-
import { LibComponent } from "esoftplay";
|
|
4
|
-
import { Audio } from "expo-av";
|
|
5
|
-
|
|
6
|
-
export interface ContentAudioProps {
|
|
7
|
-
code: string,
|
|
8
|
-
onStatusChange: (status: any) => void
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface ContentAudioState {
|
|
12
|
-
playbackInstanceName: string,
|
|
13
|
-
muted: boolean,
|
|
14
|
-
playbackInstancePosition: any,
|
|
15
|
-
playbackInstanceDuration: any,
|
|
16
|
-
shouldPlay: boolean,
|
|
17
|
-
isPlaying: boolean,
|
|
18
|
-
isBuffering: boolean,
|
|
19
|
-
isLoading: boolean,
|
|
20
|
-
volume: number,
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// create a component
|
|
24
|
-
class eaudio extends LibComponent<ContentAudioProps, ContentAudioState> {
|
|
25
|
-
playbackInstance: any
|
|
26
|
-
state: ContentAudioState;
|
|
27
|
-
props: ContentAudioProps;
|
|
28
|
-
constructor(props: ContentAudioProps) {
|
|
29
|
-
super(props)
|
|
30
|
-
this.props = props;
|
|
31
|
-
this.playbackInstance = null;
|
|
32
|
-
this.state = {
|
|
33
|
-
playbackInstanceName: "loading...",
|
|
34
|
-
muted: false,
|
|
35
|
-
playbackInstancePosition: null,
|
|
36
|
-
playbackInstanceDuration: null,
|
|
37
|
-
shouldPlay: false,
|
|
38
|
-
isPlaying: false,
|
|
39
|
-
isBuffering: false,
|
|
40
|
-
isLoading: true,
|
|
41
|
-
volume: 1.0,
|
|
42
|
-
};
|
|
43
|
-
this._onPlaybackStatusUpdate = this._onPlaybackStatusUpdate.bind(this)
|
|
44
|
-
this._loadNewPlaybackInstance = this._loadNewPlaybackInstance.bind(this)
|
|
45
|
-
this._onPlayPausePressed = this._onPlayPausePressed.bind(this)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
componentDidMount(): void {
|
|
49
|
-
super.componentDidMount();
|
|
50
|
-
Audio.setAudioModeAsync({
|
|
51
|
-
allowsRecordingIOS: false,
|
|
52
|
-
interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
|
|
53
|
-
playsInSilentModeIOS: true,
|
|
54
|
-
shouldDuckAndroid: true,
|
|
55
|
-
staysActiveInBackground: false,
|
|
56
|
-
interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DUCK_OTHERS,
|
|
57
|
-
playThroughEarpieceAndroid: false
|
|
58
|
-
});
|
|
59
|
-
this._loadNewPlaybackInstance(false);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
componentWillUnmount(): void {
|
|
63
|
-
super.componentWillUnmount();
|
|
64
|
-
(async () => {
|
|
65
|
-
if (this.playbackInstance != null) {
|
|
66
|
-
await this.playbackInstance.unloadAsync();
|
|
67
|
-
this.playbackInstance.setOnPlaybackStatusUpdate(null);
|
|
68
|
-
this.playbackInstance = null;
|
|
69
|
-
}
|
|
70
|
-
})()
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
async _loadNewPlaybackInstance(playing: boolean): Promise<void> {
|
|
74
|
-
if (this.playbackInstance != null) {
|
|
75
|
-
await this.playbackInstance.unloadAsync();
|
|
76
|
-
this.playbackInstance.setOnPlaybackStatusUpdate(null);
|
|
77
|
-
this.playbackInstance = null;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const source = { uri: "https://api.soundcloud.com/tracks/" + this.props.code + "/stream?client_id=4a584e57dbc1c522b0ccdb68464f6ec3" };
|
|
81
|
-
const initialStatus = {
|
|
82
|
-
shouldPlay: playing,
|
|
83
|
-
volume: this.state.volume,
|
|
84
|
-
isMuted: this.state.muted,
|
|
85
|
-
};
|
|
86
|
-
const { sound, status } = await Audio.Sound.createAsync(
|
|
87
|
-
source,
|
|
88
|
-
initialStatus,
|
|
89
|
-
this._onPlaybackStatusUpdate
|
|
90
|
-
);
|
|
91
|
-
this.playbackInstance = sound;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
_onPlaybackStatusUpdate(status: any): void {
|
|
95
|
-
if (status.isLoaded) {
|
|
96
|
-
this.setState({
|
|
97
|
-
playbackInstancePosition: status.positionMillis,
|
|
98
|
-
playbackInstanceDuration: status.durationMillis,
|
|
99
|
-
shouldPlay: status.shouldPlay,
|
|
100
|
-
isPlaying: status.isPlaying,
|
|
101
|
-
isBuffering: status.isBuffering,
|
|
102
|
-
muted: status.isMuted,
|
|
103
|
-
volume: status.volume,
|
|
104
|
-
}, () => this.props.onStatusChange(this.state.isPlaying));
|
|
105
|
-
} else {
|
|
106
|
-
if (status.error) {
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
_onPlayPausePressed(): void {
|
|
112
|
-
if (this.playbackInstance != null) {
|
|
113
|
-
if (this.state.isPlaying) {
|
|
114
|
-
this.playbackInstance.pauseAsync()
|
|
115
|
-
} else {
|
|
116
|
-
this.playbackInstance.playAsync()
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
render(): any {
|
|
122
|
-
return null
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export default eaudio;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// withHooks
|
|
2
|
-
|
|
3
|
-
import { ContentHeader, ContentItem, LibIcon, LibList, LibStyle, useGlobalReturn, useGlobalState } from 'esoftplay';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { Text, View } from 'react-native';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export interface ContentBookmarkArgs {
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
export interface ContentBookmarkProps {
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface ContentBookmarkData {
|
|
16
|
-
id: string,
|
|
17
|
-
title: string,
|
|
18
|
-
intro: string,
|
|
19
|
-
description: string,
|
|
20
|
-
image: string,
|
|
21
|
-
created: string,
|
|
22
|
-
updated: string,
|
|
23
|
-
url: string,
|
|
24
|
-
publish: string,
|
|
25
|
-
type_id: string,
|
|
26
|
-
created_by: string,
|
|
27
|
-
created_by_alias: string,
|
|
28
|
-
modified_by: string,
|
|
29
|
-
revised: string,
|
|
30
|
-
hits: string,
|
|
31
|
-
rating: string,
|
|
32
|
-
last_hits: string,
|
|
33
|
-
is_popimage: string,
|
|
34
|
-
is_front: string,
|
|
35
|
-
is_config: string,
|
|
36
|
-
config: string,
|
|
37
|
-
}
|
|
38
|
-
export interface ContentBookmarkType {
|
|
39
|
-
ids: number[],
|
|
40
|
-
data: ContentBookmarkData[]
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const _state = useGlobalState<ContentBookmarkType>({ data: [], ids: [] }, { persistKey: 'content_bookmark_data' })
|
|
45
|
-
|
|
46
|
-
export function toggle(row: ContentBookmarkData) {
|
|
47
|
-
let { data, ids } = _state.get()
|
|
48
|
-
const idx = ids.indexOf(Number(row.id))
|
|
49
|
-
if (idx < 0) {
|
|
50
|
-
data.unshift(row)
|
|
51
|
-
ids.unshift(Number(row.id))
|
|
52
|
-
} else {
|
|
53
|
-
data.splice(idx, 1)
|
|
54
|
-
ids.splice(idx, 1)
|
|
55
|
-
}
|
|
56
|
-
_state.set({ data, ids })
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function state(): useGlobalReturn<ContentBookmarkType> {
|
|
60
|
-
return _state
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default function m(props: ContentBookmarkProps): any {
|
|
64
|
-
const data = _state.useSelector(s => s.data)
|
|
65
|
-
return (
|
|
66
|
-
<View style={{ flex: 1 }} >
|
|
67
|
-
<ContentHeader title="Artikel tersimpan" searchButton />
|
|
68
|
-
<LibList
|
|
69
|
-
data={data}
|
|
70
|
-
ListEmptyComponent={
|
|
71
|
-
<View style={{ height: LibStyle.height - 100, justifyContent: 'center', alignItems: 'center', marginHorizontal: 24 }} >
|
|
72
|
-
<LibIcon name='bookmark-plus-outline' color={"#FD5593"} size={40} />
|
|
73
|
-
<Text style={{ fontSize: 34, marginTop: 10, fontWeight: "500", lineHeight: 40, textAlign: "center", color: "#060606" }} >Artikel belum ada</Text>
|
|
74
|
-
<Text style={{ fontSize: 16, marginTop: 10, lineHeight: 22, textAlign: "center", color: "#686868" }} >Kamu dapat menyimpan artikel untuk dibaca nanti dengan cara klik lambang bookmark</Text>
|
|
75
|
-
</View>
|
|
76
|
-
}
|
|
77
|
-
renderItem={(item) => <ContentItem {...item} />}
|
|
78
|
-
/>
|
|
79
|
-
</View>
|
|
80
|
-
)
|
|
81
|
-
}
|