|
49 | 49 | import mil.nga.giat.mage.sdk.datastore.user.UserHelper; |
50 | 50 | import mil.nga.giat.mage.sdk.event.ISessionEventListener; |
51 | 51 | import mil.nga.giat.mage.sdk.exceptions.UserException; |
| 52 | +import mil.nga.giat.mage.sdk.fetch.ImageryServerFetch; |
52 | 53 | import mil.nga.giat.mage.sdk.fetch.StaticFeatureServerFetch; |
53 | 54 | import mil.nga.giat.mage.sdk.http.HttpClientManager; |
54 | 55 | import mil.nga.giat.mage.sdk.http.resource.UserResource; |
@@ -85,8 +86,6 @@ public interface OnLogoutListener { |
85 | 86 |
|
86 | 87 | private ObservationNotificationListener observationNotificationListener = null; |
87 | 88 |
|
88 | | - private StaticFeatureServerFetch staticFeatureServerFetch = null; |
89 | | - |
90 | 89 | private Activity runningActivity; |
91 | 90 |
|
92 | 91 | @Override |
@@ -170,21 +169,28 @@ public void onLogin() { |
170 | 169 | ObservationFetchWorker.Companion.beginWork(); |
171 | 170 |
|
172 | 171 | // Pull static layers and features just once |
173 | | - loadStaticFeatures(false, null); |
| 172 | + loadOnlineAndOfflineLayers(false, null); |
174 | 173 |
|
175 | 174 | InitializeMAGEWearBridge.startBridgeIfWearBuild(getApplicationContext()); |
176 | 175 | } |
177 | 176 |
|
178 | | - public void loadStaticFeatures(final boolean force, final StaticFeatureServerFetch.OnStaticLayersListener listener) { |
| 177 | + private void loadOnlineAndOfflineLayers(final boolean force, final StaticFeatureServerFetch.OnStaticLayersListener listener) { |
179 | 178 | @SuppressLint("StaticFieldLeak") AsyncTask<Void, Void, Void> fetcher = new AsyncTask<Void, Void, Void>() { |
180 | 179 | @Override |
181 | 180 | protected Void doInBackground(Void... voids) { |
182 | | - staticFeatureServerFetch = new StaticFeatureServerFetch(getApplicationContext()); |
| 181 | + StaticFeatureServerFetch staticFeatureServerFetch = new StaticFeatureServerFetch(getApplicationContext()); |
183 | 182 | try { |
184 | 183 | staticFeatureServerFetch.fetch(force, listener); |
185 | 184 | } catch (Exception e) { |
186 | 185 | e.printStackTrace(); |
187 | 186 | } |
| 187 | + |
| 188 | + try { |
| 189 | + ImageryServerFetch imageryServerFetch = new ImageryServerFetch(getApplicationContext()); |
| 190 | + imageryServerFetch.fetch(); |
| 191 | + } catch (Exception e) { |
| 192 | + e.printStackTrace(); |
| 193 | + } |
188 | 194 | return null; |
189 | 195 | } |
190 | 196 | } ; |
@@ -333,11 +339,6 @@ private void startFetching() { |
333 | 339 | private void destroyFetching() { |
334 | 340 | stopService(new Intent(getApplicationContext(), LocationFetchService.class)); |
335 | 341 | stopService(new Intent(getApplicationContext(), ObservationFetchService.class)); |
336 | | - |
337 | | - if (staticFeatureServerFetch != null) { |
338 | | - staticFeatureServerFetch.destroy(); |
339 | | - staticFeatureServerFetch = null; |
340 | | - } |
341 | 342 | } |
342 | 343 |
|
343 | 344 | /** |
|
0 commit comments