@onekeyfe/react-native-jpush 0.0.0-stage → 6.7.0-alpha.435
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +23 -2
- package/ReactNativeJpush.podspec +66 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +143 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +143 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/cn/android/service/JTransitActivity.java +19 -0
- package/android/src/main/java/cn/jiguang/android/BuildConfig.java +10 -0
- package/android/src/main/java/cn/jiguang/android/IDataShare.java +190 -0
- package/android/src/main/java/cn/jiguang/api/BaseLogger.java +82 -0
- package/android/src/main/java/cn/jiguang/api/JAction.java +22 -0
- package/android/src/main/java/cn/jiguang/api/JActionExtra.java +21 -0
- package/android/src/main/java/cn/jiguang/api/JAnalyticsAction.java +11 -0
- package/android/src/main/java/cn/jiguang/api/JCoreInterface.java +228 -0
- package/android/src/main/java/cn/jiguang/api/JCoreManager.java +156 -0
- package/android/src/main/java/cn/jiguang/api/JDispatchAction.java +66 -0
- package/android/src/main/java/cn/jiguang/api/MultiSpHelper.java +114 -0
- package/android/src/main/java/cn/jiguang/api/ReportCallBack.java +9 -0
- package/android/src/main/java/cn/jiguang/api/SdkType.java +13 -0
- package/android/src/main/java/cn/jiguang/api/utils/JCollectionAuth.java +23 -0
- package/android/src/main/java/cn/jiguang/core/JCoreCrypto.java +545 -0
- package/android/src/main/java/cn/jiguang/core/JCoreStorage.java +737 -0
- package/android/src/main/java/cn/jiguang/core/JCoreTcpEngine.java +1394 -0
- package/android/src/main/java/cn/jiguang/core/JCoreWireCodec.java +1716 -0
- package/android/src/main/java/cn/jiguang/internal/ActionManager.java +63 -0
- package/android/src/main/java/cn/jiguang/internal/JConstants.java +61 -0
- package/android/src/main/java/cn/jiguang/internal/JCoreHelperAction.java +12 -0
- package/android/src/main/java/cn/jiguang/internal/JCoreInternalHelper.java +102 -0
- package/android/src/main/java/cn/jiguang/net/DefaultHostVerifier.java +40 -0
- package/android/src/main/java/cn/jiguang/net/HttpRequest.java +78 -0
- package/android/src/main/java/cn/jiguang/net/HttpResponse.java +48 -0
- package/android/src/main/java/cn/jiguang/net/HttpUtils.java +106 -0
- package/android/src/main/java/cn/jiguang/plugins/core/JCoreModule.java +91 -0
- package/android/src/main/java/cn/jiguang/plugins/core/JCorePackage.java +27 -0
- package/android/src/main/java/cn/jiguang/plugins/push/JPushModule.java +773 -0
- package/android/src/main/java/cn/jiguang/plugins/push/JPushPackage.java +25 -0
- package/android/src/main/java/cn/jiguang/plugins/push/common/JConstants.java +88 -0
- package/android/src/main/java/cn/jiguang/plugins/push/common/JLogger.java +122 -0
- package/android/src/main/java/cn/jiguang/plugins/push/helper/JPushHelper.java +710 -0
- package/android/src/main/java/cn/jiguang/plugins/push/receiver/JPushBroadcastReceiver.java +37 -0
- package/android/src/main/java/cn/jiguang/plugins/push/receiver/JPushModuleReceiver.java +264 -0
- package/android/src/main/java/cn/jiguang/plugins/service/JCoreModuleService.java +7 -0
- package/android/src/main/java/cn/jpush/android/api/BasicPushNotificationBuilder.java +83 -0
- package/android/src/main/java/cn/jpush/android/api/CallBackParams.java +50 -0
- package/android/src/main/java/cn/jpush/android/api/CmdMessage.java +33 -0
- package/android/src/main/java/cn/jpush/android/api/CustomMessage.java +28 -0
- package/android/src/main/java/cn/jpush/android/api/CustomPushNotificationBuilder.java +81 -0
- package/android/src/main/java/cn/jpush/android/api/DefaultPushNotificationBuilder.java +90 -0
- package/android/src/main/java/cn/jpush/android/api/InAppSlotParams.java +65 -0
- package/android/src/main/java/cn/jpush/android/api/InstrumentedActivity.java +17 -0
- package/android/src/main/java/cn/jpush/android/api/InstrumentedListActivity.java +17 -0
- package/android/src/main/java/cn/jpush/android/api/JPushInterface.java +488 -0
- package/android/src/main/java/cn/jpush/android/api/JPushMessage.java +121 -0
- package/android/src/main/java/cn/jpush/android/api/JThirdPlatFormInterface.java +147 -0
- package/android/src/main/java/cn/jpush/android/api/MultiActionsNotificationBuilder.java +72 -0
- package/android/src/main/java/cn/jpush/android/api/NotificationCustomButton.java +50 -0
- package/android/src/main/java/cn/jpush/android/api/NotificationMessage.java +67 -0
- package/android/src/main/java/cn/jpush/android/api/PushNotificationBuilder.java +13 -0
- package/android/src/main/java/cn/jpush/android/api/TagAliasCallback.java +8 -0
- package/android/src/main/java/cn/jpush/android/data/JPushCollectControl.java +96 -0
- package/android/src/main/java/cn/jpush/android/data/JPushConfig.java +79 -0
- package/android/src/main/java/cn/jpush/android/data/JPushConfigEx.java +41 -0
- package/android/src/main/java/cn/jpush/android/data/JPushLocalNotification.java +155 -0
- package/android/src/main/java/cn/jpush/android/helper/JCoreHelper.java +70 -0
- package/android/src/main/java/cn/jpush/android/helper/Logger.java +82 -0
- package/android/src/main/java/cn/jpush/android/local/ActionHelper.java +1198 -0
- package/android/src/main/java/cn/jpush/android/local/ActivityLifeCallBack.java +47 -0
- package/android/src/main/java/cn/jpush/android/local/JPushAction.java +67 -0
- package/android/src/main/java/cn/jpush/android/local/JPushConstants.java +34 -0
- package/android/src/main/java/cn/jpush/android/local/JPushResponse.java +26 -0
- package/android/src/main/java/cn/jpush/android/local/ProxyActivityAction.java +34 -0
- package/android/src/main/java/cn/jpush/android/service/AlarmReceiver.java +15 -0
- package/android/src/main/java/cn/jpush/android/service/BActivity.java +19 -0
- package/android/src/main/java/cn/jpush/android/service/DActivity.java +19 -0
- package/android/src/main/java/cn/jpush/android/service/DaemonService.java +17 -0
- package/android/src/main/java/cn/jpush/android/service/DataProvider.java +136 -0
- package/android/src/main/java/cn/jpush/android/service/DataShare.java +129 -0
- package/android/src/main/java/cn/jpush/android/service/DownloadProvider.java +139 -0
- package/android/src/main/java/cn/jpush/android/service/InitProvider.java +48 -0
- package/android/src/main/java/cn/jpush/android/service/JCommonService.java +79 -0
- package/android/src/main/java/cn/jpush/android/service/JNotifyActivity.java +28 -0
- package/android/src/main/java/cn/jpush/android/service/JPushMessageReceiver.java +93 -0
- package/android/src/main/java/cn/jpush/android/service/PushReceiver.java +26 -0
- package/android/src/main/java/cn/jpush/android/service/PushService.java +28 -0
- package/android/src/main/java/cn/jpush/android/service/SchedulerReceiver.java +17 -0
- package/android/src/main/java/cn/jpush/android/service/TagAliasReceiver.java +11 -0
- package/android/src/main/java/cn/jpush/android/service/WakedResultReceiver.java +24 -0
- package/android/src/main/java/cn/jpush/android/ui/FullScreenView.java +11 -0
- package/android/src/main/java/cn/jpush/android/ui/PopWinActivity.java +16 -0
- package/android/src/main/java/cn/jpush/android/ui/PushActivity.java +27 -0
- package/android/src/main/java/cn/jpush/android/ui/RoundedImageView.java +63 -0
- package/android/src/main/java/cn/jpush/android/ui/ShadowViewCard.java +56 -0
- package/android/src/main/java/cn/jpush/android/ups/ICallbackResult.java +5 -0
- package/android/src/main/java/cn/jpush/android/ups/JPushUPSManager.java +37 -0
- package/android/src/main/java/cn/jpush/android/ups/TokenResult.java +47 -0
- package/android/src/main/java/cn/jpush/android/ups/UPSRegisterCallBack.java +4 -0
- package/android/src/main/java/cn/jpush/android/ups/UPSTurnCallBack.java +4 -0
- package/android/src/main/java/cn/jpush/android/ups/UPSUnRegisterCallBack.java +4 -0
- package/android/src/main/java/com/margelo/nitro/reactnativejpush/ReactNativeJpush.kt +455 -0
- package/android/src/main/java/com/margelo/nitro/reactnativejpush/ReactNativeJpushPackage.kt +50 -0
- package/android/src/main/res/values/jpush_string.xml +7 -0
- package/android/src/main/res/values/jpush_style.xml +22 -0
- package/android/src/test/java/com/margelo/nitro/reactnativejpush/ReactNativeJpushProtocolTest.java +1016 -0
- package/ios/ReactNativeJpush.swift +522 -0
- package/ios/bridge/RCTJCoreModule.h +5 -0
- package/ios/bridge/RCTJCoreModule.m +31 -0
- package/ios/bridge/RCTJPushEventQueue.h +14 -0
- package/ios/bridge/RCTJPushEventQueue.m +23 -0
- package/ios/bridge/RCTJPushModule.h +37 -0
- package/ios/bridge/RCTJPushModule.m +1165 -0
- package/ios/include/JCOREService.h +3 -0
- package/ios/include/JGCOREAPI.h +14 -0
- package/ios/include/JGInforCollectionAuth.h +17 -0
- package/ios/include/JGInforCollectionAuthItems.h +2 -0
- package/ios/include/JGPushNotificationTrigger.h +2 -0
- package/ios/include/JPUSHService.h +359 -0
- package/ios/jcore/JCOREConfiguration.h +141 -0
- package/ios/jcore/JCOREConfiguration.m +703 -0
- package/ios/jcore/JCORECrypto.h +73 -0
- package/ios/jcore/JCORECrypto.m +649 -0
- package/ios/jcore/JCORESisResolver.h +56 -0
- package/ios/jcore/JCORESisResolver.m +525 -0
- package/ios/jcore/JCORETcpSession.h +42 -0
- package/ios/jcore/JCORETcpSession.m +956 -0
- package/ios/jcore/JCOREWireProtocol.h +274 -0
- package/ios/jcore/JCOREWireProtocol.m +1453 -0
- package/ios/jpush/JPUSHModels.m +214 -0
- package/ios/jpush/JPUSHNotificationManager.h +34 -0
- package/ios/jpush/JPUSHNotificationManager.m +360 -0
- package/ios/jpush/JPUSHService.m +794 -0
- package/ios/tests/ReactNativeJpushTests.m +148 -0
- package/lib/module/ReactNativeJpush.nitro.js +4 -0
- package/lib/module/ReactNativeJpush.nitro.js.map +1 -0
- package/lib/module/index.js +801 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/ReactNativeJpush.nitro.d.ts +60 -0
- package/lib/typescript/src/ReactNativeJpush.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +235 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeJpushSpec.cpp +310 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeJpushSpec.hpp +115 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativejpush/Func_void_bool.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativejpush/Func_void_std__string_std__string.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativejpush/HybridReactNativeJpushSpec.kt +274 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativejpush/reactnativejpushOnLoad.kt +35 -0
- package/nitrogen/generated/android/reactnativejpush+autolinking.cmake +81 -0
- package/nitrogen/generated/android/reactnativejpush+autolinking.gradle +27 -0
- package/nitrogen/generated/android/reactnativejpushOnLoad.cpp +58 -0
- package/nitrogen/generated/android/reactnativejpushOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/ReactNativeJpush+autolinking.rb +62 -0
- package/nitrogen/generated/ios/ReactNativeJpush-Swift-Cxx-Bridge.cpp +49 -0
- package/nitrogen/generated/ios/ReactNativeJpush-Swift-Cxx-Bridge.hpp +147 -0
- package/nitrogen/generated/ios/ReactNativeJpush-Swift-Cxx-Umbrella.hpp +46 -0
- package/nitrogen/generated/ios/ReactNativeJpushAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ReactNativeJpushAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeJpushSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeJpushSpecSwift.hpp +402 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeJpushSpec.swift +107 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeJpushSpec_cxx.swift +723 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeJpushSpec.cpp +73 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeJpushSpec.hpp +116 -0
- package/package.json +173 -4
- package/src/ReactNativeJpush.nitro.ts +93 -0
- package/src/index.tsx +1090 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
package cn.jpush.android.service;
|
|
2
|
+
|
|
3
|
+
import android.content.ContentProvider;
|
|
4
|
+
import android.content.ContentValues;
|
|
5
|
+
import android.database.Cursor;
|
|
6
|
+
import android.net.Uri;
|
|
7
|
+
import android.os.Bundle;
|
|
8
|
+
import cn.jiguang.internal.JConstants;
|
|
9
|
+
|
|
10
|
+
public class InitProvider extends ContentProvider {
|
|
11
|
+
@Override
|
|
12
|
+
public boolean onCreate() {
|
|
13
|
+
if (getContext() != null) {
|
|
14
|
+
JConstants.getAppContext(getContext().getApplicationContext());
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@Override
|
|
20
|
+
public Bundle call(String method, String arg, Bundle extras) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@Override
|
|
25
|
+
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Override
|
|
30
|
+
public String getType(Uri uri) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@Override
|
|
35
|
+
public Uri insert(Uri uri, ContentValues values) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@Override
|
|
40
|
+
public int delete(Uri uri, String selection, String[] selectionArgs) {
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Override
|
|
45
|
+
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
package cn.jpush.android.service;
|
|
2
|
+
|
|
3
|
+
import android.app.Service;
|
|
4
|
+
import android.content.Intent;
|
|
5
|
+
import android.content.res.Configuration;
|
|
6
|
+
import android.os.IBinder;
|
|
7
|
+
import android.text.TextUtils;
|
|
8
|
+
import cn.jiguang.android.IDataShare;
|
|
9
|
+
import cn.jiguang.internal.JConstants;
|
|
10
|
+
import cn.jiguang.internal.JCoreInternalHelper;
|
|
11
|
+
|
|
12
|
+
public class JCommonService extends Service {
|
|
13
|
+
private static IDataShare.Stub mBinder;
|
|
14
|
+
|
|
15
|
+
@Override
|
|
16
|
+
public final void onCreate() {
|
|
17
|
+
super.onCreate();
|
|
18
|
+
JConstants.getAppContext(this.getApplicationContext());
|
|
19
|
+
if (mBinder == null) {
|
|
20
|
+
mBinder = new DataShare();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@Override
|
|
25
|
+
public final boolean onUnbind(Intent intent) {
|
|
26
|
+
return super.onUnbind(intent);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Override
|
|
30
|
+
public final void onDestroy() {
|
|
31
|
+
super.onDestroy();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@Override
|
|
35
|
+
public final void onConfigurationChanged(Configuration newConfig) {
|
|
36
|
+
super.onConfigurationChanged(newConfig);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@Override
|
|
40
|
+
public final void onLowMemory() {
|
|
41
|
+
super.onLowMemory();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Override
|
|
45
|
+
public final void onRebind(Intent intent) {
|
|
46
|
+
super.onRebind(intent);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Override
|
|
50
|
+
public final void onTaskRemoved(Intent rootIntent) {
|
|
51
|
+
super.onTaskRemoved(rootIntent);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@Override
|
|
55
|
+
public final void onTrimMemory(int level) {
|
|
56
|
+
super.onTrimMemory(level);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Override
|
|
60
|
+
public final void onStart(Intent intent, int startId) {
|
|
61
|
+
super.onStart(intent, startId);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@Override
|
|
65
|
+
public final IBinder onBind(Intent intent) {
|
|
66
|
+
if (mBinder == null) {
|
|
67
|
+
mBinder = new DataShare();
|
|
68
|
+
}
|
|
69
|
+
return mBinder;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@Override
|
|
73
|
+
public final int onStartCommand(Intent intent, int flags, int startId) {
|
|
74
|
+
if (intent != null && !TextUtils.isEmpty(intent.getAction())) {
|
|
75
|
+
JCoreInternalHelper.getInstance().onEvent(this, "JCore", 2, true, intent.getAction(), intent.getExtras());
|
|
76
|
+
}
|
|
77
|
+
return Service.START_NOT_STICKY;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package cn.jpush.android.service;
|
|
2
|
+
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.content.Intent;
|
|
5
|
+
import android.os.Bundle;
|
|
6
|
+
import cn.jpush.android.local.ActionHelper;
|
|
7
|
+
|
|
8
|
+
public class JNotifyActivity extends Activity {
|
|
9
|
+
@Override
|
|
10
|
+
protected void onCreate(Bundle savedInstanceState) {
|
|
11
|
+
super.onCreate(savedInstanceState);
|
|
12
|
+
handleIntent(getIntent());
|
|
13
|
+
finish();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@Override
|
|
17
|
+
protected void onNewIntent(Intent intent) {
|
|
18
|
+
super.onNewIntent(intent);
|
|
19
|
+
handleIntent(intent);
|
|
20
|
+
finish();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private void handleIntent(Intent intent) {
|
|
24
|
+
if (intent != null) {
|
|
25
|
+
ActionHelper.getInstance().handleNotificationIntent(getApplicationContext(), intent);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
package cn.jpush.android.service;
|
|
2
|
+
|
|
3
|
+
import android.app.Notification;
|
|
4
|
+
import android.content.BroadcastReceiver;
|
|
5
|
+
import android.content.Context;
|
|
6
|
+
import android.content.Intent;
|
|
7
|
+
import cn.jpush.android.api.CmdMessage;
|
|
8
|
+
import cn.jpush.android.api.CustomMessage;
|
|
9
|
+
import cn.jpush.android.api.JPushMessage;
|
|
10
|
+
import cn.jpush.android.api.NotificationCustomButton;
|
|
11
|
+
import cn.jpush.android.api.NotificationMessage;
|
|
12
|
+
import cn.jpush.android.local.ActionHelper;
|
|
13
|
+
|
|
14
|
+
public abstract class JPushMessageReceiver extends BroadcastReceiver {
|
|
15
|
+
@Override
|
|
16
|
+
public final void onReceive(Context context, Intent intent) {
|
|
17
|
+
ActionHelper.getInstance().onJPushMessageReceive(context, this, intent);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public Notification getNotification(Context context, NotificationMessage notificationMessage) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public void onMessage(Context context, CustomMessage customMessage) {
|
|
25
|
+
ActionHelper.getInstance().onMessage(context, customMessage);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public void onNotifyMessageOpened(Context context, NotificationMessage notificationMessage) {
|
|
29
|
+
ActionHelper.getInstance().onNotifyMessageOpened(context, notificationMessage);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public void onNotifyMessageArrived(Context context, NotificationMessage notificationMessage) {
|
|
33
|
+
ActionHelper.getInstance().onNotifyMessageArrived(context, notificationMessage);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public void onNotifyMessageUnShow(Context context, NotificationMessage notificationMessage) {
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public void onNotifyMessageDismiss(Context context, NotificationMessage notificationMessage) {
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public void onRegister(Context context, String registrationId) {
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public void onConnected(Context context, boolean isConnected) {
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public void onCommandResult(Context context, CmdMessage cmdMessage) {
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public void onNotifyButtonClick(Context context, NotificationCustomButton button) {
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public void onMultiActionClicked(Context context, Intent intent) {
|
|
55
|
+
ActionHelper.getInstance().onMultiAction(context, intent);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public void onPropertyOperatorResult(Context context, JPushMessage jPushMessage) {
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public void onTagOperatorResult(Context context, JPushMessage jPushMessage) {
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public void onCheckTagOperatorResult(Context context, JPushMessage jPushMessage) {
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) {
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public void onNotificationSettingsCheck(Context context, boolean isOn, int source) {
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public boolean isNeedShowNotification(Context context, NotificationMessage notificationMessage, String processName) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public void onInAppMessageShow(Context context, NotificationMessage notificationMessage) {
|
|
81
|
+
ActionHelper.getInstance().onInAppMessageShow(context, notificationMessage);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public void onInAppMessageClick(Context context, NotificationMessage notificationMessage) {
|
|
85
|
+
ActionHelper.getInstance().onInAppMessageClick(context, notificationMessage);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public void onGeofenceRegion(Context context, String geofenceId, double longitude, double latitude) {
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
public void onGeofenceReceived(Context context, String geofenceJson) {
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
package cn.jpush.android.service;
|
|
2
|
+
|
|
3
|
+
import android.content.BroadcastReceiver;
|
|
4
|
+
import android.content.Context;
|
|
5
|
+
import android.content.Intent;
|
|
6
|
+
import cn.jiguang.internal.JConstants;
|
|
7
|
+
import cn.jiguang.internal.JCoreInternalHelper;
|
|
8
|
+
|
|
9
|
+
public class PushReceiver extends BroadcastReceiver {
|
|
10
|
+
@Override
|
|
11
|
+
public void onReceive(Context context, Intent intent) {
|
|
12
|
+
if (context == null || intent == null) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
JConstants.getAppContext(context.getApplicationContext());
|
|
16
|
+
JCoreInternalHelper.getInstance().onEvent(
|
|
17
|
+
context.getApplicationContext(),
|
|
18
|
+
"JCore",
|
|
19
|
+
31,
|
|
20
|
+
true,
|
|
21
|
+
intent.getAction(),
|
|
22
|
+
intent.getExtras(),
|
|
23
|
+
intent
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package cn.jpush.android.service;
|
|
2
|
+
|
|
3
|
+
import android.app.Service;
|
|
4
|
+
import android.content.Intent;
|
|
5
|
+
import android.os.IBinder;
|
|
6
|
+
import cn.jiguang.internal.JConstants;
|
|
7
|
+
import cn.jiguang.internal.JCoreInternalHelper;
|
|
8
|
+
|
|
9
|
+
public class PushService extends Service {
|
|
10
|
+
@Override
|
|
11
|
+
public void onCreate() {
|
|
12
|
+
super.onCreate();
|
|
13
|
+
JConstants.getAppContext(getApplicationContext());
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@Override
|
|
17
|
+
public IBinder onBind(Intent intent) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Override
|
|
22
|
+
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
23
|
+
if (intent != null) {
|
|
24
|
+
JCoreInternalHelper.getInstance().onEvent(this, "JCore", 2, true, intent.getAction(), intent.getExtras());
|
|
25
|
+
}
|
|
26
|
+
return Service.START_NOT_STICKY;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package cn.jpush.android.service;
|
|
2
|
+
|
|
3
|
+
import android.content.BroadcastReceiver;
|
|
4
|
+
import android.content.Context;
|
|
5
|
+
import android.content.Intent;
|
|
6
|
+
import cn.jiguang.internal.JConstants;
|
|
7
|
+
|
|
8
|
+
public class SchedulerReceiver extends BroadcastReceiver {
|
|
9
|
+
public static final String DELAY_NOTIFY = "delay_notify";
|
|
10
|
+
|
|
11
|
+
@Override
|
|
12
|
+
public void onReceive(Context context, Intent intent) {
|
|
13
|
+
if (context != null) {
|
|
14
|
+
JConstants.getAppContext(context.getApplicationContext());
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
package cn.jpush.android.service;
|
|
2
|
+
|
|
3
|
+
import android.content.BroadcastReceiver;
|
|
4
|
+
import android.content.Context;
|
|
5
|
+
import android.content.Intent;
|
|
6
|
+
|
|
7
|
+
public class TagAliasReceiver extends BroadcastReceiver {
|
|
8
|
+
@Override
|
|
9
|
+
public void onReceive(Context context, Intent intent) {
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
package cn.jpush.android.service;
|
|
2
|
+
|
|
3
|
+
import android.content.BroadcastReceiver;
|
|
4
|
+
import android.content.Context;
|
|
5
|
+
import android.content.Intent;
|
|
6
|
+
import java.util.Map;
|
|
7
|
+
|
|
8
|
+
public class WakedResultReceiver extends BroadcastReceiver {
|
|
9
|
+
public static final String CONTEXT_KEY = "1";
|
|
10
|
+
public static final String WAKE_TYPE_KEY = "2";
|
|
11
|
+
|
|
12
|
+
@Override
|
|
13
|
+
public final void onReceive(Context context, Intent intent) {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public void onWake(int wakeType) {
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public void onWake(Context context, int wakeType) {
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public final void onWakeMap(Map<String, Object> wakeInfo) {
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
package cn.jpush.android.ui;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.util.AttributeSet;
|
|
5
|
+
import android.widget.LinearLayout;
|
|
6
|
+
|
|
7
|
+
public class FullScreenView extends LinearLayout {
|
|
8
|
+
public FullScreenView(Context context, AttributeSet attrs) {
|
|
9
|
+
super(context, attrs);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
package cn.jpush.android.ui;
|
|
2
|
+
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.os.Bundle;
|
|
5
|
+
|
|
6
|
+
public class PopWinActivity extends Activity {
|
|
7
|
+
@Override
|
|
8
|
+
protected void onCreate(Bundle savedInstanceState) {
|
|
9
|
+
super.onCreate(savedInstanceState);
|
|
10
|
+
finish();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public void startPushActivity(String action) {
|
|
14
|
+
finish();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
package cn.jpush.android.ui;
|
|
2
|
+
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.content.Intent;
|
|
5
|
+
import android.os.Bundle;
|
|
6
|
+
import cn.jpush.android.local.ActionHelper;
|
|
7
|
+
|
|
8
|
+
public class PushActivity extends Activity {
|
|
9
|
+
public static final String FROM_OTHER_WAY = "from_way";
|
|
10
|
+
|
|
11
|
+
@Override
|
|
12
|
+
protected void onCreate(Bundle savedInstanceState) {
|
|
13
|
+
super.onCreate(savedInstanceState);
|
|
14
|
+
ActionHelper.getInstance().handleNotificationIntent(getApplicationContext(), getIntent());
|
|
15
|
+
finish();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@Override
|
|
19
|
+
protected void onNewIntent(Intent intent) {
|
|
20
|
+
super.onNewIntent(intent);
|
|
21
|
+
ActionHelper.getInstance().handleNotificationIntent(getApplicationContext(), intent);
|
|
22
|
+
finish();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public void showTitleBar() {
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
package cn.jpush.android.ui;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.graphics.Canvas;
|
|
5
|
+
import android.graphics.Path;
|
|
6
|
+
import android.util.AttributeSet;
|
|
7
|
+
import android.widget.ImageView;
|
|
8
|
+
|
|
9
|
+
public class RoundedImageView extends ImageView {
|
|
10
|
+
private float width;
|
|
11
|
+
private float height;
|
|
12
|
+
private int leftTopRadius = 45;
|
|
13
|
+
private int rightTopRadius = 45;
|
|
14
|
+
private int rightBottomRadius = 45;
|
|
15
|
+
private int leftBottomRadius = 45;
|
|
16
|
+
|
|
17
|
+
public RoundedImageView(Context context) {
|
|
18
|
+
super(context);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public RoundedImageView(Context context, AttributeSet attrs) {
|
|
22
|
+
super(context, attrs);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public RoundedImageView(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
26
|
+
super(context, attrs, defStyleAttr);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public void setRadius(int leftTop, int rightTop, int rightBottom, int leftBottom) {
|
|
30
|
+
this.leftTopRadius = leftTop;
|
|
31
|
+
this.rightTopRadius = rightTop;
|
|
32
|
+
this.rightBottomRadius = rightBottom;
|
|
33
|
+
this.leftBottomRadius = leftBottom;
|
|
34
|
+
invalidate();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Override
|
|
38
|
+
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
|
39
|
+
super.onLayout(changed, left, top, right, bottom);
|
|
40
|
+
this.width = getWidth();
|
|
41
|
+
this.height = getHeight();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Override
|
|
45
|
+
protected void onDraw(Canvas canvas) {
|
|
46
|
+
int horizontalNeed = Math.max(leftTopRadius, leftBottomRadius) + Math.max(rightTopRadius, rightBottomRadius);
|
|
47
|
+
int verticalNeed = Math.max(leftTopRadius, rightTopRadius) + Math.max(leftBottomRadius, rightBottomRadius);
|
|
48
|
+
if (width >= horizontalNeed && height > verticalNeed) {
|
|
49
|
+
Path path = new Path();
|
|
50
|
+
path.moveTo(leftTopRadius, 0.0f);
|
|
51
|
+
path.lineTo(width - rightTopRadius, 0.0f);
|
|
52
|
+
path.quadTo(width, 0.0f, width, rightTopRadius);
|
|
53
|
+
path.lineTo(width, height - rightBottomRadius);
|
|
54
|
+
path.quadTo(width, height, width - rightBottomRadius, height);
|
|
55
|
+
path.lineTo(leftBottomRadius, height);
|
|
56
|
+
path.quadTo(0.0f, height, 0.0f, height - leftBottomRadius);
|
|
57
|
+
path.lineTo(0.0f, leftTopRadius);
|
|
58
|
+
path.quadTo(0.0f, 0.0f, leftTopRadius, 0.0f);
|
|
59
|
+
canvas.clipPath(path);
|
|
60
|
+
}
|
|
61
|
+
super.onDraw(canvas);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
package cn.jpush.android.ui;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.graphics.Canvas;
|
|
5
|
+
import android.graphics.Color;
|
|
6
|
+
import android.graphics.Paint;
|
|
7
|
+
import android.graphics.RectF;
|
|
8
|
+
import android.util.AttributeSet;
|
|
9
|
+
import android.widget.RelativeLayout;
|
|
10
|
+
|
|
11
|
+
public class ShadowViewCard extends RelativeLayout {
|
|
12
|
+
private static final int DEFAULT_SHADOW_COLOR = Color.parseColor("#1f253044");
|
|
13
|
+
private final int shadowRound = 52;
|
|
14
|
+
private final int shadowRadius = 11;
|
|
15
|
+
private final int shadowTopHeight = 15;
|
|
16
|
+
private final int shadowLeftHeight = 5;
|
|
17
|
+
private final int shadowRightHeight = 5;
|
|
18
|
+
private final int shadowBottomHeight = 20;
|
|
19
|
+
private final int shadowOffsetX = 0;
|
|
20
|
+
private final int shadowOffsetY = 8;
|
|
21
|
+
|
|
22
|
+
public ShadowViewCard(Context context) {
|
|
23
|
+
this(context, null);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public ShadowViewCard(Context context, AttributeSet attrs) {
|
|
27
|
+
this(context, attrs, 0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public ShadowViewCard(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
31
|
+
super(context, attrs, defStyleAttr);
|
|
32
|
+
setPadding(shadowLeftHeight, shadowTopHeight, shadowRightHeight, shadowBottomHeight);
|
|
33
|
+
setLayerType(LAYER_TYPE_SOFTWARE, null);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public static int dp2px(Context context, float dp) {
|
|
37
|
+
float density = context.getResources().getDisplayMetrics().density;
|
|
38
|
+
return (int) (dp * density + 0.5f);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Override
|
|
42
|
+
protected void dispatchDraw(Canvas canvas) {
|
|
43
|
+
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
|
44
|
+
paint.setColor(Color.WHITE);
|
|
45
|
+
paint.setStyle(Paint.Style.FILL);
|
|
46
|
+
paint.setShadowLayer(shadowRadius, shadowOffsetX, shadowOffsetY, DEFAULT_SHADOW_COLOR);
|
|
47
|
+
RectF rect = new RectF(
|
|
48
|
+
shadowLeftHeight,
|
|
49
|
+
shadowTopHeight,
|
|
50
|
+
getWidth() - shadowRightHeight,
|
|
51
|
+
getHeight() - shadowBottomHeight
|
|
52
|
+
);
|
|
53
|
+
canvas.drawRoundRect(rect, shadowRound, shadowRound, paint);
|
|
54
|
+
super.dispatchDraw(canvas);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
package cn.jpush.android.ups;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import cn.jiguang.api.JCoreManager;
|
|
5
|
+
import cn.jiguang.core.JCoreStorage;
|
|
6
|
+
import cn.jpush.android.api.JPushInterface;
|
|
7
|
+
|
|
8
|
+
public class JPushUPSManager {
|
|
9
|
+
public static void registerToken(Context context, String appId, String appKey, String appSecret, UPSRegisterCallBack callback) {
|
|
10
|
+
String effectiveKey = (appKey != null && !appKey.isEmpty()) ? appKey : appId;
|
|
11
|
+
JCoreManager.register(context, effectiveKey);
|
|
12
|
+
if (callback != null) {
|
|
13
|
+
callback.onResult(new TokenResult(JCoreStorage.getRegistrationId(context), 0, "ups.register"));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public static void unRegisterToken(Context context, UPSUnRegisterCallBack callback) {
|
|
18
|
+
JCoreManager.unRegister(context);
|
|
19
|
+
if (callback != null) {
|
|
20
|
+
callback.onResult(new TokenResult("", 0, "ups.unregister"));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public static void turnOnPush(Context context, UPSTurnCallBack callback) {
|
|
25
|
+
JPushInterface.resumePush(context);
|
|
26
|
+
if (callback != null) {
|
|
27
|
+
callback.onResult(new TokenResult(JCoreStorage.getRegistrationId(context), 0, "ups.turnOn"));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public static void turnOffPush(Context context, UPSTurnCallBack callback) {
|
|
32
|
+
JPushInterface.stopPush(context);
|
|
33
|
+
if (callback != null) {
|
|
34
|
+
callback.onResult(new TokenResult("", 0, "ups.turnOff"));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
package cn.jpush.android.ups;
|
|
2
|
+
|
|
3
|
+
public class TokenResult {
|
|
4
|
+
private String token;
|
|
5
|
+
private int returnCode;
|
|
6
|
+
private String actionType;
|
|
7
|
+
|
|
8
|
+
public TokenResult(String token, int returnCode) {
|
|
9
|
+
this.token = token;
|
|
10
|
+
this.returnCode = returnCode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public TokenResult(String token, int returnCode, String actionType) {
|
|
14
|
+
this.token = token;
|
|
15
|
+
this.returnCode = returnCode;
|
|
16
|
+
this.actionType = actionType;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public String getToken() {
|
|
20
|
+
return token;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public void setToken(String token) {
|
|
24
|
+
this.token = token;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public int getReturnCode() {
|
|
28
|
+
return returnCode;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public void setReturnCode(int returnCode) {
|
|
32
|
+
this.returnCode = returnCode;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public String getActionType() {
|
|
36
|
+
return actionType;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public void setActionType(String actionType) {
|
|
40
|
+
this.actionType = actionType;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@Override
|
|
44
|
+
public String toString() {
|
|
45
|
+
return "TokenResult{token='" + token + "', returnCode=" + returnCode + ", actionType='" + actionType + "'}";
|
|
46
|
+
}
|
|
47
|
+
}
|