Skip to content

Commit 0a33be7

Browse files
committed
'地图浏览模式'
2 parents 9214d70 + 3199254 commit 0a33be7

38 files changed

Lines changed: 1643 additions & 268 deletions

File tree

‎android/app/build.gradle‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ android {
112112
targetSdkVersion 26
113113
versionCode 2
114114
versionName "2.0.2"
115+
manifestPlaceholders = [
116+
JPUSH_APPKEY: "7d2470baad20e273cd6e53cc",
117+
APP_CHANNEL : "default"
118+
]
119+
115120
ndk {
116121
abiFilters "armeabi-v7a"
117122
}
@@ -160,6 +165,8 @@ android {
160165
}
161166

162167
dependencies {
168+
implementation project(':jcore-react-native')
169+
implementation project(':jpush-react-native')
163170
compile project(':react-native-contacts')
164171
implementation project(':react-native-amap-geolocation')
165172
api project(':react-native-splash-screen')

‎android/app/src/main/AndroidManifest.xml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
xmlns:tools="http://schemas.android.com/tools"
33
package="com.supermap.itablet"
44
android:versionCode="1"
5-
android:versionName="2.0.2">
5+
android:versionName="2.0.3">
66

77
<uses-permission android:name="android.permission.INTERNET" />
88
<uses-permission android:name="android.permission.REORDER_TASKS" />
@@ -49,6 +49,13 @@
4949
<category android:name="android.intent.category.LAUNCHER" />
5050
</intent-filter>
5151
</activity>
52+
<meta-data
53+
android:name="JPUSH_APPKEY"
54+
android:value="${JPUSH_APPKEY}" />
55+
<meta-data
56+
android:name="JPUSH_CHANNEL"
57+
android:value="${APP_CHANNEL}" />
58+
5259
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
5360
<activity
5461
android:name=".wxapi.WXEntryActivity"

‎android/app/src/main/java/com/supermap/itablet/MainApplication.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import com.supermap.imb.lic.LicConfig;
66
import com.facebook.react.ReactApplication;
7+
import cn.jpush.reactnativejpush.JPushPackage;
78
import com.rt2zz.reactnativecontacts.ReactNativeContacts;
89
import cn.qiuxiang.react.geolocation.AMapGeolocationPackage;
910
//import com.airbnb.android.react.maps.MapsPackage;
@@ -32,6 +33,7 @@ public boolean getUseDeveloperSupport() {
3233
protected List<ReactPackage> getPackages() {
3334
return Arrays.<ReactPackage>asList(
3435
new MainReactPackage(),
36+
new JPushPackage(true, true),
3537
new ReactNativeContacts(),
3638
new AMapGeolocationPackage(),
3739
// new MapsPackage(),

‎android/settings.gradle‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
rootProject.name = 'iTablet'
2+
include ':jpush-react-native'
3+
project(':jpush-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jpush-react-native/android')
4+
include ':jcore-react-native'
5+
project(':jcore-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jcore-react-native/android')
26
include ':react-native-contacts'
37
project(':react-native-contacts').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-contacts/android')
48
include ':react-native-amap-geolocation'

‎ios/iTablet.xcodeproj/project.pbxproj‎

Lines changed: 121 additions & 9 deletions
Large diffs are not rendered by default.

‎ios/iTablet/AppDelegate.m‎

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
*/
99

1010
#import "AppDelegate.h"
11+
#import <RCTJPushModule.h>
12+
#ifdef NSFoundationVersionNumber_iOS_9_x_Max
13+
#import <UserNotifications/UserNotifications.h>
14+
#endif
15+
1116

1217
#import <React/RCTBundleURLProvider.h>
1318
#import <React/RCTRootView.h>
@@ -20,6 +25,49 @@
2025
static NSString* g_sampleCodeName = @"#";;
2126
@implementation AppDelegate
2227

28+
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
29+
{
30+
[JPUSHService registerDeviceToken:deviceToken];
31+
}
32+
33+
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
34+
{
35+
[[NSNotificationCenter defaultCenter] postNotificationName:kJPFDidReceiveRemoteNotification object:userInfo];
36+
}
37+
38+
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
39+
{
40+
[[NSNotificationCenter defaultCenter] postNotificationName:kJPFDidReceiveRemoteNotification object: notification.userInfo];
41+
}
42+
43+
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^) (UIBackgroundFetchResult))completionHandler
44+
{
45+
[[NSNotificationCenter defaultCenter] postNotificationName:kJPFDidReceiveRemoteNotification object:userInfo];
46+
}
47+
48+
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler
49+
{
50+
NSDictionary * userInfo = notification.request.content.userInfo;
51+
if ([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
52+
[JPUSHService handleRemoteNotification:userInfo];
53+
[[NSNotificationCenter defaultCenter] postNotificationName:kJPFDidReceiveRemoteNotification object:userInfo];
54+
}
55+
56+
completionHandler(UNNotificationPresentationOptionAlert);
57+
}
58+
59+
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler
60+
{
61+
NSDictionary * userInfo = response.notification.request.content.userInfo;
62+
if ([response.notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
63+
[JPUSHService handleRemoteNotification:userInfo];
64+
[[NSNotificationCenter defaultCenter] postNotificationName:kJPFOpenNotification object:userInfo];
65+
}
66+
67+
completionHandler();
68+
}
69+
70+
2371
- (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)())completionHandler
2472
{
2573
[RNFSManager setCompletionHandlerForIdentifier:identifier completionHandler:completionHandler];
@@ -31,10 +79,13 @@ +(void)SetSampleCodeName:(NSString*)name
3179
}
3280
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
3381
{
82+
[JPUSHService setupWithOption:launchOptions appKey:@"7d2470baad20e273cd6e53cc"
83+
channel:nil apsForProduction:nil];
84+
3485
NSURL *jsCodeLocation;
3586
3687
#if DEBUG
37-
[[RCTBundleURLProvider sharedSettings] setJsLocation:@"192.168.0.102"];
88+
[[RCTBundleURLProvider sharedSettings] setJsLocation:@"192.168.137.204"];
3889
#endif
3990
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
4091

‎ios/iTablet/iTablet.entitlements‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>aps-environment</key>
6+
<string>development</string>
7+
</dict>
8+
</plist>

‎package.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@
2828
"dependencies": {
2929
"forge": "^2.3.0",
3030
"immutable": "^3.8.2",
31+
"imobile_for_reactnative": "1.6.3",
32+
"jcore-react-native": "^1.3.2",
3133
"jest-serializer": "^23.0.1",
34+
"jpush-react-native": "^2.5.3",
3235
"node-forge": "^0.7.6",
3336
"react": "16.6.0-alpha.8af6728",
34-
"imobile_for_reactnative": "1.6.3",
3537
"react-native": "0.57.4",
3638
"react-native-actionsheet": "^2.4.2",
3739
"react-native-amap-geolocation": "^0.3.2",

‎src/constants/ConstToolType.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
*/
44
import { scaleSize } from '../utils'
55
export default {
6+
//点击监听类型
7+
NORMAL: 'NORMAL',
8+
NULL: 'NULL',
69
// Map
710
MAP_BASE: 'MAP_BASE',
811
MAP_ADD_LAYER: 'MAP_ADD_LAYER',
@@ -24,6 +27,7 @@ export default {
2427
MAP_MORE: 'MAP_MORE',
2528

2629
LEGEND: 'LEGEND',
30+
LEGEND_NOT_VISIBLE: 'LEGEND_NOT_VISIBLE',
2731

2832
// MAP_COLLECTION_POINT_POINT: 'MAP_COLLECTION_POINT_POINT',
2933
// MAP_COLLECTION_POINT_GPS: 'MAP_COLLECTION_POINT_GPS',
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { SMap } from 'imobile_for_reactnative'
2+
import NavigationService from './NavigationService'
3+
import { getLanguage } from '../language/index'
4+
import { ConstToolType } from '../constants'
5+
6+
let _params = {}
7+
let isfull = true
8+
9+
function setGestureDetectorListener(params) {
10+
(async function() {
11+
await SMap.setGestureDetector({
12+
singleTapHandler: touchCallback,
13+
})
14+
}.bind(this)())
15+
_params = params
16+
}
17+
18+
function touchCallback(event) {
19+
switch (GLOBAL.TouchType) {
20+
case ConstToolType.NORMAL:
21+
if (isfull) {
22+
GLOBAL.toolBox && GLOBAL.toolBox.showFullMap()
23+
} else {
24+
GLOBAL.toolBox && GLOBAL.toolBox.existFullMap()
25+
}
26+
isfull = !isfull
27+
break
28+
case ConstToolType.MAP_TOOL_TAGGING:
29+
NavigationService.navigate('InputPage', {
30+
headerTitle: getLanguage(global.language).Map_Main_Menu.TOOLS_NAME,
31+
cb: async value => {
32+
if (value !== '') {
33+
await SMap.addTextRecordset(
34+
GLOBAL.TaggingDatasetName,
35+
value,
36+
_params.user.currentUser.userName,
37+
event.x,
38+
event.y,
39+
)
40+
}
41+
NavigationService.goBack()
42+
GLOBAL.TouchType = ConstToolType.NORMAL
43+
},
44+
backcb: async () => {
45+
NavigationService.goBack()
46+
},
47+
})
48+
break
49+
case ConstToolType.NULL:
50+
break
51+
}
52+
}
53+
54+
export { setGestureDetectorListener }

0 commit comments

Comments
 (0)