code cleaning

This commit is contained in:
Adrian Tiberius 2016-06-16 07:27:58 +03:00
parent 58a9c2935c
commit 3d68e6d48a
2 changed files with 8 additions and 22 deletions

View File

@ -14,7 +14,6 @@ import android.os.Environment;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import com.facebook.react.common.ApplicationHolder;
import com.github.ethereum.go_ethereum.cmd.Geth; import com.github.ethereum.go_ethereum.cmd.Geth;
import java.io.File; import java.io.File;
@ -68,8 +67,6 @@ public class GethService extends Service {
protected void onGethStarted() { protected void onGethStarted() {
Log.d(TAG, "Geth Service started"); Log.d(TAG, "Geth Service started");
isGethStarted = true; isGethStarted = true;
//Log.w("Geth", "adding peer");
//Geth.run("--exec admin.addPeer(\"enode://e2f28126720452aa82f7d3083e49e6b3945502cb94d9750a15e27ee310eed6991618199f878e5fbc7dfa0e20f0af9554b41f491dc8f1dbae8f0f2d37a3a613aa@139.162.13.89:55555\") attach http://localhost:8545");
} }
protected void startGeth() { protected void startGeth() {
@ -106,15 +103,6 @@ public class GethService extends Service {
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
//SoLoader.init(this, /* native exopackage */ false);
/*
try {
ApplicationHolder.getApplication();
}
catch (AssertionError err) {
ApplicationHolder.setApplication(getApplication());
}
*/
System.loadLibrary("gethraw"); System.loadLibrary("gethraw");
System.loadLibrary("geth"); System.loadLibrary("geth");
@ -127,7 +115,7 @@ public class GethService extends Service {
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
//stop geth //TODO: stop geth
isGethStarted = false; isGethStarted = false;
isGethInitialized = false; isGethInitialized = false;
Log.d(TAG, "Geth Service stopped !"); Log.d(TAG, "Geth Service stopped !");
@ -142,8 +130,7 @@ public class GethService extends Service {
return false; return false;
} }
public static boolean isRunning() public static boolean isRunning() {
{
return isGethInitialized; return isGethInitialized;
} }
} }

View File

@ -39,6 +39,8 @@ import io.realm.react.RealmReactPackage;
public class MainActivity extends ReactActivity { public class MainActivity extends ReactActivity {
private static final String TAG = "MainActivity";
/** /**
* Incoming message handler. Calls to its binder are sequential! * Incoming message handler. Calls to its binder are sequential!
*/ */
@ -57,9 +59,8 @@ public class MainActivity extends ReactActivity {
@Override @Override
public void handleMessage(Message message) { public void handleMessage(Message message) {
boolean isClaimed = false; boolean isClaimed = false;
System.out.println("!!!!!!!!!!!!!! Received Service Message !!!!!!!!!!!!!!"); Log.d(TAG, "!!!!!!!!!!!!!! Received Service Message !!!!!!!!!!!!!!");
super.handleMessage(message); super.handleMessage(message);
} }
} }
@ -67,7 +68,6 @@ public class MainActivity extends ReactActivity {
protected ServiceConnection serviceConnection = new ServiceConnection() { protected ServiceConnection serviceConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) { public void onServiceConnected(ComponentName className, IBinder service) {
// This is called when the connection with the service has been // This is called when the connection with the service has been
// established, giving us the object we can use to // established, giving us the object we can use to
// interact with the service. We are communicating with the // interact with the service. We are communicating with the
@ -79,17 +79,16 @@ public class MainActivity extends ReactActivity {
} }
public void onServiceDisconnected(ComponentName className) { public void onServiceDisconnected(ComponentName className) {
// This is called when the connection with the service has been // This is called when the connection with the service has been
// unexpectedly disconnected -- that is, its process crashed. // unexpectedly disconnected -- that is, its process crashed.
serviceMessenger = null; serviceMessenger = null;
isBound = false; isBound = false;
System.out.println("!!!!!!!!!!!!!! Geth Service Disconnected !!!!!!!!!!!!!!"); Log.d(TAG, "!!!!!!!!!!!!!! Geth Service Disconnected !!!!!!!!!!!!!!");
} }
}; };
protected void onConnected() { protected void onConnected() {
System.out.println("!!!!!!!!!!!!!! Geth Service Connected !!!!!!!!!!!!!!"); Log.d(TAG, "!!!!!!!!!!!!!! Geth Service Connected !!!!!!!!!!!!!!");
} }
protected void startStatus() { protected void startStatus() {
@ -145,7 +144,7 @@ public class MainActivity extends ReactActivity {
unbindService(serviceConnection); unbindService(serviceConnection);
} }
catch (Throwable t) { catch (Throwable t) {
Log.e("MainActivity", "Failed to unbind from the geth service", t); Log.e(TAG, "Failed to unbind from the geth service", t);
} }
} }