@@ -71,6 +71,7 @@ public class GetRemoteCapabilitiesOperation extends RemoteOperation {
7171 private static final String NODE_FILES_SHARING = "files_sharing" ;
7272 private static final String NODE_PUBLIC = "public" ;
7373 private static final String NODE_PASSWORD = "password" ;
74+ private static final String NODE_ASK_FOR_OPTIONAL_PASSWORD = "askForOptionalPassword" ;
7475 private static final String NODE_FILES_DROP = "upload_files_drop" ;
7576 private static final String NODE_EXPIRE_DATE = "expire_date" ;
7677 private static final String NODE_USER = "user" ;
@@ -220,9 +221,20 @@ protected RemoteOperationResult run(OwnCloudClient client) {
220221 capability .setFilesSharingPublicEnabled (CapabilityBooleanType .fromBooleanValue (
221222 respPublic .getBoolean (PROPERTY_ENABLED )));
222223 if (respPublic .has (NODE_PASSWORD )) {
224+ JSONObject passwordJson = respPublic .getJSONObject (NODE_PASSWORD );
225+
223226 capability .setFilesSharingPublicPasswordEnforced (
224227 CapabilityBooleanType .fromBooleanValue (
225- respPublic .getJSONObject (NODE_PASSWORD ).getBoolean (PROPERTY_ENFORCED )));
228+ passwordJson .getBoolean (PROPERTY_ENFORCED )));
229+
230+ if (passwordJson .has (NODE_ASK_FOR_OPTIONAL_PASSWORD )) {
231+ capability .setFilesSharingPublicAskForPassword (
232+ CapabilityBooleanType .fromBooleanValue (
233+ passwordJson .getBoolean (NODE_ASK_FOR_OPTIONAL_PASSWORD ))
234+ );
235+ } else {
236+ capability .setFilesSharingPublicAskForPassword (CapabilityBooleanType .FALSE );
237+ }
226238 }
227239 if (respPublic .has (NODE_FILES_DROP )) {
228240 capability .setFilesFileDrop (
@@ -373,15 +385,11 @@ protected RemoteOperationResult run(OwnCloudClient client) {
373385 JSONObject provider = (JSONObject ) providers .get (i );
374386
375387 String id = provider .getString ("id" );
376-
377- switch (id ) {
378- case "files" :
379- capability .setFullNextSearchFiles (CapabilityBooleanType .TRUE );
380- Log_OC .d (TAG , "full next search: file provider enabled" );
381- break ;
382- default :
383- // do nothing
384- break ;
388+
389+ // do nothing
390+ if ("files" .equals (id )) {
391+ capability .setFullNextSearchFiles (CapabilityBooleanType .TRUE );
392+ Log_OC .d (TAG , "full next search: file provider enabled" );
385393 }
386394 }
387395 }
0 commit comments