diff --git a/android/app/build.gradle b/android/app/build.gradle
index 50c0cac..f612c9b 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -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'
diff --git a/android/app/release/app-release.apk b/android/app/release/app-release.apk
index 7a4b600..fc0322e 100644
Binary files a/android/app/release/app-release.apk and b/android/app/release/app-release.apk differ
diff --git a/android/app/release/output-metadata.json b/android/app/release/output-metadata.json
index 400b924..f732932 100644
--- a/android/app/release/output-metadata.json
+++ b/android/app/release/output-metadata.json
@@ -11,7 +11,7 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
- "versionCode": 100,
+ "versionCode": 101,
"versionName": "2.50",
"outputFile": "app-release.apk"
}
diff --git a/src/screens/news/News.js b/src/screens/news/News.js
index 7382d31..e1a8040 100644
--- a/src/screens/news/News.js
+++ b/src/screens/news/News.js
@@ -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 ?
-
- this.renderNativeItemImages(item)}
- horizontal={true}
- showsHorizontalScrollIndicator={false}
- pagingEnabled={true}
- keyExtractor={this._keyExtractorNewHead}
- onScroll={this._onCarouselScroll}
- />
-
- {
- this.state.news_head ?
- (this.state.news_head).map((item, i) => )
- :
- }
-
- :
- }
-
+
+ this.renderNativeItemImages(item)}
+ horizontal={true}
+ showsHorizontalScrollIndicator={false}
+ pagingEnabled={true}
+ keyExtractor={this._keyExtractorNewHead}
+ onScroll={this._onCarouselScroll}
+ />
+
+ {
+ this.state.news_head ?
+ (this.state.news_head).map((item, i) => )
+ :
+ }
+
+
+
{
this.state.auth !== null &&
(
@@ -663,15 +658,15 @@ class NewsScreen extends Component {
}}
/>
: null}
-
+
{t('or')}
-
+
{
loginWithFacebook(() => {
this.initData()
})}}>
-
-
+
+
{t('login_facebook')}
@@ -821,38 +816,34 @@ class NewsScreen extends Component {
))
-
+
}
- {
- this.state.user_project_id ?
-
- {
- return
- }}
- ListFooterComponent={() => {
- if (!this.state.isLoadmore) return null
- return ()
- }}
- />
- :
- }
-
+
+ {
+ return
+ }}
+ ListFooterComponent={() => {
+ if (!this.state.isLoadmore) return null
+ return ()
+ }}
+ />
+
diff --git a/src/screens/news/NewsDetail.js b/src/screens/news/NewsDetail.js
index bbbe81a..ef41986 100644
--- a/src/screens/news/NewsDetail.js
+++ b/src/screens/news/NewsDetail.js
@@ -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%',