update show news list for user not have project and unauthenticated
This commit is contained in:
parent
37021a723e
commit
9f7f2cebb8
@ -18,13 +18,13 @@ react {
|
|||||||
// codegenDir = file("../node_modules/@react-native/codegen")
|
// 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
|
// 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")
|
// cliFile = file("../node_modules/react-native/cli.js")
|
||||||
|
|
||||||
/* Variants */
|
/* Variants */
|
||||||
// The list of variants to that are debuggable. For those we're going to
|
// 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'.
|
// 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.
|
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
|
||||||
// debuggableVariants = ["liteDebug", "prodDebug"]
|
// debuggableVariants = ["liteDebug", "prodDebug"]
|
||||||
|
|
||||||
/* Bundling */
|
/* Bundling */
|
||||||
// A list containing the node command and its flags. Default is just 'node'.
|
// A list containing the node command and its flags. Default is just 'node'.
|
||||||
// nodeExecutableAndArgs = ["node"]
|
// nodeExecutableAndArgs = ["node"]
|
||||||
@ -44,7 +44,7 @@ react {
|
|||||||
// A list of extra flags to pass to the 'bundle' commands.
|
// 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
|
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
|
||||||
// extraPackagerArgs = []
|
// extraPackagerArgs = []
|
||||||
|
|
||||||
/* Hermes Commands */
|
/* Hermes Commands */
|
||||||
// The hermes compiler command to run. By default it is 'hermesc'
|
// The hermes compiler command to run. By default it is 'hermesc'
|
||||||
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
|
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
|
||||||
@ -79,7 +79,7 @@ android {
|
|||||||
applicationId "th.co.csasset.mobile"
|
applicationId "th.co.csasset.mobile"
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 100
|
versionCode 101
|
||||||
versionName "2.50"
|
versionName "2.50"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
missingDimensionStrategy 'react-native-camera', 'general'
|
missingDimensionStrategy 'react-native-camera', 'general'
|
||||||
@ -130,7 +130,7 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
pickFirst '**/armeabi-v7a/libc++_shared.so'
|
pickFirst '**/armeabi-v7a/libc++_shared.so'
|
||||||
pickFirst '**/x86/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
|
// The version of react-native is set by the React Native Gradle Plugin
|
||||||
implementation("com.facebook.react:react-android")
|
implementation("com.facebook.react:react-android")
|
||||||
implementation 'com.facebook.react:react-native:+'
|
implementation 'com.facebook.react:react-native:+'
|
||||||
|
|
||||||
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
|
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
|
||||||
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
|
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
|
||||||
exclude group:'com.squareup.okhttp3', module:'okhttp'
|
exclude group:'com.squareup.okhttp3', module:'okhttp'
|
||||||
|
|||||||
Binary file not shown.
@ -11,7 +11,7 @@
|
|||||||
"type": "SINGLE",
|
"type": "SINGLE",
|
||||||
"filters": [],
|
"filters": [],
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"versionCode": 100,
|
"versionCode": 101,
|
||||||
"versionName": "2.50",
|
"versionName": "2.50",
|
||||||
"outputFile": "app-release.apk"
|
"outputFile": "app-release.apk"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,12 +14,12 @@ import { NavigationEvents } from 'react-navigation'
|
|||||||
import {
|
import {
|
||||||
getNews,
|
getNews,
|
||||||
getNewsPage,
|
getNewsPage,
|
||||||
getUserProfile,
|
getUserProfile,
|
||||||
getNewsByProject,
|
getNewsByProject,
|
||||||
login,
|
login,
|
||||||
registerDevice,
|
registerDevice,
|
||||||
setPaymentLater,
|
setPaymentLater,
|
||||||
setFillInMeterLater,
|
setFillInMeterLater,
|
||||||
checkPaymentMeter } from '../../api/UserApi';
|
checkPaymentMeter } from '../../api/UserApi';
|
||||||
import { clearToken } from '../../api/api'
|
import { clearToken } from '../../api/api'
|
||||||
import { bindActionCreators } from 'redux'
|
import { bindActionCreators } from 'redux'
|
||||||
@ -199,11 +199,6 @@ class NewsScreen extends Component {
|
|||||||
this.initData = this.initData.bind(this)
|
this.initData = this.initData.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount () {
|
|
||||||
// this.initData()
|
|
||||||
// this.checkNotifiedPopup()
|
|
||||||
}
|
|
||||||
|
|
||||||
checkNotifiedPopup = () => {
|
checkNotifiedPopup = () => {
|
||||||
if (this.props.user) {
|
if (this.props.user) {
|
||||||
checkPaymentMeter()
|
checkPaymentMeter()
|
||||||
@ -260,7 +255,10 @@ class NewsScreen extends Component {
|
|||||||
},async () => {
|
},async () => {
|
||||||
await this.getAllNewsByProject(res.data.project_id)
|
await this.getAllNewsByProject(res.data.project_id)
|
||||||
})
|
})
|
||||||
|
}else {
|
||||||
|
await this.getAllNewsList()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
noti_count: res.data.count_noti,
|
noti_count: res.data.count_noti,
|
||||||
user_point: res.data.point_balance,
|
user_point: res.data.point_balance,
|
||||||
@ -285,7 +283,7 @@ class NewsScreen extends Component {
|
|||||||
this.props.appCleanUser();
|
this.props.appCleanUser();
|
||||||
this.props.appCleanToken();
|
this.props.appCleanToken();
|
||||||
this.props.appCleanProjectID();
|
this.props.appCleanProjectID();
|
||||||
|
|
||||||
this.initData()
|
this.initData()
|
||||||
}, 500)
|
}, 500)
|
||||||
// })
|
// })
|
||||||
@ -596,28 +594,25 @@ class NewsScreen extends Component {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{
|
<View style={[styles.row]}>
|
||||||
this.state.user_project_id ?
|
<FlatList
|
||||||
<View style={[styles.row]}>
|
data={this.state.news_head}
|
||||||
<FlatList
|
renderItem={({ item }) => this.renderNativeItemImages(item)}
|
||||||
data={this.state.news_head}
|
horizontal={true}
|
||||||
renderItem={({ item }) => this.renderNativeItemImages(item)}
|
showsHorizontalScrollIndicator={false}
|
||||||
horizontal={true}
|
pagingEnabled={true}
|
||||||
showsHorizontalScrollIndicator={false}
|
keyExtractor={this._keyExtractorNewHead}
|
||||||
pagingEnabled={true}
|
onScroll={this._onCarouselScroll}
|
||||||
keyExtractor={this._keyExtractorNewHead}
|
/>
|
||||||
onScroll={this._onCarouselScroll}
|
<View style={{ position: 'absolute', bottom: 10, width: '100%', justifyContent: 'center', flexDirection: 'row' }}>
|
||||||
/>
|
{
|
||||||
<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>)
|
||||||
this.state.news_head ?
|
: <View></View>
|
||||||
(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></View>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
this.state.auth !== null &&
|
this.state.auth !== null &&
|
||||||
(
|
(
|
||||||
@ -663,15 +658,15 @@ class NewsScreen extends Component {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View> : null}
|
</View> : null}
|
||||||
|
|
||||||
<Text style={{ color: 'white', marginTop: 10 }}>{t('or')}</Text>
|
<Text style={{ color: 'white', marginTop: 10 }}>{t('or')}</Text>
|
||||||
|
|
||||||
<TouchableOpacity onPress={() => {
|
<TouchableOpacity onPress={() => {
|
||||||
loginWithFacebook(() => {
|
loginWithFacebook(() => {
|
||||||
this.initData()
|
this.initData()
|
||||||
})}}>
|
})}}>
|
||||||
|
|
||||||
|
|
||||||
<View>
|
<View>
|
||||||
<Badge style={{ backgroundColor: '#145EB3', borderRadius: 5, borderColor: 'rbga(0,0,0,0)', marginTop: 10, height: null, width: 150 }}>
|
<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>
|
<Text style={{ fontSize: 16, color: 'white', padding: 5, textAlign: 'center' }}>{t('login_facebook')}</Text>
|
||||||
@ -821,38 +816,34 @@ class NewsScreen extends Component {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
))
|
))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
<View style={{ padding: 10 }}>
|
||||||
this.state.user_project_id ?
|
<FlatList
|
||||||
<View style={{ padding: 10 }}>
|
extraData={this.state}
|
||||||
<FlatList
|
contentContainerStyle={{
|
||||||
extraData={this.state}
|
height: '100%',
|
||||||
contentContainerStyle={{
|
width: '100%'
|
||||||
height: '100%',
|
}}
|
||||||
width: '100%'
|
// scrollEnabled={false}
|
||||||
}}
|
data={this.state.new_all}
|
||||||
// scrollEnabled={false}
|
renderItem={this.renderNativeItem}
|
||||||
data={this.state.new_all}
|
keyExtractor={this._keyExtractorNewAll}
|
||||||
renderItem={this.renderNativeItem}
|
// onEndReachedThreshold={0.01}
|
||||||
keyExtractor={this._keyExtractorNewAll}
|
// onEndReached={this.loadMoreData.bind(this)}
|
||||||
// onEndReachedThreshold={0.01}
|
ItemSeparatorComponent={() => {
|
||||||
// onEndReached={this.loadMoreData.bind(this)}
|
return <View style={{ width: '100%', height: 8 }}></View>
|
||||||
ItemSeparatorComponent={() => {
|
}}
|
||||||
return <View style={{ width: '100%', height: 8 }}></View>
|
ListFooterComponent={() => {
|
||||||
}}
|
if (!this.state.isLoadmore) return null
|
||||||
ListFooterComponent={() => {
|
return (<ActivityIndicator
|
||||||
if (!this.state.isLoadmore) return null
|
size="large"
|
||||||
return (<ActivityIndicator
|
color={'white'}
|
||||||
size="large"
|
/>)
|
||||||
color={'white'}
|
}}
|
||||||
/>)
|
/>
|
||||||
}}
|
</View>
|
||||||
/>
|
|
||||||
</View> : <View></View>
|
|
||||||
}
|
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</BackgroundImage>
|
</BackgroundImage>
|
||||||
<IndicatorLoading loadingVisible={this.state.isLoading}/>
|
<IndicatorLoading loadingVisible={this.state.isLoading}/>
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import {NavigationActions} from "react-navigation";
|
|||||||
import Config from 'src/utils/Config'
|
import Config from 'src/utils/Config'
|
||||||
import Carousel from "../room/RoomDetail";
|
import Carousel from "../room/RoomDetail";
|
||||||
import {sliderWidth} from "../../styles/SliderEntry.style";
|
import {sliderWidth} from "../../styles/SliderEntry.style";
|
||||||
|
import {connect} from "react-redux";
|
||||||
var uri = null;
|
var uri = null;
|
||||||
const injectScript = `
|
const injectScript = `
|
||||||
(function () {
|
(function () {
|
||||||
@ -27,7 +28,7 @@ const injectScript = `
|
|||||||
}());
|
}());
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default class NewsDetailScreen extends Component {
|
class NewsDetailScreen extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
this.state = {
|
this.state = {
|
||||||
@ -97,7 +98,7 @@ export default class NewsDetailScreen extends Component {
|
|||||||
source_webview = {
|
source_webview = {
|
||||||
baseUrl: '',
|
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: `${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'){
|
// 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({
|
const styles = StyleSheet.create({
|
||||||
imgBg: {
|
imgBg: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user