Skip to content

Commit 34becb2

Browse files
author
Javen
committed
Change mpns to winphone even for notification - should be easier to understand
1 parent 1ff9738 commit 34becb2

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

src/cn/jpush/api/push/model/notification/MpnsNotification.java renamed to src/cn/jpush/api/push/model/notification/WinphoneNotification.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import com.google.gson.JsonObject;
99
import com.google.gson.JsonPrimitive;
1010

11-
public class MpnsNotification extends PlatformNotification {
12-
public static final String NOTIFICATION_MPNS = "mpns";
11+
public class WinphoneNotification extends PlatformNotification {
12+
public static final String NOTIFICATION_WINPHONE = "winphone";
1313

1414
public static final String TITLE = "title";
1515
public static final String EXTRAS = "extras";
@@ -19,7 +19,7 @@ public class MpnsNotification extends PlatformNotification {
1919
private final String openPage;
2020
private final ImmutableMap<String, String> extras;
2121

22-
private MpnsNotification(String alert, String title, String openPage,
22+
private WinphoneNotification(String alert, String title, String openPage,
2323
ImmutableMap<String, String> extras) {
2424
super(alert);
2525
this.title = title;
@@ -31,14 +31,14 @@ public static Builder newBuilder() {
3131
return new Builder();
3232
}
3333

34-
public static MpnsNotification alert(String alert) {
34+
public static WinphoneNotification alert(String alert) {
3535
return newBuilder().setAlert(alert).build();
3636
}
3737

3838

3939
@Override
4040
public String getPlatform() {
41-
return NOTIFICATION_MPNS;
41+
return NOTIFICATION_WINPHONE;
4242
}
4343

4444
@Override
@@ -106,8 +106,8 @@ public Builder addExtra(String key, String value) {
106106
return this;
107107
}
108108

109-
public MpnsNotification build() {
110-
return new MpnsNotification(alert, title, openPage,
109+
public WinphoneNotification build() {
110+
return new WinphoneNotification(alert, title, openPage,
111111
(null == extrasBuilder) ? null : extrasBuilder.build());
112112
}
113113
}

test/cn/jpush/api/push/model/notification/NotificationTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ public void testAlertIos() {
5050
@Test
5151
public void testAlertMpns() {
5252
Notification notification = Notification.newBuilder()
53-
.addPlatformNotification(MpnsNotification.alert("alert"))
53+
.addPlatformNotification(WinphoneNotification.alert("alert"))
5454
.build();
5555
JsonObject json = new JsonObject();
56-
JsonObject mpns = new JsonObject();
57-
mpns.add("alert", new JsonPrimitive("alert"));
58-
json.add("mpns", mpns);
56+
JsonObject winphone = new JsonObject();
57+
winphone.add("alert", new JsonPrimitive("alert"));
58+
json.add("winphone", winphone);
5959
Assert.assertEquals("", json, notification.toJSON());
6060
}
6161

test/cn/jpush/api/push/model/notification/MpnsNotificationTests.java renamed to test/cn/jpush/api/push/model/notification/WinphoneNotificationTests.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,38 @@
66
import com.google.gson.JsonObject;
77
import com.google.gson.JsonPrimitive;
88

9-
public class MpnsNotificationTests {
9+
public class WinphoneNotificationTests {
1010

1111
@Test(expected = IllegalArgumentException.class)
1212
public void testIllegal() {
13-
MpnsNotification mpns = MpnsNotification.newBuilder().build();
14-
Assert.assertEquals("", "", mpns.toJSON());
13+
WinphoneNotification winphone = WinphoneNotification.newBuilder().build();
14+
Assert.assertEquals("", "", winphone.toJSON());
1515
}
1616

1717
@Test
1818
public void testQuickAlert() {
19-
MpnsNotification mpns = MpnsNotification.alert("aaa");
19+
WinphoneNotification winphone = WinphoneNotification.alert("aaa");
2020
JsonObject json = new JsonObject();
2121
json.add("alert", new JsonPrimitive("aaa"));
22-
Assert.assertEquals("", json, mpns.toJSON());
22+
Assert.assertEquals("", json, winphone.toJSON());
2323
}
2424

2525
@Test
2626
public void testTitle() {
27-
MpnsNotification mpns = MpnsNotification.newBuilder().setTitle("title").build();
27+
WinphoneNotification winphone = WinphoneNotification.newBuilder().setTitle("title").build();
2828
JsonObject json = new JsonObject();
2929
json.add("title", new JsonPrimitive("title"));
30-
Assert.assertEquals("", json, mpns.toJSON());
30+
Assert.assertEquals("", json, winphone.toJSON());
3131
}
3232

3333
@Test
3434
public void testExtra() {
35-
MpnsNotification mpns = MpnsNotification.newBuilder().addExtra("key", "value").build();
35+
WinphoneNotification winphone = WinphoneNotification.newBuilder().addExtra("key", "value").build();
3636
JsonObject json = new JsonObject();
3737
JsonObject extra = new JsonObject();
3838
extra.add("key", new JsonPrimitive("value"));
3939
json.add("extras", extra);
40-
Assert.assertEquals("", json, mpns.toJSON());
40+
Assert.assertEquals("", json, winphone.toJSON());
4141
}
4242

4343

0 commit comments

Comments
 (0)