Skip to content

Commit cb5a947

Browse files
committed
Merge branch 'dev-2.1' of https://github.com/iMobileforJavaScript/iTablet into dev-2.1
2 parents 6f329a7 + 3134691 commit cb5a947

41 files changed

Lines changed: 425 additions & 88 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

App.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import PropTypes from 'prop-types'
66
import RootNavigator from './src/containers'
77
import { setNav } from './src/models/nav'
88
import { setUser } from './src/models/user'
9+
import { setAgreeToProtocol } from './src/models/setting'
910
import {
1011
setEditLayer,
1112
setSelection,
@@ -36,10 +37,10 @@ import NavigationService from './src/containers/NavigationService'
3637
import Orientation from 'react-native-orientation'
3738
import { SOnlineService, SScene, SMap,SMessageService, SIPortalService ,SpeechManager} from 'imobile_for_reactnative'
3839
import SplashScreen from 'react-native-splash-screen'
39-
//import { Dialog } from './src/components'
4040
import UserType from './src/constants/UserType'
4141
import { getLanguage } from './src/language/index'
4242
import FetchUtils from './src/utils/FetchUtils'
43+
import { ProtocolDialog } from './src/containers/tabs/Home/components'
4344
import 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

695716
const App = () =>

android/app/src/main/java/com/supermap/RN/FileTools.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,24 +1047,6 @@ public static Boolean initUserDefaultData(String userName, Context context) {
10471047
Utils.copyAssetFileToSDcard(context.getApplicationContext(), commonCachePath, srclic);
10481048
}
10491049

1050-
String lableUDB=dataPath+"Datasource/Label_"+userName+"#.udb";
1051-
File file=new File(lableUDB);
1052-
if(!file.exists()){
1053-
Workspace workspace=new Workspace();
1054-
DatasourceConnectionInfo info=new DatasourceConnectionInfo();
1055-
info.setAlias("Label");
1056-
info.setEngineType(EngineType.UDB);
1057-
info.setServer(lableUDB);
1058-
Datasources datasources=workspace.getDatasources();
1059-
Datasource datasource=datasources.create(info);
1060-
if(datasource!=null){
1061-
System.out.println("数据源创建成功");
1062-
}else {
1063-
System.out.println("数据源创建失败");
1064-
}
1065-
workspace.dispose();
1066-
}
1067-
10681050
Boolean isUnZip,isUnZipPlot;
10691051
if (!Utils.fileIsExit(templatePath) || !Utils.fileIsExit(templateFilePath)) {
10701052
if (Utils.fileIsExit(commonZipPath)) {

src/components/Dialog/Dialog.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export default class Dialog extends PureComponent {
4040
confirmTitleStyle?: StyleSheet,
4141
cancelTitleStyle?: StyleSheet,
4242
showBtns?: boolean,
43+
defaultVisible?: boolean,
4344
header?: any,
4445
opacity: any,
4546
opacityStyle: Object,
@@ -58,17 +59,28 @@ export default class Dialog extends PureComponent {
5859
confirmBtnDisable: false,
5960
cancelBtnDisable: false,
6061
onlyOneBtn: false,
62+
defaultVisible: false,
6163
}
6264

6365
constructor(props) {
6466
super(props)
6567
this.state = {
66-
visible: false,
68+
visible: this.props.defaultVisible || false,
6769
confirmPress: false,
6870
cancelPress: false,
6971
}
7072
}
7173

74+
// shouldComponentUpdate(nextProps, nextState) {
75+
// if (
76+
// JSON.stringify(nextProps) !== JSON.stringify(this.props) ||
77+
// JSON.stringify(nextState) !== JSON.stringify(this.state)
78+
// ) {
79+
// return true
80+
// }
81+
// return false
82+
// }
83+
7284
//控制Modal框是否可以展示
7385
setDialogVisible(visible) {
7486
visible !== this.state.visible && this.setState({ visible: visible })
@@ -212,7 +224,7 @@ export default class Dialog extends PureComponent {
212224
{this.props.info}
213225
</Text>
214226
)}
215-
{this.props.children}
227+
<View style={styles.childrenContainer}>{this.props.children}</View>
216228
{this.renderBtns()}
217229
</KeyboardAvoidingView>
218230
</TouchableOpacity>
@@ -244,7 +256,7 @@ export default class Dialog extends PureComponent {
244256
{this.props.info}
245257
</Text>
246258
)}
247-
{this.props.children}
259+
<View style={styles.childrenContainer}>{this.props.children}</View>
248260
{this.renderBtns()}
249261
</KeyboardAvoidingView>
250262
</View>

src/components/Dialog/styles.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ export default StyleSheet.create({
4747
textAlign: 'center',
4848
color: color.themeText2,
4949
},
50+
childrenContainer: {
51+
flex: 1,
52+
marginBottom: scaleSize(50),
53+
},
5054
btns: {
5155
position: 'absolute',
5256
width: '100%',

src/components/Input/Input.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ export default class Input extends PureComponent {
9393
}
9494

9595
renderClearBtn = () => {
96-
if (this.state.value === '') return null
96+
if (this.state.value === '') {
97+
return <View style={styles.clearBtn} />
98+
}
9799
return (
98100
<TouchableOpacity
99101
activeOpacity={0.8}
@@ -131,7 +133,7 @@ export default class Input extends PureComponent {
131133
this.props.keyboardType === 'numeric'
132134
) {
133135
if (isNaN(text) && text !== '' && text !== '-') {
134-
text = this.state.inputValue
136+
text = this.state.value || ''
135137
}
136138
}
137139
this.props.onChangeText && this.props.onChangeText(text)

src/containers/GestureDetectorListener.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ async function touchCallback(event) {
7878
case TouchType.MAP_TOOL_TAGGING:
7979
NavigationService.navigate('InputPage', {
8080
headerTitle: getLanguage(global.language).Map_Main_Menu.TOOLS_NAME,
81+
type: 'name',
8182
cb: async value => {
8283
if (value !== '') {
8384
let datasourceName = GLOBAL.currentLayer.datasourceAlias

src/containers/InputPage/InputPage.js

Lines changed: 86 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import { getLanguage } from '../../language'
1111
import { dataUtil } from '../../utils'
1212
import styles from './styles'
1313

14+
/**
15+
* type: name | http | number | default
16+
*/
1417
export default class InputPage extends React.Component {
1518
props: {
1619
navigation: Object,
@@ -34,8 +37,9 @@ export default class InputPage extends React.Component {
3437
params && params.btnTitle
3538
? params.btnTitle
3639
: getLanguage(global.language).Prompt.CONFIRM, //'确定',
37-
keyboardType:
38-
params && params.keyboardType ? params.keyboardType : 'default',
40+
// keyboardType:
41+
// params && params.keyboardType ? params.keyboardType : 'default',
42+
type: params && params.type ? params.type : 'default', // 输入值类型,关系到值的检测
3943
isLegalName: !!defaultValue,
4044
errorInfo: '',
4145
}
@@ -61,6 +65,51 @@ export default class InputPage extends React.Component {
6165
}
6266
}
6367

68+
getKeyboardType = () => {
69+
let keyboardType
70+
switch (this.state.type) {
71+
case 'number':
72+
keyboardType = 'numeric'
73+
break
74+
case 'name':
75+
case 'http':
76+
default:
77+
keyboardType = 'default'
78+
break
79+
}
80+
return keyboardType
81+
}
82+
83+
checkValue = text => {
84+
let res
85+
switch (this.state.type) {
86+
case 'number': {
87+
let isNumber = text !== '' && !isNaN(text) && text !== undefined
88+
res = {
89+
result: isNumber,
90+
error: isNumber
91+
? null
92+
: getLanguage(this.props.language).Prompt.ERROR_INFO_NOT_A_NUMBER,
93+
}
94+
break
95+
}
96+
case 'name':
97+
res = dataUtil.isLegalName(text, this.props.language)
98+
break
99+
case 'http':
100+
if (text === '') {
101+
res = { result: true }
102+
} else {
103+
res = dataUtil.isLegalURL(text, this.props.language)
104+
}
105+
break
106+
default:
107+
res = { result: true }
108+
break
109+
}
110+
return res
111+
}
112+
64113
render() {
65114
return (
66115
<Container
@@ -93,37 +142,50 @@ export default class InputPage extends React.Component {
93142
placeholderTextColor={color.themePlaceHolder}
94143
value={this.state.value + ''}
95144
onChangeText={text => {
96-
if (this.state.keyboardType === 'numeric') {
97-
this.setState({
98-
value: text,
99-
isLegalName:
100-
text !== '' && !isNaN(text) && text !== undefined,
101-
})
102-
} else {
103-
let { result, error } = dataUtil.isLegalName(
104-
text,
105-
this.props.language,
106-
)
107-
this.setState({
108-
isLegalName: result,
109-
errorInfo: error,
110-
value: text,
111-
})
112-
}
145+
// if (this.state.keyboardType === 'numeric') {
146+
// this.setState({
147+
// value: text,
148+
// isLegalName:
149+
// text !== '' && !isNaN(text) && text !== undefined,
150+
// })
151+
// } else {
152+
// let { result, error } = dataUtil.isLegalName(
153+
// text,
154+
// this.props.language,
155+
// )
156+
// this.setState({
157+
// isLegalName: result,
158+
// errorInfo: error,
159+
// value: text,
160+
// })
161+
// }
162+
let { result, error } = this.checkValue(text)
163+
this.setState({
164+
isLegalName: result,
165+
errorInfo: error,
166+
value: text,
167+
})
113168
}}
114169
onClear={() => {
115-
let { result, error } = dataUtil.isLegalName(
116-
'',
117-
this.props.language,
118-
)
170+
// let { result, error } = dataUtil.isLegalName(
171+
// '',
172+
// this.props.language,
173+
// )
174+
// this.setState({
175+
// isLegalName: result,
176+
// errorInfo: error,
177+
// value: '',
178+
// })
179+
let { result, error } = this.checkValue('')
119180
this.setState({
120181
isLegalName: result,
121182
errorInfo: error,
122183
value: '',
123184
})
124185
}}
125186
returnKeyType={'done'}
126-
keyboardType={this.state.keyboardType}
187+
// keyboardType={this.state.keyboardType}
188+
keyboardType={this.getKeyboardType()}
127189
showClear
128190
/>
129191
{!this.state.isLegalName && !!this.state.errorInfo && (

src/containers/analystView/pages/bufferAnalystView/BufferAnalystViewTab.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,8 @@ export default class BufferAnalystViewTab extends Component {
441441
placeholder:
442442
getLanguage(this.props.language).Analyst_Prompt.PLEASE_ENTER +
443443
getLanguage(this.props.language).Analyst_Labels.BUFFER_RADIUS,
444-
keyboardType: 'numeric',
444+
// keyboardType: 'numeric',
445+
type: 'number',
445446
cb: async value => {
446447
NavigationService.goBack()
447448
this.setState({
@@ -629,6 +630,7 @@ export default class BufferAnalystViewTab extends Component {
629630
headerTitle: getLanguage(this.props.language).Analyst_Labels
630631
.RESULT_DATASET_NAME,
631632
placeholder: '',
633+
type: 'name',
632634
cb: async value => {
633635
NavigationService.goBack()
634636
this.setState({

src/containers/analystView/pages/interpolationAnalystView/InterpolationAnalystView.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ export default class InterpolationAnalystView extends Component {
448448
headerTitle: getLanguage(this.props.language).Analyst_Labels
449449
.RESULT_DATASET_NAME,
450450
placeholder: '',
451+
type: 'name',
451452
cb: async value => {
452453
NavigationService.goBack()
453454
this.setState({

0 commit comments

Comments
 (0)