Skip to content

Commit

Permalink
1.0.9
Browse files Browse the repository at this point in the history
fixed mistake on shared prefs
  • Loading branch information
niccellular committed Apr 7, 2024
1 parent 484f1a2 commit eee4ac2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
buildscript {


ext.PLUGIN_VERSION = "1.0.8"
ext.PLUGIN_VERSION = "1.0.9"
ext.ATAK_VERSION = "4.10.0"

def takdevVersion = '2.+'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import android.content.SharedPreferences;
import android.os.RemoteException;
import android.preference.PreferenceManager;

import com.atakmap.android.cot.CotMapComponent;
import com.atakmap.android.maps.MapView;
import com.atakmap.coremap.cot.event.CotDetail;
Expand Down Expand Up @@ -40,7 +42,7 @@ public class MeshtasticReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {

prefs = context.getSharedPreferences("com.atakmap.android.meshtastic", Context.MODE_PRIVATE);
prefs = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());

String action = intent.getAction();
Log.d(TAG, "ACTION: " + action);
Expand Down Expand Up @@ -92,7 +94,7 @@ else if (action.equals(MeshtasticMapComponent.ACTION_NODE_CHANGE)) {
Log.d(TAG, ni.toString());

if (prefs.getBoolean("plugin_meshtastic_tracker", false)) {

Log.d(TAG, "Sending CoT for NodeInfo");
CotEvent cotEvent = new CotEvent();
CoordinatedTime time = new CoordinatedTime();
cotEvent.setTime(time);
Expand Down Expand Up @@ -173,10 +175,12 @@ protected void receive(Intent intent) {
CotEvent cotEvent = MeshtasticMapComponent.cotShrinker.toCotEvent(combined);
if (cotEvent != null && cotEvent.isValid()) {
Log.d(TAG, "Chunked CoT Received");

cotEvent.setStale(new CoordinatedTime().addDays(3));
CotMapComponent.getInternalDispatcher().dispatch(cotEvent);

if (prefs.getBoolean("plugin_meshtastic_server", false)) {
CotMapComponent.getExternalDispatcher().dispatch(cotEvent);
} else {
Log.d(TAG, "Not sending to server");
}
} else {
Log.d(TAG, "Failed to libcotshrink: " + new String(combined));
}
Expand All @@ -193,6 +197,8 @@ protected void receive(Intent intent) {
if (prefs.getBoolean("plugin_meshtastic_server", false)) {
CotMapComponent.getExternalDispatcher().dispatch(cotEvent);

} else {
Log.d(TAG, "Not sending to server");
}
}
} catch (Throwable e) {
Expand Down Expand Up @@ -289,6 +295,8 @@ else if (team.equals("DarkGreen"))
CotMapComponent.getInternalDispatcher().dispatch(cotEvent);
if (prefs.getBoolean("plugin_meshtastic_server", false)) {
CotMapComponent.getExternalDispatcher().dispatch(cotEvent);
} else {
Log.d(TAG, "Not sending to server");
}
}
else
Expand Down Expand Up @@ -372,6 +380,8 @@ else if (team.equals("DarkGreen"))
CotMapComponent.getInternalDispatcher().dispatch(cotEvent);
if (prefs.getBoolean("plugin_meshtastic_server", false)) {
CotMapComponent.getExternalDispatcher().dispatch(cotEvent);
} else {
Log.d(TAG, "Not sending to server");
}
}
else
Expand Down Expand Up @@ -456,6 +466,8 @@ else if (team.equals("DarkGreen"))
CotMapComponent.getInternalDispatcher().dispatch(cotEvent);
if (prefs.getBoolean("plugin_meshtastic_server", false)) {
CotMapComponent.getExternalDispatcher().dispatch(cotEvent);
} else {
Log.d(TAG, "Not sending to server");
}
}
else
Expand Down

0 comments on commit eee4ac2

Please sign in to comment.