mirror of
https://github.com/status-im/status-mobile.git
synced 2025-02-23 05:48:46 +00:00
wipe lightchaindata on first run
This commit is contained in:
parent
436ba4e492
commit
caa1d6e66a
@ -14,5 +14,5 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.facebook.react:react-native:+'
|
compile 'com.facebook.react:react-native:+'
|
||||||
compile(group: 'status-im', name: 'status-go', version: '1.1.0-44-g8a96fc1', ext: 'aar')
|
compile(group: 'status-im', name: 'status-go', version: '0.9.5-51-g8ef2206', ext: 'aar')
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|||||||
import com.github.status_im.status_go.cmd.Statusgo;
|
import com.github.status_im.status_go.cmd.Statusgo;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
@ -111,6 +112,27 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
|||||||
Log.e(TAG, "error making folder: " + dataFolder, e);
|
Log.e(TAG, "error making folder: " + dataFolder, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final String ropstenFlagPath = dataFolder + "/ropsten_flag";
|
||||||
|
final File ropstenFlag = new File(ropstenFlagPath);
|
||||||
|
if (!ropstenFlag.exists()) {
|
||||||
|
try {
|
||||||
|
final String chaindDataFolderPath = dataFolder + "/StatusIM/lightchaindata";
|
||||||
|
final File lightChainFolder = new File(chaindDataFolderPath);
|
||||||
|
if (lightChainFolder.isDirectory())
|
||||||
|
{
|
||||||
|
String[] children = lightChainFolder.list();
|
||||||
|
for (int i = 0; i < children.length; i++)
|
||||||
|
{
|
||||||
|
new File(lightChainFolder, children[i]).delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lightChainFolder.delete();
|
||||||
|
ropstenFlag.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Statusgo.StartNode(Statusgo.GenerateConfig(dataFolder, 3));
|
Statusgo.StartNode(Statusgo.GenerateConfig(dataFolder, 3));
|
||||||
Log.d(TAG, "Geth node started");
|
Log.d(TAG, "Geth node started");
|
||||||
}
|
}
|
||||||
|
@ -139,6 +139,18 @@ RCT_EXPORT_METHOD(startNode:(RCTResponseSenderBlock)onResultCallback) {
|
|||||||
|
|
||||||
if (![[NSFileManager defaultManager] fileExistsAtPath:folderName.path])
|
if (![[NSFileManager defaultManager] fileExistsAtPath:folderName.path])
|
||||||
[[NSFileManager defaultManager] createDirectoryAtPath:folderName.path withIntermediateDirectories:NO attributes:nil error:&error];
|
[[NSFileManager defaultManager] createDirectoryAtPath:folderName.path withIntermediateDirectories:NO attributes:nil error:&error];
|
||||||
|
NSURL *flagFileUrl = [folderName URLByAppendingPathComponent:@"ropsten_flag"];
|
||||||
|
|
||||||
|
if(![[NSFileManager defaultManager] fileExistsAtPath:flagFileUrl.path]){
|
||||||
|
NSURL *lightChainData = [folderName URLByAppendingPathComponent:@"StatusIM/lightchaindata"];
|
||||||
|
[[NSFileManager defaultManager] removeItemAtPath:lightChainData.path
|
||||||
|
error:nil];
|
||||||
|
NSString *content = @"";
|
||||||
|
NSData *fileContents = [content dataUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
[[NSFileManager defaultManager] createFileAtPath:flagFileUrl.path
|
||||||
|
contents:fileContents
|
||||||
|
attributes:nil];
|
||||||
|
}
|
||||||
|
|
||||||
if (error){
|
if (error){
|
||||||
NSLog(@"error %@", error);
|
NSLog(@"error %@", error);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>status-im</groupId>
|
<groupId>status-im</groupId>
|
||||||
<artifactId>status-go-ios-simulator</artifactId>
|
<artifactId>status-go-ios-simulator</artifactId>
|
||||||
<version>1.1.0-44-g8a96fc1</version>
|
<version>0.9.5-51-g8ef2206</version>
|
||||||
<type>zip</type>
|
<type>zip</type>
|
||||||
<overWrite>true</overWrite>
|
<overWrite>true</overWrite>
|
||||||
<outputDirectory>./</outputDirectory>
|
<outputDirectory>./</outputDirectory>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user