Skip to content

Commit

Permalink
feat: 企业微信android端部分集成
Browse files Browse the repository at this point in the history
  • Loading branch information
newbanker-damon committed Feb 25, 2022
1 parent 73ea1c9 commit 7f4af5f
Show file tree
Hide file tree
Showing 18 changed files with 142 additions and 111 deletions.
20 changes: 12 additions & 8 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ buildscript {
repositories {
google()
jcenter()
maven { url 'https://repo1.maven.org/maven2/'}
}

dependencies {
Expand Down Expand Up @@ -51,21 +52,24 @@ repositories {
// https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle#L28
url "$projectDir/../node_modules/react-native/android"
}
maven { url 'https://dl.bintray.com/umsdk/release' }

mavenCentral()
}

dependencies {
implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion', '+')}"

//友盟
implementation 'com.umeng.umsdk:analytics:8.0.0'
implementation 'com.umeng.umsdk:common:2.0.0'
implementation 'com.umeng.umsdk:share-core:6.9.6'
implementation 'com.umeng.umsdk:share-wx:6.9.6'
implementation 'com.umeng.umsdk:share-qq:6.9.6'
implementation 'com.umeng.umsdk:share-sina:6.9.6'
implementation 'com.umeng.umsdk:common:9.4.4'//必选
implementation 'com.umeng.umsdk:asms:1.4.1'//必选
implementation 'com.umeng.umsdk:link:1.2.0'//集成U-Link,可选,如要统计分享回流次数和分享新增用户指标则必选

implementation 'com.umeng.umsdk:share-core:7.1.7'//分享核心库,必选
implementation 'com.umeng.umsdk:share-board:7.1.7'//分享面板功能,可选

implementation 'com.umeng.umsdk:share-wx:7.1.7'//微信完整版
implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.8.0'//微信官方依赖库,必选


}

def configureReactNativePom(def pom) {
Expand Down
63 changes: 1 addition & 62 deletions android/src/main/java/com/damoness/rn/umeng/ShareModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,75 +198,14 @@ private SHARE_MEDIA getShareMedia(int num){
switch (num){
case 0:
return SHARE_MEDIA.QQ;

case 1:
return SHARE_MEDIA.SINA;

case 2:
return SHARE_MEDIA.WEIXIN;

case 3:
return SHARE_MEDIA.WEIXIN_CIRCLE;
case 4:
return SHARE_MEDIA.QZONE;
case 5:
return SHARE_MEDIA.EMAIL;
case 6:
return SHARE_MEDIA.SMS;
case 7:
return SHARE_MEDIA.FACEBOOK;
case 8:
return SHARE_MEDIA.TWITTER;
case 9:
return SHARE_MEDIA.WEIXIN_FAVORITE;
case 10:
return SHARE_MEDIA.GOOGLEPLUS;
case 11:
return SHARE_MEDIA.RENREN;
case 12:
return SHARE_MEDIA.TENCENT;
case 13:
return SHARE_MEDIA.DOUBAN;
case 14:
return SHARE_MEDIA.FACEBOOK_MESSAGER;
case 15:
return SHARE_MEDIA.YIXIN;
case 16:
return SHARE_MEDIA.YIXIN_CIRCLE;
case 17:
return SHARE_MEDIA.INSTAGRAM;
case 18:
return SHARE_MEDIA.PINTEREST;
case 19:
return SHARE_MEDIA.EVERNOTE;
case 20:
return SHARE_MEDIA.POCKET;
case 21:
return SHARE_MEDIA.LINKEDIN;
case 22:
return SHARE_MEDIA.FOURSQUARE;
case 23:
return SHARE_MEDIA.YNOTE;
case 24:
return SHARE_MEDIA.WHATSAPP;
case 25:
return SHARE_MEDIA.LINE;
case 26:
return SHARE_MEDIA.FLICKR;
case 27:
return SHARE_MEDIA.TUMBLR;
case 28:
return SHARE_MEDIA.ALIPAY;
case 29:
return SHARE_MEDIA.KAKAO;
case 30:
return SHARE_MEDIA.DROPBOX;
case 31:
return SHARE_MEDIA.VKONTAKTE;
case 32:
return SHARE_MEDIA.DINGTALK;
case 33:
return SHARE_MEDIA.MORE;
return SHARE_MEDIA.WXWORK;
default:
return SHARE_MEDIA.QQ;
}
Expand Down
38 changes: 22 additions & 16 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ android {

manifestPlaceholders = [qqappid: "100424468"]

applicationId "com.example.damonessreactnativeumeng"
applicationId "com.zofund.crmmanage.test"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
Expand All @@ -146,21 +146,23 @@ android {
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
newbanker {
storeFile file(KEY_STORE_FILE)
storePassword KEY_STORE_PASSWORD
keyAlias KEY_ALIAS
keyPassword KEY_PASSWORD
v1SigningEnabled true
v2SigningEnabled true
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
signingConfig signingConfigs.newbanker
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
signingConfig signingConfigs.newbanker
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
Expand All @@ -187,7 +189,18 @@ dependencies {
implementation "com.facebook.react:react-native:+" // From node_modules


implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
//友盟
implementation 'com.umeng.umsdk:common:9.4.4'//必选
implementation 'com.umeng.umsdk:asms:1.4.1'//必选
implementation 'com.umeng.umsdk:link:1.2.0'//集成U-Link,可选,如要统计分享回流次数和分享新增用户指标则必选
implementation 'com.umeng.umsdk:share-core:7.1.7'//分享核心库,必选
implementation 'com.umeng.umsdk:share-board:7.1.7'//分享面板功能,可选
implementation 'com.umeng.umsdk:share-wx:7.1.7'//微信完整版
implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.8.0'//微信官方依赖库,必选

implementation 'com.android.support:support-v4:26.1.0'

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
Expand All @@ -199,13 +212,6 @@ dependencies {
exclude group:'com.facebook.flipper'
}

//友盟
implementation 'com.umeng.umsdk:analytics:8.0.0'
implementation 'com.umeng.umsdk:common:2.0.0'
implementation 'com.umeng.umsdk:share-core:6.9.6'
implementation 'com.umeng.umsdk:share-wx:6.9.6'
implementation 'com.umeng.umsdk:share-qq:6.9.6'
implementation 'com.umeng.umsdk:share-sina:6.9.6'

if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
Expand Down
Binary file added example/android/app/libs/libwwsdk.jar
Binary file not shown.
Binary file not shown.
Binary file added example/android/app/newbanker.jks
Binary file not shown.
35 changes: 34 additions & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.damonessreactnativeumeng">

<uses-permission android:name="android.permission.INTERNET" />
<queries>
<package android:name="com.tencent.mm" /> // 指定微信包名
<package android:name="com.tencent.mobileqq" /> //指定qq包名
<package android:name="com.sina.weibo" /> //指定微博包名
<package android:name="com.tencent.wework" /> //指定企业微信包名
<package android:name="com.qzone" /> //指定QQ空间包名
<package android:name="com.alibaba.android.rimet" /> // 指定钉钉包名
<package android:name="com.eg.android.AlipayGphone" /> // 指定支付宝包名
<package android:name="com.instagram.android" /> // 指定instagram包名
</queries>

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>

<application
android:name=".MainApplication"
Expand All @@ -21,7 +34,27 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".wxapi.WXEntryActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<!-- <provider-->
<!-- android:name="android.support.v4.content.FileProvider"-->
<!-- android:authorities="${applicationId}.fileprovider"-->
<!-- android:exported="false"-->
<!-- android:grantUriPermissions="true">-->
<!-- <meta-data-->
<!-- android:name="android.support.FILE_PROVIDER_PATHS"-->
<!-- android:resource="@xml/filepaths"/>-->
<!-- </provider>-->


<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />




</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import com.damoness.rn.umeng.DplusReactPackage;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.socialize.PlatformConfig;

public class MainApplication extends Application implements ReactApplication {

Expand Down Expand Up @@ -47,6 +49,18 @@ public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); // Remove this line if you don't want Flipper enabled

UMConfigure.init(this,"5a12384aa40fa3551f0001d1"
,"umeng",UMConfigure.DEVICE_TYPE_PHONE,"");//58edcfeb310c93091c000be2 5965ee00734be40b580001a0

// 微信设置
PlatformConfig.setWeixin("wx027de62cf741667e","2be841b3bac5e82323bbf49e2901853a");
PlatformConfig.setWXFileProvider("com.tencent.sample2.fileprovider");

// 企业微信设置
PlatformConfig.setWXWork("ww5a3c9b5d4dbd50d3","","1000005","wwauth5a3c9b5d4dbd50d3000005");
PlatformConfig.setWXWorkFileProvider("com.tencent.sample2.fileprovider");

}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.example.damonessreactnativeumeng.wxapi;

import com.umeng.socialize.weixin.view.WXCallbackActivity;

public class WXEntryActivity extends WXCallbackActivity {
}
2 changes: 1 addition & 1 deletion example/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">ReactNativeUmeng Example</string>
<string name="app_name">UMeng-RN</string>
</resources>
4 changes: 4 additions & 0 deletions example/android/app/src/main/res/xml/filepaths.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-files-path name="umeng_cache" path="umeng_cache/"/>
</paths>
2 changes: 0 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ buildscript {
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/umsdk/release' }
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.4")
Expand All @@ -35,7 +34,6 @@ allprojects {

google()
jcenter()
maven { url 'https://dl.bintray.com/umsdk/release' }
maven { url 'https://www.jitpack.io' }
}
}
7 changes: 7 additions & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@
android.useAndroidX=true
android.enableJetifier=true
FLIPPER_VERSION=0.54.0


#签名文件信息
KEY_STORE_FILE=newbanker.jks
KEY_STORE_PASSWORD=newbanker321
KEY_ALIAS=newbanker
KEY_PASSWORD=newbanker321
19 changes: 15 additions & 4 deletions example/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,26 @@
"umeng": {
"appKey": "5c998a3561f564fc5e0011fe"
},
"wechat": {
"wechat-qichang": {
"appKey": "wx52dafcf5b9efb111",
"appSecret": "9a41a18395afb5744f2ac73e6ad06bde",
"universalLink": "https://ae7b.lkme.cc/EzC/"
},
"wechat": {
"name": "中欧SCRM-Test",
"appKey": "wx027de62cf741667e",
"appSecret": "2be841b3bac5e82323bbf49e2901853a",
"universalLink": "https://testzowxzb.newtamp.cn/tolink/",
"ios_bundle_id": "com.zofund.crmmanage.test",
"android_bundle_id": "com.zofund.crmmanage.test",
"android_signature": "028a8cf6795c1d3c1856fdab7becf8ef"
},
"wechatWork": {
"appKey": "wwauth5a3c9b5d4dbd50d3000004",
"appSecret": "hGiRRNadgDGR4bfeTwKdoeycXmin8OrFJNi44vuuePM",
"appKey": "wwauth5a3c9b5d4dbd50d3000005",
"corpId": "ww5a3c9b5d4dbd50d3",
"agentId": "1000004"
"agentId": "1000005",
"ios_bundle_id": "com.zofund.crmmanage.test",
"android_bundle_id": "com.zofund.crmmanage.test",
"android_signature": "028a8cf6795c1d3c1856fdab7becf8ef"
}
}
4 changes: 2 additions & 2 deletions example/ios/ReactNativeUmengExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = com.inabr.qichang;
PRODUCT_BUNDLE_IDENTIFIER = com.zofund.crmmanage.test;
PRODUCT_NAME = ReactNativeUmengExample;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand All @@ -306,7 +306,7 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = com.inabr.qichang;
PRODUCT_BUNDLE_IDENTIFIER = com.zofund.crmmanage.test;
PRODUCT_NAME = ReactNativeUmengExample;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
Expand Down
12 changes: 6 additions & 6 deletions example/ios/ReactNativeUmengExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<string>wechat</string>
<key>CFBundleURLSchemes</key>
<array>
<string>wx52dafcf5b9efb111</string>
<string>wx027de62cf741667e</string>
</array>
</dict>
<dict>
Expand All @@ -39,7 +39,7 @@
<string>wechatwork</string>
<key>CFBundleURLSchemes</key>
<array>
<string>wwauth5a3c9b5d4dbd50d3000004</string>
<string>wwauth51245dd93992e59f000009</string>
</array>
</dict>
</array>
Expand Down Expand Up @@ -72,10 +72,10 @@
<string>wechat</string>
<string>weixin</string>
<string>weixinULAPI</string>
<string>wxwork</string>
<string>wxworkdebug</string>
<string>wxworkrdm</string>
<string>wxworkrelease</string>
<string>wxwork</string>
<string>wxworkdebug</string>
<string>wxworkrdm</string>
<string>wxworkrelease</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
Expand Down
Loading

0 comments on commit 7f4af5f

Please sign in to comment.