update show news list for user not have project and unauthenticated

This commit is contained in:
kanyanat 2025-09-23 16:01:59 +07:00
parent 37021a723e
commit 9f7f2cebb8
5 changed files with 77 additions and 77 deletions

View File

@ -79,7 +79,7 @@ android {
applicationId "th.co.csasset.mobile"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 100
versionCode 101
versionName "2.50"
vectorDrawables.useSupportLibrary = true
missingDimensionStrategy 'react-native-camera', 'general'

Binary file not shown.

View File

@ -11,7 +11,7 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 100,
"versionCode": 101,
"versionName": "2.50",
"outputFile": "app-release.apk"
}

View File

@ -199,11 +199,6 @@ class NewsScreen extends Component {
this.initData = this.initData.bind(this)
}
componentDidMount () {
// this.initData()
// this.checkNotifiedPopup()
}
checkNotifiedPopup = () => {
if (this.props.user) {
checkPaymentMeter()
@ -260,7 +255,10 @@ class NewsScreen extends Component {
},async () => {
await this.getAllNewsByProject(res.data.project_id)
})
}else {
await this.getAllNewsList()
}
this.setState({
noti_count: res.data.count_noti,
user_point: res.data.point_balance,
@ -596,27 +594,24 @@ class NewsScreen extends Component {
}
}}
>
{
this.state.user_project_id ?
<View style={[styles.row]}>
<FlatList
data={this.state.news_head}
renderItem={({ item }) => this.renderNativeItemImages(item)}
horizontal={true}
showsHorizontalScrollIndicator={false}
pagingEnabled={true}
keyExtractor={this._keyExtractorNewHead}
onScroll={this._onCarouselScroll}
/>
<View style={{ position: 'absolute', bottom: 10, width: '100%', justifyContent: 'center', flexDirection: 'row' }}>
{
this.state.news_head ?
(this.state.news_head).map((item, i) => <View key={'news_heade_' + i} style={[{ width: 10, height: 10, borderRadius: 5, backgroundColor: this.state.position == i ? '#269A21' : 'rgba(255,255,255,0.3)', marginHorizontal: 4 }]}></View>)
: <View></View>
}
</View>
</View> : <View></View>
}
<View style={[styles.row]}>
<FlatList
data={this.state.news_head}
renderItem={({ item }) => this.renderNativeItemImages(item)}
horizontal={true}
showsHorizontalScrollIndicator={false}
pagingEnabled={true}
keyExtractor={this._keyExtractorNewHead}
onScroll={this._onCarouselScroll}
/>
<View style={{ position: 'absolute', bottom: 10, width: '100%', justifyContent: 'center', flexDirection: 'row' }}>
{
this.state.news_head ?
(this.state.news_head).map((item, i) => <View key={'news_heade_' + i} style={[{ width: 10, height: 10, borderRadius: 5, backgroundColor: this.state.position == i ? '#269A21' : 'rgba(255,255,255,0.3)', marginHorizontal: 4 }]}></View>)
: <View></View>
}
</View>
</View>
{
this.state.auth !== null &&
@ -824,35 +819,31 @@ class NewsScreen extends Component {
}
{
this.state.user_project_id ?
<View style={{ padding: 10 }}>
<FlatList
extraData={this.state}
contentContainerStyle={{
height: '100%',
width: '100%'
}}
// scrollEnabled={false}
data={this.state.new_all}
renderItem={this.renderNativeItem}
keyExtractor={this._keyExtractorNewAll}
// onEndReachedThreshold={0.01}
// onEndReached={this.loadMoreData.bind(this)}
ItemSeparatorComponent={() => {
return <View style={{ width: '100%', height: 8 }}></View>
}}
ListFooterComponent={() => {
if (!this.state.isLoadmore) return null
return (<ActivityIndicator
size="large"
color={'white'}
/>)
}}
/>
</View> : <View></View>
}
<View style={{ padding: 10 }}>
<FlatList
extraData={this.state}
contentContainerStyle={{
height: '100%',
width: '100%'
}}
// scrollEnabled={false}
data={this.state.new_all}
renderItem={this.renderNativeItem}
keyExtractor={this._keyExtractorNewAll}
// onEndReachedThreshold={0.01}
// onEndReached={this.loadMoreData.bind(this)}
ItemSeparatorComponent={() => {
return <View style={{ width: '100%', height: 8 }}></View>
}}
ListFooterComponent={() => {
if (!this.state.isLoadmore) return null
return (<ActivityIndicator
size="large"
color={'white'}
/>)
}}
/>
</View>
</ScrollView>
</BackgroundImage>
<IndicatorLoading loadingVisible={this.state.isLoading}/>

View File

@ -16,6 +16,7 @@ import {NavigationActions} from "react-navigation";
import Config from 'src/utils/Config'
import Carousel from "../room/RoomDetail";
import {sliderWidth} from "../../styles/SliderEntry.style";
import {connect} from "react-redux";
var uri = null;
const injectScript = `
(function () {
@ -27,7 +28,7 @@ const injectScript = `
}());
`;
export default class NewsDetailScreen extends Component {
class NewsDetailScreen extends Component {
constructor(props) {
super(props)
this.state = {
@ -97,7 +98,7 @@ export default class NewsDetailScreen extends Component {
source_webview = {
baseUrl: '',
// uri: `${Config.API_BASE_URL_POWER_CONDO_PROD}/news/${this.state.news_id}/detail`,
uri: `${Config.API_BASE_URL_POWER_CONDO_PROD}/news/${this.state.news_id}/detail`
uri: `${this.props.server_mode === 'production' ? Config.API_BASE_URL_POWER_CONDO_PROD : Config.API_BASE_URL_POWER_CONDO_DEV}/news/${this.state.news_id}/detail`
}
// if(Platform.OS === 'android'){
@ -219,6 +220,14 @@ export default class NewsDetailScreen extends Component {
}
}
const mapStateToProps = state => {
return {
server_mode: state.app.server_mode
}
}
export default connect(mapStateToProps)(NewsDetailScreen)
const styles = StyleSheet.create({
imgBg: {
width: '100%',