Skip to content

Commit 20c5e59

Browse files
committed
Merge branch 'dev-2.1' of https://github.com/iMobileforJavaScript/iTablet into dev-2.1
2 parents b78654f + bcb2562 commit 20c5e59

54 files changed

Lines changed: 994 additions & 623 deletions

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: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ import UserType from './src/constants/UserType'
4040
import MSGConstant from "./src/containers/tabs/Friend/MsgConstant"
4141
import { getLanguage } from './src/language/index'
4242
import FriendListFileHandle from './src/containers/tabs/Friend/FriendListFileHandle'
43+
import FetchUtils from './src/utils/FetchUtils'
44+
import RNFS from 'react-native-fs'
45+
4346

4447
const {persistor, store} = ConfigStore()
4548

@@ -224,12 +227,12 @@ class AppRoot extends Component {
224227
}
225228
// let customerPath = ConstPath.CustomerPath + ConstPath.RelativeFilePath.Workspace
226229
// path = await FileTools.appendingHomeDirectory(customerPath)
227-
this.props.openWorkspace({server: path})
228230
await this.inspectEnvironment()
229231
await this.initOrientation()
230232
await this.getImportResult()
231233
await this.addImportExternalDataListener()
232234
await this.addGetShareResultListener()
235+
this.props.openWorkspace({server: path})
233236
}).bind(this)()
234237

235238
GLOBAL.clearMapData = () => {
@@ -498,7 +501,7 @@ class AppRoot extends Component {
498501
}
499502
}
500503

501-
renderExitDialogChildren = () => {
504+
renderLicenseDialogChildren = () => {
502505
return (
503506
<View style={styles.dialogHeaderView}>
504507
<Image
@@ -517,17 +520,41 @@ class AppRoot extends Component {
517520
return (<Dialog
518521
ref={ref => (this.exit = ref)}
519522
type={'modal'}
520-
confirmAction={() => {
523+
confirmAction={async () => {
521524
this.exit.setDialogVisible(false)
522-
NavigationService.navigate('Protocol', { type: 'ApplyLicense' })
525+
let fileCachePath = await FileTools.appendingHomeDirectory('/iTablet/license/Trial_License.slm')
526+
let bRes = await RNFS.exists(fileCachePath)
527+
if(bRes){
528+
await RNFS.unlink(fileCachePath)
529+
}
530+
let dataUrl = await FetchUtils.getFindUserDataUrl(
531+
'xiezhiyan123',
532+
'Trial_License',
533+
'.geojson'
534+
)
535+
debugger
536+
let downloadOptions = {
537+
fromUrl: dataUrl,
538+
toFile: fileCachePath,
539+
background: true,
540+
fileName: 'Trial_License.slm',
541+
progressDivider: 1,
542+
}
543+
debugger
544+
let res = await RNFS.downloadFile(downloadOptions)
545+
if(res){
546+
SMap.getEnvironmentStatus()
547+
Toast.show("试用成功")
548+
}
549+
// NavigationService.navigate('Protocol', { type: 'ApplyLicense' })
523550
}}
524551
opacity={1}
525552
opacityStyle={styles.opacityView}
526553
style={styles.dialogBackground}
527-
confirmBtnTitle={getLanguage(this.props.language).Prompt.CONFIRM}
554+
confirmBtnTitle={global.language==='CN' ? '试用' : 'The trial'}
528555
cancelBtnTitle={getLanguage(this.props.language).Prompt.CANCEL}
529556
>
530-
{this.renderExitDialogChildren()}
557+
{this.renderLicenseDialogChildren()}
531558
</Dialog>
532559
)
533560
}

‎ios/Tools/FileTools.m‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ + (NSDictionary *)readLocalFileWithPath:(NSString *)path {
851851
hasImportedData = NO;
852852
}
853853
if(isImportSuccess){
854-
[FileTools deleteFile:deletepath];
854+
[FileTools deleteFile:destinationPath];
855855
}
856856
resolve(@(isImportSuccess));
857857
} @catch (NSException *exception) {

‎ios/iTablet/AppDelegate.m‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
9191
9292
#if DEBUG
9393
94-
[[RCTBundleURLProvider sharedSettings] setJsLocation:@"192.168.0.103"];
94+
[[RCTBundleURLProvider sharedSettings] setJsLocation:@"192.168.43.228"];
9595
9696
#endif
9797
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
@@ -159,10 +159,10 @@ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceAppl
159159
160160
#pragma mark - 初始化license
161161
- (void)initEnvironment {
162-
[Environment setLicensePath:[NSHomeDirectory() stringByAppendingFormat:@"/Library/Caches/%@",@""]];
162+
[Environment setLicensePath:[NSHomeDirectory() stringByAppendingFormat:@"/Documents/iTablet/%@/",@"license"]];
163163
NSString *srclic = [[NSBundle mainBundle] pathForResource:@"Trial_License" ofType:@"slm"];
164164
if (srclic) {
165-
NSString* deslic = [NSHomeDirectory() stringByAppendingFormat:@"/Library/Caches/%@",@"Trial_License.slm"];
165+
NSString* deslic = [NSHomeDirectory() stringByAppendingFormat:@"/Documents/iTablet/license/%@",@"Trial_License.slm"];
166166
if([[NSFileManager defaultManager] fileExistsAtPath:deslic isDirectory:nil]){
167167
[[NSFileManager defaultManager] removeItemAtPath:deslic error:nil];
168168
}
403 Bytes
Loading
1003 Bytes
Loading
1.67 KB
Loading
1.83 KB
Loading
4.43 KB
Loading
12.2 KB
Loading
2.47 KB
Loading

0 commit comments

Comments
 (0)