Fix #7588
This commit is contained in:
parent
9de8fe59a7
commit
a3b82e0b51
3 changed files with 18 additions and 1 deletions
|
@ -1852,6 +1852,7 @@ public class OsmandAidlApi {
|
|||
|
||||
public void loadConnectedApps() {
|
||||
try {
|
||||
connectedApps.clear();
|
||||
JSONArray array = new JSONArray(app.getSettings().API_CONNECTED_APPS_JSON.get());
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
JSONObject obj = array.getJSONObject(i);
|
||||
|
|
|
@ -170,6 +170,22 @@ public abstract class OsmandPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
public static void updateActivatedPlugins(OsmandApplication app, Set<String> enabledPlugins) {
|
||||
for (OsmandPlugin plugin : allPlugins) {
|
||||
if (enabledPlugins.contains(plugin.getId())) {
|
||||
try {
|
||||
if (plugin.init(app, null)) {
|
||||
plugin.setActive(true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("Plugin initialization failed " + plugin.getId(), e);
|
||||
}
|
||||
} else if (plugin.isActive()) {
|
||||
plugin.setActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkMarketPlugin(@NonNull OsmandApplication app, @NonNull Set<String> enabledPlugins,
|
||||
@NonNull OsmandPlugin plugin, boolean paid, String id, String id2) {
|
||||
boolean marketEnabled = Version.isMarketEnabled(app);
|
||||
|
|
|
@ -370,7 +370,7 @@ public class OsmandSettings {
|
|||
OsmandAidlApi aidlApi = ctx.getAidlApi();
|
||||
if (aidlApi != null) {
|
||||
aidlApi.loadConnectedApps();
|
||||
OsmandPlugin.initPlugins(ctx);
|
||||
OsmandPlugin.updateActivatedPlugins(ctx, getEnabledPlugins());
|
||||
}
|
||||
|
||||
fireEvent(oldMode);
|
||||
|
|
Loading…
Reference in a new issue