Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
aliyun_push_clx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
aliyun_push_clx
Commits
2f5bc510
提交
2f5bc510
authored
9月 16, 2025
作者:
史晓晨
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:iOS消息内容处理
上级
19fa2224
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
116 行增加
和
63 行删除
+116
-63
AliyunPushPlugin.m
ios/Classes/AliyunPushPlugin.m
+116
-63
没有找到文件。
ios/Classes/AliyunPushPlugin.m
浏览文件 @
2f5bc510
...
@@ -50,15 +50,15 @@ static BOOL logEnable = NO;
...
@@ -50,15 +50,15 @@ static BOOL logEnable = NO;
// iOS 10通知中心
// iOS 10通知中心
UNUserNotificationCenter
*
_notificationCenter
;
UNUserNotificationCenter
*
_notificationCenter
;
BOOL
_showNoticeWhenForeground
;
BOOL
_showNoticeWhenForeground
;
NSData
*
_deviceToken
;
NSData
*
_deviceToken
;
NSDictionary
*
_remoteNotification
;
NSDictionary
*
_remoteNotification
;
}
}
+
(
void
)
registerWithRegistrar
:
(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
{
+
(
void
)
registerWithRegistrar
:
(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
{
FlutterMethodChannel
*
channel
=
[
FlutterMethodChannel
FlutterMethodChannel
*
channel
=
[
FlutterMethodChannel
methodChannelWithName
:
@"aliyun_push"
methodChannelWithName
:
@"aliyun_push"
binaryMessenger
:[
registrar
messenger
]];
binaryMessenger
:[
registrar
messenger
]];
AliyunPushPlugin
*
instance
=
[[
AliyunPushPlugin
alloc
]
init
];
AliyunPushPlugin
*
instance
=
[[
AliyunPushPlugin
alloc
]
init
];
instance
.
channel
=
channel
;
instance
.
channel
=
channel
;
[
registrar
addApplicationDelegate
:
instance
];
[
registrar
addApplicationDelegate
:
instance
];
[
registrar
addMethodCallDelegate
:
instance
channel
:
channel
];
[
registrar
addMethodCallDelegate
:
instance
channel
:
channel
];
...
@@ -66,7 +66,8 @@ static BOOL logEnable = NO;
...
@@ -66,7 +66,8 @@ static BOOL logEnable = NO;
-
(
BOOL
)
application
:
(
UIApplication
*
)
application
didFinishLaunchingWithOptions
:
(
NSDictionary
*
)
launchOptions
{
-
(
BOOL
)
application
:
(
UIApplication
*
)
application
didFinishLaunchingWithOptions
:
(
NSDictionary
*
)
launchOptions
{
NSLog
(
@"###### didFinishLaunchingWithOptions launchOptions %@"
,
launchOptions
);
NSLog
(
@"###### didFinishLaunchingWithOptions launchOptions %@"
,
launchOptions
);
if
(
launchOptions
&&
[
launchOptions
valueForKey
:
UIApplicationLaunchOptionsRemoteNotificationKey
])
{
if
(
launchOptions
&&
[
launchOptions
valueForKey
:
UIApplicationLaunchOptionsRemoteNotificationKey
])
{
_remoteNotification
=
[
launchOptions
valueForKey
:
UIApplicationLaunchOptionsRemoteNotificationKey
];
_remoteNotification
=
[
launchOptions
valueForKey
:
UIApplicationLaunchOptionsRemoteNotificationKey
];
}
}
return
YES
;
return
YES
;
...
@@ -75,10 +76,13 @@ static BOOL logEnable = NO;
...
@@ -75,10 +76,13 @@ static BOOL logEnable = NO;
/*
/*
* APNs注册成功回调,将返回的deviceToken上传到CloudPush服务器
* APNs注册成功回调,将返回的deviceToken上传到CloudPush服务器
*/
*/
-
(
void
)
application
:
(
UIApplication
*
)
application
didRegisterForRemoteNotificationsWithDeviceToken
:
(
nonnull
NSData
*
)
deviceToken
{
-
(
void
)
application
:
(
UIApplication
*
)
application
didRegisterForRemoteNotificationsWithDeviceToken
:
(
nonnull
NSData
*
)
deviceToken
{
[
CloudPushSDK
registerDevice
:
deviceToken
withCallback
:
^
(
CloudPushCallbackResult
*
res
)
{
[
CloudPushSDK
registerDevice
:
deviceToken
withCallback
:
^
(
CloudPushCallbackResult
*
res
)
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
PushLogD
(
@"Register deviceToken successfully, deviceToken: %@"
,
[
CloudPushSDK
getApnsDeviceToken
]);
PushLogD
(
@"Register deviceToken successfully, deviceToken: %@"
,
[
CloudPushSDK
getApnsDeviceToken
]);
NSMutableDictionary
*
dic
=
[
NSMutableDictionary
dictionary
];
NSMutableDictionary
*
dic
=
[
NSMutableDictionary
dictionary
];
[
dic
setValue
:[
CloudPushSDK
getApnsDeviceToken
]
forKey
:
@"apnsDeviceToken"
];
[
dic
setValue
:[
CloudPushSDK
getApnsDeviceToken
]
forKey
:
@"apnsDeviceToken"
];
[
self
.
channel
invokeMethod
:
@"onRegisterDeviceTokenSuccess"
arguments
:
dic
];
[
self
.
channel
invokeMethod
:
@"onRegisterDeviceTokenSuccess"
arguments
:
dic
];
...
@@ -102,11 +106,14 @@ static BOOL logEnable = NO;
...
@@ -102,11 +106,14 @@ static BOOL logEnable = NO;
PushLogD
(
@"####### ===> APNs register failed, %@"
,
error
);
PushLogD
(
@"####### ===> APNs register failed, %@"
,
error
);
}
}
-
(
void
)
registerAPNS
{
-
(
void
)
registerAPNS
{
_notificationCenter
=
[
UNUserNotificationCenter
currentNotificationCenter
];
_notificationCenter
=
[
UNUserNotificationCenter
currentNotificationCenter
];
_notificationCenter
.
delegate
=
self
;
_notificationCenter
.
delegate
=
self
;
// 请求推送权限
// 请求推送权限
[
_notificationCenter
requestAuthorizationWithOptions
:
UNAuthorizationOptionAlert
|
UNAuthorizationOptionBadge
|
UNAuthorizationOptionSound
completionHandler
:
^
(
BOOL
granted
,
NSError
*
_Nullable
error
)
{
[
_notificationCenter
requestAuthorizationWithOptions
:
UNAuthorizationOptionAlert
|
UNAuthorizationOptionBadge
|
UNAuthorizationOptionSound
completionHandler
:
^
(
BOOL
granted
,
NSError
*
_Nullable
error
)
{
if
(
granted
)
{
if
(
granted
)
{
// granted
// granted
PushLogD
(
@"####### ===> User authored notification."
);
PushLogD
(
@"####### ===> User authored notification."
);
...
@@ -121,15 +128,19 @@ static BOOL logEnable = NO;
...
@@ -121,15 +128,19 @@ static BOOL logEnable = NO;
}];
}];
}
}
-
(
BOOL
)
application
:
(
UIApplication
*
)
application
didReceiveRemoteNotification
:
(
nonnull
NSDictionary
*
)
userInfo
fetchCompletionHandler
:
(
nonnull
void
(
^
)(
UIBackgroundFetchResult
))
completionHandler
{
-
(
BOOL
)
application
:
(
UIApplication
*
)
application
didReceiveRemoteNotification
:
(
nonnull
NSDictionary
*
)
userInfo
fetchCompletionHandler
:
(
nonnull
void
(
^
)(
UIBackgroundFetchResult
))
completionHandler
{
PushLogD
(
@"onNotification, userInfo = [%@]"
,
userInfo
);
PushLogD
(
@"onNotification, userInfo = [%@]"
,
userInfo
);
NSLog
(
@"###### onNotification userInfo = [%@]"
,
userInfo
);
NSLog
(
@"###### onNotification userInfo = [%@]"
,
userInfo
);
[
CloudPushSDK
sendNotificationAck
:
userInfo
];
[
CloudPushSDK
sendNotificationAck
:
userInfo
];
[
self
.
channel
invokeMethod
:
@"onNotification"
arguments
:
userInfo
];
[
self
.
channel
invokeMethod
:
@"onNotification"
arguments
:
userInfo
];
if
(
_remoteNotification
&&
userInfo
)
{
if
(
_remoteNotification
&&
userInfo
)
{
NSString
*
msgId
=
[
userInfo
valueForKey
:
@"m"
];
NSString
*
msgId
=
[
userInfo
valueForKey
:
@"m"
];
NSString
*
remoteMsgId
=
[
_remoteNotification
valueForKey
:
@"m"
];
NSString
*
remoteMsgId
=
[
_remoteNotification
valueForKey
:
@"m"
];
if
(
msgId
&&
remoteMsgId
&&
[
msgId
isEqualToString
:
remoteMsgId
])
{
if
(
msgId
&&
remoteMsgId
&&
[
msgId
isEqualToString
:
remoteMsgId
])
{
[
CloudPushSDK
sendNotificationAck
:
_remoteNotification
];
[
CloudPushSDK
sendNotificationAck
:
_remoteNotification
];
NSLog
(
@"###### onNotificationOpened argument = [%@]"
,
_remoteNotification
);
NSLog
(
@"###### onNotificationOpened argument = [%@]"
,
_remoteNotification
);
...
@@ -140,7 +151,7 @@ static BOOL logEnable = NO;
...
@@ -140,7 +151,7 @@ static BOOL logEnable = NO;
completionHandler
(
UIBackgroundFetchResultNewData
);
completionHandler
(
UIBackgroundFetchResultNewData
);
return
YES
;
return
YES
;
}
}
-
(
void
)
handleiOS10Notification
:
(
UNNotification
*
)
notification
isSendAck
:
(
BOOL
)
isSendAck
{
-
(
void
)
handleiOS10Notification
:
(
UNNotification
*
)
notification
isSendAck
:
(
BOOL
)
isSendAck
{
...
@@ -148,10 +159,44 @@ static BOOL logEnable = NO;
...
@@ -148,10 +159,44 @@ static BOOL logEnable = NO;
UNNotificationContent
*
content
=
request
.
content
;
UNNotificationContent
*
content
=
request
.
content
;
NSDictionary
*
userInfo
=
content
.
userInfo
;
NSDictionary
*
userInfo
=
content
.
userInfo
;
// 通知时间
NSDate
*
noticeDate
=
notification
.
date
;
// 标题
NSString
*
title
=
content
.
title
;
// 副标题
NSString
*
subtitle
=
content
.
subtitle
;
// 内容
NSString
*
body
=
content
.
body
;
// 角标
int
badge
=
[
content
.
badge
intValue
];
// 取得通知自定义字段内容,例:获取key为"Extras"的内容
// NSString *extras = [userInfo valueForKey:@"Extras"];
// 通知角标数清0
// 通知角标数清0
[
UIApplication
sharedApplication
].
applicationIconBadgeNumber
=
0
;
[
UIApplication
sharedApplication
].
applicationIconBadgeNumber
=
0
;
// 同步角标数到服务端
// 同步角标数到服务端
[
self
syncBadgeNum
:
0
result
:
nil
];
// [self syncBadgeNum:0];
// 通知打开回执上报
[
CloudPushSDK
sendNotificationAck
:
extras
];
NSMutableDictionary
*
result
=
[[
NSMutableDictionary
alloc
]
init
];
NSLog
(
@"Notification, date: %@, title: %@, subtitle: %@, body: %@, badge: %d, extras: %@."
,
noticeDate
,
title
,
subtitle
,
body
,
badge
,
extras
);
if
(
title
!=
nil
)
{
result
[
@"title"
]
=
title
;
}
if
(
body
!=
nil
)
{
result
[
@"summary"
]
=
body
;
}
if
(
extras
!=
nil
)
{
result
[
@"extras"
]
=
[
self
convertToJsonData
:
extras
];
}
if
(
subtitle
!=
nil
)
{
result
[
@"subtitle"
]
=
subtitle
;
}
if
(
badge
!=
nil
)
{
result
[
@"badge"
]
=
@
(
badge
);
}
if
(
request
.
identifier
!=
nil
)
{
result
[
@"messageId"
]
=
request
.
identifier
;
}
// 通知打开回执上报
// 通知打开回执上报
[
CloudPushSDK
sendNotificationAck
:
userInfo
];
[
CloudPushSDK
sendNotificationAck
:
userInfo
];
...
@@ -163,22 +208,24 @@ static BOOL logEnable = NO;
...
@@ -163,22 +208,24 @@ static BOOL logEnable = NO;
/*
/*
APP处于前台时收到通知(iOS 10+)
APP处于前台时收到通知(iOS 10+)
*/
*/
-
(
void
)
userNotificationCenter
:
(
UNUserNotificationCenter
*
)
center
willPresentNotification
:
(
UNNotification
*
)
notification
withCompletionHandler
:
(
void
(
^
)(
UNNotificationPresentationOptions
))
completionHandler
{
-
(
void
)
userNotificationCenter
:
(
UNUserNotificationCenter
*
)
center
willPresentNotification
:
(
UNNotification
*
)
notification
withCompletionHandler
:
(
void
(
^
)(
if
(
_showNoticeWhenForeground
)
{
UNNotificationPresentationOptions
))
completionHandler
{
// 通知弹出,且带有声音、内容和角标
// if(_showNoticeWhenForeground) {
completionHandler
(
UNNotificationPresentationOptionSound
|
UNNotificationPresentationOptionAlert
|
UNNotificationPresentationOptionBadge
);
// // 通知弹出,且带有声音、内容和角标
}
else
{
// completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);
// } else {
// 处理iOS 10通知,并上报通知打开回执
// 处理iOS 10通知,并上报通知打开回执
[
self
handleiOS10Notification
:
notification
isSendAck
:
YES
];
[
self
handleiOS10Notification
:
notification
isSendAck
:
YES
];
// 通知不弹出
// 通知不弹出
completionHandler
(
UNNotificationPresentationOptionNone
);
completionHandler
(
UNNotificationPresentationOptionNone
);
}
//
}
}
}
/**
/**
* 触发通知动作时回调,比如点击、删除通知和点击自定义action(iOS 10+)
* 触发通知动作时回调,比如点击、删除通知和点击自定义action(iOS 10+)
*/
*/
-
(
void
)
userNotificationCenter
:
(
UNUserNotificationCenter
*
)
center
didReceiveNotificationResponse
:
(
UNNotificationResponse
*
)
response
withCompletionHandler
:
(
void
(
^
)(
void
))
completionHandler
{
-
(
void
)
userNotificationCenter
:
(
UNUserNotificationCenter
*
)
center
didReceiveNotificationResponse
:
(
UNNotificationResponse
*
)
response
withCompletionHandler
:
(
void
(
^
)(
void
))
completionHandler
{
NSString
*
userAction
=
response
.
actionIdentifier
;
NSString
*
userAction
=
response
.
actionIdentifier
;
// 点击通知打开
// 点击通知打开
if
([
userAction
isEqualToString
:
UNNotificationDefaultActionIdentifier
])
{
if
([
userAction
isEqualToString
:
UNNotificationDefaultActionIdentifier
])
{
...
@@ -197,7 +244,7 @@ static BOOL logEnable = NO;
...
@@ -197,7 +244,7 @@ static BOOL logEnable = NO;
completionHandler
();
completionHandler
();
}
}
-
(
void
)
handleMethodCall
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
-
(
void
)
handleMethodCall
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
if
([
@"initPushSdk"
isEqualToString
:
call
.
method
])
{
if
([
@"initPushSdk"
isEqualToString
:
call
.
method
])
{
[
self
initPushSdk
:
call
result
:
result
];
[
self
initPushSdk
:
call
result
:
result
];
}
else
if
([
@"getDeviceId"
isEqualToString
:
call
.
method
])
{
}
else
if
([
@"getDeviceId"
isEqualToString
:
call
.
method
])
{
...
@@ -247,7 +294,7 @@ static BOOL logEnable = NO;
...
@@ -247,7 +294,7 @@ static BOOL logEnable = NO;
}
}
}
}
-
(
void
)
initPushSdk
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
-
(
void
)
initPushSdk
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
NSDictionary
*
arguments
=
call
.
arguments
;
NSDictionary
*
arguments
=
call
.
arguments
;
NSString
*
appKey
=
arguments
[
@"appKey"
];
NSString
*
appKey
=
arguments
[
@"appKey"
];
NSString
*
appSecret
=
arguments
[
@"appSecret"
];
NSString
*
appSecret
=
arguments
[
@"appSecret"
];
...
@@ -258,14 +305,15 @@ static BOOL logEnable = NO;
...
@@ -258,14 +305,15 @@ static BOOL logEnable = NO;
[
self
registerAPNS
];
[
self
registerAPNS
];
//初始化
//初始化
[
CloudPushSDK
startWithAppkey
:
appKey
appSecret
:
appSecret
callback
:^
(
CloudPushCallbackResult
*
_Nonnull
res
)
{
[
CloudPushSDK
startWithAppkey
:
appKey
appSecret
:
appSecret
callback
:^
(
CloudPushCallbackResult
*
_Nonnull
res
)
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
PushLogD
(
@"Push SDK init success, deviceId: %@."
,
[
CloudPushSDK
getDeviceId
]);
PushLogD
(
@"Push SDK init success, deviceId: %@."
,
[
CloudPushSDK
getDeviceId
]);
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
}
else
{
}
else
{
PushLogD
(
@"###### Push SDK init failed, error: %@"
,
res
.
error
);
PushLogD
(
@"###### Push SDK init failed, error: %@"
,
res
.
error
);
NSLog
(
@"=======> Push SDK init failed, error: %@"
,
res
.
error
);
NSLog
(
@"=======> Push SDK init failed, error: %@"
,
res
.
error
);
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
}
}
}];
}];
// 监听推送通道打开动作
// 监听推送通道打开动作
...
@@ -274,6 +322,7 @@ static BOOL logEnable = NO;
...
@@ -274,6 +322,7 @@ static BOOL logEnable = NO;
}
}
#pragma mark Channel Opened
#pragma mark Channel Opened
/**
/**
* 注册推送通道打开监听
* 注册推送通道打开监听
*/
*/
...
@@ -293,6 +342,7 @@ static BOOL logEnable = NO;
...
@@ -293,6 +342,7 @@ static BOOL logEnable = NO;
}
}
#pragma mark Receive Message
#pragma mark Receive Message
/**
/**
* @brief 注册推送消息到来监听
* @brief 注册推送消息到来监听
*/
*/
...
@@ -323,7 +373,7 @@ static BOOL logEnable = NO;
...
@@ -323,7 +373,7 @@ static BOOL logEnable = NO;
}
}
/* 设置SDK的日志级别 */
/* 设置SDK的日志级别 */
-
(
void
)
setLogLevel
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
-
(
void
)
setLogLevel
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
NSDictionary
*
arguments
=
call
.
arguments
;
NSDictionary
*
arguments
=
call
.
arguments
;
NSString
*
levelString
=
arguments
[
@"level"
];
NSString
*
levelString
=
arguments
[
@"level"
];
...
@@ -348,7 +398,7 @@ static BOOL logEnable = NO;
...
@@ -348,7 +398,7 @@ static BOOL logEnable = NO;
}
}
/* 设置角标个数 */
/* 设置角标个数 */
-
(
void
)
setBadgeNum
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
-
(
void
)
setBadgeNum
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
NSDictionary
*
arguments
=
call
.
arguments
;
NSDictionary
*
arguments
=
call
.
arguments
;
[
UIApplication
sharedApplication
].
applicationIconBadgeNumber
=
[
arguments
[
@"badgeNum"
]
integerValue
];
[
UIApplication
sharedApplication
].
applicationIconBadgeNumber
=
[
arguments
[
@"badgeNum"
]
integerValue
];
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
...
@@ -358,12 +408,13 @@ static BOOL logEnable = NO;
...
@@ -358,12 +408,13 @@ static BOOL logEnable = NO;
-
(
void
)
syncBadgeNum
:
(
NSUInteger
)
badgeNum
result
:
(
FlutterResult
)
result
{
-
(
void
)
syncBadgeNum
:
(
NSUInteger
)
badgeNum
result
:
(
FlutterResult
)
result
{
[
CloudPushSDK
syncBadgeNum
:
badgeNum
withCallback
:
^
(
CloudPushCallbackResult
*
res
)
{
[
CloudPushSDK
syncBadgeNum
:
badgeNum
withCallback
:
^
(
CloudPushCallbackResult
*
res
)
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
PushLogD
(
@"Sync badge num: [%lu] success."
,
(
unsigned
long
)
badgeNum
);
PushLogD
(
@"Sync badge num: [%lu] success."
,
(
unsigned
long
)
badgeNum
);
if
(
result
)
{
if
(
result
)
{
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
}
}
}
else
{
}
else
{
PushLogD
(
@"Sync badge num: [%lu] failed, error: %@"
,
(
unsigned
long
)
badgeNum
,
res
.
error
);
PushLogD
(
@"Sync badge num: [%lu] failed, error: %@"
,
(
unsigned
long
)
badgeNum
,
res
.
error
);
if
(
result
)
{
if
(
result
)
{
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
}
}
...
@@ -375,12 +426,12 @@ static BOOL logEnable = NO;
...
@@ -375,12 +426,12 @@ static BOOL logEnable = NO;
result
([
CloudPushSDK
getDeviceId
]);
result
([
CloudPushSDK
getDeviceId
]);
}
}
-
(
void
)
showNoticeWhenForeground
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
-
(
void
)
showNoticeWhenForeground
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
NSDictionary
*
arguments
=
call
.
arguments
;
NSDictionary
*
arguments
=
call
.
arguments
;
NSNumber
*
enableNumber
=
arguments
[
@"enable"
];
NSNumber
*
enableNumber
=
arguments
[
@"enable"
];
BOOL
enable
=
[
enableNumber
boolValue
];
BOOL
enable
=
[
enableNumber
boolValue
];
_showNoticeWhenForeground
=
enable
;
_showNoticeWhenForeground
=
enable
;
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
}
}
-
(
void
)
getApnsDeviceToken
:
(
FlutterResult
)
result
{
-
(
void
)
getApnsDeviceToken
:
(
FlutterResult
)
result
{
...
@@ -389,12 +440,12 @@ static BOOL logEnable = NO;
...
@@ -389,12 +440,12 @@ static BOOL logEnable = NO;
-
(
void
)
bindAccount
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
-
(
void
)
bindAccount
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
NSDictionary
*
arguments
=
call
.
arguments
;
NSDictionary
*
arguments
=
call
.
arguments
;
NSString
*
account
=
arguments
[
@"account"
];
NSString
*
account
=
arguments
[
@"account"
];
[
CloudPushSDK
bindAccount
:
account
withCallback
:
^
(
CloudPushCallbackResult
*
res
)
{
[
CloudPushSDK
bindAccount
:
account
withCallback
:
^
(
CloudPushCallbackResult
*
res
)
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
}
else
{
}
else
{
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
}
}
}];
}];
}
}
...
@@ -402,33 +453,33 @@ static BOOL logEnable = NO;
...
@@ -402,33 +453,33 @@ static BOOL logEnable = NO;
-
(
void
)
unbindAccount
:
(
FlutterResult
)
result
{
-
(
void
)
unbindAccount
:
(
FlutterResult
)
result
{
[
CloudPushSDK
unbindAccount
:
^
(
CloudPushCallbackResult
*
res
)
{
[
CloudPushSDK
unbindAccount
:
^
(
CloudPushCallbackResult
*
res
)
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
}
else
{
}
else
{
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
}
}
}];
}];
}
}
-
(
void
)
addAlias
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
-
(
void
)
addAlias
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
NSDictionary
*
arguments
=
call
.
arguments
;
NSDictionary
*
arguments
=
call
.
arguments
;
NSString
*
alias
=
arguments
[
@"alias"
];
NSString
*
alias
=
arguments
[
@"alias"
];
[
CloudPushSDK
addAlias
:
alias
withCallback
:
^
(
CloudPushCallbackResult
*
res
)
{
[
CloudPushSDK
addAlias
:
alias
withCallback
:
^
(
CloudPushCallbackResult
*
res
)
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
}
else
{
}
else
{
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
}
}
}];
}];
}
}
-
(
void
)
removeAlias
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
-
(
void
)
removeAlias
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
NSDictionary
*
arguments
=
call
.
arguments
;
NSDictionary
*
arguments
=
call
.
arguments
;
NSString
*
alias
=
arguments
[
@"alias"
];
NSString
*
alias
=
arguments
[
@"alias"
];
[
CloudPushSDK
removeAlias
:
alias
withCallback
:
^
(
CloudPushCallbackResult
*
res
)
{
[
CloudPushSDK
removeAlias
:
alias
withCallback
:
^
(
CloudPushCallbackResult
*
res
)
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
}
else
{
}
else
{
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
}
}
}];
}];
}
}
...
@@ -436,18 +487,18 @@ static BOOL logEnable = NO;
...
@@ -436,18 +487,18 @@ static BOOL logEnable = NO;
-
(
void
)
listAlias
:
(
FlutterResult
)
result
{
-
(
void
)
listAlias
:
(
FlutterResult
)
result
{
[
CloudPushSDK
listAliases
:
^
(
CloudPushCallbackResult
*
res
)
{
[
CloudPushSDK
listAliases
:
^
(
CloudPushCallbackResult
*
res
)
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
result
(@{
KEY_CODE
:
CODE_SUCCESS
,
@"aliasList"
:
res
.
data
});
result
(@{
KEY_CODE
:
CODE_SUCCESS
,
@"aliasList"
:
res
.
data
});
}
else
{
}
else
{
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
}
}
}];
}];
}
}
-
(
void
)
bindTag
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
-
(
void
)
bindTag
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
NSDictionary
*
arguments
=
call
.
arguments
;
NSDictionary
*
arguments
=
call
.
arguments
;
NSArray
*
tags
=
arguments
[
@"tags"
];
NSArray
*
tags
=
arguments
[
@"tags"
];
NSString
*
alias
=
arguments
[
@"alias"
];
NSString
*
alias
=
arguments
[
@"alias"
];
id
targetObj
=
arguments
[
@"target"
];
id
targetObj
=
arguments
[
@"target"
];
int
target
;
int
target
;
...
@@ -456,21 +507,22 @@ static BOOL logEnable = NO;
...
@@ -456,21 +507,22 @@ static BOOL logEnable = NO;
}
else
{
}
else
{
target
=
[
targetObj
intValue
];
target
=
[
targetObj
intValue
];
}
}
[
CloudPushSDK
bindTag
:
target
withTags
:
tags
withAlias
:
alias
withCallback
:^
(
CloudPushCallbackResult
*
res
){
[
CloudPushSDK
bindTag
:
target
withTags
:
tags
withAlias
:
alias
withCallback
:^
(
CloudPushCallbackResult
*
res
)
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
}
else
{
}
else
{
PushLogD
(
@"#### ===> %@"
,
res
.
error
);
PushLogD
(
@"#### ===> %@"
,
res
.
error
);
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
}
}
}];
}];
}
}
-
(
void
)
unbindTag
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
-
(
void
)
unbindTag
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
NSDictionary
*
arguments
=
call
.
arguments
;
NSDictionary
*
arguments
=
call
.
arguments
;
NSArray
*
tags
=
arguments
[
@"tags"
];
NSArray
*
tags
=
arguments
[
@"tags"
];
NSString
*
alias
=
arguments
[
@"alias"
];
NSString
*
alias
=
arguments
[
@"alias"
];
id
targetObj
=
arguments
[
@"target"
];
id
targetObj
=
arguments
[
@"target"
];
int
target
;
int
target
;
...
@@ -479,16 +531,17 @@ static BOOL logEnable = NO;
...
@@ -479,16 +531,17 @@ static BOOL logEnable = NO;
}
else
{
}
else
{
target
=
[
targetObj
intValue
];
target
=
[
targetObj
intValue
];
}
}
[
CloudPushSDK
unbindTag
:
target
withTags
:
tags
withAlias
:
alias
withCallback
:^
(
CloudPushCallbackResult
*
res
){
[
CloudPushSDK
unbindTag
:
target
withTags
:
tags
withAlias
:
alias
withCallback
:^
(
CloudPushCallbackResult
*
res
)
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
result
(@{
KEY_CODE
:
CODE_SUCCESS
});
}
else
{
}
else
{
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
}
}
}];
}];
}
}
-
(
void
)
listTags
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
-
(
void
)
listTags
:
(
FlutterMethodCall
*
)
call
result
:
(
FlutterResult
)
result
{
NSDictionary
*
arguments
=
call
.
arguments
;
NSDictionary
*
arguments
=
call
.
arguments
;
id
targetObj
=
arguments
[
@"target"
];
id
targetObj
=
arguments
[
@"target"
];
int
target
;
int
target
;
...
@@ -499,9 +552,9 @@ static BOOL logEnable = NO;
...
@@ -499,9 +552,9 @@ static BOOL logEnable = NO;
}
}
[
CloudPushSDK
listTags
:
target
withCallback
:
^
(
CloudPushCallbackResult
*
res
)
{
[
CloudPushSDK
listTags
:
target
withCallback
:
^
(
CloudPushCallbackResult
*
res
)
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
result
(@{
KEY_CODE
:
CODE_SUCCESS
,
@"tagsList"
:
res
.
data
});
result
(@{
KEY_CODE
:
CODE_SUCCESS
,
@"tagsList"
:
res
.
data
});
}
else
{
}
else
{
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
result
(@{
KEY_CODE
:
CODE_FAILED
,
KEY_ERROR_MSG
:
[
self
stringFromError
:
res
.
error
]});
}
}
}];
}];
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论