Skip to content

Commit ceeba97

Browse files
author
Hevin
committed
Merge branch 'dev'
2 parents 4004fb6 + 957414a commit ceeba97

11 files changed

+26
-54
lines changed
-7.22 MB
Binary file not shown.
6.77 MB
Binary file not shown.
77.6 KB
Binary file not shown.
358 KB
Binary file not shown.
-337 KB
Binary file not shown.
198 KB
Binary file not shown.
-182 KB
Binary file not shown.

Plugins/Android/src/JPushBridge.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class JPushBridge {
3636
public static String funcName = "";
3737
public static boolean isQuit = true;
3838

39-
private static JPushBridge jpushBridge = new JPushBridge();
39+
private static JPushBridge jpushBridge;
4040
private Activity activity = null;
4141

4242
private Activity getActivity() {
@@ -79,9 +79,12 @@ public void resumeJPush(String gameObject, String func) {
7979
UnityPlayer.UnitySendMessage(gameObject, func, "resumeJPush");
8080
}
8181

82-
public String getRegistrationId(String gameObject, String func) {
83-
UnityPlayer.UnitySendMessage(gameObject, func, "getRegistrationId");
84-
return JPushInterface.getRegistrationID(getActivity());
82+
public static boolean isPushStopped() {
83+
return JPushInterface.isPushStopped(UnityPlayer.currentActivity.getApplicationContext());
84+
}
85+
86+
public static String getRegistrationId() {
87+
return JPushInterface.getRegistrationID(UnityPlayer.currentActivity.getApplicationContext());
8588
}
8689

8790
public String filterValidTags(String gameObject, String func, String tags) {

Plugins/JPushBinding.cs

Lines changed: 15 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ public static void setDebug(bool debug)
5353
*/
5454
public static void initJPush(string gameObject, string func)
5555
{
56-
Debug.Log("unity---initJPush");
57-
5856
_gameObject = gameObject;
5957
_func = func;
6058
_plugin.Call("initJPush", gameObject, func);
@@ -68,7 +66,6 @@ public static void stopJPush()
6866

6967
public static void stopJPush(string gameObject, string func)
7068
{
71-
Debug.Log("unity---stopJPush");
7269
_plugin.Call("stopJPush", gameObject, func);
7370
}
7471

@@ -80,7 +77,6 @@ public static void resumeJPush()
8077

8178
public static void resumeJPush(string gameObject, string func)
8279
{
83-
Debug.Log("unity---resumeJPush");
8480
_plugin.Call("resumeJPush", gameObject, func);
8581
}
8682

@@ -91,18 +87,12 @@ public static bool isPushStopped()
9187

9288
public static bool isPushStopped(string gameObject, string func)
9389
{
94-
Debug.Log("unity---isPushStopped");
9590
return _plugin.Call<bool>("isPushStopped", gameObject, func);
9691
}
9792

9893
public static string getRegistrationId()
9994
{
100-
return getRegistrationId(_gameObject, _func);
101-
}
102-
103-
public static string getRegistrationId(string gameObject, string func) {
104-
Debug.Log("unity---getRegistrationId");
105-
return _plugin.Call<string>("getRegistrationId", gameObject, func);
95+
return _plugin.CallStatic<string>("getRegistrationId");
10696
}
10797

10898
public static string filterValidTags(string tags)
@@ -123,7 +113,6 @@ public static void setTags(string tags)
123113

124114
public static void setTags(string gameObject, string func, string tags)
125115
{
126-
Debug.Log("unity---setTags");
127116
_plugin.Call("setTags", gameObject, func, tags);
128117
}
129118

@@ -135,7 +124,6 @@ public static void setAlias(string alias)
135124

136125
public static void setAlias(string gameObject, string func, string alias)
137126
{
138-
Debug.Log("unity---setAlias");
139127
_plugin.Call("setAlias", gameObject, func, alias);
140128
}
141129

@@ -144,9 +132,8 @@ public static void setAliasAndTags(string alias, string tags) {
144132
setAliasAndTags(_gameObject, _func, alias, tags);
145133
}
146134

147-
public static void setAliasAndTags(string gameObject, string func,
148-
string alias, string tags) {
149-
Debug.Log("unity---setAliasAndTags");
135+
public static void setAliasAndTags(string gameObject, string func, string alias, string tags)
136+
{
150137
_plugin.Call("setAliasAndTags", gameObject, func, alias, tags);
151138
}
152139

@@ -164,7 +151,6 @@ public static void setPushTime(string days, int startHour, int endHour)
164151
public static void setPushTime(string gameObject, string func, string days,
165152
int start_time, int end_time)
166153
{
167-
Debug.Log("unity---setPushTime");
168154
_plugin.Call("setPushTime", gameObject, func, days, start_time, end_time);
169155
}
170156

@@ -175,29 +161,24 @@ public static void setPushTime(string gameObject, string func, string days,
175161
* @param: endHour: 静默时段结束时间 - 小时(范围:0 - 23)
176162
* @param: endMinute: 静默时段结束时间 - 分钟(范围:0 - 59)
177163
*/
178-
public static void setSilenceTime(int startHour, int startMinute,
179-
int endHour, int endMinute) {
180-
setSilenceTime(_gameObject, _func, startHour, startMinute, endHour,
181-
endMinute);
164+
public static void setSilenceTime(int startHour, int startMinute, int endHour, int endMinute)
165+
{
166+
setSilenceTime(_gameObject, _func, startHour, startMinute, endHour, endMinute);
182167
}
183168

184169
public static void setSilenceTime(string gameObject, string func,
185170
int startHour, int startMinute, int endHour, int endMinute)
186171
{
187-
Debug.Log("unity---setSilenceTime");
188-
_plugin.Call("setSilenceTime",gameObject, func, startHour, startMinute, endHour,
189-
endMinute);
172+
_plugin.Call("setSilenceTime",gameObject, func, startHour, startMinute, endHour, endMinute);
190173
}
191174

192175
public static void setLatestNotificationNumber(int num)
193176
{
194177
setLatestNotificationNumber(_gameObject, _func, num);
195178
}
196179

197-
public static void setLatestNotificationNumber(string gameObject,
198-
string func, int num)
180+
public static void setLatestNotificationNumber(string gameObject, string func, int num)
199181
{
200-
Debug.Log("unity---setLatestNotificationNumber");
201182
_plugin.Call("setLatestNotificationNumber", gameObject, func, num);
202183
}
203184

@@ -238,7 +219,6 @@ public static void removeLocalNotification(int notiId)
238219

239220
public static void removeLocalNotification(string gameObject, string func, int notiId)
240221
{
241-
Debug.Log("unity---removeLocalNotification");
242222
_plugin.Call("removeLocalNotification", gameObject, func, notiId);
243223
}
244224

@@ -249,7 +229,6 @@ public static void clearLocalNotifications()
249229

250230
public static void clearLocalNotifications(string gameObject, string func)
251231
{
252-
Debug.Log("unity---clearLocalNotifications");
253232
_plugin.Call("clearLocalNotifications", gameObject, func);
254233
}
255234

@@ -260,7 +239,6 @@ public static void clearAllNotifications()
260239

261240
public static void clearAllNotifications(string gameObject, string func)
262241
{
263-
Debug.Log("unity---clearAllNotifications");
264242
_plugin.Call("clearAllNotifications", gameObject, func);
265243
}
266244

@@ -272,7 +250,6 @@ public static void clearNotificationById(int notiId)
272250
public static void clearNotificationById(string gameObject, string func,
273251
int notiId)
274252
{
275-
Debug.Log("unity---clearNotificationById");
276253
_plugin.Call("clearNotificationById", gameObject, func, notiId);
277254
}
278255

@@ -286,7 +263,6 @@ public static void requestPermission()
286263

287264
public static void requestPermission(string gameObject, string func)
288265
{
289-
Debug.Log("unity---requestPermission");
290266
_plugin.Call("requestPermission", gameObject, func);
291267
}
292268

@@ -295,10 +271,8 @@ public static void setBasicPushNotificationBuilder()
295271
setBasicPushNotificationBuilder(_gameObject, _func);
296272
}
297273

298-
public static void setBasicPushNotificationBuilder(string gameObject,
299-
string func)
274+
public static void setBasicPushNotificationBuilder(string gameObject, string func)
300275
{
301-
Debug.Log("unity---setBasicPushNotificationBuilder");
302276
// 需要根据自己业务情况修改后再调用。
303277
int builderId = 1;
304278
int notiDefaults = notificationDefaults | DEFAULT_ALL;
@@ -312,10 +286,8 @@ public static void setCustomPushNotificationBuilder()
312286
setCustomPushNotificationBuilder(_gameObject, _func);
313287
}
314288

315-
public static void setCustomPushNotificationBuilder(string gameObject,
316-
string func)
289+
public static void setCustomPushNotificationBuilder(string gameObject, string func)
317290
{
318-
Debug.Log("unity---setCustomPushNotificationBuilder");
319291
// 需要根据自己业务情况修改后再调用。
320292
int builderId = 1;
321293
string layoutName = "yourNotificationLayoutName";
@@ -350,7 +322,6 @@ public static void stopCrashHandler(string gameObject, string func)
350322
//在应用退出前调用
351323
public static void isQuit()
352324
{
353-
Debug.Log("unity---isQuit");
354325
_plugin.Call("isQuit");
355326
}
356327

@@ -363,7 +334,7 @@ public static void isQuit()
363334
void Start()
364335
{
365336
_registerNetworkDidReceiveMessage();
366-
_registerNetworkDidReceivePushNotification();
337+
_registerNetworkDidReceivePushNotification();
367338
}
368339

369340
//---------------------------- tags / alias ----------------------------//
@@ -405,7 +376,7 @@ void tagsWihtAliasCallBack(String jsonData)
405376
_printLocalLog(jsonData);
406377

407378
JsonData jd = JsonMapper.ToObject(jsonData);
408-
int respoenCode = (int)jd["rescode"];
379+
int responseCode = (int)jd["rescode"];
409380
String alias = (String)jd["alias"];
410381
JsonData jdItems = jd["tags"];
411382
int itemCnt = jdItems.Count;
@@ -418,7 +389,7 @@ void tagsWihtAliasCallBack(String jsonData)
418389

419390
if(_action!=null)
420391
{
421-
_action(respoenCode, set, alias);
392+
_action(responseCode, set, alias);
422393
}
423394
}
424395

@@ -580,8 +551,8 @@ public static void SetLocation(String latitude, String longitude){
580551
[DllImport("__Internal")]
581552
public static extern void _registerNetworkDidReceiveMessage();
582553

583-
[DllImport("__Internal")]
584-
public static extern void _registerNetworkDidReceivePushNotification();
554+
[DllImport("__Internal")]
555+
public static extern void _registerNetworkDidReceivePushNotification();
585556

586557
//--- badge ---//
587558

0 commit comments

Comments
 (0)