Skip to content

Commit 9e807fa

Browse files
committed
Merged in release/15.2.0 (pull request #63)
Release/15.2.0
2 parents b68b8d4 + 84019b3 commit 9e807fa

22 files changed

Lines changed: 720 additions & 954 deletions

README.md

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,51 @@ Execute the npm install command in your terminal:
2929
npm install @shakebugs/react-native-shake
3030
```
3131

32-
If you are using a React Native version 0.60 or greater, you should also run add command:
32+
Install pods from the project root directory:
3333
```bash
34-
react-native add-shake
34+
cd ios && pod install && cd ..
3535
```
3636

37-
If you are using a React Native version older than 0.60, you should instead run link command:
38-
```bash
39-
react-native link @shakebugs/react-native-shake
37+
### Set compileSdkVersion version in the build.gradle file
38+
39+
Since Shake requires `compileSdkVersion` 29 or greater, verify that `compileSdkVersion` is correctly set in the *build.gradle* file:
40+
41+
```groovy title="android/build.gradle"
42+
buildscript {
43+
ext {
44+
buildToolsVersion = "30.0.2"
45+
minSdkVersion = 21
46+
compileSdkVersion = 30
47+
targetSdkVersion = 30
48+
ndkVersion = "20.1.5948944"
49+
}
50+
repositories {
51+
google()
52+
mavenCentral()
53+
}
54+
dependencies {
55+
classpath("com.android.tools.build:gradle:4.2.1")
56+
}
57+
}
4058
```
4159

42-
Install pods from the project root directory:
43-
```bash
44-
cd ios && pod install && cd ..
60+
### Set multidexEnabled flag in the build.gradle file
61+
62+
If you do not have *multiDexEnabled* flag set, update app-level *build.gradle* like below:
63+
64+
```groovy title="app/build.gradle"
65+
defaultConfig {
66+
applicationId "com.shakebugs.react.example"
67+
minSdkVersion rootProject.ext.minSdkVersion
68+
targetSdkVersion rootProject.ext.targetSdkVersion
69+
versionCode 1
70+
versionName "1.0.0"
71+
multiDexEnabled true
72+
}
4573
```
4674

4775
### Start Shake
76+
4877
Call `Shake.start()` method in the *index.js* file.
4978

5079
```javascript title="index.js"

android/build.gradle

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def safeExtGet(prop, fallback) {
2222
}
2323

2424
apply plugin: 'com.android.library'
25-
apply plugin: 'maven'
2625

2726
buildscript {
2827
// The Android Gradle plugin is only required when opening the android folder stand-alone.
@@ -45,9 +44,6 @@ rootProject.allprojects {
4544
}
4645
}
4746

48-
apply plugin: 'com.android.library'
49-
apply plugin: 'maven'
50-
5147
android {
5248
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
5349
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
@@ -79,77 +75,5 @@ repositories {
7975
dependencies {
8076
//noinspection GradleDynamicVersion
8177
implementation 'com.facebook.react:react-native:+' // From node_modules
82-
api "$System.env.ANDROID_DEPENDENCY:15.1.+"
83-
}
84-
85-
def configureReactNativePom(def pom) {
86-
def packageJson = new JsonSlurper().parseText(file('../package.json').text)
87-
pom.project {
88-
name packageJson.title
89-
artifactId packageJson.name
90-
version = packageJson.version
91-
group = "com.shakebugs.react"
92-
description packageJson.description
93-
url packageJson.repository.baseUrl
94-
95-
licenses {
96-
license {
97-
name packageJson.license
98-
url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
99-
distribution 'repo'
100-
}
101-
}
102-
103-
developers {
104-
developer {
105-
id packageJson.author.username
106-
name packageJson.author.name
107-
}
108-
}
109-
}
110-
}
111-
112-
afterEvaluate { project ->
113-
// some Gradle build hooks ref:
114-
// https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
115-
task androidJavadoc(type: Javadoc) {
116-
source = android.sourceSets.main.java.srcDirs
117-
classpath += files(android.bootClasspath)
118-
classpath += files(project.getConfigurations().getByName('compile').asList())
119-
include '**/*.java'
120-
}
121-
122-
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
123-
classifier = 'javadoc'
124-
from androidJavadoc.destinationDir
125-
}
126-
127-
task androidSourcesJar(type: Jar) {
128-
classifier = 'sources'
129-
from android.sourceSets.main.java.srcDirs
130-
include '**/*.java'
131-
}
132-
133-
android.libraryVariants.all { variant ->
134-
def name = variant.name.capitalize()
135-
def javaCompileTask = variant.javaCompileProvider.get()
136-
137-
task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
138-
from javaCompileTask.destinationDir
139-
}
140-
}
141-
142-
artifacts {
143-
archives androidSourcesJar
144-
archives androidJavadocJar
145-
}
146-
147-
task installArchives(type: Upload) {
148-
configuration = configurations.archives
149-
repositories.mavenDeployer {
150-
// Deploy to react-native-event-bridge/maven, ready to publish to npm
151-
repository url: "file://${projectDir}/../android/maven"
152-
configureReactNativePom pom
153-
}
154-
}
78+
api "$System.env.ANDROID_DEPENDENCY:15.2.+"
15579
}

android/src/main/java/com/shakebugs/react/ShakeModule.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,16 @@ public void run() {
9696
}
9797

9898
@ReactMethod
99-
public void setEnabled(final boolean enabled) {
99+
public void isUserFeedbackEnabled(Promise promise) {
100+
promise.resolve(Shake.isUserFeedbackEnabled());
101+
}
102+
103+
@ReactMethod
104+
public void setUserFeedbackEnabled(final boolean enabled) {
100105
runOnUiThread(new Runnable() {
101106
@Override
102107
public void run() {
103-
Shake.setEnabled(enabled);
108+
Shake.setUserFeedbackEnabled(enabled);
104109
}
105110
});
106111
}
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package com.shakebugs.react.example;
22

3-
import android.view.MotionEvent;
4-
53
import com.facebook.react.ReactActivity;
6-
import com.shakebugs.shake.Shake;
74

85
public class MainActivity extends ReactActivity {
96
/**
@@ -14,10 +11,4 @@ public class MainActivity extends ReactActivity {
1411
protected String getMainComponentName() {
1512
return "example";
1613
}
17-
18-
@Override
19-
public boolean dispatchTouchEvent(MotionEvent ev) {
20-
Shake.handleTouchEvent(ev, this);
21-
return super.dispatchTouchEvent(ev);
22-
}
2314
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Wed Mar 16 12:03:47 CET 2022
12
distributionBase=GRADLE_USER_HOME
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
24
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
4-
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6+
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)