Skip to content

Commit 43c08e7

Browse files
committed
Init project.
0 parents  commit 43c08e7

File tree

76 files changed

+10862
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+10862
-0
lines changed

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# node.js
6+
#
7+
node_modules/
8+
npm-debug.log
9+
yarn-error.log
10+
11+
# Xcode
12+
#
13+
build/
14+
*.pbxuser
15+
!default.pbxuser
16+
*.mode1v3
17+
!default.mode1v3
18+
*.mode2v3
19+
!default.mode2v3
20+
*.perspectivev3
21+
!default.perspectivev3
22+
xcuserdata
23+
*.xccheckout
24+
*.moved-aside
25+
DerivedData
26+
*.hmap
27+
*.ipa
28+
*.xcuserstate
29+
project.xcworkspace
30+
31+
# Android/IntelliJ
32+
#
33+
build/
34+
.idea
35+
.gradle
36+
local.properties
37+
*.iml
38+
39+
# BUCK
40+
buck-out/
41+
\.buckd/
42+
*.keystore

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# @uiw/react-native-wechat
2+
3+
## Getting started
4+
5+
`$ npm install @uiw/react-native-wechat --save`
6+
7+
### Mostly automatic installation
8+
9+
`$ react-native link @uiw/react-native-wechat`
10+
11+
## Usage
12+
```javascript
13+
import RNWechat from '@uiw/react-native-wechat';
14+
15+
// TODO: What to do with the module?
16+
RNWechat;
17+
```
18+
19+
20+
## 开发
21+
22+
```bash
23+
cd example # 进入实例 example 工程,根目录不需要安装,会引发错误
24+
yarn install # 安装依赖
25+
26+
cd ios # 进入 example/ios 目录安装依赖
27+
pod instll # 安装依赖
28+
```
29+
30+
## 其它
31+
32+
当前工程基于 [@brodybits/create-react-native-module](https://github.com/brodybits/create-react-native-module) 初始化。
33+
34+
```bash
35+
npx create-react-native-module --package-identifier com.uiwjs.react.wechat --object-class-name RNWechat --generate-example Wechat --example-react-native-version 0.63.2 --module-name @uiw/react-native-wechat --github-account uiwjs --author-name "Kenny Wong" --author-email "wowohoo@qq.com"
36+
```
37+
38+
## 相关连接
39+
40+
- [微信(SDK):iOS定位SDK v1.8.7.1](https://developers.weixin.qq.com/doc/oplatform/Downloads/iOS_Resource.html)

android/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
README
2+
======
3+
4+
If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm:
5+
6+
1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed
7+
2. Be sure to have a `local.properties` file in this folder that points to the Android SDK and NDK
8+
```
9+
ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle
10+
sdk.dir=/Users/{username}/Library/Android/sdk
11+
```
12+
3. Delete the `maven` folder
13+
4. Run `./gradlew installArchives`
14+
5. Verify that latest set of generated files is in the maven folder with the correct version number

android/build.gradle

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
// android/build.gradle
2+
3+
// based on:
4+
//
5+
// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle
6+
// original location:
7+
// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/build.gradle
8+
//
9+
// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle
10+
// original location:
11+
// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle
12+
13+
def DEFAULT_COMPILE_SDK_VERSION = 28
14+
def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'
15+
def DEFAULT_MIN_SDK_VERSION = 16
16+
def DEFAULT_TARGET_SDK_VERSION = 28
17+
18+
def safeExtGet(prop, fallback) {
19+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
20+
}
21+
22+
apply plugin: 'com.android.library'
23+
apply plugin: 'maven'
24+
25+
buildscript {
26+
// The Android Gradle plugin is only required when opening the android folder stand-alone.
27+
// This avoids unnecessary downloads and potential conflicts when the library is included as a
28+
// module dependency in an application project.
29+
// ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
30+
if (project == rootProject) {
31+
repositories {
32+
google()
33+
jcenter()
34+
}
35+
dependencies {
36+
classpath 'com.android.tools.build:gradle:3.4.1'
37+
}
38+
}
39+
}
40+
41+
apply plugin: 'com.android.library'
42+
apply plugin: 'maven'
43+
44+
android {
45+
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
46+
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
47+
defaultConfig {
48+
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
49+
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
50+
versionCode 1
51+
versionName "1.0"
52+
}
53+
lintOptions {
54+
abortOnError false
55+
}
56+
}
57+
58+
repositories {
59+
// ref: https://www.baeldung.com/maven-local-repository
60+
mavenLocal()
61+
maven {
62+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
63+
url "$rootDir/../node_modules/react-native/android"
64+
}
65+
maven {
66+
// Android JSC is installed from npm
67+
url "$rootDir/../node_modules/jsc-android/dist"
68+
}
69+
google()
70+
jcenter()
71+
}
72+
73+
dependencies {
74+
//noinspection GradleDynamicVersion
75+
implementation 'com.facebook.react:react-native:+' // From node_modules
76+
}
77+
78+
def configureReactNativePom(def pom) {
79+
def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)
80+
81+
pom.project {
82+
name packageJson.title
83+
artifactId packageJson.name
84+
version = packageJson.version
85+
group = "com.uiwjs.react.wechat"
86+
description packageJson.description
87+
url packageJson.repository.baseUrl
88+
89+
licenses {
90+
license {
91+
name packageJson.license
92+
url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
93+
distribution 'repo'
94+
}
95+
}
96+
97+
developers {
98+
developer {
99+
id packageJson.author.username
100+
name packageJson.author.name
101+
}
102+
}
103+
}
104+
}
105+
106+
afterEvaluate { project ->
107+
// some Gradle build hooks ref:
108+
// https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
109+
task androidJavadoc(type: Javadoc) {
110+
source = android.sourceSets.main.java.srcDirs
111+
classpath += files(android.bootClasspath)
112+
classpath += files(project.getConfigurations().getByName('compile').asList())
113+
include '**/*.java'
114+
}
115+
116+
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
117+
classifier = 'javadoc'
118+
from androidJavadoc.destinationDir
119+
}
120+
121+
task androidSourcesJar(type: Jar) {
122+
classifier = 'sources'
123+
from android.sourceSets.main.java.srcDirs
124+
include '**/*.java'
125+
}
126+
127+
android.libraryVariants.all { variant ->
128+
def name = variant.name.capitalize()
129+
def javaCompileTask = variant.javaCompileProvider.get()
130+
131+
task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
132+
from javaCompileTask.destinationDir
133+
}
134+
}
135+
136+
artifacts {
137+
archives androidSourcesJar
138+
archives androidJavadocJar
139+
}
140+
141+
task installArchives(type: Upload) {
142+
configuration = configurations.archives
143+
repositories.mavenDeployer {
144+
// Deploy to react-native-event-bridge/maven, ready to publish to npm
145+
repository url: "file://${projectDir}/../android/maven"
146+
configureReactNativePom pom
147+
}
148+
}
149+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.uiwjs.react.wechat">
3+
4+
</manifest>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.uiwjs.react.wechat;
2+
3+
import com.facebook.react.bridge.ReactApplicationContext;
4+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
5+
import com.facebook.react.bridge.ReactMethod;
6+
import com.facebook.react.bridge.Callback;
7+
8+
public class RNWechatModule extends ReactContextBaseJavaModule {
9+
10+
private final ReactApplicationContext reactContext;
11+
12+
public RNWechatModule(ReactApplicationContext reactContext) {
13+
super(reactContext);
14+
this.reactContext = reactContext;
15+
}
16+
17+
@Override
18+
public String getName() {
19+
return "RNWechat";
20+
}
21+
22+
@ReactMethod
23+
public void sampleMethod(String stringArgument, int numberArgument, Callback callback) {
24+
// TODO: Implement some actually useful functionality
25+
callback.invoke("Received numberArgument: " + numberArgument + " stringArgument: " + stringArgument);
26+
}
27+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.uiwjs.react.wechat;
2+
3+
import java.util.Arrays;
4+
import java.util.Collections;
5+
import java.util.List;
6+
7+
import com.facebook.react.ReactPackage;
8+
import com.facebook.react.bridge.NativeModule;
9+
import com.facebook.react.bridge.ReactApplicationContext;
10+
import com.facebook.react.uimanager.ViewManager;
11+
import com.facebook.react.bridge.JavaScriptModule;
12+
13+
public class RNWechatPackage implements ReactPackage {
14+
@Override
15+
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
16+
return Arrays.<NativeModule>asList(new RNWechatModule(reactContext));
17+
}
18+
19+
@Override
20+
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
21+
return Collections.emptyList();
22+
}
23+
}

