feat: add typed data and views with scoped device power
This commit is contained in:
@@ -6,6 +6,7 @@ final class DisplayApi {
|
||||
static class ApiError extends Exception {final int status;ApiError(int status){this.status=status;}}
|
||||
static JSONObject call(String path,String token,JSONObject body)throws Exception{
|
||||
if(expired)throw new ApiError(401);if(offline)throw new ApiError(503);String action=body.optString("action");
|
||||
if(path.equals("/api/phone/home"))return HomeFixture.call(token,body);
|
||||
if(path.equals("/api/voice")){
|
||||
if(action.equals("history")){boolean old=body.optLong("before")>0;JSONArray items=new JSONArray();for(int i=0;i<3;i++)items.put(new JSONObject().put("id","chat-"+i).put("seq",i+1).put("mine",i%2==0).put("senderName",i%2==0?"示例成员的手机":"家庭显示终端").put("at",1792387200+i*60-(old?86400:0)).put("seconds",i+3.6).put("delivery",i==2?"queued":"played").put("archive",i==2?"pending":"cloud"));return new JSONObject().put("items",items).put("before",old?0:12);}
|
||||
return new JSONObject("{\"enabled\":false,\"allowed\":[],\"candidates\":[{\"id\":\"phone:demo\",\"name\":\"示例家人的手机\"}],\"targets\":[{\"id\":\"display:demo\",\"archiveKey\":\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"name\":\"家庭显示终端\",\"kind\":\"display\",\"online\":true}],\"conversations\":[],\"sent\":[],\"inbox\":[]}");
|
||||
|
||||
Reference in New Issue
Block a user