~singpolyma/cheogram-android

ce34700a00a8818d45ef3c0515fe9fae6da229fa — Stephen Paul Weber 4 months ago e350036
Get full list of gateway types

Still just use first on the label for now
1 files changed, 12 insertions(+), 4 deletions(-)

M src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java
M src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java => src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java +12 -4
@@ 516,14 516,22 @@ public class EnterJidDialog extends DialogFragment implements OnBackendConnected
        }

        public String getType(Contact gateway) {
            List<String> types = getTypes(gateway);
            return types.isEmpty() ? null : types.get(0);
        }

        public List<String> getTypes(Contact gateway) {
            List<String> types = new ArrayList<>();

            for(Presence p : gateway.getPresences().getPresences()) {
                ServiceDiscoveryResult.Identity id;
                if(p.getServiceDiscoveryResult() != null && (id = p.getServiceDiscoveryResult().getIdentity("gateway", null)) != null) {
                    return id.getType();
                if(p.getServiceDiscoveryResult() != null) {
                    for (ServiceDiscoveryResult.Identity id : p.getServiceDiscoveryResult().getIdentities()) {
                        if ("gateway".equals(id.getCategory())) types.add(id.getType());
                    }
                }
            }

            return null;
            return types;
        }

        public String getSelectedType() {