example/.buckconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
[android]
3+
target = Google Inc.:Google APIs:23
4+
5+
[maven_repositories]
6+
central = https://repo1.maven.org/maven2

example/.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
};

example/.flowconfig

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
[ignore]
2+
; We fork some components by platform
3+
.*/*[.]android.js
4+
5+
; Ignore "BUCK" generated dirs
6+
<PROJECT_ROOT>/\.buckd/
7+
8+
; Ignore polyfills
9+
node_modules/react-native/Libraries/polyfills/.*
10+
11+
; These should not be required directly
12+
; require from fbjs/lib instead: require('fbjs/lib/warning')
13+
node_modules/warning/.*
14+
15+
; Flow doesn't support platforms
16+
.*/Libraries/Utilities/LoadingView.js
17+
18+
[untyped]
19+
.*/node_modules/@react-native-community/cli/.*/.*
20+
21+
[include]
22+
23+
[libs]
24+
node_modules/react-native/interface.js
25+
node_modules/react-native/flow/
26+
27+
[options]
28+
emoji=true
29+
30+
esproposal.optional_chaining=enable
31+
esproposal.nullish_coalescing=enable
32+
33+
module.file_ext=.js
34+
module.file_ext=.json
35+
module.file_ext=.ios.js
36+
37+
munge_underscores=true
38+
39+
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
40+
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
41+
42+
suppress_type=$FlowIssue
43+
suppress_type=$FlowFixMe
44+
suppress_type=$FlowFixMeProps
45+
suppress_type=$FlowFixMeState
46+
47+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
48+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
49+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
50+
51+
[lints]
52+
sketchy-null-number=warn
53+
sketchy-null-mixed=warn
54+
sketchy-number=warn
55+
untyped-type-import=warn
56+
nonstrict-import=warn
57+
deprecated-type=warn
58+
unsafe-getters-setters=warn
59+
unnecessary-invariant=warn
60+
signature-verification-failure=warn
61+
deprecated-utility=error
62+
63+
[strict]
64+
deprecated-type
65+
nonstrict-import
66+
sketchy-null
67+
unclear-type
68+
unsafe-getters-setters
69+
untyped-import
70+
untyped-type-import
71+
72+
[version]
73+
^0.122.0

0 commit comments

Comments
 (0)