@@ -6,6 +6,7 @@ import PropTypes from 'prop-types'
66import RootNavigator from './src/containers'
77import { setNav } from './src/models/nav'
88import { setUser } from './src/models/user'
9+ import { setAgreeToProtocol } from './src/models/setting'
910import {
1011 setEditLayer ,
1112 setSelection ,
@@ -36,10 +37,10 @@ import NavigationService from './src/containers/NavigationService'
3637import Orientation from 'react-native-orientation'
3738import { SOnlineService , SScene , SMap , SMessageService , SIPortalService , SpeechManager } from 'imobile_for_reactnative'
3839import SplashScreen from 'react-native-splash-screen'
39- //import { Dialog } from './src/components'
4040import UserType from './src/constants/UserType'
4141import { getLanguage } from './src/language/index'
4242import FetchUtils from './src/utils/FetchUtils'
43+ import { ProtocolDialog } from './src/containers/tabs/Home/components'
4344import RNFS from 'react-native-fs'
4445
4546
@@ -101,6 +102,8 @@ class AppRoot extends Component {
101102 map : PropTypes . object ,
102103 collection : PropTypes . object ,
103104 layers : PropTypes . array ,
105+ isAgreeToProtocol : PropTypes . bool ,
106+
104107 setNav : PropTypes . func ,
105108 setUser : PropTypes . func ,
106109 openWorkspace : PropTypes . func ,
@@ -118,6 +121,7 @@ class AppRoot extends Component {
118121 setCurrentAttribute : PropTypes . func ,
119122 setAttributes : PropTypes . func ,
120123 setAnalystParams : PropTypes . func ,
124+ setAgreeToProtocol : PropTypes . func ,
121125 }
122126
123127 constructor ( props ) {
@@ -196,6 +200,7 @@ class AppRoot extends Component {
196200 }
197201
198202 componentDidMount ( ) {
203+ this . protocolDialog && this . protocolDialog . setVisible ( true )
199204 this . login ( )
200205 this . reCircleLogin ( )
201206 // this.initSpeechManager()
@@ -618,6 +623,19 @@ class AppRoot extends Component {
618623 )
619624 }
620625
626+ _renderProtocolDialog = ( ) => {
627+ return (
628+ < ProtocolDialog
629+ ref = { ref => ( this . protocolDialog = ref ) }
630+ language = { this . props . language }
631+ confirm = { isAgree => {
632+ this . props . setAgreeToProtocol && this . props . setAgreeToProtocol ( isAgree )
633+ this . protocolDialog . setVisible ( false )
634+ } }
635+ />
636+ )
637+ }
638+
621639 renderImportDialogChildren = ( ) => {
622640 return (
623641 < View style = { styles . dialogHeaderView } >
@@ -655,6 +673,7 @@ class AppRoot extends Component {
655673 />
656674 { this . renderDialog ( ) }
657675 { this . renderImportDialog ( ) }
676+ { ! this . props . isAgreeToProtocol && this . _renderProtocolDialog ( ) }
658677 < Loading ref = { ref => GLOBAL . Loading = ref } initLoading = { false } />
659678 </ View >
660679 )
@@ -672,6 +691,7 @@ const mapStateToProps = state => {
672691 collection : state . collection . toJS ( ) ,
673692 layers : state . layers . toJS ( ) . layers ,
674693 backActions : state . backActions . toJS ( ) ,
694+ isAgreeToProtocol : state . setting . toJS ( ) . isAgreeToProtocol ,
675695 }
676696}
677697
@@ -690,6 +710,7 @@ const AppRootWithRedux = connect(mapStateToProps, {
690710 setMapSetting,
691711 setAnalystParams,
692712 saveMap,
713+ setAgreeToProtocol,
693714} ) ( AppRoot )
694715
695716const App = ( ) =>
0 commit comments