Procházet zdrojové kódy

Merge branch 'master' of https://git.lumicharging.com/EVCharge/ChargEco

wudebin před 1 měsícem
rodič
revize
c4defcc8f6

+ 8 - 1
Strides-SPAPP/app/pages/alert/ListAlerts.js

@@ -25,12 +25,19 @@ export default class ListAlerts extends Component {
       unreadTotal: 0,
       loadingList: ["", "", "", ""]
     };
+    this.isHide = false;
   }
 
   componentDidMount() {
     //this.getMessageList();
     this.props.navigation.addListener('focus', () => {
-      this.getMessageList();
+      if (this.isHide) {
+        this.isHide = false;
+        this.getMessageList();
+      }
+    });
+    this.props.navigation.addListener('blur', () => {
+      this.isHide = true;
     });
     setTimeout(() => {
       this.getMessageList();

+ 8 - 1
Strides-SPAPP/app/pages/alert/ListCampaign.js

@@ -20,11 +20,18 @@ export default class ListCampaign extends Component {
       refreshing: false,
       loadingList: ["", "", "", ""]
     };
+    this.isHide = false;
   }
 
   componentDidMount() {
     this.props.navigation.addListener('focus', () => {
-      this.getMessageList();
+      if (this.isHide) {
+        this.isHide = false;
+        this.getMessageList();
+      }
+    });
+    this.props.navigation.addListener('blur', () => {
+      this.isHide = true;
     });
     setTimeout(() => {
       this.getMessageList();

+ 8 - 2
Strides-SPAPP/app/pages/alert/ListNews.js

@@ -20,12 +20,18 @@ export default class ListNews extends Component {
       refreshing: false,
       loadingList: ["", "", "", ""]
     };
+    this.isHide = false;
   }
 
   componentDidMount() {
-    //this.getMessageList();
     this.props.navigation.addListener('focus', () => {
-      this.getMessageList();
+      if (this.isHide) {
+        this.isHide = false;
+        this.getMessageList();
+      }
+    });
+    this.props.navigation.addListener('blur', () => {
+      this.isHide = true;
     });
     setTimeout(() => {
       this.getMessageList();

+ 18 - 5
Strides-SPAPP/app/pages/alert/Notification.js

@@ -19,6 +19,7 @@ export default class Notification extends Component {
   constructor(props) {
     super(props);
     this.state = {
+      ready: false,
       refreshing: false,
       countInfo: {},
       pageAdapter: []
@@ -59,21 +60,26 @@ export default class Notification extends Component {
   componentDidMount() {
     if (app.notifications.showCampaigns && app.notifications.showArticle) {
       this.setState({
+        ready: true,
         pageAdapter: this.pageAdapterAll
       }, () => {
         setTimeout(() => {
           this.init();
-        }, 300);
+        }, 500);
       });
     } else if (app.notifications.showArticle) {
       this.setState({
+        ready: true,
         pageAdapter: this.pageAdapter
       }, () => {
         setTimeout(() => {
           this.init();
-        }, 300);
+        }, 500);
       });
     } else {
+      this.setState({
+        ready: true
+      })
       this.init();
     }
     
@@ -158,13 +164,18 @@ export default class Notification extends Component {
 
   render() {
     const Tab = createMaterialTopTabNavigator();
+    if (!this.state.ready) {
+      return (
+        <View style={styles.container}></View>
+      )
+    }
     if (this.state.pageAdapter.length > 0) {
       return (
         <Tab.Navigator
           style={styles.container}
           screenOptions={{
-            lazy: false,
-            lazyPreloadDistance: 1,
+            lazy: isIOS,
+            lazyPreloadDistance: 2,
             ...this.tabBarStyle
           }}
           backBehavior={() => this.backPage()}>
@@ -200,12 +211,14 @@ const styles = StyleSheet.create({
     backgroundColor: app.isWhitelabel ? colorPrimary : colorLight
   },
   badgeText: {
-    width: 20,
+    minWidth: 20,
     height: 20,
     color: textLight,
     fontSize: 10,
     marginTop: 4,
     marginRight: 8,
+    paddingLeft: 4,
+    paddingRight: 4,
     borderRadius: 30,
     fontWeight: 'bold',
     alignItems: 'center',

+ 4 - 4
Strides-SPAPP/ios/ChargEco.xcodeproj/project.pbxproj

@@ -1282,7 +1282,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_ENTITLEMENTS = ChargEco/ChargEco.entitlements;
-				CURRENT_PROJECT_VERSION = 506;
+				CURRENT_PROJECT_VERSION = 510;
 				DEVELOPMENT_TEAM = 3L3U7K6Q28;
 				ENABLE_BITCODE = NO;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
@@ -1403,7 +1403,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 4.2.1;
+				MARKETING_VERSION = 4.2.2;
 				OTHER_LDFLAGS = (
 					"$(inherited)",
 					"-ObjC",
@@ -1431,7 +1431,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_ENTITLEMENTS = ChargEco/ChargEco.entitlements;
-				CURRENT_PROJECT_VERSION = 506;
+				CURRENT_PROJECT_VERSION = 510;
 				DEVELOPMENT_TEAM = 3L3U7K6Q28;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				HEADER_SEARCH_PATHS = (
@@ -1551,7 +1551,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 4.2.1;
+				MARKETING_VERSION = 4.2.2;
 				OTHER_LDFLAGS = (
 					"$(inherited)",
 					"-ObjC",