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

@ -18,13 +18,13 @@ react {
// codegenDir = file("../node_modules/@react-native/codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
// cliFile = file("../node_modules/react-native/cli.js")
/* Variants */
// The list of variants to that are debuggable. For those we're going to
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
// debuggableVariants = ["liteDebug", "prodDebug"]
/* Bundling */
// A list containing the node command and its flags. Default is just 'node'.
// nodeExecutableAndArgs = ["node"]
@ -44,7 +44,7 @@ react {
// A list of extra flags to pass to the 'bundle' commands.
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
// extraPackagerArgs = []
/* Hermes Commands */
// The hermes compiler command to run. By default it is 'hermesc'
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
@ -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'
@ -130,7 +130,7 @@ android {
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
packagingOptions {
pickFirst '**/armeabi-v7a/libc++_shared.so'
pickFirst '**/x86/libc++_shared.so'
@ -146,7 +146,7 @@ dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
implementation 'com.facebook.react:react-native:+'
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.squareup.okhttp3', module:'okhttp'

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

@ -14,12 +14,12 @@ import { NavigationEvents } from 'react-navigation'
import {
getNews,
getNewsPage,
getUserProfile,
getNewsByProject,
login,
registerDevice,
setPaymentLater,
setFillInMeterLater,
getUserProfile,
getNewsByProject,
login,
registerDevice,
setPaymentLater,
setFillInMeterLater,
checkPaymentMeter } from '../../api/UserApi';
import { clearToken } from '../../api/api'
import { bindActionCreators } from 'redux'
@ -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,
@ -285,7 +283,7 @@ class NewsScreen extends Component {
this.props.appCleanUser();
this.props.appCleanToken();
this.props.appCleanProjectID();
this.initData()
}, 500)
// })
@ -596,28 +594,25 @@ 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 &&
(
@ -663,15 +658,15 @@ class NewsScreen extends Component {
}}
/>
</View> : null}
<Text style={{ color: 'white', marginTop: 10 }}>{t('or')}</Text>
<TouchableOpacity onPress={() => {
loginWithFacebook(() => {
this.initData()
})}}>
<View>
<Badge style={{ backgroundColor: '#145EB3', borderRadius: 5, borderColor: 'rbga(0,0,0,0)', marginTop: 10, height: null, width: 150 }}>
<Text style={{ fontSize: 16, color: 'white', padding: 5, textAlign: 'center' }}>{t('login_facebook')}</Text>
@ -821,38 +816,34 @@ class NewsScreen extends Component {
</View>
</View>
))
}
{
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%',