Skip to content

Commit 16e2b4a

Browse files
committed
'导航地图离线模式更新'
2 parents 0dc20f4 + cb5a947 commit 16e2b4a

77 files changed

Lines changed: 1483 additions & 591 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: 25 additions & 6 deletions
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,13 +37,11 @@ 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'
42-
import FriendListFileHandle from './src/containers/tabs/Friend/FriendListFileHandle'
4342
import FetchUtils from './src/utils/FetchUtils'
43+
import { ProtocolDialog } from './src/containers/tabs/Home/components'
4444
import RNFS from 'react-native-fs'
45-
import constants from "./src/containers/workspace/constants"
4645

4746

4847
const {persistor, store} = ConfigStore()
@@ -103,6 +102,8 @@ class AppRoot extends Component {
103102
map: PropTypes.object,
104103
collection: PropTypes.object,
105104
layers: PropTypes.array,
105+
isAgreeToProtocol: PropTypes.bool,
106+
106107
setNav: PropTypes.func,
107108
setUser: PropTypes.func,
108109
openWorkspace: PropTypes.func,
@@ -120,6 +121,7 @@ class AppRoot extends Component {
120121
setCurrentAttribute: PropTypes.func,
121122
setAttributes: PropTypes.func,
122123
setAnalystParams: PropTypes.func,
124+
setAgreeToProtocol: PropTypes.func,
123125
}
124126

125127
constructor (props) {
@@ -173,9 +175,9 @@ class AppRoot extends Component {
173175
}
174176
// Toast.show('登陆状态失效')
175177
}else{
176-
if(!this.listDowned){
177-
FriendListFileHandle.download(this.props.user.currentUser)
178-
this.listDowned = true
178+
if(!this.initFriend){
179+
global.getFriend().onUserLoggedin()
180+
this.initFriend = true
179181
}
180182
// Toast.show('登陆')
181183
}
@@ -200,6 +202,7 @@ class AppRoot extends Component {
200202
}
201203

202204
componentDidMount () {
205+
this.protocolDialog && this.protocolDialog.setVisible(true)
203206
this.login()
204207
this.reCircleLogin()
205208
// this.initSpeechManager()
@@ -622,6 +625,19 @@ class AppRoot extends Component {
622625
)
623626
}
624627

628+
_renderProtocolDialog = () => {
629+
return (
630+
<ProtocolDialog
631+
ref={ref => (this.protocolDialog = ref)}
632+
language={this.props.language}
633+
confirm={isAgree => {
634+
this.props.setAgreeToProtocol && this.props.setAgreeToProtocol(isAgree)
635+
this.protocolDialog.setVisible(false)
636+
}}
637+
/>
638+
)
639+
}
640+
625641
renderImportDialogChildren = () => {
626642
return (
627643
<View style={styles.dialogHeaderView}>
@@ -659,6 +675,7 @@ class AppRoot extends Component {
659675
/>
660676
{this.renderDialog()}
661677
{this.renderImportDialog()}
678+
{!this.props.isAgreeToProtocol && this._renderProtocolDialog()}
662679
<Loading ref={ref => GLOBAL.Loading = ref} initLoading={false}/>
663680
</View>
664681
)
@@ -676,6 +693,7 @@ const mapStateToProps = state => {
676693
collection: state.collection.toJS(),
677694
layers: state.layers.toJS().layers,
678695
backActions: state.backActions.toJS(),
696+
isAgreeToProtocol: state.setting.toJS().isAgreeToProtocol,
679697
}
680698
}
681699

@@ -694,6 +712,7 @@ const AppRootWithRedux = connect(mapStateToProps, {
694712
setMapSetting,
695713
setAnalystParams,
696714
saveMap,
715+
setAgreeToProtocol,
697716
})(AppRoot)
698717

699718
const App = () =>

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

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -999,14 +999,37 @@ public static Boolean initUserDefaultData(String userName, Context context) {
999999
createDirectory(dataPath + "Color");
10001000
createDirectory(dataPath + "Map");
10011001
createDirectory(dataPath + "Media");
1002-
createDirectory(dataPath + "Plotting");
1002+
boolean dataPlot=createDirectory(dataPath + "Plotting");
10031003
createDirectory(dataPath + "Animation");
10041004
// createDirectory(CachePath);
10051005
createDirectory(externalDataPath);
1006-
createDirectory(plottingExtDataPath);
1006+
boolean plotExt=createDirectory(plottingExtDataPath);
10071007
createDirectory(collectionExtDataPath);
10081008
// createDirectory(externalDataPath+"Lable");
10091009

1010+
if(plotExt)
1011+
{
1012+
//添加一个.nomedis文件,系统不能访问里面的图片
1013+
String noMediaPath=".nomedia";
1014+
File mediaFile=new File(plottingExtDataPath,noMediaPath);
1015+
try {
1016+
mediaFile.createNewFile();
1017+
} catch (IOException e) {
1018+
e.printStackTrace();
1019+
}
1020+
}
1021+
if(dataPlot){
1022+
//添加一个.nomedis文件,系统不能访问里面的图片
1023+
String noMediaPath=".nomedia";
1024+
File mediaFile=new File(dataPath + "Plotting",noMediaPath);
1025+
try {
1026+
mediaFile.createNewFile();
1027+
} catch (IOException e) {
1028+
e.printStackTrace();
1029+
}
1030+
}
1031+
1032+
10101033
// 初始化用户数据
10111034
String commonPath = SDCARD + "/iTablet/Common/";
10121035
String commonCachePath = SDCARD + "/iTablet/Cache/";
@@ -1024,24 +1047,6 @@ public static Boolean initUserDefaultData(String userName, Context context) {
10241047
Utils.copyAssetFileToSDcard(context.getApplicationContext(), commonCachePath, srclic);
10251048
}
10261049

1027-
String lableUDB=dataPath+"Datasource/Label_"+userName+"#.udb";
1028-
File file=new File(lableUDB);
1029-
if(!file.exists()){
1030-
Workspace workspace=new Workspace();
1031-
DatasourceConnectionInfo info=new DatasourceConnectionInfo();
1032-
info.setAlias("Label");
1033-
info.setEngineType(EngineType.UDB);
1034-
info.setServer(lableUDB);
1035-
Datasources datasources=workspace.getDatasources();
1036-
Datasource datasource=datasources.create(info);
1037-
if(datasource!=null){
1038-
System.out.println("数据源创建成功");
1039-
}else {
1040-
System.out.println("数据源创建失败");
1041-
}
1042-
workspace.dispose();
1043-
}
1044-
10451050
Boolean isUnZip,isUnZipPlot;
10461051
if (!Utils.fileIsExit(templatePath) || !Utils.fileIsExit(templateFilePath)) {
10471052
if (Utils.fileIsExit(commonZipPath)) {

ios/Tools/FileTools.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,8 @@ +(BOOL)initUserDefaultData:(NSString *)userName {
684684
}
685685
}
686686

687+
[Environment setLicensePath:[NSHomeDirectory() stringByAppendingFormat:@"/Documents/iTablet/%@/",@"license"]];
688+
687689
NSString *labelUDB = [NSHomeDirectory() stringByAppendingFormat:@"%@%@%@%@", dataPath, @"Datasource/Label_",userName,@"#.udb"];
688690

689691
if(![[NSFileManager defaultManager]fileExistsAtPath:labelUDB]){
425 Bytes
Loading
636 Bytes
Loading
1.42 KB
Loading
2.45 KB
Loading
4.67 KB
Loading

src/components/Dialog/Dialog.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ 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,
4647
onlyOneBtn: boolean,
48+
disableBackTouch: boolean,
4749
}
4850

4951
static defaultProps = {
@@ -57,17 +59,28 @@ export default class Dialog extends PureComponent {
5759
confirmBtnDisable: false,
5860
cancelBtnDisable: false,
5961
onlyOneBtn: false,
62+
defaultVisible: false,
6063
}
6164

6265
constructor(props) {
6366
super(props)
6467
this.state = {
65-
visible: false,
68+
visible: this.props.defaultVisible || false,
6669
confirmPress: false,
6770
cancelPress: false,
6871
}
6972
}
7073

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+
7184
//控制Modal框是否可以展示
7285
setDialogVisible(visible) {
7386
visible !== this.state.visible && this.setState({ visible: visible })
@@ -176,6 +189,11 @@ export default class Dialog extends PureComponent {
176189
}}
177190
>
178191
<TouchableOpacity
192+
disabled={
193+
this.props.disableBackTouch === undefined
194+
? false
195+
: this.props.disableBackTouch
196+
}
179197
onPress={this.cancel}
180198
style={[styles.container, this.props.backgroundStyle]}
181199
>
@@ -206,7 +224,7 @@ export default class Dialog extends PureComponent {
206224
{this.props.info}
207225
</Text>
208226
)}
209-
{this.props.children}
227+
<View style={styles.childrenContainer}>{this.props.children}</View>
210228
{this.renderBtns()}
211229
</KeyboardAvoidingView>
212230
</TouchableOpacity>
@@ -238,7 +256,7 @@ export default class Dialog extends PureComponent {
238256
{this.props.info}
239257
</Text>
240258
)}
241-
{this.props.children}
259+
<View style={styles.childrenContainer}>{this.props.children}</View>
242260
{this.renderBtns()}
243261
</KeyboardAvoidingView>
244262
</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%',

0 commit comments

Comments
 (0)