Pebble: Fix vanished Health system apps (for affected users)
This code also allows us to add new system apps which will then appended to the current list of previous Gadgetbridge users.
This commit is contained in:
parent
837dfd5917
commit
eb7646d26a
|
@ -46,7 +46,7 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
||||||
= "nodomain.freeyourgadget.gadgetbridge.appmanager.action.refresh_applist";
|
= "nodomain.freeyourgadget.gadgetbridge.appmanager.action.refresh_applist";
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AbstractAppManagerFragment.class);
|
private static final Logger LOG = LoggerFactory.getLogger(AbstractAppManagerFragment.class);
|
||||||
|
|
||||||
protected abstract void refreshList();
|
protected abstract List<GBDeviceApp> getSystemAppsInCategory();
|
||||||
|
|
||||||
protected abstract String getSortFilename();
|
protected abstract String getSortFilename();
|
||||||
|
|
||||||
|
@ -62,6 +62,23 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
||||||
AppManagerActivity.rewriteAppOrderFile(getSortFilename(), uuidList);
|
AppManagerActivity.rewriteAppOrderFile(getSortFilename(), uuidList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void refreshList() {
|
||||||
|
appList.clear();
|
||||||
|
ArrayList uuids = AppManagerActivity.getUuidsFromFile(getSortFilename());
|
||||||
|
List<GBDeviceApp> systemApps = getSystemAppsInCategory();
|
||||||
|
boolean needsRewrite = false;
|
||||||
|
for (GBDeviceApp systemApp : systemApps) {
|
||||||
|
if (!uuids.contains(systemApp.getUUID())) {
|
||||||
|
uuids.add(systemApp.getUUID());
|
||||||
|
needsRewrite = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (needsRewrite) {
|
||||||
|
AppManagerActivity.rewriteAppOrderFile(getSortFilename(), uuids);
|
||||||
|
}
|
||||||
|
appList.addAll(getCachedApps(uuids));
|
||||||
|
}
|
||||||
|
|
||||||
private void refreshListFromPebble(Intent intent) {
|
private void refreshListFromPebble(Intent intent) {
|
||||||
appList.clear();
|
appList.clear();
|
||||||
int appCount = intent.getIntExtra("app_count", 0);
|
int appCount = intent.getIntExtra("app_count", 0);
|
||||||
|
@ -103,29 +120,6 @@ public abstract class AbstractAppManagerFragment extends Fragment {
|
||||||
private GBDeviceAppAdapter mGBDeviceAppAdapter;
|
private GBDeviceAppAdapter mGBDeviceAppAdapter;
|
||||||
protected GBDevice mGBDevice = null;
|
protected GBDevice mGBDevice = null;
|
||||||
|
|
||||||
protected List<GBDeviceApp> getSystemApps() {
|
|
||||||
List<GBDeviceApp> systemApps = new ArrayList<>();
|
|
||||||
//systemApps.add(new GBDeviceApp(UUID.fromString("4dab81a6-d2fc-458a-992c-7a1f3b96a970"), "Sports (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
|
||||||
//systemApps.add(new GBDeviceApp(UUID.fromString("cf1e816a-9db0-4511-bbb8-f60c48ca8fac"), "Golf (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
|
||||||
systemApps.add(new GBDeviceApp(UUID.fromString("1f03293d-47af-4f28-b960-f2b02a6dd757"), "Music (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
|
||||||
systemApps.add(new GBDeviceApp(UUID.fromString("b2cae818-10f8-46df-ad2b-98ad2254a3c1"), "Notifications (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
|
||||||
systemApps.add(new GBDeviceApp(UUID.fromString("67a32d95-ef69-46d4-a0b9-854cc62f97f9"), "Alarms (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
|
||||||
systemApps.add(new GBDeviceApp(UUID.fromString("18e443ce-38fd-47c8-84d5-6d0c775fbe55"), "Watchfaces (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
|
||||||
|
|
||||||
if (mGBDevice != null && !"aplite".equals(PebbleUtils.getPlatformName(mGBDevice.getModel()))) {
|
|
||||||
systemApps.add(new GBDeviceApp(UUID.fromString("0863fc6a-66c5-4f62-ab8a-82ed00a98b5d"), "Send Text (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
|
||||||
systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_PEBBLE_HEALTH, "Health (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
|
||||||
}
|
|
||||||
|
|
||||||
return systemApps;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected List<GBDeviceApp> getSystemWatchfaces() {
|
|
||||||
List<GBDeviceApp> systemWatchfaces = new ArrayList<>();
|
|
||||||
systemWatchfaces.add(new GBDeviceApp(UUID.fromString("8f3c8686-31a1-4f5f-91f5-01600c9bdc59"), "Tic Toc (System)", "Pebble Inc.", "", GBDeviceApp.Type.WATCHFACE_SYSTEM));
|
|
||||||
return systemWatchfaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected List<GBDeviceApp> getCachedApps(List<UUID> uuids) {
|
protected List<GBDeviceApp> getCachedApps(List<UUID> uuids) {
|
||||||
List<GBDeviceApp> cachedAppList = new ArrayList<>();
|
List<GBDeviceApp> cachedAppList = new ArrayList<>();
|
||||||
File cachePath;
|
File cachePath;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package nodomain.freeyourgadget.gadgetbridge.activities.appmanager;
|
package nodomain.freeyourgadget.gadgetbridge.activities.appmanager;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceApp;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceApp;
|
||||||
|
|
||||||
public class AppManagerFragmentCache extends AbstractAppManagerFragment {
|
public class AppManagerFragmentCache extends AbstractAppManagerFragment {
|
||||||
|
@ -14,6 +16,11 @@ public class AppManagerFragmentCache extends AbstractAppManagerFragment {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<GBDeviceApp> getSystemAppsInCategory() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSortFilename() {
|
public String getSortFilename() {
|
||||||
return "pbwcacheorder.txt";
|
return "pbwcacheorder.txt";
|
||||||
|
|
|
@ -1,23 +1,31 @@
|
||||||
package nodomain.freeyourgadget.gadgetbridge.activities.appmanager;
|
package nodomain.freeyourgadget.gadgetbridge.activities.appmanager;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceApp;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceApp;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.pebble.PebbleProtocol;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.util.PebbleUtils;
|
||||||
|
|
||||||
public class AppManagerFragmentInstalledApps extends AbstractAppManagerFragment {
|
public class AppManagerFragmentInstalledApps extends AbstractAppManagerFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void refreshList() {
|
protected List<GBDeviceApp> getSystemAppsInCategory() {
|
||||||
appList.clear();
|
List<GBDeviceApp> systemApps = new ArrayList<>();
|
||||||
ArrayList uuids = AppManagerActivity.getUuidsFromFile(getSortFilename());
|
//systemApps.add(new GBDeviceApp(UUID.fromString("4dab81a6-d2fc-458a-992c-7a1f3b96a970"), "Sports (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
||||||
if (uuids.isEmpty()) {
|
//systemApps.add(new GBDeviceApp(UUID.fromString("cf1e816a-9db0-4511-bbb8-f60c48ca8fac"), "Golf (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
||||||
appList.addAll(getSystemApps());
|
systemApps.add(new GBDeviceApp(UUID.fromString("1f03293d-47af-4f28-b960-f2b02a6dd757"), "Music (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
||||||
for (GBDeviceApp gbDeviceApp : appList) {
|
systemApps.add(new GBDeviceApp(UUID.fromString("b2cae818-10f8-46df-ad2b-98ad2254a3c1"), "Notifications (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
||||||
uuids.add(gbDeviceApp.getUUID());
|
systemApps.add(new GBDeviceApp(UUID.fromString("67a32d95-ef69-46d4-a0b9-854cc62f97f9"), "Alarms (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
||||||
}
|
systemApps.add(new GBDeviceApp(UUID.fromString("18e443ce-38fd-47c8-84d5-6d0c775fbe55"), "Watchfaces (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
||||||
AppManagerActivity.rewriteAppOrderFile(getSortFilename(), uuids);
|
|
||||||
} else {
|
if (mGBDevice != null && !"aplite".equals(PebbleUtils.getPlatformName(mGBDevice.getModel()))) {
|
||||||
appList.addAll(getCachedApps(uuids));
|
systemApps.add(new GBDeviceApp(UUID.fromString("0863fc6a-66c5-4f62-ab8a-82ed00a98b5d"), "Send Text (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
||||||
|
systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_PEBBLE_HEALTH, "Health (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return systemApps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,23 +1,18 @@
|
||||||
package nodomain.freeyourgadget.gadgetbridge.activities.appmanager;
|
package nodomain.freeyourgadget.gadgetbridge.activities.appmanager;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceApp;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceApp;
|
||||||
|
|
||||||
public class AppManagerFragmentInstalledWatchfaces extends AbstractAppManagerFragment {
|
public class AppManagerFragmentInstalledWatchfaces extends AbstractAppManagerFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void refreshList() {
|
protected List<GBDeviceApp> getSystemAppsInCategory() {
|
||||||
appList.clear();
|
List<GBDeviceApp> systemWatchfaces = new ArrayList<>();
|
||||||
ArrayList uuids = AppManagerActivity.getUuidsFromFile(getSortFilename());
|
systemWatchfaces.add(new GBDeviceApp(UUID.fromString("8f3c8686-31a1-4f5f-91f5-01600c9bdc59"), "Tic Toc (System)", "Pebble Inc.", "", GBDeviceApp.Type.WATCHFACE_SYSTEM));
|
||||||
if (uuids.isEmpty()) {
|
return systemWatchfaces;
|
||||||
appList.addAll(getSystemWatchfaces());
|
|
||||||
for (GBDeviceApp gbDeviceApp : appList) {
|
|
||||||
uuids.add(gbDeviceApp.getUUID());
|
|
||||||
}
|
|
||||||
AppManagerActivity.rewriteAppOrderFile(getSortFilename(), uuids);
|
|
||||||
} else {
|
|
||||||
appList.addAll(getCachedApps(uuids));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue