mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 13:59:29 +00:00
Created method visibility_level_to_api
This commit is contained in:
parent
f0b9058894
commit
78aadd55a1
@ -212,23 +212,7 @@ public class PostsHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Determine the visibility level of the post
|
//Determine the visibility level of the post
|
||||||
switch (post.getVisibilityLevel()){
|
req.addString("visibility", visibility_level_to_api(post.getVisibilityLevel()));
|
||||||
|
|
||||||
case PUBLIC:
|
|
||||||
req.addString("visibility", "public");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FRIENDS:
|
|
||||||
req.addString("visibility", "friends");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PRIVATE:
|
|
||||||
req.addString("visibility", "private");
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("Unsupported kind of Visibility level!");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Set the kind of target page
|
//Set the kind of target page
|
||||||
switch (post.getPage_type()){
|
switch (post.getPage_type()){
|
||||||
@ -407,4 +391,27 @@ public class PostsHelper {
|
|||||||
|
|
||||||
return post;
|
return post;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn a POST visibility level into a string ready for the API
|
||||||
|
*
|
||||||
|
* @param level The level to convert
|
||||||
|
* @return Generated API string
|
||||||
|
*/
|
||||||
|
private String visibility_level_to_api(PostVisibilityLevels level){
|
||||||
|
switch (level){
|
||||||
|
|
||||||
|
case PUBLIC:
|
||||||
|
return "public";
|
||||||
|
|
||||||
|
case FRIENDS:
|
||||||
|
return "friends";
|
||||||
|
|
||||||
|
case PRIVATE:
|
||||||
|
return "private";
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new RuntimeException("Unsupported kind of Visibility level!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user