mirror of
https://github.com/ChronosX88/Influence-P2P.git
synced 2024-11-22 15:22:18 +00:00
Fixed notifyObservers (for two-channel support)
This commit is contained in:
parent
69a1a685c4
commit
eec40b2491
@ -29,6 +29,7 @@ import io.github.chronosx88.influence.contracts.MainLogicContract;
|
|||||||
import io.github.chronosx88.influence.helpers.AppHelper;
|
import io.github.chronosx88.influence.helpers.AppHelper;
|
||||||
import io.github.chronosx88.influence.helpers.MessageActions;
|
import io.github.chronosx88.influence.helpers.MessageActions;
|
||||||
import io.github.chronosx88.influence.helpers.StorageMVStore;
|
import io.github.chronosx88.influence.helpers.StorageMVStore;
|
||||||
|
import io.github.chronosx88.influence.observable.MainObservable;
|
||||||
|
|
||||||
public class MainLogic implements MainLogicContract {
|
public class MainLogic implements MainLogicContract {
|
||||||
private static final String LOG_TAG = "MainLogic";
|
private static final String LOG_TAG = "MainLogic";
|
||||||
@ -76,7 +77,7 @@ public class MainLogic implements MainLogicContract {
|
|||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
try {
|
try {
|
||||||
AppHelper.getObservable().notifyObservers(new JSONObject()
|
AppHelper.getObservable().notifyObservers(new JSONObject()
|
||||||
.put("action", MessageActions.BOOTSTRAP_NOT_SPECIFIED));
|
.put("action", MessageActions.BOOTSTRAP_NOT_SPECIFIED), MainObservable.UI_ACTIONS_CHANNEL);
|
||||||
peerDHT.shutdown();
|
peerDHT.shutdown();
|
||||||
return;
|
return;
|
||||||
} catch (JSONException ex) {
|
} catch (JSONException ex) {
|
||||||
@ -85,7 +86,7 @@ public class MainLogic implements MainLogicContract {
|
|||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
try {
|
try {
|
||||||
AppHelper.getObservable().notifyObservers(new JSONObject()
|
AppHelper.getObservable().notifyObservers(new JSONObject()
|
||||||
.put("action", MessageActions.NETWORK_ERROR));
|
.put("action", MessageActions.NETWORK_ERROR), MainObservable.UI_ACTIONS_CHANNEL);
|
||||||
peerDHT.shutdown();
|
peerDHT.shutdown();
|
||||||
return;
|
return;
|
||||||
} catch (JSONException ex) {
|
} catch (JSONException ex) {
|
||||||
@ -96,7 +97,7 @@ public class MainLogic implements MainLogicContract {
|
|||||||
if(!discoverExternalAddress()) {
|
if(!discoverExternalAddress()) {
|
||||||
try {
|
try {
|
||||||
AppHelper.getObservable().notifyObservers(new JSONObject()
|
AppHelper.getObservable().notifyObservers(new JSONObject()
|
||||||
.put("action", MessageActions.PORT_FORWARDING_ERROR));
|
.put("action", MessageActions.PORT_FORWARDING_ERROR), MainObservable.UI_ACTIONS_CHANNEL);
|
||||||
} catch (JSONException ex) {
|
} catch (JSONException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -105,7 +106,7 @@ public class MainLogic implements MainLogicContract {
|
|||||||
if(!setupConnectionToRelay()) {
|
if(!setupConnectionToRelay()) {
|
||||||
try {
|
try {
|
||||||
AppHelper.getObservable().notifyObservers(new JSONObject()
|
AppHelper.getObservable().notifyObservers(new JSONObject()
|
||||||
.put("action", MessageActions.RELAY_CONNECTION_ERROR));
|
.put("action", MessageActions.RELAY_CONNECTION_ERROR), MainObservable.UI_ACTIONS_CHANNEL);
|
||||||
return;
|
return;
|
||||||
} catch (JSONException ex) {
|
} catch (JSONException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
@ -115,7 +116,7 @@ public class MainLogic implements MainLogicContract {
|
|||||||
if(!bootstrapPeer()) {
|
if(!bootstrapPeer()) {
|
||||||
try {
|
try {
|
||||||
AppHelper.getObservable().notifyObservers(new JSONObject()
|
AppHelper.getObservable().notifyObservers(new JSONObject()
|
||||||
.put("action", MessageActions.BOOTSTRAP_ERROR));
|
.put("action", MessageActions.BOOTSTRAP_ERROR), MainObservable.UI_ACTIONS_CHANNEL);
|
||||||
return;
|
return;
|
||||||
} catch (JSONException ex) {
|
} catch (JSONException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
@ -124,7 +125,7 @@ public class MainLogic implements MainLogicContract {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
AppHelper.getObservable().notifyObservers(new JSONObject()
|
AppHelper.getObservable().notifyObservers(new JSONObject()
|
||||||
.put("action", MessageActions.BOOTSTRAP_SUCCESS));
|
.put("action", MessageActions.BOOTSTRAP_SUCCESS), MainObservable.UI_ACTIONS_CHANNEL);
|
||||||
} catch (JSONException ex) {
|
} catch (JSONException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user