From 71efc6095662ce1fe831fb637c5df7664d3610c3 Mon Sep 17 00:00:00 2001 From: yutaipu Date: Tue, 2 Jun 2020 18:27:34 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=A7=A3=E7=BB=91?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=B8=8E=E5=88=AB=E5=90=8D=E7=9A=84=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/cn/jpush/api/JPushClient.java | 5 +++++ .../cn/jpush/api/device/DeviceClient.java | 21 +++++++++++++++++++ .../api/device/DeviceNormalRemoteTest.java | 13 ++++++++++-- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/main/java/cn/jpush/api/JPushClient.java b/src/main/java/cn/jpush/api/JPushClient.java index 94139062..74b1458b 100644 --- a/src/main/java/cn/jpush/api/JPushClient.java +++ b/src/main/java/cn/jpush/api/JPushClient.java @@ -900,6 +900,11 @@ public DefaultResult deleteAlias(String alias, String platform) return _deviceClient.deleteAlias(alias, platform); } + public DefaultResult removeDevicesFromAlias(String alias, Set toRemoveDevice) + throws APIConnectionException, APIRequestException { + return _deviceClient.removeDevicesFromAlias(alias, toRemoveDevice); + } + public Map getUserOnlineStatus(String... registrationIds) throws APIConnectionException, APIRequestException { diff --git a/src/main/java/cn/jpush/api/device/DeviceClient.java b/src/main/java/cn/jpush/api/device/DeviceClient.java index 53ded02e..c834a7a4 100644 --- a/src/main/java/cn/jpush/api/device/DeviceClient.java +++ b/src/main/java/cn/jpush/api/device/DeviceClient.java @@ -245,6 +245,27 @@ public DefaultResult deleteAlias(String alias, String platform) throws APIConnec return DefaultResult.fromResponse(response); } + public DefaultResult removeDevicesFromAlias(String alias, Set toRemoveDevice) throws APIConnectionException, APIRequestException { + String url = hostName + aliasesPath + "/" + alias; + + JsonObject top = new JsonObject(); + JsonObject registrationIds = new JsonObject(); + + if (null != toRemoveDevice && toRemoveDevice.size() > 0) { + JsonArray array = new JsonArray(); + for (String device : toRemoveDevice) { + array.add(new JsonPrimitive(device)); + } + registrationIds.add("remove", array); + } + + top.add("registration_ids", registrationIds); + + ResponseWrapper response = _httpClient.sendPost(url, top.toString()); + + return DefaultResult.fromResponse(response); + } + // -------------- devices status public Map getUserOnlineStatus(String... registrationIds) diff --git a/src/test/java/cn/jpush/api/device/DeviceNormalRemoteTest.java b/src/test/java/cn/jpush/api/device/DeviceNormalRemoteTest.java index d21bf09c..23197e31 100644 --- a/src/test/java/cn/jpush/api/device/DeviceNormalRemoteTest.java +++ b/src/test/java/cn/jpush/api/device/DeviceNormalRemoteTest.java @@ -74,8 +74,8 @@ public void testGetDeviceTagAlias_cleard() throws Exception { assertEquals("tags cleared", 0, result.tags.size()); } - - + + // ------------------ tags @Test @@ -197,4 +197,13 @@ public void testBindMobile_empty() throws APIConnectionException, APIRequestExce assertTrue(result.isResultOK()); } + @Test + @TestOrder(order = 330) + public void testRemoveDevicesFromAlias() throws APIConnectionException, APIRequestException { + Set toRemoveDevice = new HashSet<>(); + toRemoveDevice.add(REGISTRATION_ID1); + DefaultResult result = jpushClient.removeDevicesFromAlias("alias1", toRemoveDevice); + assertTrue(result.isResultOK()); + } + } From 87818cadeaa6dd4e6c0bc08ed4d7a7d01d306a27 Mon Sep 17 00:00:00 2001 From: yutaipu Date: Thu, 30 Jul 2020 14:17:32 +0800 Subject: [PATCH 2/4] =?UTF-8?q?pom=E5=8A=A0=E4=B8=8ASNAPSHOT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 420d01b6..b689e8d5 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ cn.jpush.api jpush-client - 3.4.4 + 3.4.4-SNAPSHOT jar https://github.com/jpush/jpush-api-java-client JPush API Java Client From b4d099ebdae0a4e2d1ce6e1bc040c83c0b5dd5a8 Mon Sep 17 00:00:00 2001 From: yutaipu Date: Thu, 30 Jul 2020 14:24:15 +0800 Subject: [PATCH 3/4] [maven-release-plugin] prepare release v3.4.5 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index b689e8d5..e18016cd 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ cn.jpush.api jpush-client - 3.4.4-SNAPSHOT + 3.4.5 jar https://github.com/jpush/jpush-api-java-client JPush API Java Client @@ -35,7 +35,7 @@ https://github.com/jpush/jpush-api-java-client scm:git:git@github.com:jpush/jpush-api-java-client.git scm:git:git@github.com:jpush/jpush-api-java-client.git - v3.3.12 + v3.4.5 From 9674cd11f61a7e4502038b72183a60c4e777e66b Mon Sep 17 00:00:00 2001 From: yutaipu Date: Thu, 30 Jul 2020 14:24:16 +0800 Subject: [PATCH 4/4] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index e18016cd..a1a8c99e 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ cn.jpush.api jpush-client - 3.4.5 + 3.4.6-SNAPSHOT jar https://github.com/jpush/jpush-api-java-client JPush API Java Client @@ -35,7 +35,7 @@ https://github.com/jpush/jpush-api-java-client scm:git:git@github.com:jpush/jpush-api-java-client.git scm:git:git@github.com:jpush/jpush-api-java-client.git - v3.4.5 + v3.3.12