Skip to content

Commit d8a3b96

Browse files
author
Kevin Gilland
committed
Adding online layer fetching on load
1 parent 1113584 commit d8a3b96

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

mage/src/main/java/mil/nga/giat/mage/MageApplication.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import mil.nga.giat.mage.sdk.datastore.user.UserHelper;
5050
import mil.nga.giat.mage.sdk.event.ISessionEventListener;
5151
import mil.nga.giat.mage.sdk.exceptions.UserException;
52+
import mil.nga.giat.mage.sdk.fetch.ImageryServerFetch;
5253
import mil.nga.giat.mage.sdk.fetch.StaticFeatureServerFetch;
5354
import mil.nga.giat.mage.sdk.http.HttpClientManager;
5455
import mil.nga.giat.mage.sdk.http.resource.UserResource;
@@ -85,8 +86,6 @@ public interface OnLogoutListener {
8586

8687
private ObservationNotificationListener observationNotificationListener = null;
8788

88-
private StaticFeatureServerFetch staticFeatureServerFetch = null;
89-
9089
private Activity runningActivity;
9190

9291
@Override
@@ -170,21 +169,28 @@ public void onLogin() {
170169
ObservationFetchWorker.Companion.beginWork();
171170

172171
// Pull static layers and features just once
173-
loadStaticFeatures(false, null);
172+
loadOnlineAndOfflineLayers(false, null);
174173

175174
InitializeMAGEWearBridge.startBridgeIfWearBuild(getApplicationContext());
176175
}
177176

178-
public void loadStaticFeatures(final boolean force, final StaticFeatureServerFetch.OnStaticLayersListener listener) {
177+
private void loadOnlineAndOfflineLayers(final boolean force, final StaticFeatureServerFetch.OnStaticLayersListener listener) {
179178
@SuppressLint("StaticFieldLeak") AsyncTask<Void, Void, Void> fetcher = new AsyncTask<Void, Void, Void>() {
180179
@Override
181180
protected Void doInBackground(Void... voids) {
182-
staticFeatureServerFetch = new StaticFeatureServerFetch(getApplicationContext());
181+
StaticFeatureServerFetch staticFeatureServerFetch = new StaticFeatureServerFetch(getApplicationContext());
183182
try {
184183
staticFeatureServerFetch.fetch(force, listener);
185184
} catch (Exception e) {
186185
e.printStackTrace();
187186
}
187+
188+
try {
189+
ImageryServerFetch imageryServerFetch = new ImageryServerFetch(getApplicationContext());
190+
imageryServerFetch.fetch();
191+
} catch (Exception e) {
192+
e.printStackTrace();
193+
}
188194
return null;
189195
}
190196
} ;
@@ -333,11 +339,6 @@ private void startFetching() {
333339
private void destroyFetching() {
334340
stopService(new Intent(getApplicationContext(), LocationFetchService.class));
335341
stopService(new Intent(getApplicationContext(), ObservationFetchService.class));
336-
337-
if (staticFeatureServerFetch != null) {
338-
staticFeatureServerFetch.destroy();
339-
staticFeatureServerFetch = null;
340-
}
341342
}
342343

343344
/**

0 commit comments

Comments
 (0)