chore: initial commit
This commit is contained in:
77
android/build.gradle
Normal file
77
android/build.gradle
Normal file
@@ -0,0 +1,77 @@
|
||||
buildscript {
|
||||
ext.getExtOrDefault = {name ->
|
||||
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['WeightScaleBridge_' + name]
|
||||
}
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:8.7.2"
|
||||
// noinspection DifferentKotlinGradleVersion
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
apply plugin: "com.android.library"
|
||||
apply plugin: "kotlin-android"
|
||||
|
||||
apply plugin: "com.facebook.react"
|
||||
|
||||
def getExtOrIntegerDefault(name) {
|
||||
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["WeightScaleBridge_" + name]).toInteger()
|
||||
}
|
||||
|
||||
android {
|
||||
namespace "com.weightscalebridge"
|
||||
|
||||
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
||||
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
buildConfig true
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
disable "GradleCompatible"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java.srcDirs += [
|
||||
"generated/java",
|
||||
"generated/jni"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
|
||||
def kotlin_version = getExtOrDefault("kotlinVersion")
|
||||
|
||||
dependencies {
|
||||
implementation "com.facebook.react:react-android"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
}
|
||||
5
android/gradle.properties
Normal file
5
android/gradle.properties
Normal file
@@ -0,0 +1,5 @@
|
||||
WeightScaleBridge_kotlinVersion=2.0.21
|
||||
WeightScaleBridge_minSdkVersion=24
|
||||
WeightScaleBridge_targetSdkVersion=34
|
||||
WeightScaleBridge_compileSdkVersion=35
|
||||
WeightScaleBridge_ndkVersion=27.1.12297006
|
||||
2
android/src/main/AndroidManifest.xml
Normal file
2
android/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
</manifest>
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.weightscalebridge
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.module.annotations.ReactModule
|
||||
|
||||
@ReactModule(name = WeightScaleBridgeModule.NAME)
|
||||
class WeightScaleBridgeModule(reactContext: ReactApplicationContext) :
|
||||
NativeWeightScaleBridgeSpec(reactContext) {
|
||||
|
||||
override fun getName(): String {
|
||||
return NAME
|
||||
}
|
||||
|
||||
// Example method
|
||||
// See https://reactnative.dev/docs/native-modules-android
|
||||
override fun multiply(a: Double, b: Double): Double {
|
||||
return a * b
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val NAME = "WeightScaleBridge"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.weightscalebridge
|
||||
|
||||
import com.facebook.react.BaseReactPackage
|
||||
import com.facebook.react.bridge.NativeModule
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.module.model.ReactModuleInfo
|
||||
import com.facebook.react.module.model.ReactModuleInfoProvider
|
||||
import java.util.HashMap
|
||||
|
||||
class WeightScaleBridgePackage : BaseReactPackage() {
|
||||
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
||||
return if (name == WeightScaleBridgeModule.NAME) {
|
||||
WeightScaleBridgeModule(reactContext)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
||||
return ReactModuleInfoProvider {
|
||||
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
||||
moduleInfos[WeightScaleBridgeModule.NAME] = ReactModuleInfo(
|
||||
WeightScaleBridgeModule.NAME,
|
||||
WeightScaleBridgeModule.NAME,
|
||||
false, // canOverrideExistingModule
|
||||
false, // needsEagerInit
|
||||
false, // isCxxModule
|
||||
true // isTurboModule
|
||||
)
|
||||
moduleInfos
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user