Compare commits

...

6 Commits

Author SHA1 Message Date
JoshLi
76d6c5ddb1 更新文档 2021-07-28 11:29:04 +08:00
JoshLi
521422cac0 更新插件版本v382 2021-07-28 11:28:51 +08:00
JoshLi
c629dcc033 更新iOSsdk到v374 2021-07-28 11:20:56 +08:00
JoshLi
aeee619eab 更新androidsdk到v428 2021-07-28 11:17:08 +08:00
JoshLi
bc9e441fe2 iOS添加手机号设置接口 2021-07-28 10:58:19 +08:00
JoshLi
fad4745e01 Android添加手机号设置接口 2021-07-27 18:32:54 +08:00
33 changed files with 354 additions and 138 deletions

View File

@@ -21,6 +21,8 @@
- [cleanTags](#cleantags)
- [getAllTags](#getalltags)
- [checkTagBindState](#checktagbindstate)
- [设置手机号](#设置手机号)
- [setMobileNumber](#setMobileNumber)
- [获取点击通知内容](#获取点击通知内容)
- [event - jpush.openNotification](#event---jpushopennotification)
- [获取通知内容](#获取通知内容)
@@ -396,6 +398,37 @@ window.JPush.checkTagBindState({ sequence: 1, tag: 'tag1' },
- sequence: number。用户自定义的操作序列号, 同操作结果一起返回,用来标识一次操作的唯一性。
- tag: string待查询的 tag。
## 设置手机号
提供设置手机号码的接口,用于短信补充功能。
注:短信补充仅支持国内业务,号码格式为 11 位数字,有无 +86 前缀皆可。
### setMobileNumber
调用此 API 设置手机号码。该接口会控制调用频率,频率为 10s 之内最多 3 次。
#### 代码示例
```js
window.JPush.setMobileNumber({ sequence: 5, mobileNumber: '111111' },
(result) => {
var sequence = result.sequence
var number = result.mobileNumber
}, (error) => {
var sequence = error.sequence
var errorCode = error.code
})
```
#### 参数说明
- sequence: number。用户自定义的操作序列号, 同操作结果一起返回,用来标识一次操作的唯一性。
- mobileNumber: string
- 手机号码。如果传空串则为解除号码绑定操作。
- 限制:只能以 “+” 或者 数字开头;后面的内容只能包含 “-” 和数字。
## 获取点击通知内容
### event - jpush.openNotification

View File

@@ -200,6 +200,16 @@
alert(error.code)
})
});
$("#setMobileNumber").click(function (event) {
var number = $("#mobileNumberText").val()
window.JPush.setMobileNumber({ sequence: 5, mobileNumber: number },
function (result) {
$("#mobileNumberResult").html(result.mobileNumber)
}, function (error){
alert(error.code)
})
})
};
document.addEventListener("deviceready", onDeviceReady, false);
@@ -251,6 +261,14 @@
</td>
</tr>
</table>
<label>MobileNumber: </label>
<table>
<tr>
<td>
<input type="number" id="mobileNumberText" />
</td>
</tr>
</table>
</div>
<div data-role="fieldcontain">
@@ -265,6 +283,10 @@
<input type="button" id="deleteAlias" value="Delete alias" />
</div>
<div data-role="fieldcontain">
<input type="button" id="setMobileNumber" value="Set mobileNumber" />
</div>
<div data-role="fieldcontain">
<label id="tagsPrompt">设置 Tag 的结果:</label>
<label id="tagsResult">null</label>
@@ -273,6 +295,10 @@
<label id="aliasPrompt">设置 Alias 的结果:</label>
<label id="aliasResult">null</label>
</div>
<div data-role="fieldcontain">
<label id="mobileNumberPrompt">设置手机号的结果:</label>
<label id="mobileNumberResult">null</label>
</div>
<div data-role="fieldcontain">
<label id="notificationPrompt">接受的通知内容:</label>
<label id="notificationResult">null</label>

View File

@@ -1,6 +1,6 @@
{
"name": "jpush-phonegap-plugin",
"version": "3.8.1",
"version": "3.8.2",
"description": "JPush for cordova plugin",
"cordova": {
"id": "jpush-phonegap-plugin",

View File

@@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="jpush-phonegap-plugin"
version="3.8.1">
version="3.8.2">
<name>JPush</name>
<description>JPush for cordova plugin</description>
@@ -49,7 +49,7 @@
<source-file src="src/ios/Plugins/AppDelegate+JPush.m" />
<header-file src="src/ios/lib/JPUSHService.h" />
<source-file src="src/ios/lib/jpush-ios-3.5.2.a" framework="true" />
<source-file src="src/ios/lib/jpush-ios-3.7.4.a" framework="true" />
<resource-file src="src/ios/JPushConfig.plist" />
<framework src="CFNetwork.framework" weak="true" />
@@ -215,16 +215,18 @@
</receiver>
<!--since 3.3.0 Required SDK核心功能-->
<activity
android:name="cn.jpush.android.service.JNotifyActivity"
android:exported="true"
android:taskAffinity="jpush.custom"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="cn.jpush.android.intent.JNotifyActivity" />
<category android:name="$PACKAGE_NAME" />
</intent-filter>
</activity>
<activity
android:name="cn.jpush.android.service.JNotifyActivity"
android:exported="true"
android:taskAffinity="jpush.custom"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="cn.jpush.android.intent.JNotifyActivity" />
<category android:name="android.intent.category.DEFAULT" /><!--Required SDK核心功能 since 4.2.2-->
<category android:name="$PACKAGE_NAME" />
</intent-filter>
</activity>
<!-- since 3.3.0 Required SDK 核心功能-->
<!-- 可配置android:process参数将PushService放在其他进程中 -->
@@ -259,12 +261,13 @@
</config-file>
<lib-file src="src/android/libs/jpush-android-4.1.0.jar" />
<lib-file src="src/android/libs/jpush-android-4.2.8.jar" />
<source-file src="src/android/PushService.java" target-dir="src/cn/jiguang/cordova/push" />
<source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jiguang/cordova/push" />
<source-file src="src/android/JPushReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
<source-file src="src/android/JPushEventReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
<source-file src="src/android/JLogger.java" target-dir="src/cn/jiguang/cordova/push" />
<resource-file src="src/android/res/drawable-hdpi/jpush_richpush_btn_selector.xml"
target="res/drawable/jpush_richpush_btn_selector.xml" />

46
src/android/JLogger.java Normal file
View File

@@ -0,0 +1,46 @@
package cn.jiguang.cordova.push;
import android.util.Log;
public class JLogger {
public static final String TAG = "[Cordova-JPush]";
private static boolean isLoggerEnable = false;
public static void setLoggerEnable(boolean loggerEnable) {
Log.d(TAG, "setLoggerEnable:" + loggerEnable);
isLoggerEnable = loggerEnable;
}
public static void i(String tag,String msg) {
if (isLoggerEnable) {
Log.i(TAG+tag, msg);
}
}
public static void d(String tag,String msg) {
if (isLoggerEnable) {
Log.d(TAG+tag, msg);
}
}
public static void v(String tag,String msg) {
if (isLoggerEnable) {
Log.v(TAG+tag, msg);
}
}
public static void w(String tag,String msg) {
if (isLoggerEnable) {
Log.w(TAG+tag, msg);
}
}
public static void e(String tag,String error) {
if (isLoggerEnable) {
Log.e(TAG+tag, error);
}
}
}

View File

@@ -3,20 +3,18 @@ package cn.jiguang.cordova.push;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import org.apache.cordova.CallbackContext;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Map;
import java.util.Set;
import cn.jpush.android.api.CustomMessage;
import cn.jpush.android.api.JPushInterface;
import cn.jpush.android.api.JPushMessage;
import cn.jpush.android.api.NotificationMessage;
import cn.jpush.android.helper.Logger;
import cn.jpush.android.service.JPushMessageReceiver;
public class JPushEventReceiver extends JPushMessageReceiver {
@@ -26,143 +24,58 @@ public class JPushEventReceiver extends JPushMessageReceiver {
@Override
public void onTagOperatorResult(Context context, JPushMessage jPushMessage) {
super.onTagOperatorResult(context, jPushMessage);
//Log.e(TAG,"onTagOperatorResult:"+jPushMessage);
JSONObject resultJson = new JSONObject();
JLogger.d(TAG,"onTagOperatorResult:"+jPushMessage);
int sequence = jPushMessage.getSequence();
try {
resultJson.put("sequence", sequence);
} catch (JSONException e) {
e.printStackTrace();
}
CallbackContext callback = JPushPlugin.eventCallbackMap.get(sequence);
if (callback == null) {
Log.i(TAG, "Unexpected error, callback is null!");
return;
}
if (jPushMessage.getErrorCode() == 0) { // success
Set<String> tags = jPushMessage.getTags();
JSONArray tagsJsonArr = new JSONArray();
for (String tag : tags) {
tagsJsonArr.put(tag);
}
try {
tryCallback(jPushMessage, new SuccessCallback() {
@Override
public void onSuccessCallback(JSONObject resultJson) throws JSONException {
Set<String> tags = jPushMessage.getTags();
JSONArray tagsJsonArr = new JSONArray();
for (String tag : tags) {
tagsJsonArr.put(tag);
}
if (tagsJsonArr.length() != 0) {
resultJson.put("tags", tagsJsonArr);
}
} catch (JSONException e) {
e.printStackTrace();
}
callback.success(resultJson);
} else {
try {
resultJson.put("code", jPushMessage.getErrorCode());
} catch (JSONException e) {
e.printStackTrace();
}
callback.error(resultJson);
}
JPushPlugin.eventCallbackMap.remove(sequence);
});
}
@Override
public void onCheckTagOperatorResult(Context context, JPushMessage jPushMessage) {
super.onCheckTagOperatorResult(context, jPushMessage);
//Log.e(TAG,"onCheckTagOperatorResult:"+jPushMessage);
JSONObject resultJson = new JSONObject();
JLogger.d(TAG,"onCheckTagOperatorResult:"+jPushMessage);
int sequence = jPushMessage.getSequence();
try {
resultJson.put("sequence", sequence);
} catch (JSONException e) {
e.printStackTrace();
}
CallbackContext callback = JPushPlugin.eventCallbackMap.get(sequence);
if (callback == null) {
Log.i(TAG, "Unexpected error, callback is null!");
return;
}
if (jPushMessage.getErrorCode() == 0) {
try {
tryCallback(jPushMessage, new SuccessCallback() {
@Override
public void onSuccessCallback(JSONObject resultJson) throws JSONException {
resultJson.put("tag", jPushMessage.getCheckTag());
resultJson.put("isBind", jPushMessage.getTagCheckStateResult());
} catch (JSONException e) {
e.printStackTrace();
}
callback.success(resultJson);
} else {
try {
resultJson.put("code", jPushMessage.getErrorCode());
} catch (JSONException e) {
e.printStackTrace();
}
callback.error(resultJson);
}
JPushPlugin.eventCallbackMap.remove(sequence);
});
}
@Override
public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
super.onAliasOperatorResult(context, jPushMessage);
//Log.e(TAG,"onAliasOperatorResult:"+jPushMessage);
JSONObject resultJson = new JSONObject();
JLogger.d(TAG,"onAliasOperatorResult:"+jPushMessage);
int sequence = jPushMessage.getSequence();
try {
resultJson.put("sequence", sequence);
} catch (JSONException e) {
e.printStackTrace();
}
CallbackContext callback = JPushPlugin.eventCallbackMap.get(sequence);
if (callback == null) {
Log.i(TAG, "Unexpected error, callback is null!");
return;
}
if (jPushMessage.getErrorCode() == 0) { // success
try {
tryCallback(jPushMessage, new SuccessCallback() {
@Override
public void onSuccessCallback(JSONObject resultJson) throws JSONException {
if (!TextUtils.isEmpty(jPushMessage.getAlias())) {
resultJson.put("alias", jPushMessage.getAlias());
}
} catch (JSONException e) {
e.printStackTrace();
}
callback.success(resultJson);
} else {
try {
resultJson.put("code", jPushMessage.getErrorCode());
} catch (JSONException e) {
e.printStackTrace();
}
callback.error(resultJson);
}
JPushPlugin.eventCallbackMap.remove(sequence);
});
}
@Override
public void onRegister(Context context, String regId) {
//Log.e(TAG,"onRegister:"+regId);
JLogger.d(TAG,"onRegister:"+regId);
JPushPlugin.transmitReceiveRegistrationId(regId);
}
@@ -179,24 +92,74 @@ public class JPushEventReceiver extends JPushMessageReceiver {
public void onNotifyMessageArrived(Context context, NotificationMessage notificationMessage) {
super.onNotifyMessageArrived(context, notificationMessage);
//Log.e(TAG,"onNotifyMessageArrived:"+notificationMessage);
JLogger.d(TAG,"onNotifyMessageArrived:"+notificationMessage);
}
@Override
public void onNotifyMessageOpened(Context context, NotificationMessage notificationMessage) {
super.onNotifyMessageOpened(context, notificationMessage);
//Log.e(TAG,"onNotifyMessageOpened:"+notificationMessage);
JLogger.d(TAG,"onNotifyMessageOpened:"+notificationMessage);
}
@Override
public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) {
super.onMobileNumberOperatorResult(context, jPushMessage);
//Log.e(TAG,"onMobileNumberOperatorResult:"+jPushMessage);
JLogger.d(TAG,"onMobileNumberOperatorResult:"+jPushMessage);
tryCallback(jPushMessage, new SuccessCallback() {
@Override
public void onSuccessCallback(JSONObject resultJson) throws JSONException {
if (!TextUtils.isEmpty(jPushMessage.getMobileNumber())) {
resultJson.put("mobileNumber", jPushMessage.getMobileNumber());
}
}
});
}
@Override
public void onMultiActionClicked(Context context, Intent intent) {
super.onMultiActionClicked(context, intent);
//Log.e(TAG,"onMultiActionClicked:"+intent);
JLogger.d(TAG,"onMultiActionClicked:"+intent);
}
interface SuccessCallback{
void onSuccessCallback(JSONObject resultJson) throws JSONException;
}
public void tryCallback(JPushMessage jPushMessage,SuccessCallback successCallback){
JSONObject resultJson = new JSONObject();
int sequence = jPushMessage.getSequence();
try {
resultJson.put("sequence", sequence);
} catch (JSONException e) {
e.printStackTrace();
}
CallbackContext callback = JPushPlugin.eventCallbackMap.get(sequence);
if (callback == null) {
Logger.i(TAG, "Unexpected error, callback is null!");
return;
}
if (jPushMessage.getErrorCode() == 0) {
try {
successCallback.onSuccessCallback(resultJson);
} catch (JSONException e) {
e.printStackTrace();
}
callback.success(resultJson);
} else {
try {
resultJson.put("code", jPushMessage.getErrorCode());
} catch (JSONException e) {
e.printStackTrace();
}
callback.error(resultJson);
}
JPushPlugin.eventCallbackMap.remove(sequence);
}
}

View File

@@ -59,8 +59,9 @@ public class JPushPlugin extends CordovaPlugin {
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
mContext = cordova.getActivity().getApplicationContext();
Log.d(TAG,"initialize plugin");
JPushInterface.init(mContext);
// JPushInterface.init(mContext);
cordovaActivity = cordova.getActivity();
@@ -254,6 +255,7 @@ public class JPushPlugin extends CordovaPlugin {
try {
mode = data.getBoolean(0);
JPushInterface.setDebugMode(mode);
JLogger.setLoggerEnable(mode);
callbackContext.success();
} catch (JSONException e) {
e.printStackTrace();
@@ -296,6 +298,7 @@ public class JPushPlugin extends CordovaPlugin {
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("error reading num json");
return;
}
if (num != -1) {
JPushInterface.setLatestNotificationNumber(mContext, num);
@@ -364,6 +367,7 @@ public class JPushPlugin extends CordovaPlugin {
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("Parameters error.");
return;
}
JPushInterface.setAlias(mContext, sequence, alias);
@@ -379,6 +383,7 @@ public class JPushPlugin extends CordovaPlugin {
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("Parameters error.");
return;
}
JPushInterface.deleteAlias(mContext, sequence);
@@ -394,6 +399,7 @@ public class JPushPlugin extends CordovaPlugin {
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("Parameters error.");
return;
}
JPushInterface.getAlias(mContext, sequence);
@@ -416,6 +422,7 @@ public class JPushPlugin extends CordovaPlugin {
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("Parameters error.");
return;
}
JPushInterface.setTags(mContext, sequence, tags);
@@ -438,6 +445,7 @@ public class JPushPlugin extends CordovaPlugin {
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("Parameters error.");
return;
}
JPushInterface.addTags(mContext, sequence, tags);
@@ -460,6 +468,7 @@ public class JPushPlugin extends CordovaPlugin {
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("Parameters error.");
return;
}
JPushInterface.deleteTags(mContext, sequence, tags);
@@ -476,6 +485,7 @@ public class JPushPlugin extends CordovaPlugin {
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("Parameters error.");
return;
}
JPushInterface.cleanTags(mContext, sequence);
@@ -492,6 +502,7 @@ public class JPushPlugin extends CordovaPlugin {
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("Parameters error.");
return;
}
JPushInterface.getAllTags(mContext, sequence);
@@ -510,6 +521,7 @@ public class JPushPlugin extends CordovaPlugin {
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("Parameters error.");
return;
}
JPushInterface.checkTagBindState(mContext, sequence, tag);
@@ -642,6 +654,25 @@ public class JPushPlugin extends CordovaPlugin {
JPushInterface.setBadgeNumber(mContext, badgeNumb);
}
void setMobileNumber(JSONArray data, CallbackContext callbackContext) throws JSONException {
int sequence = -1;
String number = null;
try {
JSONObject params = data.getJSONObject(0);
sequence = params.getInt("sequence");
number = params.getString("mobileNumber");
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("Parameters error.");
return;
}
eventCallbackMap.put(sequence, callbackContext);
JPushInterface.setMobileNumber(mContext,sequence, number);
}
private boolean isValidHour(int hour) {
return !(hour < 0 || hour > 23);
}

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 551 B

After

Width:  |  Height:  |  Size: 551 B

View File

Before

Width:  |  Height:  |  Size: 591 B

After

Width:  |  Height:  |  Size: 591 B

View File

Before

Width:  |  Height:  |  Size: 759 B

After

Width:  |  Height:  |  Size: 759 B

View File

Before

Width:  |  Height:  |  Size: 695 B

After

Width:  |  Height:  |  Size: 695 B

View File

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 181 B

View File

View File

0
src/android/res/layout-v21/push_notification.xml Normal file → Executable file
View File

0
src/android/res/layout-v21/push_notification_large.xml Normal file → Executable file
View File

View File

0
src/android/res/layout/jpush_inapp_banner.xml Normal file → Executable file
View File

0
src/android/res/layout/jpush_popwin_layout.xml Normal file → Executable file
View File

0
src/android/res/layout/jpush_webview_layout.xml Normal file → Executable file
View File

0
src/android/res/layout/push_notification.xml Normal file → Executable file
View File

0
src/android/res/layout/push_notification_large.xml Normal file → Executable file
View File

0
src/android/res/layout/push_notification_middle.xml Normal file → Executable file
View File

0
src/android/res/values-zh/jpush_string.xml Normal file → Executable file
View File

0
src/android/res/values/jpush_string.xml Normal file → Executable file
View File

0
src/android/res/values/jpush_style.xml Normal file → Executable file
View File

View File

@@ -73,6 +73,9 @@ static NSMutableDictionary *_jpushEventCache;
-(void)addDismissActions:(CDVInvokedUrlCommand*)command;
-(void)addNotificationActions:(CDVInvokedUrlCommand*)command;
// 设置手机号
-(void)setMobileNumber:(CDVInvokedUrlCommand*)command;
/*
* 以下为js中可监听到的事件
* jpush.openNotification 点击推送消息启动或唤醒app

View File

@@ -510,6 +510,29 @@
[[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:[NSSet setWithObject:category]];
}
#pragma mark -
-(void)setMobileNumber:(CDVInvokedUrlCommand *)command {
NSDictionary* params = [command.arguments objectAtIndex:0];
NSNumber* sequence = params[@"sequence"];
NSString* number = params[@"mobileNumber"];
[JPUSHService setMobileNumber:number completion:^(NSError *error) {
NSMutableDictionary* dic = [[NSMutableDictionary alloc] init];
[dic setObject:sequence forKey:@"sequence"];
CDVPluginResult* result;
if (error) {
[dic setValue:[NSNumber numberWithUnsignedInteger:error.code] forKey:@"code"];
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dic];
}
else {
// success
[dic setObject:number forKey:@"mobileNumber"];
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dic];
}
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
}];
}
#pragma mark -
+(void)setupJPushSDK:(NSDictionary*)userInfo{

View File

@@ -9,7 +9,7 @@
* Copyright (c) 2011 ~ 2017 Shenzhen HXHG. All rights reserved.
*/
#define JPUSH_VERSION_NUMBER 3.5.2
#define JPUSH_VERSION_NUMBER 3.7.4
#import <Foundation/Foundation.h>
@@ -20,6 +20,7 @@
@class UNNotificationSettings;
@class UNNotificationRequest;
@class UNNotification;
@class UIView;
@protocol JPUSHRegisterDelegate;
@protocol JPUSHGeofenceDelegate;
@protocol JPushInMessageDelegate;
@@ -428,7 +429,14 @@ typedef NS_OPTIONS(NSUInteger, JPInMessageType) {
默认值为 10 iOS系统默认地理围栏最大个数为20
@param count 个数 count
*/
+ (void)setGeofenecMaxCount:(NSInteger)count;
+ (void)setGeofeneceMaxCount:(NSInteger)count;
/**
设置地理围栏'圈内'类型的检测周期
默认15分钟检测一次
*/
+ (void)setGeofenecePeriodForInside:(NSInteger)seconds;
/**
注册地理围栏的代理
@@ -662,6 +670,14 @@ typedef NS_OPTIONS(NSUInteger, JPInMessageType) {
*/
+ (void)setInMessageDelegate:(id<JPushInMessageDelegate>)inMessageDelegate;
/*!
* @abstract 设置应用内消息的inMessageView的父控件
*
* @discussion 建议设置成当前展示的windowSDK默认取当前APP顶层的Window。
*
*/
+ (void)setInMessageSuperView:(UIView *)view;
/*!
* @abstract 主动拉取应用内消息的接口
@@ -669,7 +685,7 @@ typedef NS_OPTIONS(NSUInteger, JPInMessageType) {
* @discussion 拉取结果的回调
*
*/
+ (void)pullInMessageCompletion:(JPUSHInMssageCompletion)completion;
+ (void)pullInMessageCompletion:(JPUSHInMssageCompletion)completion __attribute__((deprecated("JPush 3.7.0 版本已过期")));
/*!
@@ -679,20 +695,63 @@ typedef NS_OPTIONS(NSUInteger, JPInMessageType) {
*
* @discussion 拉取结果的回调
*/
+ (void)pullInMessageWithTypes:(NSUInteger)types completion:(JPUSHInMssageCompletion)completion;
+ (void)pullInMessageWithTypes:(NSUInteger)types completion:(JPUSHInMssageCompletion)completion __attribute__((deprecated("JPush 3.7.0 版本已过期")));
/*!
* @abstract 向sdk报告当前展示的控制器的名称
* @abstract 主动拉取应用内消息的接口
*
* @param adPosition 广告位
*
* @discussion 拉取结果的回调
*/
+ (void)pullInMessageWithAdPosition:(NSString *)adPosition completion:(JPUSHInMssageCompletion)completion;
/*!
* @abstract 主动拉取应用内消息的接口
*
* @param params 拉取条件 可传参数: @"adPosition" -> 广告位 NSString, @"event" -> 事件 NSString
*
* @discussion 拉取结果的回调
*/
+ (void)pullInMessageWithParams:(NSDictionary *)params completion:(JPUSHInMssageCompletion)completion;
/*!
* @abstract 通过事件触发应用内消息下发
*
* @param event 事件
*
*/
+ (void)triggerInMessageByEvent:(NSString *)event;
/*!
* @abstract 在页面切换的时候调用告诉sdk当前切换到的页面名称
*
* @param className 当前页面的类名
*
* @discussion 如果类名在黑名单内就会关闭所有处于曝光状态的inapp
* @discussion
通过定向页面触发应用内消息下发的功能、页面跳转到黑名单页面隐藏正在曝光中的inapp的功能、inapp页面延迟展示功能都依赖于该接口调用。
请在页面切换的时候调用此方法。确保在所有页面的viewDidAppear中调用此方法。不然可能会造成inapp部分功能不完善。建议在viewController的基类中调用或者使用method swizzling方法交换viewController的viewDidAppear方法。
*
*/
+ (void)currentViewControllerName:(NSString *)className;
/*!
* @abstract 通过定向页面触发应用内消息下发
*
* @param pageName 当前页面的类名
*
* @discussion 请在页面切换的时候调用此方法。确保在所有页面的viewDidAppear中调用此方法。不然可能会造成该功能不完善。建议在viewController的基类中调用或者使用method swizzling方法交换viewController的viewDidAppear方法。
*
*/
+ (void)triggerInMessageByPageChange:(NSString *)pageName __attribute__((deprecated("JPush 3.7.4 版本已过期")));
///----------------------------------------------------
///********************下列方法已过期********************
///**************请使用新版tag/alias操作接口**************
@@ -765,6 +824,20 @@ callbackSelector:(SEL)cbSelector
@end
@protocol JPUSHGeofenceDelegate <NSObject>
/**
触发地理围栏
@param geofence 地理围栏触发时返回的信息
@param error 错误信息
*/
- (void)jpushGeofenceRegion:(NSDictionary *)geofence
error:(NSError *)error;
/**
拉取地理围栏列表的回调
@param geofenceList 地理围栏列表
*/
- (void)jpushCallbackGeofenceReceived:(NSArray<NSDictionary*> *)geofenceList;
/**
进入地理围栏区域
@@ -773,7 +846,7 @@ callbackSelector:(SEL)cbSelector
@param userInfo 地理围栏触发时返回的信息
@param error 错误信息
*/
- (void)jpushGeofenceIdentifer:(NSString *)geofenceId didEnterRegion:(NSDictionary *)userInfo error:(NSError *)error;
- (void)jpushGeofenceIdentifer:(NSString *)geofenceId didEnterRegion:(NSDictionary *)userInfo error:(NSError *)error __attribute__((deprecated("JPush 3.6.0 版本已过期")));
/**
离开地理围栏区域
@@ -782,7 +855,8 @@ callbackSelector:(SEL)cbSelector
@param userInfo 地理围栏触发时返回的信息
@param error 错误信息
*/
- (void)jpushGeofenceIdentifer:(NSString *)geofenceId didExitRegion:(NSDictionary *)userInfo error:(NSError *)error;
- (void)jpushGeofenceIdentifer:(NSString *)geofenceId didExitRegion:(NSDictionary *)userInfo error:(NSError *)error __attribute__((deprecated("JPush 3.6.0 版本已过期")));
@end
@@ -797,7 +871,7 @@ callbackSelector:(SEL)cbSelector
/**
*应用内消息展示的回调
*/
- (void)jPushInMessageAlreadyPop __attribute__((deprecated("JPush 3.4.0 版本已过期")));;
- (void)jPushInMessageAlreadyPop __attribute__((deprecated("JPush 3.4.0 版本已过期")));
/**
*应用内消息已消失

View File

@@ -482,6 +482,20 @@ JPushPlugin.prototype.setBadgeNumber = function(badgeNumb) {
}
};
/**
* 设置手机号。
*
* @param params = { 'sequence': number, 'mobileNumber': string }
*/
JPushPlugin.prototype.setMobileNumber = function(
params,
successCallback,
errorCallback
) {
this.callNative("setMobileNumber", [params], successCallback, errorCallback);
};
if (!window.plugins) {
window.plugins = {};
}