Skip to content

Commit

Permalink
feat: 企业微信iOS端集成
Browse files Browse the repository at this point in the history
  • Loading branch information
newbanker-damon committed Feb 21, 2022
1 parent d73bcb1 commit 73ea1c9
Show file tree
Hide file tree
Showing 14 changed files with 143 additions and 187 deletions.
1 change: 1 addition & 0 deletions damoness-react-native-umeng.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Pod::Spec.new do |s|
s.dependency "UMShare/UI" # U-Share SDK UI模块(分享面板,建议添加)
s.dependency "UMShare/Social/WeChat" # 集成微信(完整版14.4M)
s.dependency "UMShare/Social/QQ" # 集成QQ/QZone/TIM(完整版7.6M)
s.dependency "UMShare/Social/WeChatWork" # 集成企业微信

#友盟推送
s.dependency "UMPush"
Expand Down
16 changes: 15 additions & 1 deletion example/app.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
{
"name": "ReactNativeUmengExample",
"displayName": "ReactNativeUmeng Example"
"displayName": "ReactNativeUmeng Example",
"umeng": {
"appKey": "5c998a3561f564fc5e0011fe"
},
"wechat": {
"appKey": "wx52dafcf5b9efb111",
"appSecret": "9a41a18395afb5744f2ac73e6ad06bde",
"universalLink": "https://ae7b.lkme.cc/EzC/"
},
"wechatWork": {
"appKey": "wwauth5a3c9b5d4dbd50d3000004",
"appSecret": "hGiRRNadgDGR4bfeTwKdoeycXmin8OrFJNi44vuuePM",
"corpId": "ww5a3c9b5d4dbd50d3",
"agentId": "1000004"
}
}
8 changes: 4 additions & 4 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ target 'ReactNativeUmengExample' do
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1')
post_install do |installer|
flipper_post_install(installer)
end
# use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1')
# post_install do |installer|
# flipper_post_install(installer)
# end
end
104 changes: 8 additions & 96 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
PODS:
- boost-for-react-native (1.63.0)
- CocoaAsyncSocket (7.6.5)
- damoness-react-native-umeng (1.6.0):
- damoness-react-native-umeng (1.7.0):
- React-Core
- UMCommon
- UMDevice
- UMPush
- UMShare/Social/QQ
- UMShare/Social/WeChat
- UMShare/Social/WeChatWork
- UMShare/UI
- DoubleConversion (1.1.6)
- FBLazyVector (0.63.4)
Expand All @@ -18,52 +18,6 @@ PODS:
- React-Core (= 0.63.4)
- React-jsi (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- Flipper (0.75.1):
- Flipper-Folly (~> 2.5)
- Flipper-RSocket (~> 1.3)
- Flipper-DoubleConversion (1.1.7)
- Flipper-Folly (2.5.3):
- boost-for-react-native
- Flipper-DoubleConversion
- Flipper-Glog
- libevent (~> 2.1.12)
- OpenSSL-Universal (= 1.1.180)
- Flipper-Glog (0.3.6)
- Flipper-PeerTalk (0.0.4)
- Flipper-RSocket (1.3.1):
- Flipper-Folly (~> 2.5)
- FlipperKit (0.75.1):
- FlipperKit/Core (= 0.75.1)
- FlipperKit/Core (0.75.1):
- Flipper (~> 0.75.1)
- FlipperKit/CppBridge
- FlipperKit/FBCxxFollyDynamicConvert
- FlipperKit/FBDefines
- FlipperKit/FKPortForwarding
- FlipperKit/CppBridge (0.75.1):
- Flipper (~> 0.75.1)
- FlipperKit/FBCxxFollyDynamicConvert (0.75.1):
- Flipper-Folly (~> 2.5)
- FlipperKit/FBDefines (0.75.1)
- FlipperKit/FKPortForwarding (0.75.1):
- CocoaAsyncSocket (~> 7.6)
- Flipper-PeerTalk (~> 0.0.4)
- FlipperKit/FlipperKitHighlightOverlay (0.75.1)
- FlipperKit/FlipperKitLayoutPlugin (0.75.1):
- FlipperKit/Core
- FlipperKit/FlipperKitHighlightOverlay
- FlipperKit/FlipperKitLayoutTextSearchable
- YogaKit (~> 1.18)
- FlipperKit/FlipperKitLayoutTextSearchable (0.75.1)
- FlipperKit/FlipperKitNetworkPlugin (0.75.1):
- FlipperKit/Core
- FlipperKit/FlipperKitReactPlugin (0.75.1):
- FlipperKit/Core
- FlipperKit/FlipperKitUserDefaultsPlugin (0.75.1):
- FlipperKit/Core
- FlipperKit/SKIOSNetworkPlugin (0.75.1):
- FlipperKit/Core
- FlipperKit/FlipperKitNetworkPlugin
- Folly (2020.01.13.00):
- boost-for-react-native
- DoubleConversion
Expand All @@ -74,8 +28,6 @@ PODS:
- DoubleConversion
- glog
- glog (0.3.5)
- libevent (2.1.12)
- OpenSSL-Universal (1.1.180)
- RCTRequired (0.63.4)
- RCTTypeSafety (0.63.4):
- FBLazyVector (= 0.63.4)
Expand Down Expand Up @@ -323,37 +275,19 @@ PODS:
- UMCommon
- UMShare/Core
- UMShare/Social/ReducedWeChat
- UMShare/Social/WeChatWork (6.10.3):
- UMCommon
- UMShare/Core
- UMShare/UI (6.10.3):
- UMCommon
- UMShare/Core
- Yoga (1.14.0)
- YogaKit (1.18.1):
- Yoga (~> 1.14)

DEPENDENCIES:
- damoness-react-native-umeng (from `../..`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`)
- Flipper (= 0.75.1)
- Flipper-DoubleConversion (= 1.1.7)
- Flipper-Folly (= 2.5.3)
- Flipper-Glog (= 0.3.6)
- Flipper-PeerTalk (~> 0.0.4)
- Flipper-RSocket (= 1.3.1)
- FlipperKit (= 0.75.1)
- FlipperKit/Core (= 0.75.1)
- FlipperKit/CppBridge (= 0.75.1)
- FlipperKit/FBCxxFollyDynamicConvert (= 0.75.1)
- FlipperKit/FBDefines (= 0.75.1)
- FlipperKit/FKPortForwarding (= 0.75.1)
- FlipperKit/FlipperKitHighlightOverlay (= 0.75.1)
- FlipperKit/FlipperKitLayoutPlugin (= 0.75.1)
- FlipperKit/FlipperKitLayoutTextSearchable (= 0.75.1)
- FlipperKit/FlipperKitNetworkPlugin (= 0.75.1)
- FlipperKit/FlipperKitReactPlugin (= 0.75.1)
- FlipperKit/FlipperKitUserDefaultsPlugin (= 0.75.1)
- FlipperKit/SKIOSNetworkPlugin (= 0.75.1)
- Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
Expand Down Expand Up @@ -383,21 +317,10 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- boost-for-react-native
- CocoaAsyncSocket
- Flipper
- Flipper-DoubleConversion
- Flipper-Folly
- Flipper-Glog
- Flipper-PeerTalk
- Flipper-RSocket
- FlipperKit
- libevent
- OpenSSL-Universal
- UMCommon
- UMDevice
- UMPush
- UMShare
- YogaKit

EXTERNAL SOURCES:
damoness-react-native-umeng:
Expand Down Expand Up @@ -457,22 +380,12 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
damoness-react-native-umeng: 2ff1d87e72cc3b9e58efdc246321599e32dbca9d
damoness-react-native-umeng: 91fafb2c689ad8ccabeca4109366959503c4f77c
DoubleConversion: cde416483dac037923206447da6e1454df403714
FBLazyVector: 3bb422f41b18121b71783a905c10e58606f7dc3e
FBReactNativeSpec: f2c97f2529dd79c083355182cc158c9f98f4bd6e
Flipper: d3da1aa199aad94455ae725e9f3aa43f3ec17021
Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41
Flipper-Folly: 755929a4f851b2fb2c347d533a23f191b008554c
Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
Flipper-RSocket: 127954abe8b162fcaf68d2134d34dc2bd7076154
FlipperKit: 8a20b5c5fcf9436cac58551dc049867247f64b00
Folly: b73c3869541e86821df3c387eb0af5f65addfab4
glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b
RCTRequired: 082f10cd3f905d6c124597fd1c14f6f2655ff65e
RCTTypeSafety: 8c9c544ecbf20337d069e4ae7fd9a377aadf504b
React: b0a957a2c44da4113b0c4c9853d8387f8e64e615
Expand All @@ -498,8 +411,7 @@ SPEC CHECKSUMS:
UMPush: 7ef2ff2fcca16e4d5c7897183a78a0d26f920bfe
UMShare: a3f9cb2d3ece67edd2c58331bd89bfffb289782b
Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: 5f2f8a82a256f01eb1a3db8f980a7dda2bd2507a
PODFILE CHECKSUM: ea3ebdaec3bf219bda106f7a8f3812d5818ce9b8

COCOAPODS: 1.10.2
COCOAPODS: 1.11.2
19 changes: 0 additions & 19 deletions example/ios/ReactNativeUmengExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
C1D60D28B925C94BD88E79D7 /* [CP] Copy Pods Resources */,
A311A398F38302B10C265C3C /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -210,24 +209,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
A311A398F38302B10C265C3C /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-ReactNativeUmengExample/Pods-ReactNativeUmengExample-frameworks.sh",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL/OpenSSL.framework/OpenSSL",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OpenSSL.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeUmengExample/Pods-ReactNativeUmengExample-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
C1D60D28B925C94BD88E79D7 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
7 changes: 6 additions & 1 deletion example/ios/ReactNativeUmengExample/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#import <UMShare/UMShare.h>

#import "WWKApiObject.h"

//友盟key
#define UMAppKey @"5c998a3561f564fc5e0011fe"

Expand Down Expand Up @@ -54,7 +56,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
InitializeFlipper(application);
#endif

[self initUMeng];
//[self initUMeng];

RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
Expand Down Expand Up @@ -98,6 +100,9 @@ - (void)initUMeng{
/* 设置微信的appKey和appSecret */
[[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_WechatSession appKey:WXAppKey appSecret:WXAppSecret redirectURL:nil];


/* 设置企业微信 */
// [UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_WechatWork appKey:<#(NSString *)#> appSecret:<#(NSString *)#> redirectURL:<#(NSString *)#>

}

Expand Down
14 changes: 14 additions & 0 deletions example/ios/ReactNativeUmengExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
<string>wx52dafcf5b9efb111</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>wechatwork</string>
<key>CFBundleURLSchemes</key>
<array>
<string>wwauth5a3c9b5d4dbd50d3000004</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
Expand Down Expand Up @@ -62,6 +72,10 @@
<string>wechat</string>
<string>weixin</string>
<string>weixinULAPI</string>
<string>wxwork</string>
<string>wxworkdebug</string>
<string>wxworkrdm</string>
<string>wxworkrelease</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
Expand Down
32 changes: 29 additions & 3 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@ import {
Alert,
SafeAreaView,
} from 'react-native';
import { ShareUtil, Platform } from '@damoness/react-native-umeng';
import { ShareUtil, Platform, Configure } from '@damoness/react-native-umeng';

import appJSON from '../app.json';

let { wechat, umeng, wechatWork } = appJSON;

Configure.initApp(umeng.appKey, 'RN');
Configure.setWeChat(wechat.appKey, wechat.appSecret, wechat.universalLink);
Configure.setWeChatWork(
wechatWork.appKey,
wechatWork.corpId,
wechatWork.agentId
);

export default function App() {
return (
<SafeAreaView style={styles.container}>
Expand All @@ -24,6 +37,18 @@ export default function App() {
}
}}
/>
<Button
title={'企业微信登录'}
onPress={async () => {
try {
let re = await ShareUtil.auth(Platform.WechatWork);
console.log(re);
Alert.alert(JSON.stringify(re));
} catch (error) {
console.log('error', error);
}
}}
/>
<Button
title={'微信登录 报错'}
onPress={async () => {
Expand All @@ -35,14 +60,15 @@ export default function App() {
}
}}
/>

<Button
onPress={() => {
ShareUtil.shareboard(
'内容',
'http://t1.qichangv.com/images/logo/favition.png',
'https://hot.cnbeta.com/articles/game/1097481.htm',
'标题',
[Platform.Wechat, Platform.Wechat_TimeLine]
[Platform.Wechat, Platform.Wechat_TimeLine, Platform.WechatWork]
);
}}
title="分享面板 - 分享"
Expand All @@ -55,7 +81,7 @@ export default function App() {
'http://t1.qichangv.com/images/logo/favition.png',
'',
'标题',
[Platform.Wechat, Platform.Wechat_TimeLine]
[Platform.Wechat, Platform.Wechat_TimeLine, Platform.WechatWork]
);
}}
title="分享面板 - 分享图片"
Expand Down
4 changes: 2 additions & 2 deletions ios/UM/RNUMConfigure.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

#import <Foundation/Foundation.h>
#import <UMCommon/UMCommon.h>
#import <React/RCTBridgeModule.h>

@interface RNUMConfigure : NSObject
@interface RNUMConfigure : NSObject <RCTBridgeModule>

+ (void)initWithAppkey:(NSString *)appkey channel:(NSString *)channel;

@end
Loading

0 comments on commit 73ea1c9

Please sign in to comment.