| 51 | } |
| 52 | |
| 53 | function push() { |
| 54 | var result = 0; |
| 55 | var UIApplication = plus.ios.import("UIApplication"); |
| 56 | var app = UIApplication.sharedApplication(); |
| 57 | var enabledTypes = 0; |
| 58 | if (app.currentUserNotificationSettings) { |
| 59 | var settings = app.currentUserNotificationSettings(); |
| 60 | enabledTypes = settings.plusGetAttribute("types"); |
| 61 | if (enabledTypes == 0) { |
| 62 | result = 0; |
| 63 | console.log("推送权限没有开启"); |
| 64 | } else { |
| 65 | result = 1; |
| 66 | console.log("已经开启推送功能!") |
| 67 | } |
| 68 | plus.ios.deleteObject(settings); |
| 69 | } else { |
| 70 | enabledTypes = app.enabledRemoteNotificationTypes(); |
| 71 | if (enabledTypes == 0) { |
| 72 | result = 3; |
| 73 | console.log("推送权限没有开启!"); |
| 74 | } else { |
| 75 | result = 4; |
| 76 | console.log("已经开启推送功能!") |
| 77 | } |
| 78 | } |
| 79 | plus.ios.deleteObject(app); |
| 80 | plus.ios.deleteObject(UIApplication); |
| 81 | return result; |
| 82 | } |
| 83 | |
| 84 | function contact() { |
| 85 | var result = 0; |