Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 6f3211a8 authored by tobiasKaminsky's avatar tobiasKaminsky
Browse files

add capabilities for fullnextsearch

parent a4eb1dfa
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ dependencies {

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.0'
    buildToolsVersion '26.0.2'

    sourceSets {
        main {
+26 −0
Original line number Diff line number Diff line
@@ -333,7 +333,33 @@ public class GetRemoteCapabilitiesOperation extends RemoteOperation {
                            }
                        }
                        
                        if (respCapabilities.has("fullnextsearch")) {
                            JSONObject respFullNextSearch = respCapabilities.getJSONObject("fullnextsearch");

                            if (respFullNextSearch.getBoolean("remote")) {
                                capability.setFullNextSearchEnabled(CapabilityBooleanType.TRUE);
                            } else {
                                capability.setFullNextSearchEnabled(CapabilityBooleanType.FALSE);
                            }

                            JSONArray providers = respFullNextSearch.getJSONArray("providers");
                            
                            for (int i = 0; i < providers.length(); i++) {
                                JSONObject provider = (JSONObject) providers.get(i);
                                
                                String id = provider.getString("id");
                                
                                switch (id) {
                                    case "files":
                                        capability.setFullNextSearchFiles(CapabilityBooleanType.TRUE);
                                        Log_OC.d(TAG, "full next search: file provider enabled");
                                    default:
                                        // do nothing
                                }
                            }
                        }
                    }
                    
                    // Result
                    data.add(capability);
                    result = new RemoteOperationResult(true, get);
+20 −0
Original line number Diff line number Diff line
@@ -80,6 +80,11 @@ public class OCCapability {

    private CapabilityBooleanType mExternalLinks;
    
    // Fullnextsearch
    private CapabilityBooleanType mFullNextSearchEnabled;
    private CapabilityBooleanType mFullNextSearchFiles;
    

    public OCCapability(){
        mId = 0;
        mAccountName = "";
@@ -402,4 +407,19 @@ public class OCCapability {
        this.mExternalLinks = mExternalLinks;
    }

    public CapabilityBooleanType getFullNextSearchEnabled() {
        return mFullNextSearchEnabled;
    }

    public void setFullNextSearchEnabled(CapabilityBooleanType fullNextSearchEnabled) {
        mFullNextSearchEnabled = fullNextSearchEnabled;
    }

    public CapabilityBooleanType getFullNextSearchFiles() {
        return mFullNextSearchFiles;
    }

    public void setFullNextSearchFiles(CapabilityBooleanType fullNextSearchFiles) {
        mFullNextSearchFiles = fullNextSearchFiles;
    }
}