forked from GetuiLaboratory/getui-sdk-ios-cocoapods
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckCode.sh
122 lines (108 loc) · 5.8 KB
/
checkCode.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/sh
PACKAGENAME="xcworkspace"
APPDELEGATE_H="AppDelegate.h"
APPDELEGATE_M="AppDelegate.m"
PLIST="Info.plist"
ENTITLEMENTS="entitlements"
ergodic() {
for file in ` ls `
do
if [ ${file##*.} = $PACKAGENAME ]; then
cd `dirname $0`/${file%.*}
count=`ls |grep *${ENTITLEMENTS} |wc -l`
for file in ` ls `
do
#echo $file
if [ ${file} = $APPDELEGATE_H ]; then
GTSDKLine=`sed -n '/#import <GTSDK\/GeTuiSdk.h>/=' $APPDELEGATE_H`
if [[ -z $GTSDKLine ]]; then
echo 需要在${APPDELEGATE_H}添加个推SDK的头文件\<GTSDK/GeTuiSdk.h\>
fi
GeTuiSdkDelegateLine=`sed -n '/GeTuiSdkDelegate/=' $APPDELEGATE_H`
if [[ -z $GeTuiSdkDelegateLine ]]; then
echo 需要在${APPDELEGATE_H}遵守GeTuiSdk的代理
fi
fi
if [ ${file} = $APPDELEGATE_M ]; then
UserNotificationsLine=`sed -n '/#import <UserNotifications\/UserNotifications.h>/=' $APPDELEGATE_M`
if [[ -z $UserNotificationsLine ]]; then
echo 需要在${APPDELEGATE_M}添加UserNotifications的头文件\<UserNotifications/UserNotifications.h\>
fi
StartSdkWithAppIdLine=`sed -n '/startSdkWithAppId:/=' $APPDELEGATE_M`
if [[ -z $StartSdkWithAppIdLine ]]; then
echo 需要在${APPDELEGATE_M}的didFinishLaunchingWithOptions方法里添加启动个推SDK
fi
TransferRegistRemoteNotiLine=`sed -n '/[self registerRemoteNotification];/=' $APPDELEGATE_M`
if [[ -z $TransferRegistRemoteNotiLine ]]; then
echo 需要在${APPDELEGATE_M}的didFinishLaunchingWithOptions方法里添加注册APNs
fi
RegisterRemoteNotiLine=`sed -n '/(void)registerRemoteNotification/=' $APPDELEGATE_M`
if [[ -z $RegisterRemoteNotiLine ]]; then
echo 需要在${APPDELEGATE_M}添加registerRemoteNotification方法
fi
DidRegistFRNWDeviceTokenLine=`sed -n '/didRegisterForRemoteNotificationsWithDeviceToken/=' $APPDELEGATE_M`
if [[ -z $DidRegistFRNWDeviceTokenLine ]]; then
echo 需要在${APPDELEGATE_M}添加didRegisterForRemoteNotificationsWithDeviceToken方法
else
RegisterDeviceTokenToGTLine=`sed -n '/[GeTuiSdk registerDeviceToken:]/=' $APPDELEGATE_M`
if [[ -z $RegisterDeviceTokenToGTLine ]]; then
echo 需要在${APPDELEGATE_M}的didRegisterForRemoteNotificationsWithDeviceToken方法里添加向个推服务器注册deviceToken
fi
fi
DidReceiveRemoteNotificationLine=`sed -n '/didReceiveRemoteNotification/=' $APPDELEGATE_M`
if [[ -z $DidReceiveRemoteNotificationLine ]]; then
echo 需要在${APPDELEGATE_M}添加didReceiveRemoteNotification方法
else
HandleRemoteNotificationLine=`sed -n '/[GeTuiSdk handleRemoteNotification:]/=' $APPDELEGATE_M`
if [[ -z $HandleRemoteNotificationLine ]]; then
echo 需要在${APPDELEGATE_M}的didReceiveRemoteNotification方法里添加将收到的APNs信息传给个推统计
fi
fi
DidReceiveNotificationResponseLine=`sed -n '/didReceiveNotificationResponse/=' $APPDELEGATE_M`
if [[ -z $DidReceiveNotificationResponseLine ]]; then
echo 需要在${APPDELEGATE_M}添加didReceiveNotificationResponse方法
else
HandleRemoteNotification10Line=`sed -n '/[GeTuiSdk handleRemoteNotification:]/=' $APPDELEGATE_M`
if [[ -z $HandleRemoteNotification10Line ]]; then
echo 需要在${APPDELEGATE_M}的didReceiveRemoteNotification方法里添加将收到的APNs信息传给个推统计
fi
fi
RegisterClientLine=`sed -n '/GeTuiSdkDidRegisterClient/=' $APPDELEGATE_M`
if [[ -z $RegisterClientLine ]]; then
echo 需要在${APPDELEGATE_M}添加GeTuiSdkDidRegisterClient方法
else
ClientIdLine=`sed -n '/[GeTuiSdk RegisterClient]/=' $APPDELEGATE_M`
if [[ -z $ClientIdLine ]]; then
echo 需要在${APPDELEGATE_M}的GeTuiSdkDidRegisterClient方法里添加个推SDK注册后返回的clientId
fi
fi
ReceivePayLoadDataLine=`sed -n '/GeTuiSdkDidReceivePayloadData/=' $APPDELEGATE_M`
if [[ -z $ReceivePayLoadDataLine ]]; then
echo 需要在${APPDELEGATE_M}添加GeTuiSdkDidReceivePayloadData方法
else
PayLoadDataLine=`sed -n '/[GeTuiSdk sendFeedbackMessage:]/=' $APPDELEGATE_M`
if [[ -z $PayLoadDataLine ]]; then
echo 需要在${APPDELEGATE_M}的GeTuiSdkDidReceivePayloadData方法里添加汇报个推自定义事件\(反馈透传消息\)
fi
fi
fi
if [ ${file} = $PLIST ]; then
UIBackgroundModesLine=`sed -n '/UIBackgroundModes/=' $PLIST`
if [[ -z $UIBackgroundModesLine ]]; then
echo 需要在${PLIST}添加UIBackgroundModes权限
fi
fi
if [ ${file##*.} = $ENTITLEMENTS ]; then
ENVIRONMENTLine=`sed -n '/aps-environment/=' $file`
if [[ -z $ENVIRONMENTLine ]]; then
echo Push Notifications开关没开
fi
fi
done
if [[ $count=0 ]]; then
echo 缺少.entitlements文件
fi
fi
done
}
ergodic