NIMSDK-AOS  10.5.0
SignallingPushConfig.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.avsignalling.model;
2 
3 
4 import com.netease.nimlib.session.MsgHelper;
5 
6 import java.io.Serializable;
7 import java.util.Map;
8 
12 public class SignallingPushConfig implements Serializable {
13 
14  private final boolean needPush;
15 
16  private boolean needBadge = true;
17  private String pushTitle;
18  private String pushContent;
19  private String pushPayload;
20 
26  public SignallingPushConfig(boolean needPush, String pushTitle, String pushContent) {
27  this.needPush = needPush;
28  this.pushTitle = pushTitle;
29  this.pushContent = pushContent;
30  }
31 
38  public SignallingPushConfig(boolean needPush, String pushTitle, String pushContent, Map<String, Object> pushPayload) {
39  this(needPush, pushTitle, pushContent);
40  this.pushPayload = MsgHelper.getJsonStringFromMap(pushPayload);
41  }
42 
46  public boolean needPush() {
47  return needPush;
48  }
49 
50  public boolean needBadge() {
51  return needBadge;
52  }
53 
57  public String getPushTitle() {
58  return pushTitle;
59  }
60 
64  public String getPushContent() {
65  return pushContent;
66  }
67 
71  public String getPushPayload() {
72  return pushPayload;
73  }
74 
75 
76  public static final class SignallingPushConfigBuilder {
77  private final boolean needPush;
78  private boolean needBadge = true;
79  private String pushTitle;
80  private String pushContent;
81  private String pushPayload;
82 
83  public SignallingPushConfigBuilder(boolean needPush) {
84  this.needPush = needPush;
85  }
86 
87  public SignallingPushConfigBuilder withNeedBadge(boolean needBadge) {
88  this.needBadge = needBadge;
89  return this;
90  }
91 
92  public SignallingPushConfigBuilder withPushTitle(String pushTitle) {
93  this.pushTitle = pushTitle;
94  return this;
95  }
96 
97  public SignallingPushConfigBuilder withPushContent(String pushContent) {
98  this.pushContent = pushContent;
99  return this;
100  }
101 
102  public SignallingPushConfigBuilder withPushPayload(String pushPayload) {
103  this.pushPayload = pushPayload;
104  return this;
105  }
106 
107  public SignallingPushConfig build() {
108  SignallingPushConfig signallingPushConfig = new SignallingPushConfig(needPush, pushTitle, pushContent);
109  signallingPushConfig.pushPayload = this.pushPayload;
110  signallingPushConfig.needBadge = this.needBadge;
111  return signallingPushConfig;
112  }
113  }
114 }
SignallingPushConfig(boolean needPush, String pushTitle, String pushContent)
SignallingPushConfig(boolean needPush, String pushTitle, String pushContent, Map< String, Object > pushPayload)