├── .babelrc ├── .gitignore ├── .npmignore ├── LICENSE ├── RCTAliyunPush.podspec ├── README.md ├── android ├── build.gradle ├── libs │ └── alicloud-android-third-push-3.0.9.aar ├── proguard-rules.pro ├── project.properties └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── org │ │ └── wonday │ │ └── aliyun │ │ └── push │ │ ├── AliyunPushMessageReceiver.java │ │ ├── AliyunPushModule.java │ │ ├── AliyunPushPackage.java │ │ ├── MIUIUtils.java │ │ ├── SystemProperty.java │ │ └── ThirdPartMessageActivity.java │ └── res │ └── values │ └── styles.xml ├── index.js ├── ios ├── RCTAliyunPush.xcodeproj │ └── project.pbxproj ├── RCTAliyunPush │ ├── AliyunPushManager.h │ └── AliyunPushManager.m └── libs │ ├── AlicloudUtils.framework │ ├── AlicloudUtils │ ├── Headers │ │ ├── ABSBootingProtection.h │ │ ├── ABSUncaughtExceptionHandler.h │ │ ├── ABSUtil.h │ │ ├── AlicloudHTTPDNSMini.h │ │ ├── AlicloudIPv6Adapter.h │ │ ├── AlicloudReachabilityManager.h │ │ ├── AlicloudReport.h │ │ ├── AlicloudTracker.h │ │ ├── AlicloudTrackerManager.h │ │ ├── AlicloudUtils.h │ │ ├── AntilockBrakeSystem.h │ │ ├── EMASBeaconService.h │ │ ├── EMASOptions.h │ │ ├── EMASSecurityModeCommon.h │ │ ├── EMASSecurityModeManager.h │ │ ├── EMASTools.h │ │ └── UtilLog.h │ └── Modules │ │ └── module.modulemap │ ├── CloudPushSDK.framework │ ├── CloudPushSDK │ ├── Headers │ │ ├── CCPSysMessage.h │ │ ├── CloudPushCallbackResult.h │ │ ├── CloudPushSDK.h │ │ └── MPGerneralDefinition.h │ └── Modules │ │ └── module.modulemap │ ├── UTDID.framework │ ├── Headers │ │ ├── AidProtocol.h │ │ └── UTDevice.h │ ├── Info.plist │ └── UTDID │ └── UTMini.framework │ ├── Headers │ ├── AppMonitor.h │ ├── AppMonitorAlarm.h │ ├── AppMonitorBase.h │ ├── AppMonitorCounter.h │ ├── AppMonitorDimension.h │ ├── AppMonitorDimensionSet.h │ ├── AppMonitorDimensionValueSet.h │ ├── AppMonitorMeasure.h │ ├── AppMonitorMeasureSet.h │ ├── AppMonitorMeasureValue.h │ ├── AppMonitorMeasureValueSet.h │ ├── AppMonitorStat.h │ ├── AppMonitorTable.h │ ├── UT.h │ ├── UTAnalytics.h │ ├── UTBaseRequestAuthentication.h │ ├── UTCustomHitBuilder.h │ ├── UTHitBuilder.h │ ├── UTICrashCaughtListener.h │ ├── UTIRequestAuthentication.h │ ├── UTOirginalCustomHitBuilder.h │ ├── UTPageHitBuilder.h │ ├── UTSecuritySDKRequestAuthentication.h │ ├── UTTeamWork.h │ └── UTTracker.h │ ├── Info.plist │ └── UTMini ├── package.json └── sample ├── android ├── app │ ├── BUCK │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── org │ │ │ └── wonday │ │ │ ├── MainActivity.java │ │ │ └── MainApplication.java │ │ └── res │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ └── ic_launcher_s.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ └── ic_launcher_s.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ └── ic_launcher_s.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ └── ic_launcher_s.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── keystores │ ├── BUCK │ └── debug.keystore.properties └── settings.gradle ├── app.json ├── app ├── app.js └── root.js ├── index.js ├── ios ├── libs │ ├── AlicloudUtils.framework │ │ ├── AlicloudUtils │ │ ├── Headers │ │ │ ├── ABSBootingProtection.h │ │ │ ├── ABSUncaughtExceptionHandler.h │ │ │ ├── ABSUtil.h │ │ │ ├── AlicloudHTTPDNSMini.h │ │ │ ├── AlicloudIPv6Adapter.h │ │ │ ├── AlicloudReachabilityManager.h │ │ │ ├── AlicloudReport.h │ │ │ ├── AlicloudTracker.h │ │ │ ├── AlicloudTrackerManager.h │ │ │ ├── AlicloudUtils.h │ │ │ ├── AntilockBrakeSystem.h │ │ │ └── UtilLog.h │ │ └── Modules │ │ │ └── module.modulemap │ ├── CloudPushSDK.framework │ │ ├── CloudPushSDK │ │ ├── Headers │ │ │ ├── CCPSysMessage.h │ │ │ ├── CloudPushCallbackResult.h │ │ │ ├── CloudPushSDK.h │ │ │ └── MPGerneralDefinition.h │ │ └── Modules │ │ │ └── module.modulemap │ ├── UTDID.framework │ │ ├── Headers │ │ │ ├── AidProtocol.h │ │ │ └── UTDevice.h │ │ ├── Resources │ │ │ └── Info.plist │ │ └── UTDID │ └── UTMini.framework │ │ ├── Headers │ │ ├── AppMonitor.h │ │ ├── AppMonitorAlarm.h │ │ ├── AppMonitorBase.h │ │ ├── AppMonitorCounter.h │ │ ├── AppMonitorDimension.h │ │ ├── AppMonitorDimensionSet.h │ │ ├── AppMonitorDimensionValueSet.h │ │ ├── AppMonitorMeasure.h │ │ ├── AppMonitorMeasureSet.h │ │ ├── AppMonitorMeasureValue.h │ │ ├── AppMonitorMeasureValueSet.h │ │ ├── AppMonitorStat.h │ │ ├── AppMonitorTable.h │ │ ├── UT.h │ │ ├── UTAnalytics.h │ │ ├── UTBaseRequestAuthentication.h │ │ ├── UTCustomHitBuilder.h │ │ ├── UTHitBuilder.h │ │ ├── UTICrashCaughtListener.h │ │ ├── UTIRequestAuthentication.h │ │ ├── UTOirginalCustomHitBuilder.h │ │ ├── UTPageHitBuilder.h │ │ ├── UTSecuritySDKRequestAuthentication.h │ │ └── UTTracker.h │ │ ├── Info.plist │ │ └── UTMini ├── sample.xcodeproj │ └── project.pbxproj └── sample │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ └── LaunchScreen.xib │ ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Info.plist │ ├── main.m │ └── sample.entitlements └── package.json /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react-native"] 3 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | !**/*.xcodeproj 7 | !**/*.pbxproj 8 | !**/*.xcworkspacedata 9 | !**/*.xcsettings 10 | !**/*.xcscheme 11 | *.pbxuser 12 | !default.pbxuser 13 | *.mode1v3 14 | !default.mode1v3 15 | *.mode2v3 16 | !default.mode2v3 17 | *.perspectivev3 18 | !default.perspectivev3 19 | xcuserdata 20 | *.xccheckout 21 | *.moved-aside 22 | DerivedData 23 | *.hmap 24 | *.ipa 25 | *.xcuserstate 26 | project.xcworkspace 27 | 28 | # Android/IJ 29 | # 30 | /build/ 31 | .idea 32 | .gradle 33 | local.properties 34 | 35 | # node.js 36 | # 37 | node_modules/ 38 | npm-debug.log 39 | yarn.lock 40 | yarn-error.log 41 | 42 | # others 43 | # 44 | .buckconfig 45 | .flowconfig 46 | .gitattributes 47 | .watchmanconfig 48 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | !**/*.xcodeproj 7 | !**/*.pbxproj 8 | !**/*.xcworkspacedata 9 | !**/*.xcsettings 10 | !**/*.xcscheme 11 | *.pbxuser 12 | !default.pbxuser 13 | *.mode1v3 14 | !default.mode1v3 15 | *.mode2v3 16 | !default.mode2v3 17 | *.perspectivev3 18 | !default.perspectivev3 19 | xcuserdata 20 | *.xccheckout 21 | *.moved-aside 22 | DerivedData 23 | *.hmap 24 | *.ipa 25 | *.xcuserstate 26 | project.xcworkspace 27 | 28 | # Android/IJ 29 | # 30 | /build/ 31 | .idea 32 | .gradle 33 | local.properties 34 | 35 | # node.js 36 | # 37 | node_modules/ 38 | npm-debug.log 39 | yarn.lock 40 | yarn-error.log 41 | 42 | # others 43 | # 44 | .npmignore 45 | .buckconfig 46 | .flowconfig 47 | .gitattributes 48 | .gitignore 49 | .git 50 | .watchmanconfig 51 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Wonday (@wonday.org) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /RCTAliyunPush.podspec: -------------------------------------------------------------------------------- 1 | require "json" 2 | version = JSON.parse(File.read("package.json"))["version"] 3 | 4 | Pod::Spec.new do |spec| 5 | 6 | spec.name = "RCTAliyunPush" 7 | spec.version = version 8 | spec.summary = "A short description of RCTAliyunPush." 9 | spec.homepage = "https://github.com/a188658587/react-native-aliyun-push" 10 | spec.license = "MIT" 11 | spec.author = { "wwwlin" => "188658587@qq.com" } 12 | spec.ios.deployment_target = "9.0" 13 | spec.tvos.deployment_target = "9.0" 14 | spec.source = { :git => 'https://github.com/a188658587/react-native-aliyun-push.git', :tag => "v#{spec.version}"} 15 | spec.source_files = "ios/**/*.{h,m}" 16 | spec.vendored_frameworks = "ios/libs/AlicloudUtils.framework","ios/libs/CloudPushSDK.framework","ios/libs/UTDID.framework","ios/libs/UTMini.framework" 17 | spec.libraries = "z", "resolv", "sqlite3" 18 | 19 | spec.requires_arc = true 20 | 21 | spec.dependency "React" 22 | end 23 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | description = 'react-native-aliyun-push' 4 | 5 | buildscript { 6 | repositories { 7 | jcenter() 8 | } 9 | 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:1.3.1' 12 | classpath 'com.google.gms:google-services:3.0.0' 13 | } 14 | } 15 | 16 | android { 17 | compileSdkVersion 28 18 | buildToolsVersion '28.0.3' 19 | 20 | defaultConfig { 21 | minSdkVersion 16 22 | targetSdkVersion 28 23 | } 24 | } 25 | 26 | repositories { 27 | jcenter() 28 | } 29 | 30 | dependencies { 31 | 32 | implementation 'com.facebook.react:react-native:+' 33 | 34 | api 'com.aliyun.ams:alicloud-android-push:3.1.6' 35 | api 'com.aliyun.ams:alicloud-android-utils:1.1.3' 36 | api 'com.aliyun.ams:alicloud-android-beacon:1.0.2' 37 | api 'com.aliyun.ams:alicloud-android-utdid:1.5.2' 38 | api 'com.aliyun.ams:alicloud-android-ut:5.4.0' 39 | api 'com.aliyun.ams:alicloud-android-third-push:3.1.0' 40 | 41 | // huawei 42 | api 'com.google.firebase:firebase-messaging:17.6.0' 43 | api 'com.aliyun.ams:huawei-push:2.6.3.305' 44 | api 'com.aliyun.ams:huawei-push-base:2.6.3.305' 45 | 46 | // meizu 47 | api 'com.aliyun.ams:meizu-push:3.8.7.1' 48 | 49 | // vivo 50 | api 'com.aliyun.ams:third_vivopush:2.9.0.1' 51 | 52 | // shortcutBadger 53 | api 'me.leolin:ShortcutBadger:1.1.22@aar' 54 | 55 | } -------------------------------------------------------------------------------- /android/libs/alicloud-android-third-push-3.0.9.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/android/libs/alicloud-android-third-push-3.0.9.aar -------------------------------------------------------------------------------- /android/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Disabling obfuscation is useful if you collect stack traces from production crashes 20 | # (unless you are using a system that supports de-obfuscate the stack traces). 21 | -dontobfuscate 22 | 23 | # React Native 24 | 25 | # Keep our interfaces so they can be used by other ProGuard rules. 26 | # See http://sourceforge.net/p/proguard/bugs/466/ 27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip 28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters 29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip 30 | 31 | # Do not strip any method/class that is annotated with @DoNotStrip 32 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 33 | -keep @com.facebook.common.internal.DoNotStrip class * 34 | -keepclassmembers class * { 35 | @com.facebook.proguard.annotations.DoNotStrip *; 36 | @com.facebook.common.internal.DoNotStrip *; 37 | } 38 | 39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 40 | void set*(***); 41 | *** get*(); 42 | } 43 | 44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 46 | -keepclassmembers,includedescriptorclasses class * { native ; } 47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } 49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } 50 | 51 | -dontwarn com.facebook.react.** 52 | 53 | # TextLayoutBuilder uses a non-public Android constructor within StaticLayout. 54 | # See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details. 55 | -dontwarn android.text.StaticLayout 56 | 57 | # okhttp 58 | 59 | -keepattributes Signature 60 | -keepattributes *Annotation* 61 | -keep class okhttp3.** { *; } 62 | -keep interface okhttp3.** { *; } 63 | -dontwarn okhttp3.** 64 | 65 | # okio 66 | 67 | -keep class sun.misc.Unsafe { *; } 68 | -dontwarn java.nio.file.* 69 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 70 | -dontwarn okio.** 71 | 72 | -keepclasseswithmembernames class ** { 73 | native ; 74 | } 75 | -keepattributes Signature 76 | -keep class sun.misc.Unsafe { *; } 77 | -keep class com.taobao.** {*;} 78 | -keep class com.alibaba.** {*;} 79 | -keep class com.alipay.** {*;} 80 | -dontwarn com.taobao.** 81 | -dontwarn com.alibaba.** 82 | -dontwarn com.alipay.** 83 | -keep class com.ut.** {*;} 84 | -dontwarn com.ut.** 85 | -keep class com.ta.** {*;} 86 | -dontwarn com.ta.** 87 | -keep class anet.**{*;} 88 | -keep class org.android.spdy.**{*;} 89 | -keep class org.android.agoo.**{*;} 90 | -dontwarn anet.** 91 | -dontwarn org.android.spdy.** 92 | -dontwarn org.android.agoo.** 93 | # 小米通道 94 | -keep class com.xiaomi.** {*;} 95 | -dontwarn com.xiaomi.** 96 | # 华为通道 97 | -keep class com.huawei.** {*;} 98 | -dontwarn com.huawei.** 99 | # GCM/FCM通道 100 | -keep class com.google.firebase.**{*;} 101 | - dontwarn com.google.firebase.** -------------------------------------------------------------------------------- /android/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | android.library=true 11 | # Project target. 12 | target=android-16 13 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | -------------------------------------------------------------------------------- /android/src/main/java/org/wonday/aliyun/push/AliyunPushPackage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Wonday (@wonday.org) 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT-style license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | package org.wonday.aliyun.push; 10 | 11 | import java.util.Arrays; 12 | import java.util.Collections; 13 | import java.util.List; 14 | import java.util.ArrayList; 15 | 16 | import com.facebook.react.ReactPackage; 17 | import com.facebook.react.bridge.JavaScriptModule; 18 | import com.facebook.react.bridge.NativeModule; 19 | import com.facebook.react.bridge.ReactApplicationContext; 20 | import com.facebook.react.uimanager.ViewManager; 21 | 22 | public class AliyunPushPackage implements ReactPackage { 23 | 24 | @Override 25 | public List createNativeModules(ReactApplicationContext reactContext) { 26 | List modules = new ArrayList<>(); 27 | modules.add(new AliyunPushModule(reactContext)); 28 | return modules; 29 | } 30 | 31 | 32 | public List> createJSModules() { 33 | return Collections.emptyList(); 34 | } 35 | 36 | @Override 37 | public List createViewManagers(ReactApplicationContext reactContext) { 38 | return Collections.emptyList(); 39 | } 40 | } -------------------------------------------------------------------------------- /android/src/main/java/org/wonday/aliyun/push/MIUIUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Wonday (@wonday.org) 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT-style license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | package org.wonday.aliyun.push; 10 | 11 | import java.lang.reflect.Field; 12 | import java.lang.reflect.Method; 13 | import java.util.Properties; 14 | import java.io.IOException; 15 | import java.io.File; 16 | import java.io.FileInputStream; 17 | import java.util.List; 18 | 19 | import android.app.ActivityManager; 20 | import android.app.Notification; 21 | import android.app.NotificationManager; 22 | import android.app.PendingIntent; 23 | import android.content.Intent; 24 | import android.content.IntentFilter; 25 | import android.content.Context; 26 | import android.os.Handler; 27 | import android.os.HandlerThread; 28 | import android.os.SystemClock; 29 | import android.os.Environment; 30 | import android.app.ActivityManager.RunningAppProcessInfo; 31 | import android.content.ComponentName; 32 | import android.app.ActivityManager.RunningTaskInfo; 33 | 34 | import com.facebook.react.common.ReactConstants; 35 | import com.facebook.common.logging.FLog; 36 | 37 | public class MIUIUtils { 38 | 39 | // 检测MIUI 40 | private static final String KEY_MIUI_VERSION_CODE = "ro.miui.ui.version.code"; 41 | private static final String KEY_MIUI_VERSION_NAME = "ro.miui.ui.version.name"; 42 | private static final String KEY_MIUI_INTERNAL_STORAGE = "ro.miui.internal.storage"; 43 | private static boolean hasChecked = false; 44 | private static boolean isMIUI = false; 45 | 46 | // 通知ID 47 | private static int notificationId = (int)(System.currentTimeMillis()/1000); 48 | 49 | 50 | public static boolean isMIUI(Context context) { 51 | if(hasChecked) { 52 | return isMIUI; 53 | } 54 | 55 | try { 56 | SystemProperty sp = new SystemProperty(context); 57 | String ret1 = ""; 58 | String ret2 = ""; 59 | String ret3 = ""; 60 | ret1 = sp.getOrThrow(KEY_MIUI_VERSION_CODE); 61 | ret2 = sp.getOrThrow(KEY_MIUI_VERSION_NAME); 62 | ret3 = sp.getOrThrow(KEY_MIUI_INTERNAL_STORAGE); 63 | if ((ret1 != null && ret1.compareToIgnoreCase("") != 0) || 64 | (ret2 != null && ret2.compareToIgnoreCase("") != 0) || 65 | (ret3 != null && ret3.compareToIgnoreCase("") != 0)) { 66 | hasChecked = true; 67 | isMIUI = true; 68 | } 69 | } catch (Exception e) { 70 | e.printStackTrace(); 71 | return false; 72 | } 73 | 74 | return isMIUI; 75 | } 76 | 77 | 78 | //小米角标特殊处理 79 | public static void setBadgeNumber(Context context, Class cls, int badgeNumber) { 80 | 81 | //避免显示0条消息 82 | if (badgeNumber<=0) return; 83 | 84 | try { 85 | 86 | Intent intent = new Intent(context, cls); 87 | PendingIntent contentIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); 88 | 89 | Notification.Builder builder = new Notification.Builder(context) 90 | .setContentTitle(context.getString(R.string.app_name)) 91 | .setContentText("您有"+Integer.toString(badgeNumber)+"条未读消息") 92 | .setWhen(System.currentTimeMillis()) 93 | .setContentIntent(contentIntent) 94 | .setSmallIcon(android.R.drawable.stat_notify_chat); 95 | 96 | final Notification notification = builder.build(); 97 | 98 | Field field = notification.getClass().getDeclaredField("extraNotification"); 99 | Object extraNotification = field.get(notification); 100 | Method method = extraNotification.getClass().getDeclaredMethod("setMessageCount", int.class); 101 | method.invoke(extraNotification, badgeNumber); 102 | 103 | NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); 104 | 105 | notificationManager.cancelAll(); 106 | notificationManager.notify(notificationId++, notification); 107 | 108 | } catch (Exception e) { 109 | 110 | } 111 | } 112 | } -------------------------------------------------------------------------------- /android/src/main/java/org/wonday/aliyun/push/SystemProperty.java: -------------------------------------------------------------------------------- 1 | package org.wonday.aliyun.push; 2 | 3 | import android.content.Context; 4 | 5 | import java.lang.reflect.InvocationTargetException; 6 | import java.lang.reflect.Method; 7 | 8 | public class SystemProperty { 9 | private final Context mContext; 10 | 11 | public SystemProperty(Context mContext) { 12 | this.mContext = mContext; 13 | } 14 | 15 | public String getOrThrow(String key) throws Exception { 16 | try { 17 | ClassLoader classLoader = mContext.getClassLoader(); 18 | Class SystemProperties = classLoader.loadClass("android.os.SystemProperties"); 19 | Method methodGet = SystemProperties.getMethod("get", String.class); 20 | return (String) methodGet.invoke(SystemProperties, key); 21 | } catch (Exception e) { 22 | throw new Exception(e); 23 | } 24 | } 25 | 26 | public String get(String key) { 27 | try { 28 | return getOrThrow(key); 29 | } catch (Exception e) { 30 | return null; 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /android/src/main/java/org/wonday/aliyun/push/ThirdPartMessageActivity.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Wonday (@wonday.org) 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT-style license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | package org.wonday.aliyun.push; 10 | 11 | import java.util.Map; 12 | import android.app.Activity; 13 | import android.content.Intent; 14 | import android.os.Bundle; 15 | import android.content.Context; 16 | 17 | import com.alibaba.sdk.android.push.AndroidPopupActivity; 18 | import com.facebook.react.bridge.ReactApplicationContext; 19 | 20 | public class ThirdPartMessageActivity extends AndroidPopupActivity { 21 | 22 | public static Class mainClass; 23 | public static ReactApplicationContext context; 24 | 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | } 29 | 30 | /** 31 | * 实现通知打开回调方法,获取通知相关信息 32 | * @param title 标题 33 | * @param summary 内容 34 | * @param extMap 额外参数 35 | */ 36 | @Override 37 | protected void onSysNoticeOpened(String title, String summary, Map extMap) { 38 | if (AliyunPushMessageReceiver.instance!=null) { 39 | AliyunPushMessageReceiver.instance.onNotification(context, title, summary, extMap); 40 | 41 | if (ThirdPartMessageActivity.mainClass!=null) { 42 | Intent itent=new Intent(); 43 | itent.setClass(ThirdPartMessageActivity.this, mainClass); 44 | startActivity(itent); 45 | ThirdPartMessageActivity.this.finish(); 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /android/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 11 | 16 | 17 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Wonday (@wonday.org) 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT-style license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | 'use strict'; 10 | import React,{ Component } from 'react'; 11 | import { 12 | requireNativeComponent, 13 | Platform, 14 | } from 'react-native'; 15 | 16 | const AliyunPushNative = require('react-native').NativeModules.AliyunPush; 17 | const { NativeEventEmitter } = require('react-native'); 18 | const LocalEventEmitter = new NativeEventEmitter(AliyunPushNative); 19 | 20 | var listeners = {}; 21 | 22 | var id = 0; 23 | var META = '__listener_id'; 24 | 25 | function getKey(listener,type){ 26 | 27 | if (!listener.hasOwnProperty(META)){ 28 | if (!Object.isExtensible(listener)) { 29 | return 'F'; 30 | } 31 | Object.defineProperty(listener, META, { 32 | value: 'L' + type + ++id, 33 | }); 34 | } 35 | return listener[META]; 36 | 37 | }; 38 | 39 | 40 | export default class AliyunPush { 41 | 42 | static getDeviceId = () => { 43 | return AliyunPushNative.getDeviceId(); 44 | } 45 | 46 | static getInitialMessage = () => { 47 | return AliyunPushNative.getInitialMessage().then(e => { 48 | if(e && e.extraStr) { 49 | let extras = JSON.parse(e.extraStr); 50 | if (extras) { 51 | if (extras.badge) { 52 | let badgeNumber = parseInt(extras.badge); 53 | if (!isNaN(badgeNumber)) { 54 | AliyunPush.setApplicationIconBadgeNumber(badgeNumber); 55 | } 56 | } 57 | e.extras = extras; 58 | } 59 | delete e.extraStr; 60 | } 61 | return e; 62 | }); 63 | } 64 | 65 | static getApplicationIconBadgeNumber = (callback) => { 66 | AliyunPushNative.getApplicationIconBadgeNumber(function(args) { 67 | callback(args); 68 | }); 69 | } 70 | 71 | static setApplicationIconBadgeNumber = (num) => { 72 | AliyunPushNative.setApplicationIconBadgeNumber(num); 73 | } 74 | 75 | static syncBadgeNum = (num) => { 76 | if(Platform.OS === 'android') { 77 | return; 78 | } 79 | AliyunPushNative.syncBadgeNum(num); 80 | } 81 | 82 | static bindAccount = (account) => { 83 | return AliyunPushNative.bindAccount(account); 84 | } 85 | 86 | static unbindAccount = () => { 87 | return AliyunPushNative.unbindAccount(); 88 | } 89 | 90 | static bindTag = (target, tags, alias) => { 91 | return AliyunPushNative.bindTag(target, tags, alias); 92 | } 93 | 94 | static unbindTag = (target, tags, alias) => { 95 | return AliyunPushNative.unbindTag(target, tags, alias); 96 | } 97 | 98 | static listTags = (target) => { 99 | return AliyunPushNative.listTags(target); 100 | } 101 | 102 | static addAlias = (alias) => { 103 | return AliyunPushNative.addAlias(alias); 104 | } 105 | 106 | static removeAlias = (alias) => { 107 | return AliyunPushNative.removeAlias(alias); 108 | } 109 | 110 | static listAliases = () => { 111 | return AliyunPushNative.listAliases(); 112 | } 113 | 114 | static getAuthorizationStatus = (callback) => { 115 | if(Platform.OS === 'android') { 116 | // android always return true 117 | callback(true); 118 | } else { 119 | AliyunPushNative.getAuthorizationStatus(function(args) { 120 | callback(args); 121 | }); 122 | } 123 | } 124 | 125 | 126 | static addListener = (callback) => { 127 | 128 | AliyunPush._addListener(callback,"aliyunPushReceived"); 129 | 130 | }; 131 | 132 | static removeListener = (callback) => { 133 | 134 | AliyunPush._removeListener(callback, "aliyunPushReceived"); 135 | 136 | }; 137 | 138 | static removeAllListeners = () => { 139 | for(var key in listeners){ 140 | listeners[key].remove(); 141 | delete(listeners[key]); 142 | } 143 | }; 144 | 145 | static _addListener = (callback,type) => { 146 | 147 | var key = getKey(callback,type); 148 | listeners[key] = LocalEventEmitter.addListener(type, 149 | (e) => { 150 | // convert json string to obj 151 | if (e.extraStr) { 152 | let extras = JSON.parse(e.extraStr); 153 | if (extras) { 154 | if (extras.badge) { 155 | let badgeNumber = parseInt(extras.badge); 156 | if (!isNaN(badgeNumber)) { 157 | AliyunPush.setApplicationIconBadgeNumber(badgeNumber); 158 | } 159 | } 160 | e.extras = extras; 161 | } 162 | delete e.extraStr; 163 | callback(e); 164 | } else { 165 | callback(e); 166 | } 167 | 168 | }); 169 | 170 | }; 171 | 172 | static _removeListener = (callback,type) => { 173 | 174 | var key = getKey(callback,type); 175 | if (!listeners[key]) { 176 | return; 177 | } 178 | listeners[key].remove(); 179 | listeners[key] = null; 180 | 181 | }; 182 | } 183 | -------------------------------------------------------------------------------- /ios/RCTAliyunPush/AliyunPushManager.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Wonday (@wonday.org) 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT-style license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | 10 | #import 11 | #import 12 | #import 13 | 14 | @interface AliyunPushManager : RCTEventEmitter 15 | 16 | + (AliyunPushManager *)sharedInstance; 17 | 18 | 19 | - (void)setParams:(NSString *)appKey appSecret:(NSString *)appSecret lauchOptions:(NSDictionary *)lauchOptions createNotificationCategoryHandler:(void (^)(void))categoryHandler; 20 | 21 | // notification settings 22 | - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings; 23 | 24 | // APNs register success and return deviceToken 25 | - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken; 26 | // APNs register failed 27 | - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error; 28 | 29 | 30 | // Notification Open 31 | - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler; 32 | 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/AlicloudUtils: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/ios/libs/AlicloudUtils.framework/AlicloudUtils -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/ABSBootingProtection.h: -------------------------------------------------------------------------------- 1 | // 2 | // ABSBootingProtection.h 3 | // AntilockBrakeSystem 4 | // 5 | // Created by 地风(ElonChan) on 16/5/16. 6 | // Copyright © 2016年 Ali. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void (^ABSBoolCompletionHandler)(BOOL succeeded, NSError *error); 12 | typedef void (^ABSRepairBlock)(ABSBoolCompletionHandler completionHandler); 13 | typedef void (^ABSReportBlock)(NSUInteger crashCounts); 14 | 15 | typedef NS_ENUM(NSInteger, ABSBootingProtectionStatus) { 16 | ABSBootingProtectionStatusNormal, /**< APP 启动正常 */ 17 | ABSBootingProtectionStatusNormalChecking, /**< 正在检测是否会在特定时间内是否会 Crash,注意:检测状态下“连续启动崩溃计数”个数小于或等于上限值 */ 18 | ABSBootingProtectionStatusNeedFix, /**< APP 出现连续启动 Crash,需要采取修复措施 */ 19 | ABSBootingProtectionStatusFixing, /**< APP 出现连续启动 Crash,正在修复中... */ 20 | }; 21 | 22 | /** 23 | * 启动连续 crash 保护。 24 | * 启动后 `_crashOnLaunchTimeIntervalThreshold` 秒内 crash,反复超过 `_continuousCrashOnLaunchNeedToReport` 次则上报日志,超过 `_continuousCrashOnLaunchNeedToFix` 则启动修复操作。 25 | */ 26 | @interface ABSBootingProtection : NSObject 27 | 28 | /** 29 | * 启动连续 crash 保护方法。 30 | * 前置条件:在 App 启动时注册 crash 处理函数,在 crash 时调用[ABSBootingProtection addCrashCountIfNeeded]。 31 | * 启动后一定时间内(`crashOnLaunchTimeIntervalThreshold`秒内)crash,反复超过一定次数(`continuousCrashOnLaunchNeedToReport`次)则上报日志,超过一定次数(`continuousCrashOnLaunchNeedToFix`次)则启动修复程序;在一定时间内(`crashOnLaunchTimeIntervalThreshold`秒) 秒后若没有 crash 将“连续启动崩溃计数”计数置零。 32 | `reportBlock` 上报逻辑, 33 | `repairtBlock` 修复逻辑,完成后执行 `[self setCrashCount:0]` 34 | 35 | */ 36 | - (void)launchContinuousCrashProtect; 37 | 38 | /*! 39 | * 当前启动Crash的状态 40 | */ 41 | @property (nonatomic, assign, readonly) ABSBootingProtectionStatus bootingProtectionStatus; 42 | 43 | /*! 44 | * 达到需要执行上报操作的“连续启动崩溃计数”个数。 45 | */ 46 | @property (nonatomic, assign, readonly) NSUInteger continuousCrashOnLaunchNeedToReport; 47 | 48 | /*! 49 | * 达到需要执行修复操作的“连续启动崩溃计数”个数。 50 | */ 51 | @property (nonatomic, assign, readonly) NSUInteger continuousCrashOnLaunchNeedToFix; 52 | 53 | /*! 54 | * APP 启动后经过多少秒,可以将“连续启动崩溃计数”清零 55 | */ 56 | @property (nonatomic, assign, readonly) NSTimeInterval crashOnLaunchTimeIntervalThreshold; 57 | 58 | /*! 59 | * 借助 context 可以让多个模块注册事件,并且事件 block 能独立执行,互不干扰。 60 | */ 61 | @property (nonatomic, copy, readonly) NSString *context; 62 | 63 | /*! 64 | * @details 启动后kCrashOnLaunchTimeIntervalThreshold秒内crash,反复超过continuousCrashOnLaunchNeedToReport次则上报日志,超过continuousCrashOnLaunchNeedToFix则启动修复程序;当所有操作完成后,执行 completion。在 crashOnLaunchTimeIntervalThreshold 秒后若没有 crash 将 kContinuousCrashOnLaunchCounterKey 计数置零。 65 | * @param context 借助 context 可以让多个模块注册事件,并且事件 block 能独立执行,互不干扰。 66 | */ 67 | - (instancetype)initWithContinuousCrashOnLaunchNeedToReport:(NSUInteger)continuousCrashOnLaunchNeedToReport 68 | continuousCrashOnLaunchNeedToFix:(NSUInteger)continuousCrashOnLaunchNeedToFix 69 | crashOnLaunchTimeIntervalThreshold:(NSTimeInterval)crashOnLaunchTimeIntervalThreshold 70 | context:(NSString *)context; 71 | /*! 72 | * 当前“连续启动崩溃“的状态 73 | */ 74 | + (ABSBootingProtectionStatus)bootingProtectionStatusWithContext:(NSString *)context continuousCrashOnLaunchNeedToFix:(NSUInteger)continuousCrashOnLaunchNeedToFix; 75 | 76 | /*! 77 | * 设置上报逻辑,参数 crashCounts 为启动连续 crash 次数 78 | */ 79 | - (void)setReportBlock:(ABSReportBlock)reportBlock; 80 | 81 | /*! 82 | * 设置修复逻辑 83 | */ 84 | - (void)setRepairBlock:(ABSRepairBlock)repairtBlock; 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/ABSUncaughtExceptionHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // ABSUncaughtExceptionHandler.h 3 | // AntilockBrakeSystem 4 | // 5 | // Created by 地风(ElonChan) on 16/5/16. 6 | // Copyright © 2016年 Ali. All rights reserved. 7 | // 8 | 9 | #import 10 | typedef void (^ABSUncaughtExceptionCallback)(NSException *exception); 11 | 12 | @interface ABSUncaughtExceptionHandler : NSObject 13 | 14 | + (void)registerExceptionHandlerWithCallback:(ABSUncaughtExceptionCallback)callback; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/ABSUtil.h: -------------------------------------------------------------------------------- 1 | // 2 | // ABSUtil.h 3 | // AntilockBrakeSystem 4 | // 5 | // Created by 地风(ElonChan) on 16/5/16. 6 | // Copyright © 2016年 Ali. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ABSUtil : NSObject 12 | 13 | // 设置日志逻辑 14 | + (void)setLogger:(void (^)(NSString *))logger; 15 | 16 | + (void)Logger:(NSString *)log; 17 | 18 | + (BOOL)isValidString:(id)notValidString; 19 | 20 | + (BOOL)isWhiteListClass:(Class)class; 21 | 22 | + (void)deleteCacheWithfilePathsToRemove:(NSArray *)filePathsToRemove; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/AlicloudHTTPDNSMini.h: -------------------------------------------------------------------------------- 1 | // 2 | // AlicloudHTTPDNSMini.h 3 | // AlicloudUtils 4 | // 5 | // Created by ryan on 3/6/2016. 6 | // Copyright © 2016 Ali. All rights reserved. 7 | // 8 | 9 | #ifndef AlicloudHTTPDNSMini_h 10 | #define AlicloudHTTPDNSMini_h 11 | 12 | #define HTTPDNSMINI_RESOLVED_NOTIFY @"HTTPDNSMiniResolvedNotify" 13 | 14 | @interface AlicloudHTTPDNSMini : NSObject 15 | 16 | + (AlicloudHTTPDNSMini *)sharedInstance; 17 | - (NSArray *)getIpsByHostAsync:(NSString *)host; 18 | - (void)setPreResolveHosts:(NSArray *)hosts; 19 | 20 | @end 21 | 22 | #endif /* AlicloudHTTPDNSMini_h */ 23 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/AlicloudIPv6Adapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2015 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. The rights granted to you under the License 10 | * may not be used to create, or enable the creation or redistribution of, 11 | * unlawful or unlicensed copies of an Apple operating system, or to 12 | * circumvent, violate, or enable the circumvention or violation of, any 13 | * terms of an Apple operating system software license agreement. 14 | * 15 | * Please obtain a copy of the License at 16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 | * 18 | * The Original Code and all software distributed under the License are 19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 | * Please see the License for the specific language governing rights and 24 | * limitations under the License. 25 | * 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 | */ 28 | /* 29 | * Copyright (c) 1980, 1986, 1993 30 | * The Regents of the University of California. All rights reserved. 31 | * 32 | * Redistribution and use in source and binary forms, with or without 33 | * modification, are permitted provided that the following conditions 34 | * are met: 35 | * 1. Redistributions of source code must retain the above copyright 36 | * notice, this list of conditions and the following disclaimer. 37 | * 2. Redistributions in binary form must reproduce the above copyright 38 | * notice, this list of conditions and the following disclaimer in the 39 | * documentation and/or other materials provided with the distribution. 40 | * 3. All advertising materials mentioning features or use of this software 41 | * must display the following acknowledgement: 42 | * This product includes software developed by the University of 43 | * California, Berkeley and its contributors. 44 | * 4. Neither the name of the University nor the names of its contributors 45 | * may be used to endorse or promote products derived from this software 46 | * without specific prior written permission. 47 | * 48 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 49 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 50 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 | * SUCH DAMAGE. 59 | * 60 | * @(#)route.h 8.3 (Berkeley) 4/19/94 61 | * $FreeBSD: src/sys/net/route.h,v 1.36.2.1 2000/08/16 06:14:23 jayanth Exp $ 62 | */ 63 | 64 | 65 | #ifndef AlicloudIPv6Adapter_h 66 | #define AlicloudIPv6Adapter_h 67 | #import 68 | 69 | @interface AlicloudIPv6Adapter : NSObject 70 | 71 | + (instancetype)getInstance; 72 | 73 | /** 74 | * 判断当前是否为IPv6-Only网络 75 | */ 76 | - (BOOL)isIPv6OnlyNetwork; 77 | 78 | /** 79 | * 手动刷新IPv6-Only网络的判定 80 | */ 81 | - (BOOL)reResolveIPv6OnlyStatus; 82 | 83 | /** 84 | IPv4 > IPv6地址转换\n 85 | - 输入IPv4地址无效,返回原地址 86 | - IPv6-Only网络,返回转换后的IPv6地址 87 | - 非IPv6-Only网络,返回原地址 88 | 89 | @param addr IPv4地址 90 | @return 转换后的v6地址 或 原地址 91 | */ 92 | - (NSString *)handleIpv4Address:(NSString *)addr; 93 | 94 | /** 95 | * 判断是否为IPv4地址 96 | */ 97 | - (BOOL)isIPv4Address:(NSString *)addr; 98 | 99 | /** 100 | * 判断是否为IPv6地址 101 | */ 102 | - (BOOL)isIPv6Address:(NSString *)addr; 103 | 104 | @end 105 | 106 | #endif /* AlicloudIPv6Adapter_h */ 107 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/AlicloudReachabilityManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // AlicloudReachabilityManager.h 3 | // 4 | // Created by 亿刀 on 14-1-9. 5 | // Edited by junmo on 15-5-16 6 | // Copyright (c) 2014年 Twitter. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #define ALICLOUD_NETWOEK_STATUS_NOTIFY @"AlicloudNetworkStatusChangeNotify" 13 | 14 | typedef enum { 15 | AlicloudNotReachable = 0, 16 | AlicloudReachableViaWiFi, 17 | AlicloudReachableVia2G, 18 | AlicloudReachableVia3G, 19 | AlicloudReachableVia4G 20 | } AlicloudNetworkStatus; 21 | 22 | @interface AlicloudReachabilityManager : NSObject 23 | 24 | /** 25 | * 获取Reachability单例对象 26 | */ 27 | + (AlicloudReachabilityManager *)shareInstance; 28 | 29 | /** 30 | * 获取Reachability单例对象,为保证全局维护一个netInfo实例,可从外部传入netInfo对象的引用 31 | * warn: netInfo多次实例化,有一定几率crash 32 | * 33 | */ 34 | + (AlicloudReachabilityManager *)shareInstanceWithNetInfo:(CTTelephonyNetworkInfo *)netInfo; 35 | 36 | /** 37 | * 返回当前网络状态(同步调用,可能会阻塞调用线程) 38 | */ 39 | - (AlicloudNetworkStatus)currentNetworkStatus; 40 | 41 | /** 42 | * 返回之前网络状态 43 | */ 44 | - (AlicloudNetworkStatus)preNetworkStatus; 45 | 46 | /** 47 | * 检测网络是否连通(同步调用,阻塞调用线程) 48 | */ 49 | - (BOOL)checkInternetConnection; 50 | 51 | /** 52 | * 检测Wifi网络是否联通 53 | */ 54 | - (BOOL)isReachableViaWifi; 55 | 56 | /** 57 | * 检测蜂窝网络是否联通 58 | */ 59 | - (BOOL)isReachableViaWWAN; 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/AlicloudReport.h: -------------------------------------------------------------------------------- 1 | // 2 | // AlicloudReport.h 3 | // AlicloudUtils 4 | // 5 | // Created by ryan on 3/6/2016. 6 | // Copyright © 2016 Ali. All rights reserved. 7 | // 8 | 9 | #ifndef AlicloudReport_h 10 | #define AlicloudReport_h 11 | 12 | extern const NSString *EXT_INFO_KEY_VERSION; 13 | extern const NSString *EXT_INFO_KEY_PACKAGE; 14 | 15 | // SDK标识 16 | typedef NS_ENUM(NSInteger, AMSService) { 17 | AMSMAN = 0, 18 | AMSHTTPDNS, 19 | AMSMPUSH, 20 | AMSMAC, 21 | AMSAPI, 22 | AMSHOTFIX, 23 | AMSFEEDBACK, 24 | AMSIM 25 | }; 26 | 27 | // 上报状态 28 | typedef NS_ENUM(NSInteger, AMSReportStatus) { 29 | AMS_UNREPORTED_STATUS, 30 | AMS_REPORTED_STATUS 31 | }; 32 | 33 | @interface AlicloudReport : NSObject 34 | 35 | /** 36 | * 异步上报活跃设备统计 37 | * 38 | @param tag SDK标识 39 | */ 40 | + (void)statAsync:(AMSService)tag; 41 | 42 | /** 43 | * 异步上报活跃设备统计并携带附加信息 44 | * 45 | @param tag SDK标识 46 | @param extInfo 附加上报信息 { EXT_INFO_KEY_VERSION :"x.x.x", EXT_INFO_KEY_PACKAGE: "xxx"} 47 | */ 48 | + (void)statAsync:(AMSService)tag extInfo:(NSDictionary *)extInfo; 49 | 50 | /** 51 | * 获取指定SDK标识上报状态 52 | * 53 | @param tag SDK标识 54 | @return 返回上报状态 55 | */ 56 | + (AMSReportStatus)getReportStatus:(AMSService)tag; 57 | 58 | /** 59 | * 获取上报状态(兼容老版本接口) 60 | * 61 | @param tag SDK标识 62 | @return YES:已经上报 NO:没有上报 63 | */ 64 | + (BOOL)isDeviceReported:(AMSService)tag; 65 | 66 | @end 67 | 68 | #endif /* AlicloudReport_h */ 69 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/AlicloudTracker.h: -------------------------------------------------------------------------------- 1 | // 2 | // AlicloudTracker.h 3 | // AlicloudUtils 4 | // 5 | // Created by junmo on 2017/6/30. 6 | // Copyright © 2017年 Ali. All rights reserved. 7 | // 8 | 9 | #ifndef AlicloudTracker_h 10 | #define AlicloudTracker_h 11 | 12 | @interface AlicloudTracker : NSObject 13 | 14 | @property (nonatomic, copy) NSString *sdkId; 15 | @property (nonatomic, copy) NSString *sdkVersion; 16 | 17 | /** 18 | 设置Tracker的通用打点属性,每次上报都携带该参数 19 | 20 | @param key 通用属性Key 21 | @param value 通用属性Value 22 | */ 23 | - (void)setGlobalProperty:(NSString *)key value:(NSString *)value; 24 | 25 | /** 26 | 删除Tracker通用打点属性 27 | 28 | @param key 通用属性Key 29 | */ 30 | - (void)removeGlobalProperty:(NSString *)key; 31 | 32 | /** 33 | 自定义打点上报 34 | 35 | @param eventName 事件名 36 | @param duration 时长 37 | @param properties 额外参数 38 | */ 39 | - (void)sendCustomHit:(NSString *)eventName 40 | duration:(long long)duration 41 | properties:(NSDictionary *)properties; 42 | 43 | @end 44 | #endif /* AlicloudTracker_h */ 45 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/AlicloudTrackerManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // AlicloudTrackerManager.h 3 | // AlicloudUtils 4 | // 5 | // Created by junmo on 2017/7/4. 6 | // Copyright © 2017年 Ali. All rights reserved. 7 | // 8 | 9 | #ifndef AlicloudTrackerManager_h 10 | #define AlicloudTrackerManager_h 11 | 12 | #import "AlicloudTracker.h" 13 | 14 | @interface AlicloudTrackerManager : NSObject 15 | 16 | /** 17 | 获取上报通道管理器对象,并初始化UT 18 | 19 | @return 管理器对象 20 | */ 21 | + (instancetype)getInstance; 22 | 23 | /** 24 | 根据SDK标识和版本号获取上报通道 25 | 26 | @param sdkId SDK标识 27 | @param version SDK版本号 28 | @return 上报通道对象 29 | */ 30 | - (AlicloudTracker *)getTrackerBySdkId:(NSString *)sdkId version:(NSString *)version; 31 | 32 | @end 33 | 34 | #endif /* AlicloudTrackerManager_h */ 35 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/AlicloudUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // AlicloudUtils.h 3 | // AlicloudUtils 4 | // 5 | // Created by lingkun on 16/5/16. 6 | // Copyright © 2016年 Ali. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define ALICLOUDUTILS_VERSION @"1.3.8" 12 | 13 | // In this header, you should import all the public headers of your framework using statements like #import 14 | 15 | #import 16 | #import 17 | #import 18 | #import 19 | #import 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/AntilockBrakeSystem.h: -------------------------------------------------------------------------------- 1 | // 2 | // AntilockBrakeSystem.h 3 | // AntilockBrakeSystem 4 | // 5 | // Created by 地风(ElonChan) on 16/5/16. 6 | // Copyright © 2016年 Ali. All rights reserved. 7 | // 8 | 9 | #import "ABSUncaughtExceptionHandler.h" 10 | #import "ABSBootingProtection.h" 11 | #import "ABSUtil.h" 12 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/EMASBeaconService.h: -------------------------------------------------------------------------------- 1 | // 2 | // EMASBeaconService.h 3 | // AlicloudBeacon 4 | // 5 | // Created by junmo on 2017/7/6. 6 | // Copyright © 2017年 junmo. All rights reserved. 7 | // 8 | 9 | #ifndef EMASBeaconService_h 10 | #define EMASBeaconService_h 11 | 12 | @interface EMASBeaconConfiguration : NSObject 13 | 14 | - (instancetype)initWithData:(NSData *)data; 15 | - (id)getConfigureItemByKey:(NSString *)key; 16 | 17 | @end 18 | 19 | typedef void (^AlicloudBeaconCallbackHandler)(BOOL res, NSError *error); 20 | 21 | @interface EMASBeaconService : NSObject 22 | 23 | - (instancetype)initWithAppKey:(NSString *)appKey 24 | appSecret:(NSString *)appSecret 25 | SDKVersion:(NSString *)SDKVersion 26 | SDKID:(NSString *)SDKID; 27 | 28 | - (instancetype)initWithAppKey:(NSString *)appKey 29 | appSecret:(NSString *)appSecret 30 | SDKVersion:(NSString *)SDKVersion 31 | SDKID:(NSString *)SDKID 32 | extension:(NSDictionary *)extension; 33 | 34 | - (void)enableLog:(BOOL)enabled; 35 | - (BOOL)isLogEnabled; 36 | 37 | //- (void)getBeaconConfigByKey:(NSString *)key 38 | // completionHandler:(void(^)(EMASBeaconConfiguration *configuration, NSError *error))completionHandler; 39 | 40 | - (void)getBeaconConfigStringByKey:(NSString *)key 41 | completionHandler:(void(^)(NSString *result, NSError *error))completionHandler; 42 | 43 | @end 44 | 45 | #endif /* EMASBeaconService_h */ 46 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/EMASOptions.h: -------------------------------------------------------------------------------- 1 | // 2 | // EMASOptions.h 3 | // AlicloudUtils 4 | // 5 | // Created by junmo on 2018/3/16. 6 | // Copyright © 2018年 Ali. All rights reserved. 7 | // 8 | 9 | #ifndef EMASOptions_h 10 | #define EMASOptions_h 11 | 12 | @interface EMASOptionSDKServiceItem : NSObject 13 | 14 | @property (nonatomic, copy) NSString *sdkId; 15 | @property (nonatomic, copy) NSString *version; 16 | @property (nonatomic, assign) NSNumber *status; 17 | 18 | @end 19 | 20 | @interface EMASOptions : NSObject 21 | 22 | @property (nonatomic, copy, readonly) NSString *emasAppKey; 23 | @property (nonatomic, copy, readonly) NSString *emasAppSecret; 24 | @property (nonatomic, copy, readonly) NSString *emasBundleId; 25 | @property (nonatomic, copy, readonly) NSString *hotfixIdSecret; 26 | @property (nonatomic, copy, readonly) NSString *hotfixRsaSecret; 27 | @property (nonatomic, copy, readonly) NSString *tlogRsaSecret; 28 | @property (nonatomic, copy, readonly) NSString *httpdnsAccountId; 29 | @property (nonatomic, copy, readonly) NSString *httpdnsSecretKey; 30 | 31 | + (EMASOptions *)defaultOptions; 32 | - (NSString *)optionByConfigKey:(NSString *)key; 33 | - (EMASOptionSDKServiceItem *)sdkServiceItemForSdkId:(NSString *)sdkId; 34 | 35 | @end 36 | 37 | #endif /* EMASOptions_h */ 38 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/EMASSecurityModeCommon.h: -------------------------------------------------------------------------------- 1 | // 2 | // EMASSecurityModeCommon.h 3 | // AlicloudUtils 4 | // 5 | // Created by junmo on 2018/3/11. 6 | // Copyright © 2018年 Ali. All rights reserved. 7 | // 8 | 9 | #ifndef EMASSecurityModeCommon_h 10 | #define EMASSecurityModeCommon_h 11 | 12 | typedef void (^SDKCheckSuccessHandler)(void); 13 | typedef void (^SDKCheckCrashHandler)(NSUInteger crashCount); 14 | 15 | #endif /* EMASSecurityModeCommon_h */ 16 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/EMASSecurityModeManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // EMASSecurityModeManager.h 3 | // AlicloudUtils 4 | // 5 | // Created by junmo on 2018/3/10. 6 | // Copyright © 2018年 Ali. All rights reserved. 7 | // 8 | 9 | #ifndef EMASSecurityModeManager_h 10 | #define EMASSecurityModeManager_h 11 | 12 | #import "EMASSecurityModeCommon.h" 13 | 14 | @interface EMASSecurityModeManager : NSObject 15 | 16 | + (instancetype)sharedInstance; 17 | 18 | - (void)registerSDKComponentAndStartCheck:(NSString *)sdkId 19 | sdkVersion:(NSString *)sdkVersion 20 | appKey:(NSString *)appKey 21 | appSecret:(NSString *)appSecret 22 | sdkCrashThreshold:(NSUInteger)crashTimesThreshold 23 | onSuccess:(SDKCheckSuccessHandler)successHandler 24 | onCrash:(SDKCheckCrashHandler)crashHandler; 25 | 26 | @end 27 | 28 | #endif /* EMASSecurityModeManager_h */ 29 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/EMASTools.h: -------------------------------------------------------------------------------- 1 | // 2 | // EMASTools.h 3 | // AlicloudUtils 4 | // 5 | // Created by junmo on 2018/3/14. 6 | // Copyright © 2018年 Ali. All rights reserved. 7 | // 8 | 9 | #ifndef EMASTools_h 10 | #define EMASTools_h 11 | 12 | #define EMAS_SYNC_EXECUTE_BY_KEY(key, executor)\ 13 | [EMASTools syncExecuteBlockByKey:key block:executor];\ 14 | 15 | #define EMAS_SYNC_EXECUTE_BY_QUEUE(queue, executor)\ 16 | [EMASTools syncExecuteBlockByQueue:queue block:executor];\ 17 | 18 | @interface EMASTools : NSObject 19 | 20 | + (BOOL)isValidString:(id)obj; 21 | + (BOOL)isValidDictionary:(id)obj; 22 | + (BOOL)isValidArray:(id)obj; 23 | 24 | + (NSString *)md5:(NSString *)str; 25 | + (NSString *)sha1:(NSString *)str; 26 | + (NSString *)hmacSha1:(NSString *)str key:(NSString *)key; 27 | + (NSString *)base64EncodedWithString:(NSString *)str; 28 | + (NSString *)base64DecodedWithString:(NSString *)base64Str; 29 | + (NSData *)aes128CBCEncrypt:(NSData *)data key:(NSData *)key iv:(char *)iv; 30 | + (NSString *)URLEncodedString:(NSString *)str; 31 | 32 | + (NSString *)convertObjectToJsonString:(id)obj; 33 | + (id)convertJsonStringToObject:(NSString *)jsonStr; 34 | + (id)convertJsonDataToObject:(NSData *)jsonData; 35 | 36 | + (NSString *)convertDateToGMT0String:(NSDate *)date; 37 | + (NSString *)convertDateToGMT8String:(NSDate *)date; 38 | 39 | + (void)swizzleClassMethod:(Class)cls originSEL:(SEL)originSEL swizzleSEL:(SEL)swizzleSEL; 40 | + (void)swizzleInstanceMethod:(Class)cls originSEL:(SEL)originSEL swizzleSEL:(SEL)swizzleSEL; 41 | 42 | + (BOOL)isIPv4Address:(NSString *)addr; 43 | + (BOOL)isIPv6Address:(NSString *)addr; 44 | 45 | + (dispatch_queue_t)createQueueIfNotExists:(NSString *)key; 46 | + (void)syncExecuteBlockByKey:(NSString *)key block:(void(^)(void))block; 47 | + (void)syncExecuteBlockByQueue:(dispatch_queue_t)queue block:(void(^)(void))block; 48 | 49 | + (NSString *)bundleIdForApp; 50 | + (NSString *)deviceBrand; 51 | + (NSString *)deviceModel; 52 | 53 | + (void)threadWaitForSec:(double)sec; 54 | 55 | @end 56 | 57 | #endif /* EMASTools_h */ 58 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Headers/UtilLog.h: -------------------------------------------------------------------------------- 1 | // 2 | // UtilLog.h 3 | // AlicloudUtils 4 | // 5 | // Created by junmo on 16/11/24. 6 | // Copyright © 2016年 Ali. All rights reserved. 7 | // 8 | 9 | #ifndef UtilLog_h 10 | #define UtilLog_h 11 | 12 | @interface UtilLog : NSObject 13 | 14 | + (void)enableLog; 15 | 16 | + (BOOL)isLogEnabled; 17 | 18 | #define UtilLogD(tag, frmt, ...)\ 19 | if ([UtilLog isLogEnabled]) {\ 20 | NSLog(@"[%@]-[D]: %@", tag, [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\ 21 | } 22 | 23 | #define UtilLogI(tag, frmt, ...)\ 24 | if ([UtilLog isLogEnabled]) {\ 25 | NSLog(@"[%@]-[I]: %@", tag, [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\ 26 | } 27 | 28 | #define UtilLogE(tag, frmt, ...)\ 29 | if ([UtilLog isLogEnabled]) {\ 30 | NSLog(@"[%@]-[E]: %@", tag, [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\ 31 | } 32 | @end 33 | 34 | #endif /* UtilLog_h */ 35 | -------------------------------------------------------------------------------- /ios/libs/AlicloudUtils.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module AlicloudUtils { 2 | umbrella header "AlicloudUtils.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /ios/libs/CloudPushSDK.framework/CloudPushSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/ios/libs/CloudPushSDK.framework/CloudPushSDK -------------------------------------------------------------------------------- /ios/libs/CloudPushSDK.framework/Headers/CCPSysMessage.h: -------------------------------------------------------------------------------- 1 | // 2 | // CCPSysMessage.h 3 | // CloudPushSDK 4 | // 5 | // Created by wuxiang on 15/5/18. 6 | // Copyright (c) 2015年 aliyun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CCPSysMessage : NSObject 12 | 13 | @property UInt8 messageType;// 消息类型 14 | @property NSData *title; // 标题 15 | @property NSData *body; // 内容 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /ios/libs/CloudPushSDK.framework/Headers/CloudPushCallbackResult.h: -------------------------------------------------------------------------------- 1 | // 2 | // CloudPushCallbackResult.h 3 | // CloudPushSDK 4 | // 5 | // Created by lingkun on 16/6/16. 6 | // Copyright © 2016年 aliyun.mobileService. All rights reserved. 7 | // 8 | 9 | #ifndef CloudPushCallbackResult_h 10 | #define CloudPushCallbackResult_h 11 | 12 | @interface CloudPushCallbackResult : NSObject 13 | 14 | @property(nonatomic, readonly) BOOL success; 15 | 16 | @property(nonatomic, readonly, nullable) id data; 17 | 18 | @property(nonatomic, readonly, nullable) NSError *error; 19 | 20 | + (nonnull instancetype)resultWithData:(nullable id)data; 21 | 22 | + (nonnull instancetype)resultWithError:(nullable NSError *)error; 23 | 24 | @end 25 | 26 | #endif /* CloudPushCallbackResult_h */ 27 | -------------------------------------------------------------------------------- /ios/libs/CloudPushSDK.framework/Headers/CloudPushSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // CloudPushSDK.h 3 | // CloudPushSDK 4 | // 5 | // Created by junmo on 16/7/26. 6 | // Copyright © 2016年 aliyun.mobileService. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CCPSysMessage.h" 11 | #import "MPGerneralDefinition.h" 12 | 13 | /* SDK版本号 */ 14 | #define MPUSH_IOS_SDK_VERSION @"1.9.9.1" 15 | 16 | @interface CloudPushSDK : NSObject 17 | 18 | /** 19 | Push SDK初始化 20 | 无需手动配置appKey/appSecret 21 | 22 | @param callback 回调 23 | */ 24 | + (void)autoInit:(CallbackHandler)callback; 25 | 26 | /** 27 | * Push SDK初始化 28 | * 29 | * @param appKey appKey 30 | * @param appSecret appSecret 31 | * @param callback 回调 32 | */ 33 | + (void)asyncInit:(NSString *)appKey 34 | appSecret:(NSString *)appSecret 35 | callback:(CallbackHandler)callback; 36 | 37 | /** 38 | * 打开调试日志 39 | */ 40 | + (void)turnOnDebug; 41 | 42 | /** 43 | * 获取本机的deviceId (deviceId为推送系统的设备标识) 44 | * 45 | * @return deviceId 46 | */ 47 | + (NSString *)getDeviceId; 48 | 49 | /** 50 | * 返回SDK版本 51 | * 52 | * @return SDK版本 53 | */ 54 | + (NSString *)getVersion; 55 | 56 | /** 57 | * 返回推送通道的状态 58 | * 59 | * @return 通道状态 60 | */ 61 | + (BOOL)isChannelOpened; 62 | 63 | /** 64 | * 返回推送通知ACK到服务器 65 | * 66 | * @param userInfo 通知相关信息 67 | */ 68 | + (void)sendNotificationAck:(NSDictionary *)userInfo; 69 | 70 | /** 71 | * 返回推送通知ACK到服务器 (该通知为App处于关闭状态时接收,点击后启动App) 72 | * v1.8.1版本之后,由sendNotificationAck替代 73 | * @param launchOptions 通知相关信息 74 | */ 75 | + (void)handleLaunching:(NSDictionary *)launchOptions DEPRECATED_MSG_ATTRIBUTE("Use 'sendNotificationAck:' instead"); 76 | 77 | /** 78 | * 返回推送通知ACK到服务器 (该通知为App处于开启状态时接收) 79 | * v1.8.1版本之后,由sendNotificationAck替代 80 | * @param userInfo 通知相关信息 81 | */ 82 | + (void)handleReceiveRemoteNotification:(NSDictionary *)userInfo DEPRECATED_MSG_ATTRIBUTE("Use 'sendNotificationAck:' instead"); 83 | 84 | /** 85 | * 绑定账号 86 | * 87 | * @param account 账号名 88 | * @param callback 回调 89 | */ 90 | + (void)bindAccount:(NSString *)account 91 | withCallback:(CallbackHandler)callback; 92 | 93 | /** 94 | * 解绑账号 95 | * 96 | * @param callback 回调 97 | */ 98 | + (void)unbindAccount:(CallbackHandler)callback; 99 | 100 | /** 101 | * 向指定目标添加自定义标签 102 | * 支持向本设备/本设备绑定账号/别名添加自定义标签,目标类型由target指定 103 | * @param target 目标类型,1:本设备 2:本设备绑定账号 3:别名 104 | * @param tags 标签名 105 | * @param alias 别名(仅当target = 3时生效) 106 | * @param callback 回调 107 | */ 108 | + (void)bindTag:(int)target 109 | withTags:(NSArray *)tags 110 | withAlias:(NSString *)alias 111 | withCallback:(CallbackHandler)callback; 112 | 113 | /** 114 | * 删除指定目标的自定义标签 115 | * 支持从本设备/本设备绑定账号/别名删除自定义标签,目标类型由target指定 116 | * @param target 目标类型,1:本设备 2:本设备绑定账号 3:别名 117 | * @param tags 标签名 118 | * @param alias 别名(仅当target = 3时生效) 119 | * @param callback 回调 120 | */ 121 | + (void)unbindTag:(int)target 122 | withTags:(NSArray *)tags 123 | withAlias:(NSString *)alias 124 | withCallback:(CallbackHandler)callback; 125 | 126 | /** 127 | * 查询绑定标签,查询结果可从callback的data中获取 128 | * 129 | * @param target 目标类型,1:本设备(当前仅支持查询本设备绑定标签) 130 | * @param callback 回调 131 | */ 132 | + (void)listTags:(int)target 133 | withCallback:(CallbackHandler)callback; 134 | 135 | /** 136 | * 给当前设备打别名 137 | * 138 | * @param alias 别名名称 139 | * @param callback 回调 140 | */ 141 | + (void)addAlias:(NSString *)alias 142 | withCallback:(CallbackHandler)callback; 143 | 144 | /** 145 | * 删除当前设备的指定别名 146 | * 当alias为nil or length = 0时,删除当前设备绑定所有别名 147 | * @param alias 别名名称 148 | * @param callback 回调 149 | */ 150 | + (void)removeAlias:(NSString *)alias 151 | withCallback:(CallbackHandler)callback; 152 | 153 | /** 154 | * 查询本设备绑定别名,查询结果可从callback的data中获取 155 | * 156 | * @param callback 回调 157 | */ 158 | + (void)listAliases:(CallbackHandler)callback; 159 | 160 | /** 161 | * 向阿里云推送注册该设备的deviceToken 162 | * 163 | * @param deviceToken 苹果APNs服务器返回的deviceToken 164 | */ 165 | + (void)registerDevice:(NSData *)deviceToken 166 | withCallback:(CallbackHandler)callback; 167 | 168 | /** 169 | * 获取APNs返回的deviceToken 170 | * 171 | * @return deviceToken 172 | */ 173 | + (NSString *)getApnsDeviceToken; 174 | 175 | /** 176 | 同步设备通知角标数到推送服务器 177 | 178 | @param num badge数,取值范围[0,99999] 179 | @param callback 回调 180 | */ 181 | + (void)syncBadgeNum:(NSUInteger)num 182 | withCallback:(CallbackHandler)callback; 183 | 184 | @end 185 | -------------------------------------------------------------------------------- /ios/libs/CloudPushSDK.framework/Headers/MPGerneralDefinition.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPGerneralDefinition.h 3 | // CloudPushSDK 4 | // 5 | // Created by junmo on 16/10/11. 6 | // Copyright © 2016年 aliyun.mobileService. All rights reserved. 7 | // 8 | 9 | #ifndef MPGerneralDefinition_h 10 | #define MPGerneralDefinition_h 11 | 12 | #import "CloudPushCallbackResult.h" 13 | 14 | typedef void (^CallbackHandler)(CloudPushCallbackResult *res); 15 | 16 | // 保证callback不为空且回调不在主线程上执行 17 | #define NotNilCallback(funcName, paras)\ 18 | if (funcName) {\ 19 | if ([NSThread isMainThread]) {\ 20 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\ 21 | funcName(paras);\ 22 | });\ 23 | } else {\ 24 | funcName(paras);\ 25 | }\ 26 | } 27 | 28 | #endif /* MPGerneralDefinition_h */ 29 | -------------------------------------------------------------------------------- /ios/libs/CloudPushSDK.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module CloudPushSDK { 2 | umbrella header "CloudPushSDK.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /ios/libs/UTDID.framework/Headers/AidProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // AidProtocol.h 3 | // UtdidSDK 4 | // 5 | // Created by ALLEN on 14-12-22. 6 | // Copyright (c) 2014年 Alvin. All rights reserved. 7 | // 8 | 9 | #ifndef AidProtocol_h 10 | #define AidProtocol_h 11 | 12 | #define EVENT_REQUEST_STARTED 1000 13 | #define EVENT_REQUEST_SUCCESS 1001 14 | #define EVENT_REQUEST_FAILED 1002 15 | #define EVENT_NETWORK_ERROR 1003 16 | 17 | @protocol AidProtocolDelegate 18 | @required 19 | - (void) onAidEventChanged:(NSInteger)eventId 20 | aid:(NSString *)aid; 21 | @end 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /ios/libs/UTDID.framework/Headers/UTDevice.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTDevice.h 3 | // 4 | // 5 | // Created by Alvin on 4/21/13. 6 | // 7 | // 设备信息的分装类:sdk合作开发需要用这个类提供的设备信息接口 8 | 9 | // Version:utdid4all-1.1.0 10 | 11 | #ifndef UTDIDDevice_h 12 | #define UTDIDDevice_h 13 | 14 | #import "AidProtocol.h" 15 | 16 | @interface UTDevice : NSObject 17 | 18 | /** 19 | * @brief 获取SDK生成的设备唯一标识. 20 | * 21 | * @warning 调用说明:这个设备唯一标识是持久的,并且格式安全,iOS6以及以下,多应用互通. 22 | * 23 | * 调用顺序:utdid任意时刻都可以调用. 24 | * 25 | * @return 24字节的设备唯一标识. 26 | */ 27 | +(NSString *) utdid; 28 | 29 | /** 30 | * @brief 同步获得AID. 31 | * 32 | * @warning 调用说明:若本地端没有最新AID,将耗费远程通信时间并阻塞线程,建议将此调用置于非主线程,或使用{@link getAidAsync}异步获得AID。 33 | * 34 | * 调用顺序:aid任意时刻都可以调用. 35 | * 36 | * @return AID. 37 | */ 38 | +(NSString *) aid:(NSString *)appName 39 | token:(NSString *)token; 40 | 41 | /** 42 | * @brief 异步请求AID. 43 | * 44 | * @warning 调用说明:若本地端没有最新AID,将建立异步请求获得AID, 45 | * 46 | * 调用顺序:aidAsync任意时刻都可以调用. 47 | * 48 | */ 49 | +(void) aidAsync:(NSString *)appName 50 | token:(NSString *)token 51 | aidDelegate:(id)aidDelegate; 52 | 53 | @end 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /ios/libs/UTDID.framework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 17A405 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | UTDID 11 | CFBundleIdentifier 12 | Taobao.UTDID 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | UTDID 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.1.0.17-SNAPSHOT 21 | CFBundleSignature 22 | ???? 23 | CFBundleSupportedPlatforms 24 | 25 | iPhoneOS 26 | 27 | CFBundleVersion 28 | 1 29 | DTCompiler 30 | com.apple.compilers.llvm.clang.1_0 31 | DTPlatformBuild 32 | 15A372 33 | DTPlatformName 34 | iphoneos 35 | DTPlatformVersion 36 | 11.0 37 | DTSDKBuild 38 | 15A372 39 | DTSDKName 40 | iphoneos11.0 41 | DTXcode 42 | 0900 43 | DTXcodeBuild 44 | 9A235 45 | MinimumOSVersion 46 | 4.3 47 | UIDeviceFamily 48 | 49 | 1 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /ios/libs/UTDID.framework/UTDID: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/ios/libs/UTDID.framework/UTDID -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/AppMonitor.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorSDK.h 3 | // AppMonitorSDK 4 | // 5 | // Created by junzhan on 14-9-9. 6 | // Copyright (c) 2014年 君展. All rights reserved. 7 | // 接口类 8 | 9 | #import 10 | #import "AppMonitorTable.h" 11 | #import "AppMonitorAlarm.h" 12 | #import "AppMonitorCounter.h" 13 | #import "AppMonitorStat.h" 14 | 15 | @interface AppMonitor : NSObject 16 | 17 | + (BOOL)isInit; 18 | 19 | + (BOOL) isUTInit; 20 | 21 | + (void) setUTInit; 22 | 23 | + (instancetype)sharedInstance; 24 | 25 | /* 26 | * 设置采样率配置 27 | * @param jsonStr JSON串 28 | */ 29 | + (void)setSamplingConfigWithJson:(NSString *)jsonStr; 30 | 31 | /** 32 | * 关闭采样,紧开发调试用。线上版本请勿调用此API 33 | */ 34 | + (void)disableSample; 35 | 36 | /** 37 | * 设置采样率(默认是 50%) 值范围在[0~10000] (0表示不上传,10000表示100%上传,5000表示50%上传) 38 | */ 39 | + (void)setSampling:(NSString *)sampling; 40 | 41 | ////是否开启实时调试模式(与UT同步) 42 | + (BOOL)isTurnOnRealTimeDebug; 43 | + (NSString*)realTimeDebugUploadUrl; 44 | + (NSString*)realTimeDebugId; 45 | 46 | +(void) turnOnAppMonitorRealtimeDebug:(NSDictionary *) pDict; 47 | +(void) turnOffAppMonitorRealtimeDebug; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/AppMonitorAlarm.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorAlarm.h 3 | // AppMonitor 4 | // 5 | // Created by junzhan on 14-9-15. 6 | // Copyright (c) 2014年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppMonitorBase.h" 11 | 12 | @interface AppMonitorAlarm : AppMonitorBase 13 | /** 14 | * 记录业务操作成功接口 15 | * 16 | * @param page 页面名称,安卓iOS要相同. 命名规范:若之前埋点有页面名,则用原来的; 否则用"业务名_页面名"(无页面则"业务名"); 采用首字母大写驼峰方式. 如Shop_Detail, Shop_List 17 | * @param monitorPoint 监控点名称,安卓iOS要相同,从@雷曼 获取 18 | * 19 | */ 20 | + (void)commitSuccessWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint; 21 | 22 | /** 23 | * 记录业务操作失败接口 24 | * 25 | * @param page 页面名称,安卓iOS要相同. 命名规范:若之前埋点有页面名,则用原来的; 否则用"业务名_页面名"(无页面则"业务名"); 采用首字母大写驼峰方式. 如Shop_Detail, Shop_List 26 | * @param monitorPoint 监控点名称,安卓iOS要相同,从@雷曼 获取 27 | * @param errorCode 错误码,若为MTOP请求则传MTOP的错误码,否则请业务方对错误进行分类编码,方便统计错误类型占比 28 | * @param errorMsg 错误信息,若位MTOP请求则传MTOP的错误信息, 否则请业务方自己描述错误, 方便自己查找原因 29 | */ 30 | + (void)commitFailWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint errorCode:(NSString *)errorCode errorMsg:(NSString *)errorMsg; 31 | 32 | /** 33 | * 记录业务操作成功接口 34 | * 35 | * @param page 页面名称,安卓iOS要相同. 命名规范:若之前埋点有页面名,则用原来的; 否则用"业务名_页面名"(无页面则"业务名"); 采用首字母大写驼峰方式. 如Shop_Detail, Shop_List 36 | * @param monitorPoint 监控点名称,安卓iOS要相同,从@雷曼 获取 37 | * @arg 附加参数,用于做横向扩展 38 | */ 39 | + (void)commitSuccessWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint arg:(NSString *)arg; 40 | 41 | /** 42 | * 记录业务操作失败接口 43 | * 44 | * @param page 页面名称,安卓iOS要相同. 命名规范:若之前埋点有页面名,则用原来的; 否则用"业务名_页面名"(无页面则"业务名"); 采用首字母大写驼峰方式. 如Shop_Detail, Shop_List 45 | * @param monitorPoint 监控点名称,安卓iOS要相同,从@雷曼 获取 46 | * @param errorCode 错误码,若为MTOP请求则传MTOP的错误码,否则请业务方对错误进行分类编码,方便统计错误类型占比 47 | * @param errorMsg 错误信息,若位MTOP请求则传MTOP的错误信息, 否则请业务方自己描述错误, 方便自己查找原因 48 | * @arg 附加参数,用于做横向扩展 49 | */ 50 | + (void)commitFailWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint errorCode:(NSString *)errorCode errorMsg:(NSString *)errorMsg arg:(NSString *)arg; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/AppMonitorBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorBase.h 3 | // AppMonitor 4 | // 5 | // Created by junzhan on 14-10-14. 6 | // Copyright (c) 2014年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface AppMonitorBase : NSObject 13 | /** 14 | * 日志写入UT间隔时间(单位秒).默认300秒, -1代表关闭. 会监听配置中心做变化 15 | */ 16 | + (void)setWriteLogInterval:(NSInteger)writeLogInterval; 17 | 18 | + (NSInteger)writeLogInterval; 19 | 20 | 21 | /** 22 | * 将appmonitor的日志立刻强制写入本地(UT),避免丢失。请不要私自调用,使用前咨询@君展 23 | */ 24 | + (void)flushAllLog; 25 | 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/AppMonitorCounter.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorCounter.h 3 | // AppMonitor 4 | // 5 | // Created by junzhan on 14-10-14. 6 | // Copyright (c) 2014年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppMonitorBase.h" 11 | 12 | @interface AppMonitorCounter : AppMonitorBase 13 | 14 | /** 15 | * 实时计数接口.(每次commit会累加一次count,value也会累加)可用于服务端计算总次数或求平均值。 16 | * 此接口数据量不应太大, 17 | * 18 | * @param page 操作发生所在的页面 19 | * @param monitorPoint 监控点名称 20 | * @param value 数值 21 | */ 22 | + (void)commitWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint value:(double)value; 23 | 24 | /** 25 | * 实时计数接口.(每次commit会累加一次count,value也会累加)可用于服务端计算总次数或求平均值。 26 | * 此接口数据量不应太大, 27 | * 28 | * @param page 操作发生所在的页面 29 | * @param monitorPoint 监控点名称 30 | * @param value 数值 31 | * @param arg 附加参数 32 | */ 33 | + (void)commitWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint value:(double)value arg:(NSString *)arg; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/AppMonitorDimension.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorDimension.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/2/15. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * 监控维度 13 | * 14 | */ 15 | 16 | @interface AppMonitorDimension : NSObject 17 | 18 | @property (nonatomic, copy) NSString *name; 19 | @property (nonatomic, copy) NSString *constantValue; 20 | 21 | - (instancetype)initWithName:(NSString *)name; 22 | 23 | - (instancetype)initWithName:(NSString *)name constantValue:(NSString *)constantValue; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/AppMonitorDimensionSet.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorDimensionSet.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/2/15. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppMonitorDimensionValueSet.h" 11 | #import "AppMonitorDimension.h" 12 | @interface AppMonitorDimensionSet : NSObject 13 | 14 | /** 15 | * 根据列表初始化指标集合对象 16 | * 17 | * @param array NSString类型的数组 string为Name; 18 | * @return 19 | */ 20 | 21 | + (instancetype)setWithArray:(NSArray *)array; 22 | 23 | - (BOOL)valid:(AppMonitorDimensionValueSet*)dimensionValues; 24 | /** 25 | * 增加维度 26 | * 27 | * @param dimension 维度对象 28 | * @return 29 | */ 30 | - (void)addDimension:(AppMonitorDimension *)dimension; 31 | 32 | /** 33 | * 增加维度对象 34 | * 35 | * @param name 维度名称 36 | * @return 37 | */ 38 | - (void)addDimensionWithName:(NSString *)name; 39 | /** 40 | * 获取维度对象 41 | * 42 | * @param name 维度名称 43 | * @return 44 | */ 45 | - (AppMonitorDimension *)dimensionForName:(NSString *)name; 46 | 47 | - (NSMutableOrderedSet *)dimensions; 48 | 49 | /** 50 | * 设置定值维度 51 | * 52 | * @param dimensionValues key为维度名称,value为内容 53 | */ 54 | - (void)setConstantValue:(AppMonitorDimensionValueSet *)dimensionValues; 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/AppMonitorDimensionValueSet.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorDimensionValueSet.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/2/15. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | /** 11 | 其实就是个字典 12 | */ 13 | @interface AppMonitorDimensionValueSet : NSObject 14 | 15 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 16 | 17 | /** 18 | * 存储维度值 19 | */ 20 | @property (nonatomic, strong) NSMutableDictionary *dict; 21 | 22 | - (void)setValue:(NSString *)value forName:(NSString *)name; 23 | - (BOOL)containValueForName:(NSString *)name; 24 | - (NSString *)valueForName:(NSString *)name; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/AppMonitorMeasure.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorMeasure.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/2/15. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppMonitorMeasureValue.h" 11 | /** 12 | * 监控指标项 13 | * 14 | */ 15 | 16 | @interface AppMonitorMeasure : NSObject 17 | 18 | @property (nonatomic, copy) NSString *name; 19 | @property (nonatomic, strong) NSNumber *constantValue; 20 | @property (nonatomic, strong) NSNumber *min; 21 | @property (nonatomic, strong) NSNumber *max; 22 | 23 | - (instancetype)initWithName:(NSString *)name; 24 | - (instancetype)initWithName:(NSString *)name constantValue:(NSNumber *)constantValue; 25 | - (instancetype)initWithName:(NSString *)name constantValue:(NSNumber *)constantValue min:(NSNumber *)min max:(NSNumber *)max; 26 | - (void)setRangeWithMin:(NSNumber *)min max:(NSNumber *)max; 27 | - (BOOL)valid:(AppMonitorMeasureValue *)measureValue; 28 | @end 29 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/AppMonitorMeasureSet.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorMeasureSet.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/2/15. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppMonitorMeasure.h" 11 | #import "AppMonitorMeasureValueSet.h" 12 | @interface AppMonitorMeasureSet : NSObject 13 | 14 | /** 15 | * 根据列表初始化指标集合对象 16 | * 17 | * @param array NSString类型的数组 string为Name; 18 | * @return 19 | */ 20 | 21 | + (instancetype)setWithArray:(NSArray *)array; 22 | 23 | - (BOOL)valid:(NSString*)module MonitorPoint:(NSString*)monitorpoint measureValues:(AppMonitorMeasureValueSet *)measureValues; 24 | /** 25 | * 增加指标 26 | * 27 | * @param measure 指标对象 28 | * @return 29 | */ 30 | - (void)addMeasure:(AppMonitorMeasure *)measure; 31 | 32 | /** 33 | * 增加指标对象 34 | * 35 | * @param name 指标名称 36 | * @return 37 | */ 38 | - (void)addMeasureWithName:(NSString *)name; 39 | /** 40 | * 获取指标对象 41 | * 42 | * @param name 指标名称 43 | * @return 44 | */ 45 | - (AppMonitorMeasure *)measureForName:(NSString *)name; 46 | 47 | /** 48 | * 获取指标对象的列表 49 | * 50 | * @return 51 | */ 52 | - (NSMutableOrderedSet *)measures; 53 | 54 | /** 55 | * 设置定值维度 56 | * 57 | * @param measureValues key为指标名称,value为内容 58 | */ 59 | - (void)setConstantValue:(AppMonitorMeasureValueSet *)measureValues; 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/AppMonitorMeasureValue.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorMeasureValue.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/2/15. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * 监控指标值 13 | * 14 | */ 15 | 16 | @interface AppMonitorMeasureValue : NSObject 17 | 18 | /** 19 | * 耗时操作是否已经完成 20 | */ 21 | @property (nonatomic, assign) BOOL isFinish; 22 | @property (nonatomic, strong) NSNumber * offset; 23 | @property (nonatomic, strong) NSNumber * value; 24 | 25 | - (instancetype)initWithValue:(NSNumber *)value; 26 | - (instancetype)initWithValue:(NSNumber *)value offset:(NSNumber *)offset; 27 | - (void)merge:(AppMonitorMeasureValue *)measureValue; 28 | //为了json序列化 29 | - (NSDictionary *)jsonDict; 30 | //json反序列化 31 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/AppMonitorMeasureValueSet.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorMeasureValueSet.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/2/15. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppMonitorMeasureValue.h" 11 | @interface AppMonitorMeasureValueSet : NSObject 12 | 13 | 14 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 15 | 16 | 17 | /** 18 | * 设置指标值 19 | * 20 | * @param name 21 | * @param value 22 | * @return 23 | */ 24 | - (void)setDoubleValue:(double)value forName:(NSString *)name; 25 | - (void)setValue:(AppMonitorMeasureValue *)value forName:(NSString *)name; 26 | - (BOOL)containValueForName:(NSString *)name; 27 | - (AppMonitorMeasureValue *)valueForName:(NSString *)name; 28 | /** 29 | * 合并指标 30 | * 31 | * @param measureValueSet 目标指标集合 32 | * 发现相同的name就对MeasureValue做加操作 33 | */ 34 | - (void)merge:(AppMonitorMeasureValueSet*)measureValueSet; 35 | 36 | - (NSDictionary *)jsonDict; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/AppMonitorStat.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorStat.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/3/10. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppMonitorBase.h" 11 | #import "AppMonitorMeasureSet.h" 12 | #import "AppMonitorDimensionSet.h" 13 | 14 | @interface AppMonitorStatTransaction :NSObject 15 | 16 | - (void)beginWithMeasureName:(NSString *)measureName; 17 | 18 | - (void)endWithMeasureName:(NSString *)measureName; 19 | 20 | @end 21 | 22 | @interface AppMonitorStat : AppMonitorBase 23 | 24 | /** 25 | * 注册性能埋点 26 | * @param module 模块 27 | * @param monitorPoint 监控点 28 | * @param measures 多指标 29 | */ 30 | + (void)registerWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureSet:(AppMonitorMeasureSet *)measures; 31 | 32 | /** 33 | * 注册性能埋点 34 | * @param module 模块 35 | * @param monitorPoint 监控点 36 | * @param measures 多指标 37 | * @param dimemsions 多维度 38 | */ 39 | + (void)registerWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureSet:(AppMonitorMeasureSet *)measures dimensionSet:(AppMonitorDimensionSet *)dimensions; 40 | 41 | /** 42 | * 注册性能埋点 43 | * @param module 模块 44 | * @param monitorPoint 监控点 45 | * @param measures 多指标 46 | * @param isCommitDetail 标记是否提交明细。需要提交明细时设置为YES,否则为NO 47 | */ 48 | + (void)registerWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureSet:(AppMonitorMeasureSet *)measures isCommitDetail:(BOOL)detail; 49 | 50 | /** 51 | * 注册性能埋点 52 | * @param module 模块 53 | * @param monitorPoint 监控点 54 | * @param measures 多指标 55 | * @param dimemsions 多维度 56 | * @param isCommitDetail 标记是否提交明细。需要提交明细时设置为YES,否则为NO 57 | */ 58 | + (void)registerWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureSet:(AppMonitorMeasureSet *)measures dimensionSet:(AppMonitorDimensionSet *)dimensions isCommitDetail:(BOOL)detail; 59 | 60 | /** 61 | * 提交多维度,多指标 62 | * @param module 监控模块 63 | * @param monitorPoint 监控点名称 Page+monitorPoint必须唯一 64 | * @param dimensionValues 维度值集合 65 | * @param measureValues 指标值集合 66 | */ 67 | + (void)commitWithModule:(NSString*) module monitorPoint:(NSString *)monitorPoint dimensionValueSet:(AppMonitorDimensionValueSet *)dimensionValues measureValueSet:(AppMonitorMeasureValueSet *)measureValues; 68 | 69 | /** 70 | * 提交多维度单指标 71 | * @param module 监控模块 72 | * @param monitorPoint 监控点名称 Page+monitorPoint必须唯一 73 | * @param dimensionValues 维度值集合 74 | * @param value 指标值 75 | */ 76 | 77 | + (void)commitWithModule:(NSString*) module monitorPoint:(NSString *)monitorPoint dimensionValueSet:(AppMonitorDimensionValueSet *)dimensionValues value:(double)value; 78 | 79 | /** 80 | * 提交单指标 81 | * @param module 监控模块 82 | * @param monitorPoint 监控点名称 Page+monitorPoint必须唯一 83 | * @param value 指标值 84 | */ 85 | + (void)commitWithModule:(NSString*) module monitorPoint:(NSString *)monitorPoint value:(double)value; 86 | 87 | /** 88 | *开始事件,适合不存在并发的跨多线程事件(比如常见的UI加载渲染)
89 | *如果事件跨多线程多并发执行,请使用beginTransaction-endTransaction方法对,此场景较少见 90 | * @param module 监控模块 91 | * @param monitorPoint 监控点名称 module+monitorPoint必须唯一 92 | */ 93 | + (void)beginWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureName:(NSString *)measureName; 94 | 95 | /** 96 | *结束事件,适合不存在并发的跨多线程事件(比如常见的UI加载渲染)
97 | *如果事件跨多线程多并发执行,请使用beginTransaction-endTransaction方法对,此场景较少见 98 | * @param module 监控模块 99 | * @param monitorPoint 监控点名称 module+monitorPoint必须唯一 100 | */ 101 | + (void)endWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureName:(NSString *)measureName; 102 | 103 | /** 104 | * 埋点事务,可以通过调用事务的begin-end方法对来统计耗时指标的值 105 | * 106 | * @param module 模块 107 | * @param monitorPoint 监控点 108 | * @return 返回埋点事务实例 109 | */ 110 | 111 | + (AppMonitorStatTransaction *)createTransactionWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint; 112 | 113 | @end 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/AppMonitorTable.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorStat2.h 3 | // AppMonitor 4 | // 5 | // Created by sugar on 7/8/15. 6 | // Copyright (c) 2015 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | ///////////////////////////////////////////////////////// 12 | // 数据格式以下图为例: 13 | // 启动性能 - 启动时间监控 14 | // 启动方式 | cpu | 机型 | 网络类型| 总计 15 | // ---------------------------------- 16 | // 冷启动耗时 |arm7 | 4s | 2G | 5s (约束2-10) 17 | // 热启动耗时 |arm7s| 5s | 4G | 3s (约束1-3) 18 | 19 | // step 1: 创建一个模块空间;monitorForScheme 20 | // step 2: 在空间下面创建表 21 | // step 3: 添加对应的值的约束,不在约束范围内的点将一噪点方式上报 22 | // step 4: 更新表数据 23 | // 24 | 25 | ///////////////////////////////////////////////////////// 26 | 27 | 28 | @interface AppMonitorTable : NSObject 29 | 30 | // BEGIN Add by 玄叶 31 | + (void)registerWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint columns:(NSArray *)cols rows:(NSArray * )rows aggregate:(BOOL)aggregate; 32 | 33 | + (void)addConstraintWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint name:(NSString *)name min:(double)min max:(double)max defaultValue:(double)value; 34 | 35 | + (BOOL)commitWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint columns:(NSDictionary *)cols rows:(NSDictionary *)rows; 36 | // END 37 | 38 | // 创建一个表的模块空间 39 | + (instancetype)monitorForScheme:(NSString *)scheme tableName:(NSString *)tableName; 40 | 41 | // 新建一张表, 行,列,数据是否聚合 42 | - (void)registerTableWithRows:(NSArray * )rows columns:(NSArray *)cols aggregate:(BOOL)yn; 43 | 44 | // 添加约束 45 | - (void)addConstraintWithName:(NSString *)name range:(NSRange)range defaultValue:(NSNumber *)number; 46 | 47 | // 添加约束 48 | - (void)addConstraintWithName:(NSString *)name min:(double)min max:(double)max defaultValue:(double)value; 49 | 50 | // 更新表 行的名字,列的名字,行的数据,列的数据 51 | - (BOOL)updateTableForColumns:(NSDictionary *)cols rows:(NSDictionary *)rows; 52 | 53 | // 更新表,不区分行列名字。此接口不允许行列同名,性能偏低,慎用! 54 | - (BOOL)updateTableWithDictionary:(NSDictionary *)dict; 55 | 56 | @end -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/UT.h: -------------------------------------------------------------------------------- 1 | // 2 | // UT.h 3 | // miniUTSDK 4 | // 5 | // Created by 宋军 on 15/5/19. 6 | // Copyright (c) 2015年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface UT : NSObject 13 | 14 | ////=====================================h5&Native接口===================================== 15 | /** 16 | * @brief h5&Native打通 17 | * 18 | * @warning 调用说明:由windwave封装,供aplus_wap.js调用 19 | * 20 | * 21 | * 22 | * @param dataDict aplus_wap.js采集的h5信息都通过该字典传进来,该字典中必须有key(funcType) 23 | * 用来区分采集的是哪个事件信息,比如funcType=2001,则h5UT内部会调用 24 | * pageEnter来处理,funcType=2101,则调用ctrlClicked处理 25 | * 26 | */ 27 | +(void) h5UT:(NSDictionary *) dataDict view:(UIView *) pView viewController:(UIViewController *) pViewController; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/UTAnalytics.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTAnalytics.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-14. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UTTracker.h" 11 | #import "UTIRequestAuthentication.h" 12 | #import "UTICrashCaughtListener.h" 13 | 14 | @interface UTAnalytics : NSObject 15 | 16 | 17 | + (void) turnOnDev2; 18 | 19 | /** 20 | * 单例初始化时,不再会从安全图片和指令plist读取appkey 21 | * 22 | * @return 返回UTAnalytics单例 23 | * 24 | */ 25 | +(UTAnalytics *) getInstance; 26 | 27 | 28 | /** 29 | * 老接口兼容:接口方式设置主app级appkey/appsecret对 30 | * 重复设置抛异常 31 | * 32 | * @param appKey 主app级的appkey 33 | * 34 | * @param secret 主app级的appsecret 35 | * 36 | */ 37 | - (void)setAppKey:(NSString *)appKey secret:(NSString *)secret; 38 | 39 | 40 | /** 41 | * 新接口1:从安全图片读取出appkey后,塞給ut,作为主app级的appkey 42 | * 重复设置抛异常 43 | * 44 | * @param appKey 主app级的appkey 45 | * 46 | * @param authocode 多图片时的后缀;为nil时,对应默认图片 47 | * 48 | */ 49 | - (void)setAppKey4APP:(NSString *)appKey authcode:(NSString *)authcode; 50 | 51 | 52 | /** 53 | * 新接口2:接口方式设置SDK级appkey/appsecret对 54 | * !!!请注意:只设置了SDK级appkey,埋点方法(UTTracker *) getTracker:(NSString *) pTrackId将不起作用 55 | * !!!请注意:一定要先设置了主app级appkey,埋点方法(UTTracker *) getTracker:(NSString *) pTrackId才会作用 56 | * 57 | * @param appKey SDK级的appkey 58 | * 59 | * @param secret SDK级的appsecret 60 | * 61 | */ 62 | - (void)setAppKey4SDK:(NSString *)appKey secret:(NSString *)secret; 63 | 64 | 65 | /** 66 | * 新接口3:从安全图片读取出appkey后,塞給ut,作为SDK级的appkey 67 | * !!!请注意:只设置了SDK级appkey,埋点方法(UTTracker *) getTracker:(NSString *) pTrackId将不起作用 68 | * !!!请注意:一定要先设置了主app级appkey,埋点方法(UTTracker *) getTracker:(NSString *) pTrackId才会作用 69 | * 70 | * @param appKey SDK级的appkey 71 | * 72 | * @param authocode 多图片时的后缀;为nil时,对应默认图片 73 | * 74 | */ 75 | - (void)setAppKey4SDK:(NSString *)appKey authcode:(NSString *)authcode; 76 | 77 | 78 | + (void)setDailyEnvironment __deprecated; 79 | 80 | /** 81 | * 老接口:对主app级的appkey设置appversion 82 | * 83 | * @param pAppVersion app级的appversion 84 | * 85 | */ 86 | -(void) setAppVersion:(NSString *) pAppVersion; 87 | 88 | 89 | -(void) setChannel:(NSString *) pChannel; 90 | 91 | -(void) updateUserAccount:(NSString *) pNick userid:(NSString *) pUserId; 92 | 93 | -(void) userRegister:(NSString *) pUsernick; 94 | 95 | -(void) updateSessionProperties:(NSDictionary *) pDict; 96 | 97 | 98 | /** 99 | * 老接口兼容:获取默认的UTTracker. 100 | * 如果设置了app级的appkey,默认的tracker对应app级的生产者 101 | * 如果只设置了sdk级的appkey,默认的tracker为空,返回第一个设置appkey的对应生产者 102 | * 103 | * @return 默认的UTTracker 104 | * 105 | */ 106 | -(UTTracker *) getDefaultTracker; 107 | 108 | 109 | /** 110 | * 老接口兼容:返回trackid对应的UTTracker. 111 | * 只能已经设置主app级appkey的前提下,才能有效设置并返回 112 | * 113 | * @param pTrackId 主app级的trackid 114 | * 115 | * @return 返回trackid对应的UTTracker 116 | * 117 | */ 118 | -(UTTracker *) getTracker:(NSString *) pTrackId; 119 | 120 | 121 | /** 122 | * 新接口:获取sdk级对应的UTTracker. 123 | * 只有已经设置对应的sdk级的appkey的前提下,才能有效返回 124 | * 125 | * @param pAppkey SDK级的appkey 126 | * 127 | * @return sdk级对应的UTTracker 128 | * 129 | */ 130 | -(UTTracker *) getTracker4SDK:(NSString *) pAppkey; 131 | 132 | -(void) turnOnDebug; 133 | 134 | -(void) turnOnDev; 135 | 136 | // 以下接口功能已废弃,接口保留 137 | -(void) setRequestAuthentication:(id) pRequestAuth __deprecated; 138 | 139 | - (void)onCrashHandler; 140 | 141 | -(void) turnOffCrashHandler; 142 | 143 | -(void) setCrashCaughtListener:(id) aListener; 144 | 145 | @end 146 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/UTBaseRequestAuthentication.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseRequestAuthentication.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-17. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UTIRequestAuthentication.h" 11 | 12 | @interface UTBaseRequestAuthentication : NSObject 13 | 14 | -(id) initWithAppKey:(NSString *) pAppKey appSecret:(NSString *) pSecret; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/UTCustomHitBuilder.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTCustomHitBuilder.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-17. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import "UTHitBuilder.h" 10 | 11 | @interface UTCustomHitBuilder : UTHitBuilder 12 | 13 | -(void) setEventLabel:(NSString *) pEventId; 14 | 15 | -(void) setEventPage:(NSString *) pPageName; 16 | 17 | -(void) setDurationOnEvent:(long long) durationOnEvent; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/UTHitBuilder.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTBaseMapBuilder.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-14. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface UTHitBuilder : NSObject 13 | 14 | 15 | -(NSDictionary *) build; 16 | 17 | -(void) setProperty:(NSString *) pKey value:(NSString *) pValue; 18 | 19 | -(void) setProperties:(NSDictionary *) pPageProperties; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/UTICrashCaughtListener.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTICrashCaughtListener.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14/10/28. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol UTICrashCaughtListener 12 | 13 | -(NSDictionary *) onCrashCaught:(NSString *) pCrashReason CallStack:(NSString *)callStack; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/UTIRequestAuthentication.h: -------------------------------------------------------------------------------- 1 | // 2 | // IRequestAuthentication.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-17. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol UTIRequestAuthentication 12 | 13 | -(NSString *) getAppKey; 14 | 15 | -(NSString *) getSign:(NSString*) pToBeSignStr; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/UTOirginalCustomHitBuilder.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTOirginalCustomHitBuilder.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14/10/28. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UTHitBuilder.h" 11 | @interface UTOirginalCustomHitBuilder : UTHitBuilder 12 | 13 | -(void) setPageName:(NSString *) pPage; 14 | 15 | -(void) setEventId:(NSString *) pEventId; 16 | 17 | -(void) setArg1:(NSString *) pArg1; 18 | 19 | -(void) setArg2:(NSString *) pArg2; 20 | 21 | -(void) setArg3:(NSString *) pArg3; 22 | 23 | -(void) setArgs:(NSDictionary *) pArgs; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/UTPageHitBuilder.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTMapBuilder.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-14. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import "UTHitBuilder.h" 10 | 11 | @interface UTPageHitBuilder : UTHitBuilder 12 | 13 | -(void) setPageName:(NSString *) pPageName; 14 | 15 | -(void) setReferPage:(NSString *) pReferPageName; 16 | 17 | -(void) setDurationOnPage:(long long ) durationTimeOnPage; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/UTSecuritySDKRequestAuthentication.h: -------------------------------------------------------------------------------- 1 | // 2 | // SecuritySDKRequestAuthentication.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-17. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UTIRequestAuthentication.h" 11 | 12 | @interface UTSecuritySDKRequestAuthentication : NSObject 13 | 14 | -(id) initWithAppKey:(NSString *) pAppKey; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/UTTeamWork.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTTeamWork.h 3 | // UTMini 4 | // 5 | // Created by ljianfeng on 2019/9/29. 6 | // Copyright © 2019 alibaba. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface UTTeamWork : NSObject 14 | /** 15 | * @brief 自定义https上传域名 16 | * 17 | * @param url 指定的https上传域名,比如以https://开头 18 | * 19 | * @warning 调用说明:需要在初始化UT之前调用(setAppkey之前) 20 | */ 21 | + (void)setHttpsUploadUrl:(NSString *)url; 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Headers/UTTracker.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTTracker.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-14. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | //#import 11 | //#import 12 | @class UTDSDKInfo; 13 | 14 | typedef enum _UTPageStatus{ 15 | UT_H5_IN_WebView//设置容器中的H5页面事件的eventid为2001,不设置默认为2006 16 | } UTPageStatus; 17 | 18 | @interface UTTracker : NSObject 19 | 20 | @property (readonly,copy) UTDSDKInfo * mSdkinfo; 21 | 22 | -(id) initWithTrackId:(NSString *) pTrackId __deprecated; 23 | 24 | -(id) initWithAppKey:(NSString *) pAppkey 25 | appsecret:(NSString *) pAppSecret 26 | authcode:(NSString *) pAuthCode 27 | securitySign:(BOOL) securitySign; 28 | 29 | -(id) initWithTracker:(UTTracker *) pTracker trackid:(NSString *) pTrackId; 30 | 31 | -(NSString *) getAppKey; 32 | 33 | -(void) setGlobalProperty:(NSString *) pKey value:(NSString *) pValue; 34 | 35 | -(void) removeGlobalProperty:(NSString *) pKey; 36 | 37 | -(NSString *) getGlobalProperty:(NSString *) pKey; 38 | 39 | -(void) send:(NSDictionary *) pLogDict; 40 | 41 | #pragma mark 页面埋点 42 | /** 43 | * @brief 页面进入. 44 | * 45 | * @param pPageObject 页面对象,如viewcontroller指针 46 | * 47 | * @warning 调用说明:1.必须和pageDisAppear配对使用,否则不会成功埋点 48 | * 2.确定页面名称优先级:updatePageName > NSStringFromClass(pObject.class) 49 | * 50 | * 最佳位置:若是viewcontroller页面,则需在viewDidAppear函数内调用 51 | */ 52 | -(void) pageAppear:(id) pPageObject; 53 | 54 | /** 55 | * @brief 页面进入. 56 | * 57 | * @param pPageObject 页面对象,如viewcontroller指针 58 | * @param pPageName 页面名称,如Page_Detail 59 | * 60 | * @warning 调用说明:1.必须和pageDisAppear配对使用,否则不会成功埋点 61 | * 2.确定页面名称优先级:updatePageName > pPageName > NSStringFromClass(pObject.class) 62 | * 若当调用pageAppear时已知页面名称,强烈建议使用该接口 63 | * 最佳位置:若是viewcontroller页面,则需在viewDidAppear函数内调用 64 | */ 65 | -(void) pageAppear:(id) pPageObject withPageName:(NSString *) pPageName; 66 | 67 | /** 68 | * @brief 页面离开. 69 | * 70 | * @param pPageObject 页面对象,如viewcontroller指针 71 | * 72 | * @warning 调用说明:必须和pageAppear配对使用,否则不会成功埋点 73 | * 74 | * 最佳位置:若是viewcontroller页面,则需在viewDidDisAppear函数内调用 75 | */ 76 | -(void) pageDisAppear:(id) pPageObject; 77 | 78 | /** 79 | * @brief 更新页面业务参数. 80 | * 81 | * @param pPageObject 页面对象,如viewcontroller指针 82 | * @param pProperties 业务参数,kv对 83 | * 84 | * @warning 调用说明:必须在pageDisAppear之前调用 85 | * 86 | * 最佳位置:在pageDisAppear之前调用即可 87 | */ 88 | -(void) updatePageProperties:(id) pPageObject properties:(NSDictionary *) pProperties; 89 | 90 | /** 91 | * @brief 更新页面业务参数. 92 | * 93 | * @param pProperties 传给下一个页面业务参数,kv对 94 | * 95 | * @warning 调用说明:必须在下一个页面pageAppear之前调用,否则会携带错误 96 | * 97 | * 最佳位置:必须在下一个页面pageAppear之前调用 98 | */ 99 | -(void) updateNextPageProperties:(NSDictionary *) pProperties; 100 | 101 | #pragma mark 页面埋点的辅助函数 102 | /** 103 | * @brief 更新页面名称. 104 | * 105 | * @param pPageObject 页面对象,如viewcontroller指针 106 | * @param pPageName 更新后的页面名称 107 | * 108 | * @warning 调用说明:只有当调用pageAppear时还未知页面名称,后续可使用该接口更新 109 | * 110 | * 最佳位置:在pageDisAppear之前调用 111 | */ 112 | -(void) updatePageName:(id) pPageObject pageName:(NSString *) pPageName; 113 | 114 | /** 115 | * @brief 更新页面url. 116 | * 117 | * @param pPageObject 页面对象,如viewcontroller指针 118 | * @param pUrl 页面对应的url 119 | * 120 | * @warning 调用说明:如手淘统一导航将每次页面跳转的url塞给对应的viewcontroller 121 | * 122 | * 最佳位置:在pageDisAppear之前调用 123 | */ 124 | -(void) updatePageUrl:(id) pPageObject url:(NSURL *) pUrl; 125 | 126 | /** 127 | * @brief 更新页面状态. 128 | * 129 | * @param pPageObject 页面对象,如viewcontroller指针 130 | * @param aStatus 页面状态 enum类型 131 | * 132 | * @warning 调用说明:告知页面处于某些特殊的业务场景,如回退等 133 | * 134 | * 最佳位置:必须在pageAppear之前调用 135 | */ 136 | -(void) updatePageStatus:(id) pPageObject status:(UTPageStatus) aStatus; 137 | 138 | 139 | -(void) skipPage:(id) pPageObject; 140 | 141 | - (void) ctrlClicked:(NSString *)controlName onPage:(NSObject *) pageName args:(NSDictionary *) dict; 142 | 143 | @end 144 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 17G65 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | UTMini 11 | CFBundleIdentifier 12 | com.taobao.junzhan.UTMini 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | UTMini 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 5.2.0.2-appkeys-SNAPSHOT 21 | CFBundleSignature 22 | ???? 23 | CFBundleSupportedPlatforms 24 | 25 | iPhoneOS 26 | 27 | CFBundleVersion 28 | 1 29 | DTCompiler 30 | com.apple.compilers.llvm.clang.1_0 31 | DTPlatformBuild 32 | 16B91 33 | DTPlatformName 34 | iphoneos 35 | DTPlatformVersion 36 | 12.1 37 | DTSDKBuild 38 | 16B91 39 | DTSDKName 40 | iphoneos12.1 41 | DTXcode 42 | 1010 43 | DTXcodeBuild 44 | 10B61 45 | MinimumOSVersion 46 | 5.0 47 | UIDeviceFamily 48 | 49 | 1 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /ios/libs/UTMini.framework/UTMini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/ios/libs/UTMini.framework/UTMini -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-aliyun-push", 3 | "version": "1.0.22", 4 | "description": "A react native wrapper for aliyun push SDK", 5 | "main": "index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/wonday/react-native-aliyun-push.git" 9 | }, 10 | "keywords": [ 11 | "react-component", 12 | "react-native", 13 | "android", 14 | "ios", 15 | "aliyun", 16 | "ali", 17 | "push", 18 | "aliyun-push", 19 | "ali-push" 20 | ], 21 | "author": { 22 | "name": "Wonday", 23 | "url": "https://github.com/wonday" 24 | }, 25 | "license": "MIT", 26 | "bugs": { 27 | "url": "https://github.com/wonday/react-native-aliyun-push/issues" 28 | }, 29 | "dependencies": { 30 | }, 31 | "peerDependencies": { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /sample/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | lib_deps = [] 12 | 13 | for jarfile in glob(['libs/*.jar']): 14 | name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] 15 | lib_deps.append(':' + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | 21 | for aarfile in glob(['libs/*.aar']): 22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] 23 | lib_deps.append(':' + name) 24 | android_prebuilt_aar( 25 | name = name, 26 | aar = aarfile, 27 | ) 28 | 29 | android_library( 30 | name = "all-libs", 31 | exported_deps = lib_deps, 32 | ) 33 | 34 | android_library( 35 | name = "app-code", 36 | srcs = glob([ 37 | "src/main/java/**/*.java", 38 | ]), 39 | deps = [ 40 | ":all-libs", 41 | ":build_config", 42 | ":res", 43 | ], 44 | ) 45 | 46 | android_build_config( 47 | name = "build_config", 48 | package = "org.wonday", 49 | ) 50 | 51 | android_resource( 52 | name = "res", 53 | package = "org.wonday", 54 | res = "src/main/res", 55 | ) 56 | 57 | android_binary( 58 | name = "app", 59 | keystore = "//android/keystores:debug", 60 | manifest = "src/main/AndroidManifest.xml", 61 | package_type = "debug", 62 | deps = [ 63 | ":app-code", 64 | ], 65 | ) 66 | -------------------------------------------------------------------------------- /sample/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation 19 | * entryFile: "index.android.js", 20 | * 21 | * // whether to bundle JS and assets in debug mode 22 | * bundleInDebug: false, 23 | * 24 | * // whether to bundle JS and assets in release mode 25 | * bundleInRelease: true, 26 | * 27 | * // whether to bundle JS and assets in another build variant (if configured). 28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 29 | * // The configuration property can be in the following formats 30 | * // 'bundleIn${productFlavor}${buildType}' 31 | * // 'bundleIn${buildType}' 32 | * // bundleInFreeDebug: true, 33 | * // bundleInPaidRelease: true, 34 | * // bundleInBeta: true, 35 | * 36 | * // the root of your project, i.e. where "package.json" lives 37 | * root: "../../", 38 | * 39 | * // where to put the JS bundle asset in debug mode 40 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 41 | * 42 | * // where to put the JS bundle asset in release mode 43 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 44 | * 45 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 46 | * // require('./image.png')), in debug mode 47 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 48 | * 49 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 50 | * // require('./image.png')), in release mode 51 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 52 | * 53 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 54 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 55 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 56 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 57 | * // for example, you might want to remove it from here. 58 | * inputExcludes: ["android/**", "ios/**"], 59 | * 60 | * // override which node gets called and with what additional arguments 61 | * nodeExecutableAndArgs: ["node"] 62 | * 63 | * // supply additional arguments to the packager 64 | * extraPackagerArgs: [] 65 | * ] 66 | */ 67 | 68 | project.ext.react = [ 69 | entryFile: "index.js" 70 | ] 71 | 72 | apply from: "../../node_modules/react-native/react.gradle" 73 | 74 | /** 75 | * Set this to true to create two separate APKs instead of one: 76 | * - An APK that only works on ARM devices 77 | * - An APK that only works on x86 devices 78 | * The advantage is the size of the APK is reduced by about 4MB. 79 | * Upload all the APKs to the Play Store and people will download 80 | * the correct one based on the CPU architecture of their device. 81 | */ 82 | def enableSeparateBuildPerCPUArchitecture = false 83 | 84 | /** 85 | * Run Proguard to shrink the Java bytecode in release builds. 86 | */ 87 | def enableProguardInReleaseBuilds = false 88 | 89 | android { 90 | compileSdkVersion rootProject.ext.compileSdkVersion 91 | buildToolsVersion rootProject.ext.buildToolsVersion 92 | 93 | defaultConfig { 94 | applicationId "org.wonday" 95 | minSdkVersion rootProject.ext.minSdkVersion 96 | targetSdkVersion rootProject.ext.targetSdkVersion 97 | versionCode 1 98 | versionName '1.0.0' 99 | 100 | ndk { 101 | abiFilters "armeabi-v7a", "x86" 102 | } 103 | vectorDrawables.useSupportLibrary true 104 | multiDexEnabled true 105 | } 106 | 107 | splits { 108 | abi { 109 | reset() 110 | enable enableSeparateBuildPerCPUArchitecture 111 | universalApk false // If true, also generate a universal APK 112 | include "armeabi-v7a", "x86" 113 | } 114 | } 115 | buildTypes { 116 | } 117 | // applicationVariants are e.g. debug, release 118 | applicationVariants.all { variant -> 119 | variant.outputs.each { output -> 120 | // For each separate APK per architecture, set a unique version code as described here: 121 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 122 | def versionCodes = ["armeabi-v7a":1, "x86":2] 123 | def abi = output.getFilter(OutputFile.ABI) 124 | if (abi != null) { // null for the universal-debug, universal-release variants 125 | output.versionCodeOverride = 126 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 127 | } 128 | } 129 | } 130 | } 131 | 132 | dependencies { 133 | compile project(':react-native-aliyun-push') 134 | compile fileTree(dir: "libs", include: ["*.jar"]) 135 | compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" 136 | compile "com.facebook.react:react-native:+" // From node_modules 137 | 138 | // If your app supports Android versions before Ice Cream Sandwich (API level 14) 139 | compile 'com.facebook.fresco:animated-base-support:1.3.0' 140 | 141 | // For animated GIF support 142 | compile 'com.facebook.fresco:animated-gif:1.3.0' 143 | 144 | // For WebP support, including animated WebP 145 | compile 'com.facebook.fresco:animated-webp:1.3.0' 146 | compile 'com.facebook.fresco:webpsupport:1.3.0' 147 | 148 | // For WebP support, without animations 149 | compile 'com.facebook.fresco:webpsupport:1.3.0' 150 | compile 'com.android.support:multidex:' 151 | } 152 | 153 | // Run this once to be able to run the application with BUCK 154 | // puts all compile dependencies into folder libs for BUCK to use 155 | task copyDownloadableDepsToLibs(type: Copy) { 156 | from configurations.compile 157 | into 'libs' 158 | } 159 | -------------------------------------------------------------------------------- /sample/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Disabling obfuscation is useful if you collect stack traces from production crashes 20 | # (unless you are using a system that supports de-obfuscate the stack traces). 21 | -dontobfuscate 22 | 23 | # React Native 24 | 25 | # Keep our interfaces so they can be used by other ProGuard rules. 26 | # See http://sourceforge.net/p/proguard/bugs/466/ 27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip 28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters 29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip 30 | 31 | # Do not strip any method/class that is annotated with @DoNotStrip 32 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 33 | -keep @com.facebook.common.internal.DoNotStrip class * 34 | -keepclassmembers class * { 35 | @com.facebook.proguard.annotations.DoNotStrip *; 36 | @com.facebook.common.internal.DoNotStrip *; 37 | } 38 | 39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 40 | void set*(***); 41 | *** get*(); 42 | } 43 | 44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 46 | -keepclassmembers,includedescriptorclasses class * { native ; } 47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } 49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } 50 | 51 | -dontwarn com.facebook.react.** 52 | 53 | # okhttp 54 | 55 | -keepattributes Signature 56 | -keepattributes *Annotation* 57 | -keep class okhttp3.** { *; } 58 | -keep interface okhttp3.** { *; } 59 | -dontwarn okhttp3.** 60 | 61 | # okio 62 | 63 | -keep class sun.misc.Unsafe { *; } 64 | -dontwarn java.nio.file.* 65 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 66 | -dontwarn okio.** 67 | 68 | -keep class com.tencent.mm.sdk.** {*;} 69 | 70 | -keep class com.facebook.imagepipeline.animated.factory.AnimatedFactoryImpl { 71 | public AnimatedFactoryImpl(com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory, com.facebook.imagepipeline.core.ExecutorSupplier); 72 | } -------------------------------------------------------------------------------- /sample/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 23 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /sample/android/app/src/main/java/org/wonday/MainActivity.java: -------------------------------------------------------------------------------- 1 | package org.wonday; 2 | 3 | import com.facebook.react.ReactActivity; 4 | import android.content.Intent; 5 | import android.content.res.Configuration; 6 | 7 | public class MainActivity extends ReactActivity { 8 | 9 | /** 10 | * Returns the name of the main component registered from JavaScript. 11 | * This is used to schedule rendering of the component. 12 | */ 13 | @Override 14 | protected String getMainComponentName() { 15 | return "sample"; 16 | } 17 | 18 | @Override 19 | public void onConfigurationChanged(Configuration newConfig) { 20 | super.onConfigurationChanged(newConfig); 21 | Intent intent = new Intent("onConfigurationChanged"); 22 | intent.putExtra("newConfig", newConfig); 23 | this.sendBroadcast(intent); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /sample/android/app/src/main/java/org/wonday/MainApplication.java: -------------------------------------------------------------------------------- 1 | package org.wonday; 2 | 3 | import android.app.Application; 4 | import android.support.multidex.MultiDexApplication; 5 | import android.app.NotificationChannel; 6 | import android.app.NotificationManager; 7 | import android.content.Context; 8 | import android.graphics.Color; 9 | import android.os.Build; 10 | 11 | import com.facebook.react.ReactApplication; 12 | import org.wonday.aliyun.push.AliyunPushPackage; 13 | 14 | import com.facebook.react.ReactInstanceManager; 15 | import com.facebook.react.ReactNativeHost; 16 | import com.facebook.react.ReactPackage; 17 | import com.facebook.react.shell.MainReactPackage; 18 | import com.facebook.soloader.SoLoader; 19 | import com.facebook.react.common.ReactConstants; 20 | import com.facebook.common.logging.FLog; 21 | 22 | import java.util.Arrays; 23 | import java.util.List; 24 | 25 | import com.alibaba.sdk.android.push.CloudPushService; 26 | import com.alibaba.sdk.android.push.CommonCallback; 27 | import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory; 28 | import com.alibaba.sdk.android.push.register.HuaWeiRegister; 29 | import com.alibaba.sdk.android.push.register.MiPushRegister; 30 | 31 | public class MainApplication extends MultiDexApplication implements ReactApplication { 32 | 33 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 34 | @Override 35 | public boolean getUseDeveloperSupport() { 36 | return BuildConfig.DEBUG; 37 | } 38 | 39 | @Override 40 | protected List getPackages() { 41 | return Arrays.asList( 42 | new MainReactPackage(), 43 | new AliyunPushPackage() 44 | ); 45 | } 46 | 47 | @Override 48 | protected String getJSMainModuleName() { 49 | return "index"; 50 | } 51 | 52 | }; 53 | 54 | 55 | @Override 56 | public ReactNativeHost getReactNativeHost() { 57 | return mReactNativeHost; 58 | } 59 | 60 | @Override 61 | public void onCreate() { 62 | super.onCreate(); 63 | this.initCloudChannel(this); 64 | } 65 | 66 | /** 67 | * 初始化阿里云推送通道 68 | * @param applicationContext 69 | */ 70 | private void initCloudChannel(final Context applicationContext) { 71 | // 创建notificaiton channel 72 | this.createNotificationChannel(); 73 | PushServiceFactory.init(applicationContext); 74 | CloudPushService pushService = PushServiceFactory.getCloudPushService(); 75 | pushService.setNotificationSmallIcon(R.mipmap.ic_launcher_s); 76 | pushService.register(applicationContext, "11111111", "11111111", new CommonCallback() { 77 | @Override 78 | public void onSuccess(String response) { 79 | FLog.d(ReactConstants.TAG, "init aliyun push cloudchannel success"); 80 | } 81 | @Override 82 | public void onFailed(String code, String message) { 83 | FLog.d(ReactConstants.TAG, "init aliyun push cloudchannel failed. errorCode:" + code + ". errorMsg:" + message); 84 | } 85 | }); 86 | 87 | // 注册方法会自动判断是否支持小米系统推送,如不支持会跳过注册。 88 | MiPushRegister.register(applicationContext, "11111111", "11111111"); 89 | // 注册方法会自动判断是否支持华为系统推送,如不支持会跳过注册。 90 | HuaWeiRegister.register(applicationContext); 91 | } 92 | 93 | private void createNotificationChannel() { 94 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 95 | NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 96 | // 通知渠道的id 97 | String id = "1"; 98 | // 用户可以看到的通知渠道的名字. 99 | CharSequence name = "sample"; 100 | // 用户可以看到的通知渠道的描述 101 | String description = "xxx通知"; 102 | int importance = NotificationManager.IMPORTANCE_HIGH; 103 | NotificationChannel mChannel = new NotificationChannel(id, name, importance); 104 | // 配置通知渠道的属性 105 | mChannel.setDescription(description); 106 | // 设置通知出现时的闪灯(如果 android 设备支持的话) 107 | mChannel.enableLights(true); 108 | mChannel.setLightColor(Color.RED); 109 | // 设置通知出现时的震动(如果 android 设备支持的话) 110 | mChannel.enableVibration(true); 111 | mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); 112 | //最后在notificationmanager中创建该通知渠道 113 | mNotificationManager.createNotificationChannel(mChannel); 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-hdpi/ic_launcher_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/android/app/src/main/res/mipmap-hdpi/ic_launcher_s.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-mdpi/ic_launcher_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/android/app/src/main/res/mipmap-mdpi/ic_launcher_s.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher_s.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_s.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | sample 3 | 4 | -------------------------------------------------------------------------------- /sample/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /sample/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | maven { 7 | url 'https://dl.google.com/dl/android/maven2/' 8 | name 'Google' 9 | } 10 | } 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:2.3.3' 13 | 14 | // NOTE: Do not place your application dependencies here; they belong 15 | // in the individual module build.gradle files 16 | } 17 | } 18 | 19 | allprojects { 20 | repositories { 21 | mavenLocal() 22 | jcenter() 23 | maven { 24 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 25 | url "$rootDir/../node_modules/react-native/android" 26 | } 27 | maven { 28 | url 'https://dl.google.com/dl/android/maven2/' 29 | name 'Google' 30 | } 31 | maven { 32 | url "http://maven.aliyun.com/nexus/content/repositories/releases/" 33 | } 34 | flatDir { 35 | dirs project(':react-native-aliyun-push').file('libs') 36 | } 37 | maven { 38 | url "https://jitpack.io" 39 | } 40 | } 41 | } 42 | 43 | ext { 44 | buildToolsVersion = "26.0.3" 45 | minSdkVersion = 16 46 | compileSdkVersion = 23 47 | targetSdkVersion = 23 48 | supportLibVersion = "26.1.0" 49 | } 50 | 51 | subprojects { 52 | afterEvaluate {project -> 53 | if (project.hasProperty("android")) { 54 | android { 55 | compileSdkVersion 26 56 | buildToolsVersion '26.0.3' 57 | } 58 | dependencies { 59 | compile "com.android.support:appcompat-v7:26.1.0" 60 | } 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /sample/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useDeprecatedNdk=true 21 | org.gradle.jvmargs=-Xmx2048M -------------------------------------------------------------------------------- /sample/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /sample/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip 6 | -------------------------------------------------------------------------------- /sample/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /sample/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /sample/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /sample/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /sample/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'sample' 2 | include ':react-native-aliyun-push' 3 | project(':react-native-aliyun-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-aliyun-push/android') 4 | 5 | include ':app' 6 | -------------------------------------------------------------------------------- /sample/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sample", 3 | "displayName": "react-native-aliyun-push Sample" 4 | } -------------------------------------------------------------------------------- /sample/app/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | 6 | 'use strict'; 7 | import React, { Component } from 'react'; 8 | import { 9 | View, 10 | Linking, 11 | Text 12 | } from 'react-native'; 13 | import AliyunPush from 'react-native-aliyun-push'; 14 | 15 | export default class App extends Component { 16 | constructor(props) { 17 | super(props); 18 | } 19 | 20 | componentWillMount() { 21 | 22 | 23 | AliyunPush.getDeviceId() 24 | .then((aliyunDeviceId) => { 25 | //do something 26 | }); 27 | 28 | 29 | 30 | AliyunPush.addListener(this.handleAliyunPushMessage); 31 | Linking.addEventListener('url', this.handleOpenURL); 32 | Linking.getInitialURL().then((url) => { 33 | if (url) { 34 | UrlNavigator.push( 35 | { 36 | url: url, 37 | } 38 | ); 39 | } 40 | }).catch((err) => { 41 | __DEV__ && console.error('start from url error', err) 42 | }); 43 | 44 | } 45 | componentDidMount() { 46 | 47 | } 48 | 49 | componentWillUnmount() { 50 | 51 | AliyunPush.removeListener(this.handleAliyunPushMessage); 52 | Linking.removeEventListener('url', this.handleOpenURL); 53 | 54 | } 55 | 56 | handleAliyunPushMessage = (msg) => { 57 | 58 | 59 | __DEV__ && console.log("Message Received. " + JSON.stringify(msg)); 60 | 61 | if (msg.type && msg.type === "message" ) { 62 | try{ 63 | msg = JSON.parse(msg.body); 64 | }catch (e) { 65 | 66 | } 67 | 68 | } 69 | 70 | if (msg.extras 71 | &&msg.extras.action_ok) { 72 | 73 | Alert.alert( 74 | msg.title, 75 | msg.body, 76 | [ 77 | {text: btnTextCancel, onPress: () => {}}, 78 | {text: btnTextView, onPress: () => { 79 | /* 80 | UrlNavigator.push( 81 | { 82 | url: msg.extras.action_ok, 83 | } 84 | ); 85 | */ 86 | }}, 87 | ] 88 | ); 89 | 90 | } else { 91 | if (!!msg.actionIdentifier===false || msg.actionIdentifier!=='removed') { 92 | Alert.alert( 93 | msg.title, 94 | msg.body 95 | ); 96 | } 97 | 98 | } 99 | 100 | }; 101 | 102 | handleOpenURL = (e) => { 103 | if (e.url) { 104 | UrlNavigator.push( 105 | { 106 | url:e.url, 107 | } 108 | ); 109 | } 110 | }; 111 | 112 | 113 | render() { 114 | 115 | 116 | return ( 117 | 118 | Hello World 119 | 120 | ); 121 | 122 | } 123 | } 124 | 125 | module.exports = App; 126 | -------------------------------------------------------------------------------- /sample/app/root.js: -------------------------------------------------------------------------------- 1 | /** 2 | *app启动 3 | * 4 | */ 5 | import React, { Component } from 'react'; 6 | import App from './app'; 7 | 8 | 9 | export default class Root extends Component { 10 | state: State; 11 | 12 | constructor() { 13 | super(); 14 | this.state = { 15 | }; 16 | 17 | } 18 | 19 | render() { 20 | 21 | return ( 22 | 23 | ); 24 | } 25 | } -------------------------------------------------------------------------------- /sample/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | import {AppRegistry} from 'react-native'; 7 | import Root from './app/root'; 8 | 9 | AppRegistry.registerComponent('sample', () => Root); -------------------------------------------------------------------------------- /sample/ios/libs/AlicloudUtils.framework/AlicloudUtils: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/ios/libs/AlicloudUtils.framework/AlicloudUtils -------------------------------------------------------------------------------- /sample/ios/libs/AlicloudUtils.framework/Headers/ABSBootingProtection.h: -------------------------------------------------------------------------------- 1 | // 2 | // ABSBootingProtection.h 3 | // AntilockBrakeSystem 4 | // 5 | // Created by 地风(ElonChan) on 16/5/16. 6 | // Copyright © 2016年 Ali. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void (^ABSBoolCompletionHandler)(BOOL succeeded, NSError *error); 12 | typedef void (^ABSRepairBlock)(ABSBoolCompletionHandler completionHandler); 13 | typedef void (^ABSReportBlock)(NSUInteger crashCounts); 14 | 15 | typedef NS_ENUM(NSInteger, ABSBootingProtectionStatus) { 16 | ABSBootingProtectionStatusNormal, /**< APP 启动正常 */ 17 | ABSBootingProtectionStatusNormalChecking, /**< 正在检测是否会在特定时间内是否会 Crash,注意:检测状态下“连续启动崩溃计数”个数小于或等于上限值 */ 18 | ABSBootingProtectionStatusNeedFix, /**< APP 出现连续启动 Crash,需要采取修复措施 */ 19 | ABSBootingProtectionStatusFixing, /**< APP 出现连续启动 Crash,正在修复中... */ 20 | }; 21 | 22 | /** 23 | * 启动连续 crash 保护。 24 | * 启动后 `_crashOnLaunchTimeIntervalThreshold` 秒内 crash,反复超过 `_continuousCrashOnLaunchNeedToReport` 次则上报日志,超过 `_continuousCrashOnLaunchNeedToFix` 则启动修复操作。 25 | */ 26 | @interface ABSBootingProtection : NSObject 27 | 28 | /** 29 | * 启动连续 crash 保护方法。 30 | * 前置条件:在 App 启动时注册 crash 处理函数,在 crash 时调用[ABSBootingProtection addCrashCountIfNeeded]。 31 | * 启动后一定时间内(`crashOnLaunchTimeIntervalThreshold`秒内)crash,反复超过一定次数(`continuousCrashOnLaunchNeedToReport`次)则上报日志,超过一定次数(`continuousCrashOnLaunchNeedToFix`次)则启动修复程序;在一定时间内(`crashOnLaunchTimeIntervalThreshold`秒) 秒后若没有 crash 将“连续启动崩溃计数”计数置零。 32 | `reportBlock` 上报逻辑, 33 | `repairtBlock` 修复逻辑,完成后执行 `[self setCrashCount:0]` 34 | 35 | */ 36 | - (void)launchContinuousCrashProtect; 37 | 38 | /*! 39 | * 当前启动Crash的状态 40 | */ 41 | @property (nonatomic, assign, readonly) ABSBootingProtectionStatus bootingProtectionStatus; 42 | 43 | /*! 44 | * 达到需要执行上报操作的“连续启动崩溃计数”个数。 45 | */ 46 | @property (nonatomic, assign, readonly) NSUInteger continuousCrashOnLaunchNeedToReport; 47 | 48 | /*! 49 | * 达到需要执行修复操作的“连续启动崩溃计数”个数。 50 | */ 51 | @property (nonatomic, assign, readonly) NSUInteger continuousCrashOnLaunchNeedToFix; 52 | 53 | /*! 54 | * APP 启动后经过多少秒,可以将“连续启动崩溃计数”清零 55 | */ 56 | @property (nonatomic, assign, readonly) NSTimeInterval crashOnLaunchTimeIntervalThreshold; 57 | 58 | /*! 59 | * 借助 context 可以让多个模块注册事件,并且事件 block 能独立执行,互不干扰。 60 | */ 61 | @property (nonatomic, copy, readonly) NSString *context; 62 | 63 | /*! 64 | * @details 启动后kCrashOnLaunchTimeIntervalThreshold秒内crash,反复超过continuousCrashOnLaunchNeedToReport次则上报日志,超过continuousCrashOnLaunchNeedToFix则启动修复程序;当所有操作完成后,执行 completion。在 crashOnLaunchTimeIntervalThreshold 秒后若没有 crash 将 kContinuousCrashOnLaunchCounterKey 计数置零。 65 | * @param context 借助 context 可以让多个模块注册事件,并且事件 block 能独立执行,互不干扰。 66 | */ 67 | - (instancetype)initWithContinuousCrashOnLaunchNeedToReport:(NSUInteger)continuousCrashOnLaunchNeedToReport 68 | continuousCrashOnLaunchNeedToFix:(NSUInteger)continuousCrashOnLaunchNeedToFix 69 | crashOnLaunchTimeIntervalThreshold:(NSTimeInterval)crashOnLaunchTimeIntervalThreshold 70 | context:(NSString *)context; 71 | /*! 72 | * 当前“连续启动崩溃“的状态 73 | */ 74 | + (ABSBootingProtectionStatus)bootingProtectionStatusWithContext:(NSString *)context continuousCrashOnLaunchNeedToFix:(NSUInteger)continuousCrashOnLaunchNeedToFix; 75 | 76 | /*! 77 | * 设置上报逻辑,参数 crashCounts 为启动连续 crash 次数 78 | */ 79 | - (void)setReportBlock:(ABSReportBlock)reportBlock; 80 | 81 | /*! 82 | * 设置修复逻辑 83 | */ 84 | - (void)setRepairBlock:(ABSRepairBlock)repairtBlock; 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /sample/ios/libs/AlicloudUtils.framework/Headers/ABSUncaughtExceptionHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // ABSUncaughtExceptionHandler.h 3 | // AntilockBrakeSystem 4 | // 5 | // Created by 地风(ElonChan) on 16/5/16. 6 | // Copyright © 2016年 Ali. All rights reserved. 7 | // 8 | 9 | #import 10 | typedef void (^ABSUncaughtExceptionCallback)(NSException *exception); 11 | 12 | @interface ABSUncaughtExceptionHandler : NSObject 13 | 14 | + (void)registerExceptionHandlerWithCallback:(ABSUncaughtExceptionCallback)callback; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /sample/ios/libs/AlicloudUtils.framework/Headers/ABSUtil.h: -------------------------------------------------------------------------------- 1 | // 2 | // ABSUtil.h 3 | // AntilockBrakeSystem 4 | // 5 | // Created by 地风(ElonChan) on 16/5/16. 6 | // Copyright © 2016年 Ali. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ABSUtil : NSObject 12 | 13 | // 设置日志逻辑 14 | + (void)setLogger:(void (^)(NSString *))logger; 15 | 16 | + (void)Logger:(NSString *)log; 17 | 18 | + (BOOL)isValidString:(id)notValidString; 19 | 20 | + (BOOL)isWhiteListClass:(Class)class; 21 | 22 | + (void)deleteCacheWithfilePathsToRemove:(NSArray *)filePathsToRemove; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /sample/ios/libs/AlicloudUtils.framework/Headers/AlicloudHTTPDNSMini.h: -------------------------------------------------------------------------------- 1 | // 2 | // AlicloudHTTPDNSMini.h 3 | // AlicloudUtils 4 | // 5 | // Created by ryan on 3/6/2016. 6 | // Copyright © 2016 Ali. All rights reserved. 7 | // 8 | 9 | #ifndef AlicloudHTTPDNSMini_h 10 | #define AlicloudHTTPDNSMini_h 11 | 12 | #define HTTPDNSMINI_RESOLVED_NOTIFY @"HTTPDNSMiniResolvedNotify" 13 | 14 | @interface AlicloudHTTPDNSMini : NSObject 15 | 16 | + (AlicloudHTTPDNSMini *)sharedInstance; 17 | - (NSArray *)getIpsByHostAsync:(NSString *)host; 18 | 19 | @end 20 | 21 | #endif /* AlicloudHTTPDNSMini_h */ 22 | -------------------------------------------------------------------------------- /sample/ios/libs/AlicloudUtils.framework/Headers/AlicloudIPv6Adapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2015 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. The rights granted to you under the License 10 | * may not be used to create, or enable the creation or redistribution of, 11 | * unlawful or unlicensed copies of an Apple operating system, or to 12 | * circumvent, violate, or enable the circumvention or violation of, any 13 | * terms of an Apple operating system software license agreement. 14 | * 15 | * Please obtain a copy of the License at 16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 | * 18 | * The Original Code and all software distributed under the License are 19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 | * Please see the License for the specific language governing rights and 24 | * limitations under the License. 25 | * 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 | */ 28 | /* 29 | * Copyright (c) 1980, 1986, 1993 30 | * The Regents of the University of California. All rights reserved. 31 | * 32 | * Redistribution and use in source and binary forms, with or without 33 | * modification, are permitted provided that the following conditions 34 | * are met: 35 | * 1. Redistributions of source code must retain the above copyright 36 | * notice, this list of conditions and the following disclaimer. 37 | * 2. Redistributions in binary form must reproduce the above copyright 38 | * notice, this list of conditions and the following disclaimer in the 39 | * documentation and/or other materials provided with the distribution. 40 | * 3. All advertising materials mentioning features or use of this software 41 | * must display the following acknowledgement: 42 | * This product includes software developed by the University of 43 | * California, Berkeley and its contributors. 44 | * 4. Neither the name of the University nor the names of its contributors 45 | * may be used to endorse or promote products derived from this software 46 | * without specific prior written permission. 47 | * 48 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 49 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 50 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 | * SUCH DAMAGE. 59 | * 60 | * @(#)route.h 8.3 (Berkeley) 4/19/94 61 | * $FreeBSD: src/sys/net/route.h,v 1.36.2.1 2000/08/16 06:14:23 jayanth Exp $ 62 | */ 63 | 64 | 65 | #ifndef AlicloudIPv6Adapter_h 66 | #define AlicloudIPv6Adapter_h 67 | #import 68 | 69 | @interface AlicloudIPv6Adapter : NSObject 70 | 71 | + (instancetype)getInstance; 72 | 73 | /** 74 | * 判断当前是否为IPv6-Only网络 75 | */ 76 | - (BOOL)isIPv6OnlyNetwork; 77 | 78 | /** 79 | * 手动刷新IPv6-Only网络的判定 80 | */ 81 | - (BOOL)reResolveIPv6OnlyStatus; 82 | 83 | /** 84 | IPv4 > IPv6地址转换\n 85 | - 输入IPv4地址无效,返回原地址 86 | - IPv6-Only网络,返回转换后的IPv6地址 87 | - 非IPv6-Only网络,返回原地址 88 | 89 | @param addr IPv4地址 90 | @return 转换后的v6地址 或 原地址 91 | */ 92 | - (NSString *)handleIpv4Address:(NSString *)addr; 93 | 94 | /** 95 | * 判断是否为IPv4地址 96 | */ 97 | - (BOOL)isIPv4Address:(NSString *)addr; 98 | 99 | /** 100 | * 判断是否为IPv6地址 101 | */ 102 | - (BOOL)isIPv6Address:(NSString *)addr; 103 | 104 | @end 105 | 106 | #endif /* AlicloudIPv6Adapter_h */ 107 | -------------------------------------------------------------------------------- /sample/ios/libs/AlicloudUtils.framework/Headers/AlicloudReachabilityManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // AlicloudReachabilityManager.h 3 | // 4 | // Created by 亿刀 on 14-1-9. 5 | // Edited by junmo on 15-5-16 6 | // Copyright (c) 2014年 Twitter. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #define ALICLOUD_NETWOEK_STATUS_NOTIFY @"AlicloudNetworkStatusChangeNotify" 13 | 14 | typedef enum { 15 | AlicloudNotReachable = 0, 16 | AlicloudReachableViaWiFi, 17 | AlicloudReachableVia2G, 18 | AlicloudReachableVia3G, 19 | AlicloudReachableVia4G 20 | } AlicloudNetworkStatus; 21 | 22 | @interface AlicloudReachabilityManager : NSObject 23 | 24 | /** 25 | * 获取Reachability单例对象 26 | */ 27 | + (AlicloudReachabilityManager *)shareInstance; 28 | 29 | /** 30 | * 获取Reachability单例对象,为保证全局维护一个netInfo实例,可从外部传入netInfo对象的引用 31 | * warn: netInfo多次实例化,有一定几率crash 32 | * 33 | */ 34 | + (AlicloudReachabilityManager *)shareInstanceWithNetInfo:(CTTelephonyNetworkInfo *)netInfo; 35 | 36 | /** 37 | * 返回当前网络状态(同步调用,可能会阻塞调用线程) 38 | */ 39 | - (AlicloudNetworkStatus)currentNetworkStatus; 40 | 41 | /** 42 | * 返回之前网络状态 43 | */ 44 | - (AlicloudNetworkStatus)preNetworkStatus; 45 | 46 | /** 47 | * 检测网络是否连通(同步调用,阻塞调用线程) 48 | */ 49 | - (BOOL)checkInternetConnection; 50 | 51 | /** 52 | * 检测Wifi网络是否联通 53 | */ 54 | - (BOOL)isReachableViaWifi; 55 | 56 | /** 57 | * 检测蜂窝网络是否联通 58 | */ 59 | - (BOOL)isReachableViaWWAN; 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /sample/ios/libs/AlicloudUtils.framework/Headers/AlicloudReport.h: -------------------------------------------------------------------------------- 1 | // 2 | // AlicloudReport.h 3 | // AlicloudUtils 4 | // 5 | // Created by ryan on 3/6/2016. 6 | // Copyright © 2016 Ali. All rights reserved. 7 | // 8 | 9 | #ifndef AlicloudReport_h 10 | #define AlicloudReport_h 11 | 12 | extern const NSString *EXT_INFO_KEY_VERSION; 13 | extern const NSString *EXT_INFO_KEY_PACKAGE; 14 | 15 | // SDK标识 16 | typedef NS_ENUM(NSInteger, AMSService) { 17 | AMSMAN = 0, 18 | AMSHTTPDNS, 19 | AMSMPUSH, 20 | AMSMAC, 21 | AMSAPI, 22 | AMSHOTFIX, 23 | AMSFEEDBACK, 24 | AMSIM 25 | }; 26 | 27 | // 上报状态 28 | typedef NS_ENUM(NSInteger, AMSReportStatus) { 29 | AMS_UNREPORTED_STATUS, 30 | AMS_REPORTED_STATUS 31 | }; 32 | 33 | @interface AlicloudReport : NSObject 34 | 35 | /** 36 | * 异步上报活跃设备统计 37 | * 38 | @param tag SDK标识 39 | */ 40 | + (void)statAsync:(AMSService)tag; 41 | 42 | /** 43 | * 异步上报活跃设备统计并携带附加信息 44 | * 45 | @param tag SDK标识 46 | @param extInfo 附加上报信息 { EXT_INFO_KEY_VERSION :"x.x.x", EXT_INFO_KEY_PACKAGE: "xxx"} 47 | */ 48 | + (void)statAsync:(AMSService)tag extInfo:(NSDictionary *)extInfo; 49 | 50 | /** 51 | * 获取指定SDK标识上报状态 52 | * 53 | @param tag SDK标识 54 | @return 返回上报状态 55 | */ 56 | + (AMSReportStatus)getReportStatus:(AMSService)tag; 57 | 58 | /** 59 | * 获取上报状态(兼容老版本接口) 60 | * 61 | @param tag SDK标识 62 | @return YES:已经上报 NO:没有上报 63 | */ 64 | + (BOOL)isDeviceReported:(AMSService)tag; 65 | 66 | @end 67 | 68 | #endif /* AlicloudReport_h */ 69 | -------------------------------------------------------------------------------- /sample/ios/libs/AlicloudUtils.framework/Headers/AlicloudTracker.h: -------------------------------------------------------------------------------- 1 | // 2 | // AlicloudTracker.h 3 | // AlicloudUtils 4 | // 5 | // Created by junmo on 2017/6/30. 6 | // Copyright © 2017年 Ali. All rights reserved. 7 | // 8 | 9 | #ifndef AlicloudTracker_h 10 | #define AlicloudTracker_h 11 | 12 | @interface AlicloudTracker : NSObject 13 | 14 | @property (nonatomic, copy) NSString *sdkId; 15 | @property (nonatomic, copy) NSString *sdkVersion; 16 | 17 | /** 18 | 设置Tracker的通用打点属性,每次上报都携带该参数 19 | 20 | @param key 通用属性Key 21 | @param value 通用属性Value 22 | */ 23 | - (void)setGlobalProperty:(NSString *)key value:(NSString *)value; 24 | 25 | 26 | /** 27 | 删除Tracker通用打点属性 28 | 29 | @param key 通用属性Key 30 | */ 31 | - (void)removeGlobalProperty:(NSString *)key; 32 | 33 | /** 34 | 自定义打点上报 35 | 36 | @param eventName 事件名 37 | @param duration 时长 38 | @param properties 额外参数 39 | */ 40 | - (void)sendCustomHit:(NSString *)eventName 41 | duration:(long long)duration 42 | properties:(NSDictionary *)properties; 43 | 44 | @end 45 | #endif /* AlicloudTracker_h */ 46 | -------------------------------------------------------------------------------- /sample/ios/libs/AlicloudUtils.framework/Headers/AlicloudTrackerManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // AlicloudTrackerManager.h 3 | // AlicloudUtils 4 | // 5 | // Created by junmo on 2017/7/4. 6 | // Copyright © 2017年 Ali. All rights reserved. 7 | // 8 | 9 | #ifndef AlicloudTrackerManager_h 10 | #define AlicloudTrackerManager_h 11 | 12 | #import "AlicloudTracker.h" 13 | 14 | @interface AlicloudTrackerManager : NSObject 15 | 16 | /** 17 | 获取上报通道管理器对象,并初始化UT 18 | 19 | @return 管理器对象 20 | */ 21 | + (instancetype)getInstance; 22 | 23 | /** 24 | 根据SDK标识和版本号获取上报通道 25 | 26 | @param sdkId SDK标识 27 | @param version SDK版本号 28 | @return 上报通道对象 29 | */ 30 | - (AlicloudTracker *)getTrackerBySdkId:(NSString *)sdkId version:(NSString *)version; 31 | 32 | @end 33 | 34 | #endif /* AlicloudTrackerManager_h */ 35 | -------------------------------------------------------------------------------- /sample/ios/libs/AlicloudUtils.framework/Headers/AlicloudUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // AlicloudUtils.h 3 | // AlicloudUtils 4 | // 5 | // Created by lingkun on 16/5/16. 6 | // Copyright © 2016年 Ali. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define ALICLOUDUTILS_VERSION @"1.2.2" 12 | 13 | // In this header, you should import all the public headers of your framework using statements like #import 14 | 15 | #import 16 | #import 17 | #import 18 | #import 19 | #import 20 | #import 21 | #import 22 | #import 23 | -------------------------------------------------------------------------------- /sample/ios/libs/AlicloudUtils.framework/Headers/AntilockBrakeSystem.h: -------------------------------------------------------------------------------- 1 | // 2 | // AntilockBrakeSystem.h 3 | // AntilockBrakeSystem 4 | // 5 | // Created by 地风(ElonChan) on 16/5/16. 6 | // Copyright © 2016年 Ali. All rights reserved. 7 | // 8 | 9 | #import "ABSBootingProtection.h" 10 | #import "ABSUtil.h" 11 | #import "ABSUncaughtExceptionHandler.h" 12 | -------------------------------------------------------------------------------- /sample/ios/libs/AlicloudUtils.framework/Headers/UtilLog.h: -------------------------------------------------------------------------------- 1 | // 2 | // UtilLog.h 3 | // AlicloudUtils 4 | // 5 | // Created by junmo on 16/11/24. 6 | // Copyright © 2016年 Ali. All rights reserved. 7 | // 8 | 9 | #ifndef UtilLog_h 10 | #define UtilLog_h 11 | 12 | @interface UtilLog : NSObject 13 | 14 | + (void)enableLog; 15 | 16 | + (BOOL)isLogEnabled; 17 | 18 | #define UtilLogD(tag, frmt, ...)\ 19 | if ([UtilLog isLogEnabled]) {\ 20 | NSLog(@"[%@]-[D]: %@", tag, [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\ 21 | } 22 | 23 | #define UtilLogI(tag, frmt, ...)\ 24 | if ([UtilLog isLogEnabled]) {\ 25 | NSLog(@"[%@]-[I]: %@", tag, [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\ 26 | } 27 | 28 | #define UtilLogE(tag, frmt, ...)\ 29 | if ([UtilLog isLogEnabled]) {\ 30 | NSLog(@"[%@]-[E]: %@", tag, [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\ 31 | } 32 | @end 33 | 34 | #endif /* UtilLog_h */ 35 | -------------------------------------------------------------------------------- /sample/ios/libs/AlicloudUtils.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module AlicloudUtils { 2 | umbrella header "AlicloudUtils.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /sample/ios/libs/CloudPushSDK.framework/CloudPushSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/ios/libs/CloudPushSDK.framework/CloudPushSDK -------------------------------------------------------------------------------- /sample/ios/libs/CloudPushSDK.framework/Headers/CCPSysMessage.h: -------------------------------------------------------------------------------- 1 | // 2 | // CCPSysMessage.h 3 | // CloudPushSDK 4 | // 5 | // Created by wuxiang on 15/5/18. 6 | // Copyright (c) 2015年 aliyun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CCPSysMessage : NSObject 12 | 13 | @property UInt8 messageType;// 消息类型 14 | @property NSData *title; // 标题 15 | @property NSData *body; // 内容 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /sample/ios/libs/CloudPushSDK.framework/Headers/CloudPushCallbackResult.h: -------------------------------------------------------------------------------- 1 | // 2 | // CloudPushCallbackResult.h 3 | // CloudPushSDK 4 | // 5 | // Created by lingkun on 16/6/16. 6 | // Copyright © 2016年 aliyun.mobileService. All rights reserved. 7 | // 8 | 9 | #ifndef CloudPushCallbackResult_h 10 | #define CloudPushCallbackResult_h 11 | 12 | @interface CloudPushCallbackResult : NSObject 13 | 14 | @property(nonatomic, readonly) BOOL success; 15 | 16 | @property(nonatomic, readonly, nullable) id data; 17 | 18 | @property(nonatomic, readonly, nullable) NSError *error; 19 | 20 | + (nonnull instancetype)resultWithData:(nullable id)data; 21 | 22 | + (nonnull instancetype)resultWithError:(nullable NSError *)error; 23 | 24 | @end 25 | 26 | #endif /* CloudPushCallbackResult_h */ 27 | -------------------------------------------------------------------------------- /sample/ios/libs/CloudPushSDK.framework/Headers/CloudPushSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // CloudPushSDK.h 3 | // CloudPushSDK 4 | // 5 | // Created by junmo on 16/7/26. 6 | // Copyright © 2016年 aliyun.mobileService. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CCPSysMessage.h" 11 | #import "MPGerneralDefinition.h" 12 | 13 | /* SDK版本号 */ 14 | #define MPUSH_IOS_SDK_VERSION @"1.9.6" 15 | 16 | @interface CloudPushSDK : NSObject 17 | 18 | /** 19 | * Push SDK初始化 20 | * 21 | * @param appKey appKey 22 | * @param appSecret appSecret 23 | * @param callback 回调 24 | */ 25 | + (void)asyncInit:(NSString *)appKey 26 | appSecret:(NSString *)appSecret 27 | callback:(CallbackHandler)callback; 28 | 29 | /** 30 | * 打开调试日志 31 | */ 32 | + (void)turnOnDebug; 33 | 34 | /** 35 | * 获取本机的deviceId (deviceId为推送系统的设备标识) 36 | * 37 | * @return deviceId 38 | */ 39 | + (NSString *)getDeviceId; 40 | 41 | /** 42 | * 返回SDK版本 43 | * 44 | * @return SDK版本 45 | */ 46 | + (NSString *)getVersion; 47 | 48 | /** 49 | * 返回推送通道的状态 50 | * 51 | * @return 通道状态 52 | */ 53 | + (BOOL)isChannelOpened; 54 | 55 | /** 56 | * 返回推送通知ACK到服务器 57 | * 58 | * @param userInfo 通知相关信息 59 | */ 60 | + (void)sendNotificationAck:(NSDictionary *)userInfo; 61 | 62 | /** 63 | * 返回推送通知ACK到服务器 (该通知为App处于关闭状态时接收,点击后启动App) 64 | * v1.8.1版本之后,由sendNotificationAck替代 65 | * @param launchOptions 通知相关信息 66 | */ 67 | + (void)handleLaunching:(NSDictionary *)launchOptions DEPRECATED_MSG_ATTRIBUTE("Use 'sendNotificationAck:' instead"); 68 | 69 | /** 70 | * 返回推送通知ACK到服务器 (该通知为App处于开启状态时接收) 71 | * v1.8.1版本之后,由sendNotificationAck替代 72 | * @param userInfo 通知相关信息 73 | */ 74 | + (void)handleReceiveRemoteNotification:(NSDictionary *)userInfo DEPRECATED_MSG_ATTRIBUTE("Use 'sendNotificationAck:' instead"); 75 | 76 | /** 77 | * 绑定账号 78 | * 79 | * @param account 账号名 80 | * @param callback 回调 81 | */ 82 | + (void)bindAccount:(NSString *)account 83 | withCallback:(CallbackHandler)callback; 84 | 85 | /** 86 | * 解绑账号 87 | * 88 | * @param callback 回调 89 | */ 90 | + (void)unbindAccount:(CallbackHandler)callback; 91 | 92 | /** 93 | * 向指定目标添加自定义标签 94 | * 支持向本设备/本设备绑定账号/别名添加自定义标签,目标类型由target指定 95 | * @param target 目标类型,1:本设备 2:本设备绑定账号 3:别名 96 | * @param tags 标签名 97 | * @param alias 别名(仅当target = 3时生效) 98 | * @param callback 回调 99 | */ 100 | + (void)bindTag:(int)target 101 | withTags:(NSArray *)tags 102 | withAlias:(NSString *)alias 103 | withCallback:(CallbackHandler)callback; 104 | 105 | /** 106 | * 删除指定目标的自定义标签 107 | * 支持从本设备/本设备绑定账号/别名删除自定义标签,目标类型由target指定 108 | * @param target 目标类型,1:本设备 2:本设备绑定账号 3:别名 109 | * @param tags 标签名 110 | * @param alias 别名(仅当target = 3时生效) 111 | * @param callback 回调 112 | */ 113 | + (void)unbindTag:(int)target 114 | withTags:(NSArray *)tags 115 | withAlias:(NSString *)alias 116 | withCallback:(CallbackHandler)callback; 117 | 118 | /** 119 | * 查询绑定标签,查询结果可从callback的data中获取 120 | * 121 | * @param target 目标类型,1:本设备(当前仅支持查询本设备绑定标签) 122 | * @param callback 回调 123 | */ 124 | + (void)listTags:(int)target 125 | withCallback:(CallbackHandler)callback; 126 | 127 | /** 128 | * 给当前设备打别名 129 | * 130 | * @param alias 别名名称 131 | * @param callback 回调 132 | */ 133 | + (void)addAlias:(NSString *)alias 134 | withCallback:(CallbackHandler)callback; 135 | 136 | /** 137 | * 删除当前设备的指定别名 138 | * 当alias为nil or length = 0时,删除当前设备绑定所有别名 139 | * @param alias 别名名称 140 | * @param callback 回调 141 | */ 142 | + (void)removeAlias:(NSString *)alias 143 | withCallback:(CallbackHandler)callback; 144 | 145 | /** 146 | * 查询本设备绑定别名,查询结果可从callback的data中获取 147 | * 148 | * @param callback 回调 149 | */ 150 | + (void)listAliases:(CallbackHandler)callback; 151 | 152 | /** 153 | * 向阿里云推送注册该设备的deviceToken 154 | * 155 | * @param deviceToken 苹果APNs服务器返回的deviceToken 156 | */ 157 | + (void)registerDevice:(NSData *)deviceToken 158 | withCallback:(CallbackHandler)callback; 159 | 160 | /** 161 | * 获取APNs返回的deviceToken 162 | * 163 | * @return deviceToken 164 | */ 165 | + (NSString *)getApnsDeviceToken; 166 | 167 | /** 168 | 同步设备通知角标数到推送服务器 169 | 170 | @param num badge数,取值范围[0,99999] 171 | @param callback 回调 172 | */ 173 | + (void)syncBadgeNum:(NSUInteger)num 174 | withCallback:(CallbackHandler)callback; 175 | 176 | @end 177 | -------------------------------------------------------------------------------- /sample/ios/libs/CloudPushSDK.framework/Headers/MPGerneralDefinition.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPGerneralDefinition.h 3 | // CloudPushSDK 4 | // 5 | // Created by junmo on 16/10/11. 6 | // Copyright © 2016年 aliyun.mobileService. All rights reserved. 7 | // 8 | 9 | #ifndef MPGerneralDefinition_h 10 | #define MPGerneralDefinition_h 11 | 12 | #import "CloudPushCallbackResult.h" 13 | 14 | typedef void (^CallbackHandler)(CloudPushCallbackResult *res); 15 | 16 | // 保证callback不为空且回调不在主线程上执行 17 | #define NotNilCallback(funcName, paras)\ 18 | if (funcName) {\ 19 | if ([NSThread isMainThread]) {\ 20 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\ 21 | funcName(paras);\ 22 | });\ 23 | } else {\ 24 | funcName(paras);\ 25 | }\ 26 | } 27 | 28 | #endif /* MPGerneralDefinition_h */ 29 | -------------------------------------------------------------------------------- /sample/ios/libs/CloudPushSDK.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module CloudPushSDK { 2 | umbrella header "CloudPushSDK.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /sample/ios/libs/UTDID.framework/Headers/AidProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // AidProtocol.h 3 | // UtdidSDK 4 | // 5 | // Created by ALLEN on 14-12-22. 6 | // Copyright (c) 2014年 Alvin. All rights reserved. 7 | // 8 | 9 | #ifndef AidProtocol_h 10 | #define AidProtocol_h 11 | 12 | #define EVENT_REQUEST_STARTED 1000 13 | #define EVENT_REQUEST_SUCCESS 1001 14 | #define EVENT_REQUEST_FAILED 1002 15 | #define EVENT_NETWORK_ERROR 1003 16 | 17 | @protocol AidProtocolDelegate 18 | @required 19 | - (void) onAidEventChanged:(NSInteger)eventId 20 | aid:(NSString *)aid; 21 | @end 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /sample/ios/libs/UTDID.framework/Headers/UTDevice.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTDevice.h 3 | // 4 | // 5 | // Created by Alvin on 4/21/13. 6 | // 7 | // 设备信息的分装类:sdk合作开发需要用这个类提供的设备信息接口 8 | 9 | // Version:utdid4all-1.1.0 10 | 11 | #ifndef UTDIDDevice_h 12 | #define UTDIDDevice_h 13 | 14 | #import "AidProtocol.h" 15 | 16 | @interface UTDevice : NSObject 17 | 18 | /** 19 | * @brief 获取SDK生成的设备唯一标识. 20 | * 21 | * @warning 调用说明:这个设备唯一标识是持久的,并且格式安全,iOS6以及以下,多应用互通. 22 | * 23 | * 调用顺序:utdid任意时刻都可以调用. 24 | * 25 | * @return 24字节的设备唯一标识. 26 | */ 27 | +(NSString *) utdid; 28 | 29 | /** 30 | * @brief 同步获得AID. 31 | * 32 | * @warning 调用说明:若本地端没有最新AID,将耗费远程通信时间并阻塞线程,建议将此调用置于非主线程,或使用{@link getAidAsync}异步获得AID。 33 | * 34 | * 调用顺序:aid任意时刻都可以调用. 35 | * 36 | * @return AID. 37 | */ 38 | +(NSString *) aid:(NSString *)appName 39 | token:(NSString *)token; 40 | 41 | /** 42 | * @brief 异步请求AID. 43 | * 44 | * @warning 调用说明:若本地端没有最新AID,将建立异步请求获得AID, 45 | * 46 | * 调用顺序:aidAsync任意时刻都可以调用. 47 | * 48 | * @return AID. 49 | */ 50 | +(void) aidAsync:(NSString *)appName 51 | token:(NSString *)token 52 | aidDelegate:(id)aidDelegate; 53 | 54 | @end 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /sample/ios/libs/UTDID.framework/Resources/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/ios/libs/UTDID.framework/Resources/Info.plist -------------------------------------------------------------------------------- /sample/ios/libs/UTDID.framework/UTDID: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/ios/libs/UTDID.framework/UTDID -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/AppMonitor.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorSDK.h 3 | // AppMonitorSDK 4 | // 5 | // Created by junzhan on 14-9-9. 6 | // Copyright (c) 2014年 君展. All rights reserved. 7 | // 接口类 8 | 9 | #import 10 | #import "AppMonitorTable.h" 11 | #import "AppMonitorAlarm.h" 12 | #import "AppMonitorCounter.h" 13 | #import "AppMonitorStat.h" 14 | 15 | @interface AppMonitor : NSObject 16 | 17 | + (BOOL)isInit; 18 | 19 | + (BOOL) isUTInit; 20 | 21 | + (void) setUTInit; 22 | 23 | + (instancetype)sharedInstance; 24 | 25 | /* 26 | * 设置采样率配置 27 | * @param jsonStr JSON串 28 | */ 29 | + (void)setSamplingConfigWithJson:(NSString *)jsonStr; 30 | 31 | /** 32 | * 关闭采样,紧开发调试用。线上版本请勿调用此API 33 | */ 34 | + (void)disableSample; 35 | 36 | /** 37 | * 设置采样率(默认是 50%) 值范围在[0~10000] (0表示不上传,10000表示100%上传,5000表示50%上传) 38 | */ 39 | + (void)setSampling:(NSString *)sampling; 40 | 41 | ////是否开启实时调试模式(与UT同步) 42 | + (BOOL)isTurnOnRealTimeDebug; 43 | + (NSString*)realTimeDebugUploadUrl; 44 | + (NSString*)realTimeDebugId; 45 | 46 | +(void) turnOnAppMonitorRealtimeDebug:(NSDictionary *) pDict; 47 | +(void) turnOffAppMonitorRealtimeDebug; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/AppMonitorAlarm.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorAlarm.h 3 | // AppMonitor 4 | // 5 | // Created by junzhan on 14-9-15. 6 | // Copyright (c) 2014年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppMonitorBase.h" 11 | 12 | @interface AppMonitorAlarm : AppMonitorBase 13 | /** 14 | * 记录业务操作成功接口 15 | * 16 | * @param page 页面名称,安卓iOS要相同. 命名规范:若之前埋点有页面名,则用原来的; 否则用"业务名_页面名"(无页面则"业务名"); 采用首字母大写驼峰方式. 如Shop_Detail, Shop_List 17 | * @param monitorPoint 监控点名称,安卓iOS要相同,从@雷曼 获取 18 | * 19 | */ 20 | + (void)commitSuccessWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint; 21 | 22 | /** 23 | * 记录业务操作失败接口 24 | * 25 | * @param page 页面名称,安卓iOS要相同. 命名规范:若之前埋点有页面名,则用原来的; 否则用"业务名_页面名"(无页面则"业务名"); 采用首字母大写驼峰方式. 如Shop_Detail, Shop_List 26 | * @param monitorPoint 监控点名称,安卓iOS要相同,从@雷曼 获取 27 | * @param errorCode 错误码,若为MTOP请求则传MTOP的错误码,否则请业务方对错误进行分类编码,方便统计错误类型占比 28 | * @param errorMsg 错误信息,若位MTOP请求则传MTOP的错误信息, 否则请业务方自己描述错误, 方便自己查找原因 29 | */ 30 | + (void)commitFailWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint errorCode:(NSString *)errorCode errorMsg:(NSString *)errorMsg; 31 | 32 | /** 33 | * 记录业务操作成功接口 34 | * 35 | * @param page 页面名称,安卓iOS要相同. 命名规范:若之前埋点有页面名,则用原来的; 否则用"业务名_页面名"(无页面则"业务名"); 采用首字母大写驼峰方式. 如Shop_Detail, Shop_List 36 | * @param monitorPoint 监控点名称,安卓iOS要相同,从@雷曼 获取 37 | * @arg 附加参数,用于做横向扩展 38 | */ 39 | + (void)commitSuccessWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint arg:(NSString *)arg; 40 | 41 | /** 42 | * 记录业务操作失败接口 43 | * 44 | * @param page 页面名称,安卓iOS要相同. 命名规范:若之前埋点有页面名,则用原来的; 否则用"业务名_页面名"(无页面则"业务名"); 采用首字母大写驼峰方式. 如Shop_Detail, Shop_List 45 | * @param monitorPoint 监控点名称,安卓iOS要相同,从@雷曼 获取 46 | * @param errorCode 错误码,若为MTOP请求则传MTOP的错误码,否则请业务方对错误进行分类编码,方便统计错误类型占比 47 | * @param errorMsg 错误信息,若位MTOP请求则传MTOP的错误信息, 否则请业务方自己描述错误, 方便自己查找原因 48 | * @arg 附加参数,用于做横向扩展 49 | */ 50 | + (void)commitFailWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint errorCode:(NSString *)errorCode errorMsg:(NSString *)errorMsg arg:(NSString *)arg; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/AppMonitorBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorBase.h 3 | // AppMonitor 4 | // 5 | // Created by junzhan on 14-10-14. 6 | // Copyright (c) 2014年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface AppMonitorBase : NSObject 13 | /** 14 | * 日志写入UT间隔时间(单位秒).默认300秒, -1代表关闭. 会监听配置中心做变化 15 | */ 16 | + (void)setWriteLogInterval:(NSInteger)writeLogInterval; 17 | 18 | + (NSInteger)writeLogInterval; 19 | 20 | 21 | /** 22 | * 将appmonitor的日志立刻强制写入本地(UT),避免丢失。请不要私自调用,使用前咨询@君展 23 | */ 24 | + (void)flushAllLog; 25 | 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/AppMonitorCounter.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorCounter.h 3 | // AppMonitor 4 | // 5 | // Created by junzhan on 14-10-14. 6 | // Copyright (c) 2014年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppMonitorBase.h" 11 | 12 | @interface AppMonitorCounter : AppMonitorBase 13 | 14 | /** 15 | * 实时计数接口.(每次commit会累加一次count,value也会累加)可用于服务端计算总次数或求平均值。 16 | * 此接口数据量不应太大, 17 | * 18 | * @param page 操作发生所在的页面 19 | * @param monitorPoint 监控点名称 20 | * @param value 数值 21 | */ 22 | + (void)commitWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint value:(double)value; 23 | 24 | /** 25 | * 实时计数接口.(每次commit会累加一次count,value也会累加)可用于服务端计算总次数或求平均值。 26 | * 此接口数据量不应太大, 27 | * 28 | * @param page 操作发生所在的页面 29 | * @param monitorPoint 监控点名称 30 | * @param value 数值 31 | * @param arg 附加参数 32 | */ 33 | + (void)commitWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint value:(double)value arg:(NSString *)arg; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/AppMonitorDimension.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorDimension.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/2/15. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * 监控维度 13 | * 14 | */ 15 | 16 | @interface AppMonitorDimension : NSObject 17 | 18 | @property (nonatomic, copy) NSString *name; 19 | @property (nonatomic, copy) NSString *constantValue; 20 | 21 | - (instancetype)initWithName:(NSString *)name; 22 | 23 | - (instancetype)initWithName:(NSString *)name constantValue:(NSString *)constantValue; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/AppMonitorDimensionSet.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorDimensionSet.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/2/15. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppMonitorDimensionValueSet.h" 11 | #import "AppMonitorDimension.h" 12 | @interface AppMonitorDimensionSet : NSObject 13 | 14 | /** 15 | * 根据列表初始化指标集合对象 16 | * 17 | * @param array NSString类型的数组 string为Name; 18 | * @return 19 | */ 20 | 21 | + (instancetype)setWithArray:(NSArray *)array; 22 | 23 | - (BOOL)valid:(AppMonitorDimensionValueSet*)dimensionValues; 24 | /** 25 | * 增加维度 26 | * 27 | * @param dimension 维度对象 28 | * @return 29 | */ 30 | - (void)addDimension:(AppMonitorDimension *)dimension; 31 | 32 | /** 33 | * 增加维度对象 34 | * 35 | * @param name 维度名称 36 | * @return 37 | */ 38 | - (void)addDimensionWithName:(NSString *)name; 39 | /** 40 | * 获取维度对象 41 | * 42 | * @param name 维度名称 43 | * @return 44 | */ 45 | - (AppMonitorDimension *)dimensionForName:(NSString *)name; 46 | 47 | - (NSMutableOrderedSet *)dimensions; 48 | 49 | /** 50 | * 设置定值维度 51 | * 52 | * @param dimensionValues key为维度名称,value为内容 53 | */ 54 | - (void)setConstantValue:(AppMonitorDimensionValueSet *)dimensionValues; 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/AppMonitorDimensionValueSet.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorDimensionValueSet.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/2/15. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | /** 11 | 其实就是个字典 12 | */ 13 | @interface AppMonitorDimensionValueSet : NSObject 14 | 15 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 16 | 17 | /** 18 | * 存储维度值 19 | */ 20 | @property (nonatomic, strong) NSMutableDictionary *dict; 21 | 22 | - (void)setValue:(NSString *)value forName:(NSString *)name; 23 | - (BOOL)containValueForName:(NSString *)name; 24 | - (NSString *)valueForName:(NSString *)name; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/AppMonitorMeasure.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorMeasure.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/2/15. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppMonitorMeasureValue.h" 11 | /** 12 | * 监控指标项 13 | * 14 | */ 15 | 16 | @interface AppMonitorMeasure : NSObject 17 | 18 | @property (nonatomic, copy) NSString *name; 19 | @property (nonatomic, strong) NSNumber *constantValue; 20 | @property (nonatomic, strong) NSNumber *min; 21 | @property (nonatomic, strong) NSNumber *max; 22 | 23 | - (instancetype)initWithName:(NSString *)name; 24 | - (instancetype)initWithName:(NSString *)name constantValue:(NSNumber *)constantValue; 25 | - (instancetype)initWithName:(NSString *)name constantValue:(NSNumber *)constantValue min:(NSNumber *)min max:(NSNumber *)max; 26 | - (void)setRangeWithMin:(NSNumber *)min max:(NSNumber *)max; 27 | - (BOOL)valid:(AppMonitorMeasureValue *)measureValue; 28 | @end 29 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/AppMonitorMeasureSet.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorMeasureSet.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/2/15. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppMonitorMeasure.h" 11 | #import "AppMonitorMeasureValueSet.h" 12 | @interface AppMonitorMeasureSet : NSObject 13 | 14 | /** 15 | * 根据列表初始化指标集合对象 16 | * 17 | * @param array NSString类型的数组 string为Name; 18 | * @return 19 | */ 20 | 21 | + (instancetype)setWithArray:(NSArray *)array; 22 | 23 | - (BOOL)valid:(NSString*)module MonitorPoint:(NSString*)monitorpoint measureValues:(AppMonitorMeasureValueSet *)measureValues; 24 | /** 25 | * 增加指标 26 | * 27 | * @param measure 指标对象 28 | * @return 29 | */ 30 | - (void)addMeasure:(AppMonitorMeasure *)measure; 31 | 32 | /** 33 | * 增加指标对象 34 | * 35 | * @param name 指标名称 36 | * @return 37 | */ 38 | - (void)addMeasureWithName:(NSString *)name; 39 | /** 40 | * 获取指标对象 41 | * 42 | * @param name 指标名称 43 | * @return 44 | */ 45 | - (AppMonitorMeasure *)measureForName:(NSString *)name; 46 | 47 | /** 48 | * 获取指标对象的列表 49 | * 50 | * @return 51 | */ 52 | - (NSMutableOrderedSet *)measures; 53 | 54 | /** 55 | * 设置定值维度 56 | * 57 | * @param measureValues key为指标名称,value为内容 58 | */ 59 | - (void)setConstantValue:(AppMonitorMeasureValueSet *)measureValues; 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/AppMonitorMeasureValue.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorMeasureValue.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/2/15. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * 监控指标值 13 | * 14 | */ 15 | 16 | @interface AppMonitorMeasureValue : NSObject 17 | 18 | /** 19 | * 耗时操作是否已经完成 20 | */ 21 | @property (nonatomic, assign) BOOL isFinish; 22 | @property (nonatomic, strong) NSNumber * offset; 23 | @property (nonatomic, strong) NSNumber * value; 24 | 25 | - (instancetype)initWithValue:(NSNumber *)value; 26 | - (instancetype)initWithValue:(NSNumber *)value offset:(NSNumber *)offset; 27 | - (void)merge:(AppMonitorMeasureValue *)measureValue; 28 | //为了json序列化 29 | - (NSDictionary *)jsonDict; 30 | //json反序列化 31 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/AppMonitorMeasureValueSet.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorMeasureValueSet.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/2/15. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppMonitorMeasureValue.h" 11 | @interface AppMonitorMeasureValueSet : NSObject 12 | 13 | 14 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 15 | 16 | 17 | /** 18 | * 设置指标值 19 | * 20 | * @param name 21 | * @param value 22 | * @return 23 | */ 24 | - (void)setDoubleValue:(double)value forName:(NSString *)name; 25 | - (void)setValue:(AppMonitorMeasureValue *)value forName:(NSString *)name; 26 | - (BOOL)containValueForName:(NSString *)name; 27 | - (AppMonitorMeasureValue *)valueForName:(NSString *)name; 28 | /** 29 | * 合并指标 30 | * 31 | * @param measureValueSet 目标指标集合 32 | * 发现相同的name就对MeasureValue做加操作 33 | */ 34 | - (void)merge:(AppMonitorMeasureValueSet*)measureValueSet; 35 | 36 | - (NSDictionary *)jsonDict; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/AppMonitorStat.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorStat.h 3 | // AppMonitor 4 | // 5 | // Created by christ.yuj on 15/3/10. 6 | // Copyright (c) 2015年 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppMonitorBase.h" 11 | #import "AppMonitorMeasureSet.h" 12 | #import "AppMonitorDimensionSet.h" 13 | 14 | @interface AppMonitorStatTransaction :NSObject 15 | 16 | - (void)beginWithMeasureName:(NSString *)measureName; 17 | 18 | - (void)endWithMeasureName:(NSString *)measureName; 19 | 20 | @end 21 | 22 | @interface AppMonitorStat : AppMonitorBase 23 | 24 | /** 25 | * 注册性能埋点 26 | * @param module 模块 27 | * @param monitorPoint 监控点 28 | * @param measures 多指标 29 | */ 30 | + (void)registerWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureSet:(AppMonitorMeasureSet *)measures; 31 | 32 | /** 33 | * 注册性能埋点 34 | * @param module 模块 35 | * @param monitorPoint 监控点 36 | * @param measures 多指标 37 | * @param dimemsions 多维度 38 | */ 39 | + (void)registerWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureSet:(AppMonitorMeasureSet *)measures dimensionSet:(AppMonitorDimensionSet *)dimensions; 40 | 41 | /** 42 | * 注册性能埋点 43 | * @param module 模块 44 | * @param monitorPoint 监控点 45 | * @param measures 多指标 46 | * @param isCommitDetail 标记是否提交明细。需要提交明细时设置为YES,否则为NO 47 | */ 48 | + (void)registerWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureSet:(AppMonitorMeasureSet *)measures isCommitDetail:(BOOL)detail; 49 | 50 | /** 51 | * 注册性能埋点 52 | * @param module 模块 53 | * @param monitorPoint 监控点 54 | * @param measures 多指标 55 | * @param dimemsions 多维度 56 | * @param isCommitDetail 标记是否提交明细。需要提交明细时设置为YES,否则为NO 57 | */ 58 | + (void)registerWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureSet:(AppMonitorMeasureSet *)measures dimensionSet:(AppMonitorDimensionSet *)dimensions isCommitDetail:(BOOL)detail; 59 | 60 | /** 61 | * 提交多维度,多指标 62 | * @param module 监控模块 63 | * @param monitorPoint 监控点名称 Page+monitorPoint必须唯一 64 | * @param dimensionValues 维度值集合 65 | * @param measureValues 指标值集合 66 | */ 67 | + (void)commitWithModule:(NSString*) module monitorPoint:(NSString *)monitorPoint dimensionValueSet:(AppMonitorDimensionValueSet *)dimensionValues measureValueSet:(AppMonitorMeasureValueSet *)measureValues; 68 | 69 | /** 70 | * 提交多维度单指标 71 | * @param module 监控模块 72 | * @param monitorPoint 监控点名称 Page+monitorPoint必须唯一 73 | * @param dimensionValues 维度值集合 74 | * @param value 指标值 75 | */ 76 | 77 | + (void)commitWithModule:(NSString*) module monitorPoint:(NSString *)monitorPoint dimensionValueSet:(AppMonitorDimensionValueSet *)dimensionValues value:(double)value; 78 | 79 | /** 80 | * 提交单指标 81 | * @param module 监控模块 82 | * @param monitorPoint 监控点名称 Page+monitorPoint必须唯一 83 | * @param value 指标值 84 | */ 85 | + (void)commitWithModule:(NSString*) module monitorPoint:(NSString *)monitorPoint value:(double)value; 86 | 87 | /** 88 | *开始事件,适合不存在并发的跨多线程事件(比如常见的UI加载渲染)
89 | *如果事件跨多线程多并发执行,请使用beginTransaction-endTransaction方法对,此场景较少见 90 | * @param module 监控模块 91 | * @param monitorPoint 监控点名称 module+monitorPoint必须唯一 92 | */ 93 | + (void)beginWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureName:(NSString *)measureName; 94 | 95 | /** 96 | *结束事件,适合不存在并发的跨多线程事件(比如常见的UI加载渲染)
97 | *如果事件跨多线程多并发执行,请使用beginTransaction-endTransaction方法对,此场景较少见 98 | * @param module 监控模块 99 | * @param monitorPoint 监控点名称 module+monitorPoint必须唯一 100 | */ 101 | + (void)endWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureName:(NSString *)measureName; 102 | 103 | /** 104 | * 埋点事务,可以通过调用事务的begin-end方法对来统计耗时指标的值 105 | * 106 | * @param module 模块 107 | * @param monitorPoint 监控点 108 | * @return 返回埋点事务实例 109 | */ 110 | 111 | + (AppMonitorStatTransaction *)createTransactionWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint; 112 | 113 | @end 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/AppMonitorTable.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppMonitorStat2.h 3 | // AppMonitor 4 | // 5 | // Created by sugar on 7/8/15. 6 | // Copyright (c) 2015 君展. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | ///////////////////////////////////////////////////////// 12 | // 数据格式以下图为例: 13 | // 启动性能 - 启动时间监控 14 | // 启动方式 | cpu | 机型 | 网络类型| 总计 15 | // ---------------------------------- 16 | // 冷启动耗时 |arm7 | 4s | 2G | 5s (约束2-10) 17 | // 热启动耗时 |arm7s| 5s | 4G | 3s (约束1-3) 18 | 19 | // step 1: 创建一个模块空间;monitorForScheme 20 | // step 2: 在空间下面创建表 21 | // step 3: 添加对应的值的约束,不在约束范围内的点将一噪点方式上报 22 | // step 4: 更新表数据 23 | // 24 | 25 | ///////////////////////////////////////////////////////// 26 | 27 | 28 | @interface AppMonitorTable : NSObject 29 | 30 | // BEGIN Add by 玄叶 31 | + (void)registerWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint columns:(NSArray *)cols rows:(NSArray * )rows aggregate:(BOOL)aggregate; 32 | 33 | + (void)addConstraintWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint name:(NSString *)name min:(double)min max:(double)max defaultValue:(double)value; 34 | 35 | + (BOOL)commitWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint columns:(NSDictionary *)cols rows:(NSDictionary *)rows; 36 | // END 37 | 38 | // 创建一个表的模块空间 39 | + (instancetype)monitorForScheme:(NSString *)scheme tableName:(NSString *)tableName; 40 | 41 | // 新建一张表, 行,列,数据是否聚合 42 | - (void)registerTableWithRows:(NSArray * )rows columns:(NSArray *)cols aggregate:(BOOL)yn; 43 | 44 | // 添加约束 45 | - (void)addConstraintWithName:(NSString *)name range:(NSRange)range defaultValue:(NSNumber *)number; 46 | 47 | // 添加约束 48 | - (void)addConstraintWithName:(NSString *)name min:(double)min max:(double)max defaultValue:(double)value; 49 | 50 | // 更新表 行的名字,列的名字,行的数据,列的数据 51 | - (BOOL)updateTableForColumns:(NSDictionary *)cols rows:(NSDictionary *)rows; 52 | 53 | // 更新表,不区分行列名字。此接口不允许行列同名,性能偏低,慎用! 54 | - (BOOL)updateTableWithDictionary:(NSDictionary *)dict; 55 | 56 | @end -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/UT.h: -------------------------------------------------------------------------------- 1 | // 2 | // UT.h 3 | // miniUTSDK 4 | // 5 | // Created by 宋军 on 15/5/19. 6 | // Copyright (c) 2015年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface UT : NSObject 13 | 14 | ////=====================================h5&Native接口===================================== 15 | /** 16 | * @brief h5&Native打通 17 | * 18 | * @warning 调用说明:由windwave封装,供aplus_wap.js调用 19 | * 20 | * 21 | * 22 | * @param dataDict aplus_wap.js采集的h5信息都通过该字典传进来,该字典中必须有key(funcType) 23 | * 用来区分采集的是哪个事件信息,比如funcType=2001,则h5UT内部会调用 24 | * pageEnter来处理,funcType=2101,则调用ctrlClicked处理 25 | * 26 | */ 27 | +(void) h5UT:(NSDictionary *) dataDict view:(UIWebView *) pView viewController:(UIViewController *) pViewController; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/UTAnalytics.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTAnalytics.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-14. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UTTracker.h" 11 | #import "UTIRequestAuthentication.h" 12 | #import "UTICrashCaughtListener.h" 13 | 14 | @interface UTAnalytics : NSObject 15 | 16 | 17 | + (void) turnOnDev2; 18 | 19 | /** 20 | * 单例初始化时,不再会从安全图片和指令plist读取appkey 21 | * 22 | * @return 返回UTAnalytics单例 23 | * 24 | */ 25 | +(UTAnalytics *) getInstance; 26 | 27 | 28 | /** 29 | * 老接口兼容:接口方式设置主app级appkey/appsecret对 30 | * 重复设置抛异常 31 | * 32 | * @param appKey 主app级的appkey 33 | * 34 | * @param secret 主app级的appsecret 35 | * 36 | */ 37 | - (void)setAppKey:(NSString *)appKey secret:(NSString *)secret; 38 | 39 | 40 | /** 41 | * 新接口1:从安全图片读取出appkey后,塞給ut,作为主app级的appkey 42 | * 重复设置抛异常 43 | * 44 | * @param appKey 主app级的appkey 45 | * 46 | * @param authocode 多图片时的后缀;为nil时,对应默认图片 47 | * 48 | */ 49 | - (void)setAppKey4APP:(NSString *)appKey authcode:(NSString *)authcode; 50 | 51 | 52 | /** 53 | * 新接口2:接口方式设置SDK级appkey/appsecret对 54 | * !!!请注意:只设置了SDK级appkey,埋点方法(UTTracker *) getTracker:(NSString *) pTrackId将不起作用 55 | * !!!请注意:一定要先设置了主app级appkey,埋点方法(UTTracker *) getTracker:(NSString *) pTrackId才会作用 56 | * 57 | * @param appKey SDK级的appkey 58 | * 59 | * @param secret SDK级的appsecret 60 | * 61 | */ 62 | - (void)setAppKey4SDK:(NSString *)appKey secret:(NSString *)secret; 63 | 64 | 65 | /** 66 | * 新接口3:从安全图片读取出appkey后,塞給ut,作为SDK级的appkey 67 | * !!!请注意:只设置了SDK级appkey,埋点方法(UTTracker *) getTracker:(NSString *) pTrackId将不起作用 68 | * !!!请注意:一定要先设置了主app级appkey,埋点方法(UTTracker *) getTracker:(NSString *) pTrackId才会作用 69 | * 70 | * @param appKey SDK级的appkey 71 | * 72 | * @param authocode 多图片时的后缀;为nil时,对应默认图片 73 | * 74 | */ 75 | - (void)setAppKey4SDK:(NSString *)appKey authcode:(NSString *)authcode; 76 | 77 | 78 | + (void)setDailyEnvironment __deprecated; 79 | 80 | /** 81 | * 老接口:对主app级的appkey设置appversion 82 | * 83 | * @param pAppVersion app级的appversion 84 | * 85 | */ 86 | -(void) setAppVersion:(NSString *) pAppVersion; 87 | 88 | 89 | -(void) setChannel:(NSString *) pChannel; 90 | 91 | -(void) updateUserAccount:(NSString *) pNick userid:(NSString *) pUserId; 92 | 93 | -(void) userRegister:(NSString *) pUsernick; 94 | 95 | -(void) updateSessionProperties:(NSDictionary *) pDict; 96 | 97 | 98 | /** 99 | * 老接口兼容:获取默认的UTTracker. 100 | * 如果设置了app级的appkey,默认的tracker对应app级的生产者 101 | * 如果只设置了sdk级的appkey,默认的tracker为空,返回第一个设置appkey的对应生产者 102 | * 103 | * @return 默认的UTTracker 104 | * 105 | */ 106 | -(UTTracker *) getDefaultTracker; 107 | 108 | 109 | /** 110 | * 老接口兼容:返回trackid对应的UTTracker. 111 | * 只能已经设置主app级appkey的前提下,才能有效设置并返回 112 | * 113 | * @param pTrackId 主app级的trackid 114 | * 115 | * @return 返回trackid对应的UTTracker 116 | * 117 | */ 118 | -(UTTracker *) getTracker:(NSString *) pTrackId; 119 | 120 | 121 | /** 122 | * 新接口:获取sdk级对应的UTTracker. 123 | * 只有已经设置对应的sdk级的appkey的前提下,才能有效返回 124 | * 125 | * @param pAppkey SDK级的appkey 126 | * 127 | * @return sdk级对应的UTTracker 128 | * 129 | */ 130 | -(UTTracker *) getTracker4SDK:(NSString *) pAppkey; 131 | 132 | -(void) turnOnDebug; 133 | 134 | -(void) turnOnDev; 135 | 136 | // 以下接口功能已废弃,接口保留 137 | -(void) setRequestAuthentication:(id) pRequestAuth __deprecated; 138 | 139 | - (void)onCrashHandler; 140 | 141 | -(void) turnOffCrashHandler; 142 | 143 | -(void) setCrashCaughtListener:(id) aListener; 144 | 145 | @end 146 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/UTBaseRequestAuthentication.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseRequestAuthentication.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-17. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UTIRequestAuthentication.h" 11 | 12 | @interface UTBaseRequestAuthentication : NSObject 13 | 14 | -(id) initWithAppKey:(NSString *) pAppKey appSecret:(NSString *) pSecret; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/UTCustomHitBuilder.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTCustomHitBuilder.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-17. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import "UTHitBuilder.h" 10 | 11 | @interface UTCustomHitBuilder : UTHitBuilder 12 | 13 | -(void) setEventLabel:(NSString *) pEventId; 14 | 15 | -(void) setEventPage:(NSString *) pPageName; 16 | 17 | -(void) setDurationOnEvent:(long long) durationOnEvent; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/UTHitBuilder.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTBaseMapBuilder.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-14. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface UTHitBuilder : NSObject 13 | 14 | 15 | -(NSDictionary *) build; 16 | 17 | -(void) setProperty:(NSString *) pKey value:(NSString *) pValue; 18 | 19 | -(void) setProperties:(NSDictionary *) pPageProperties; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/UTICrashCaughtListener.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTICrashCaughtListener.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14/10/28. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol UTICrashCaughtListener 12 | 13 | -(NSDictionary *) onCrashCaught:(NSString *) pCrashReason CallStack:(NSString *)callStack; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/UTIRequestAuthentication.h: -------------------------------------------------------------------------------- 1 | // 2 | // IRequestAuthentication.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-17. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol UTIRequestAuthentication 12 | 13 | -(NSString *) getAppKey; 14 | 15 | -(NSString *) getSign:(NSString*) pToBeSignStr; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/UTOirginalCustomHitBuilder.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTOirginalCustomHitBuilder.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14/10/28. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UTHitBuilder.h" 11 | @interface UTOirginalCustomHitBuilder : UTHitBuilder 12 | 13 | -(void) setPageName:(NSString *) pPage; 14 | 15 | -(void) setEventId:(NSString *) pEventId; 16 | 17 | -(void) setArg1:(NSString *) pArg1; 18 | 19 | -(void) setArg2:(NSString *) pArg2; 20 | 21 | -(void) setArg3:(NSString *) pArg3; 22 | 23 | -(void) setArgs:(NSDictionary *) pArgs; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/UTPageHitBuilder.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTMapBuilder.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-14. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import "UTHitBuilder.h" 10 | 11 | @interface UTPageHitBuilder : UTHitBuilder 12 | 13 | -(void) setPageName:(NSString *) pPageName; 14 | 15 | -(void) setReferPage:(NSString *) pReferPageName; 16 | 17 | -(void) setDurationOnPage:(long long ) durationTimeOnPage; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/UTSecuritySDKRequestAuthentication.h: -------------------------------------------------------------------------------- 1 | // 2 | // SecuritySDKRequestAuthentication.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-17. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UTIRequestAuthentication.h" 11 | 12 | @interface UTSecuritySDKRequestAuthentication : NSObject 13 | 14 | -(id) initWithAppKey:(NSString *) pAppKey; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Headers/UTTracker.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTTracker.h 3 | // miniUTInterface 4 | // 5 | // Created by 宋军 on 14-10-14. 6 | // Copyright (c) 2014年 ___SONGJUN___. All rights reserved. 7 | // 8 | 9 | #import 10 | //#import 11 | //#import 12 | @class UTDSDKInfo; 13 | 14 | typedef enum _UTPageStatus{ 15 | UT_H5_IN_WebView//设置容器中的H5页面事件的eventid为2001,不设置默认为2006 16 | } UTPageStatus; 17 | 18 | @interface UTTracker : NSObject 19 | 20 | @property (readonly,copy) UTDSDKInfo * mSdkinfo; 21 | 22 | -(id) initWithTrackId:(NSString *) pTrackId __deprecated; 23 | 24 | -(id) initWithAppKey:(NSString *) pAppkey 25 | appsecret:(NSString *) pAppSecret 26 | authcode:(NSString *) pAuthCode 27 | securitySign:(BOOL) securitySign; 28 | 29 | -(id) initWithTracker:(UTTracker *) pTracker trackid:(NSString *) pTrackId; 30 | 31 | -(NSString *) getAppKey; 32 | 33 | -(void) setGlobalProperty:(NSString *) pKey value:(NSString *) pValue; 34 | 35 | -(void) removeGlobalProperty:(NSString *) pKey; 36 | 37 | -(NSString *) getGlobalProperty:(NSString *) pKey; 38 | 39 | -(void) send:(NSDictionary *) pLogDict; 40 | 41 | #pragma mark 页面埋点 42 | /** 43 | * @brief 页面进入. 44 | * 45 | * @param pPageObject 页面对象,如viewcontroller指针 46 | * 47 | * @warning 调用说明:1.必须和pageDisAppear配对使用,否则不会成功埋点 48 | * 2.确定页面名称优先级:updatePageName > NSStringFromClass(pObject.class) 49 | * 50 | * 最佳位置:若是viewcontroller页面,则需在viewDidAppear函数内调用 51 | */ 52 | -(void) pageAppear:(id) pPageObject; 53 | 54 | /** 55 | * @brief 页面进入. 56 | * 57 | * @param pPageObject 页面对象,如viewcontroller指针 58 | * @param pPageName 页面名称,如Page_Detail 59 | * 60 | * @warning 调用说明:1.必须和pageDisAppear配对使用,否则不会成功埋点 61 | * 2.确定页面名称优先级:updatePageName > pPageName > NSStringFromClass(pObject.class) 62 | * 若当调用pageAppear时已知页面名称,强烈建议使用该接口 63 | * 最佳位置:若是viewcontroller页面,则需在viewDidAppear函数内调用 64 | */ 65 | -(void) pageAppear:(id) pPageObject withPageName:(NSString *) pPageName; 66 | 67 | /** 68 | * @brief 页面离开. 69 | * 70 | * @param pPageObject 页面对象,如viewcontroller指针 71 | * 72 | * @warning 调用说明:必须和pageAppear配对使用,否则不会成功埋点 73 | * 74 | * 最佳位置:若是viewcontroller页面,则需在viewDidDisAppear函数内调用 75 | */ 76 | -(void) pageDisAppear:(id) pPageObject; 77 | 78 | /** 79 | * @brief 更新页面业务参数. 80 | * 81 | * @param pPageObject 页面对象,如viewcontroller指针 82 | * @param pProperties 业务参数,kv对 83 | * 84 | * @warning 调用说明:必须在pageDisAppear之前调用 85 | * 86 | * 最佳位置:在pageDisAppear之前调用即可 87 | */ 88 | -(void) updatePageProperties:(id) pPageObject properties:(NSDictionary *) pProperties; 89 | 90 | /** 91 | * @brief 更新页面业务参数. 92 | * 93 | * @param pProperties 传给下一个页面业务参数,kv对 94 | * 95 | * @warning 调用说明:必须在下一个页面pageAppear之前调用,否则会携带错误 96 | * 97 | * 最佳位置:必须在下一个页面pageAppear之前调用 98 | */ 99 | -(void) updateNextPageProperties:(NSDictionary *) pProperties; 100 | 101 | #pragma mark 页面埋点的辅助函数 102 | /** 103 | * @brief 更新页面名称. 104 | * 105 | * @param pPageObject 页面对象,如viewcontroller指针 106 | * @param pPageName 更新后的页面名称 107 | * 108 | * @warning 调用说明:只有当调用pageAppear时还未知页面名称,后续可使用该接口更新 109 | * 110 | * 最佳位置:在pageDisAppear之前调用 111 | */ 112 | -(void) updatePageName:(id) pPageObject pageName:(NSString *) pPageName; 113 | 114 | /** 115 | * @brief 更新页面url. 116 | * 117 | * @param pPageObject 页面对象,如viewcontroller指针 118 | * @param pUrl 页面对应的url 119 | * 120 | * @warning 调用说明:如手淘统一导航将每次页面跳转的url塞给对应的viewcontroller 121 | * 122 | * 最佳位置:在pageDisAppear之前调用 123 | */ 124 | -(void) updatePageUrl:(id) pPageObject url:(NSURL *) pUrl; 125 | 126 | /** 127 | * @brief 更新页面状态. 128 | * 129 | * @param pPageObject 页面对象,如viewcontroller指针 130 | * @param aStatus 页面状态 enum类型 131 | * 132 | * @warning 调用说明:告知页面处于某些特殊的业务场景,如回退等 133 | * 134 | * 最佳位置:必须在pageAppear之前调用 135 | */ 136 | -(void) updatePageStatus:(id) pPageObject status:(UTPageStatus) aStatus; 137 | 138 | 139 | -(void) skipPage:(id) pPageObject; 140 | 141 | - (void) ctrlClicked:(NSString *)controlName onPage:(NSObject *) pageName args:(NSDictionary *) dict; 142 | 143 | @end 144 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 15B42 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | UTMini 11 | CFBundleIdentifier 12 | com.taobao.junzhan.UTMini 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | UTMini 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 5.2.0.1-appkeys-SNAPSHOT 21 | CFBundleSignature 22 | ???? 23 | CFBundleSupportedPlatforms 24 | 25 | iPhoneOS 26 | 27 | CFBundleVersion 28 | 1 29 | DTCompiler 30 | com.apple.compilers.llvm.clang.1_0 31 | DTPlatformBuild 32 | 13E230 33 | DTPlatformName 34 | iphoneos 35 | DTPlatformVersion 36 | 9.3 37 | DTSDKBuild 38 | 13E230 39 | DTSDKName 40 | iphoneos9.3 41 | DTXcode 42 | 0731 43 | DTXcodeBuild 44 | 7D1014 45 | MinimumOSVersion 46 | 5.0 47 | UIDeviceFamily 48 | 49 | 1 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /sample/ios/libs/UTMini.framework/UTMini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wonday/react-native-aliyun-push/e9777f52fec05c29dc718dd9799e2310d837f214/sample/ios/libs/UTMini.framework/UTMini -------------------------------------------------------------------------------- /sample/ios/sample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | @interface AppDelegate : UIResponder 11 | 12 | @property (nonatomic, strong) UIWindow *window; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /sample/ios/sample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | #import 12 | #import 13 | #import "AliyunPushManager.h" 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 19 | { 20 | 21 | NSURL *jsCodeLocation; 22 | 23 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 24 | 25 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 26 | moduleName:@"sample" 27 | initialProperties:nil 28 | launchOptions:launchOptions]; 29 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 30 | 31 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 32 | UIViewController *rootViewController = [UIViewController new]; 33 | rootViewController.view = rootView; 34 | self.window.rootViewController = rootViewController; 35 | [self.window makeKeyAndVisible]; 36 | 37 | [[AliyunPushManager sharedInstance] setParams:@"11111111" 38 | appSecret:@"11111111" 39 | lauchOptions:launchOptions 40 | createNotificationCategoryHandler:^{ 41 | NSLog(@"create customize notification category here"); 42 | //create customize notification category here 43 | }]; 44 | 45 | return YES; 46 | } 47 | 48 | // ios 10 or later 49 | - (BOOL)application:(UIApplication *)application 50 | openURL:(NSURL *)url 51 | options:(NSDictionary *)options 52 | { 53 | return [RCTLinkingManager application:application openURL:url 54 | sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey] 55 | annotation:options[UIApplicationOpenURLOptionsAnnotationKey]]; 56 | } 57 | 58 | // ios 9 or older 59 | - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url 60 | sourceApplication:(NSString *)sourceApplication annotation:(id)annotation 61 | { 62 | return [RCTLinkingManager application:application openURL:url 63 | sourceApplication:sourceApplication annotation:annotation]; 64 | } 65 | 66 | 67 | // APNs注册成功回调,将返回的deviceToken上传到CloudPush服务器 68 | - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken 69 | { 70 | [[AliyunPushManager sharedInstance] application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; 71 | } 72 | 73 | 74 | // APNs注册失败回调 75 | - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error 76 | { 77 | [[AliyunPushManager sharedInstance] application:application didFailToRegisterForRemoteNotificationsWithError:error]; 78 | } 79 | 80 | // 打开/删除通知回调 81 | - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler 82 | { 83 | [[AliyunPushManager sharedInstance] application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; 84 | } 85 | 86 | 87 | // 请求注册设定后,回调 88 | - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings 89 | { 90 | [[AliyunPushManager sharedInstance] application:application didRegisterUserNotificationSettings:notificationSettings]; 91 | } 92 | 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /sample/ios/sample/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /sample/ios/sample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | ], 4 | "info" : { 5 | "version" : 1, 6 | "author" : "xcode" 7 | } 8 | } -------------------------------------------------------------------------------- /sample/ios/sample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | zh_CN 7 | CFBundleDisplayName 8 | sample 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleGetInfoString 12 | 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | $(PRODUCT_NAME) 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1 27 | ITSAppUsesNonExemptEncryption 28 | 29 | LSApplicationCategoryType 30 | 31 | LSRequiresIPhoneOS 32 | 33 | NSAppTransportSecurity 34 | 35 | NSAllowsArbitraryLoads 36 | 37 | 38 | NSHumanReadableCopyright 39 | 40 | UIBackgroundModes 41 | 42 | remote-notification 43 | 44 | UILaunchStoryboardName 45 | LaunchScreen 46 | UIRequiredDeviceCapabilities 47 | 48 | armv7 49 | 50 | UIStatusBarHidden~ipad 51 | 52 | UIStatusBarStyle 53 | UIStatusBarStyleDefault 54 | UISupportedInterfaceOrientations 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationPortraitUpsideDown 58 | UIInterfaceOrientationLandscapeLeft 59 | UIInterfaceOrientationLandscapeRight 60 | 61 | UISupportedInterfaceOrientations~ipad 62 | 63 | UIInterfaceOrientationPortrait 64 | UIInterfaceOrientationLandscapeLeft 65 | UIInterfaceOrientationLandscapeRight 66 | UIInterfaceOrientationPortraitUpsideDown 67 | 68 | UIViewControllerBasedStatusBarAppearance 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /sample/ios/sample/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /sample/ios/sample/sample.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | aps-environment 6 | development 7 | 8 | 9 | -------------------------------------------------------------------------------- /sample/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "zsqingnian", 3 | "version": "3.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "test": "jest" 8 | }, 9 | "dependencies": { 10 | "create-react-class": "^15.6.3", 11 | "dateformat": "^3.0.3", 12 | "prop-types": "^15.6.1", 13 | "react": "16.3.1", 14 | "react-native": "0.55.4", 15 | "react-native-aliyun-push": "*", 16 | "react-redux": "^5.0.7", 17 | "rebound": "0.0.15", 18 | "redux": "^3.7.0", 19 | "redux-logger": "^3.0.6", 20 | "redux-persist": "^4.10.2", 21 | "redux-thunk": "^2.2.0", 22 | "rn-fetch-blob": "^0.10.12", 23 | "underscore": "^1.8.3", 24 | "url": "^0.11.0", 25 | "url-parse": "^1.4.3" 26 | }, 27 | "devDependencies": {}, 28 | "jest": { 29 | "preset": "react-native" 30 | } 31 | } 32 | --------------------------------------------------------------------------------