react-native-nitro-geolocation 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022-present, React Native Community
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,30 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "NitroGeolocation"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => min_ios_version_supported }
14
+ s.source = { :git => ".git", :tag => "#{s.version}" }
15
+
16
+
17
+ s.source_files = [
18
+ "ios/**/*.{swift}",
19
+ "ios/**/*.{m,mm}",
20
+ "cpp/**/*.{hpp,cpp}",
21
+ ]
22
+
23
+ s.dependency 'React-jsi'
24
+ s.dependency 'React-callinvoker'
25
+
26
+ load 'nitrogen/generated/ios/NitroGeolocation+autolinking.rb'
27
+ add_nitrogen_files(s)
28
+
29
+ install_modules_dependencies(s)
30
+ end
@@ -0,0 +1,24 @@
1
+ project(nitrogeolocation)
2
+ cmake_minimum_required(VERSION 3.9.0)
3
+
4
+ set(PACKAGE_NAME nitrogeolocation)
5
+ set(CMAKE_VERBOSE_MAKEFILE ON)
6
+ set(CMAKE_CXX_STANDARD 20)
7
+
8
+ # Define C++ library and add all sources
9
+ add_library(${PACKAGE_NAME} SHARED src/main/cpp/cpp-adapter.cpp)
10
+
11
+ # Add Nitrogen specs :)
12
+ include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/nitrogeolocation+autolinking.cmake)
13
+
14
+ # Set up local includes
15
+ include_directories("src/main/cpp" "../cpp")
16
+
17
+ find_library(LOG_LIB log)
18
+
19
+ # Link all libraries together
20
+ target_link_libraries(
21
+ ${PACKAGE_NAME}
22
+ ${LOG_LIB}
23
+ android # <-- Android core
24
+ )
@@ -0,0 +1,128 @@
1
+ buildscript {
2
+ ext.getExtOrDefault = {name ->
3
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['NitroGeolocation_' + name]
4
+ }
5
+
6
+ repositories {
7
+ google()
8
+ mavenCentral()
9
+ }
10
+
11
+ dependencies {
12
+ classpath "com.android.tools.build:gradle:8.7.2"
13
+ // noinspection DifferentKotlinGradleVersion
14
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
15
+ }
16
+ }
17
+
18
+ def reactNativeArchitectures() {
19
+ def value = rootProject.getProperties().get("reactNativeArchitectures")
20
+ return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
21
+ }
22
+
23
+ apply plugin: "com.android.library"
24
+ apply plugin: "kotlin-android"
25
+ apply from: '../nitrogen/generated/android/nitrogeolocation+autolinking.gradle'
26
+
27
+ apply plugin: "com.facebook.react"
28
+
29
+ def getExtOrIntegerDefault(name) {
30
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["NitroGeolocation_" + name]).toInteger()
31
+ }
32
+
33
+ android {
34
+ namespace "com.margelo.nitro.nitrogeolocation"
35
+
36
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
37
+
38
+ defaultConfig {
39
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
40
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
41
+
42
+ externalNativeBuild {
43
+ cmake {
44
+ cppFlags "-frtti -fexceptions -Wall -fstack-protector-all"
45
+ arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
46
+ abiFilters (*reactNativeArchitectures())
47
+
48
+ buildTypes {
49
+ debug {
50
+ cppFlags "-O1 -g"
51
+ }
52
+ release {
53
+ cppFlags "-O2"
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
59
+
60
+ externalNativeBuild {
61
+ cmake {
62
+ path "CMakeLists.txt"
63
+ }
64
+ }
65
+
66
+ packagingOptions {
67
+ excludes = [
68
+ "META-INF",
69
+ "META-INF/**",
70
+ "**/libc++_shared.so",
71
+ "**/libfbjni.so",
72
+ "**/libjsi.so",
73
+ "**/libfolly_json.so",
74
+ "**/libfolly_runtime.so",
75
+ "**/libglog.so",
76
+ "**/libhermes.so",
77
+ "**/libhermes-executor-debug.so",
78
+ "**/libhermes_executor.so",
79
+ "**/libreactnative.so",
80
+ "**/libreactnativejni.so",
81
+ "**/libturbomodulejsijni.so",
82
+ "**/libreact_nativemodule_core.so",
83
+ "**/libjscexecutor.so"
84
+ ]
85
+ }
86
+
87
+ buildFeatures {
88
+ buildConfig true
89
+ prefab true
90
+ }
91
+
92
+ buildTypes {
93
+ release {
94
+ minifyEnabled false
95
+ }
96
+ }
97
+
98
+ lintOptions {
99
+ disable "GradleCompatible"
100
+ }
101
+
102
+ compileOptions {
103
+ sourceCompatibility JavaVersion.VERSION_1_8
104
+ targetCompatibility JavaVersion.VERSION_1_8
105
+ }
106
+
107
+ sourceSets {
108
+ main {
109
+ java.srcDirs += [
110
+ "generated/java",
111
+ "generated/jni"
112
+ ]
113
+ }
114
+ }
115
+ }
116
+
117
+ repositories {
118
+ mavenCentral()
119
+ google()
120
+ }
121
+
122
+ def kotlin_version = getExtOrDefault("kotlinVersion")
123
+
124
+ dependencies {
125
+ implementation "com.facebook.react:react-android"
126
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
127
+ implementation project(":react-native-nitro-modules")
128
+ }
@@ -0,0 +1,5 @@
1
+ NitroGeolocation_kotlinVersion=2.0.21
2
+ NitroGeolocation_minSdkVersion=24
3
+ NitroGeolocation_targetSdkVersion=34
4
+ NitroGeolocation_compileSdkVersion=35
5
+ NitroGeolocation_ndkVersion=27.1.12297006
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,6 @@
1
+ #include <jni.h>
2
+ #include "nitrogeolocationOnLoad.hpp"
3
+
4
+ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
5
+ return margelo::nitro::nitrogeolocation::initialize(vm);
6
+ }
@@ -0,0 +1,10 @@
1
+ package com.margelo.nitro.nitrogeolocation
2
+
3
+ import com.facebook.proguard.annotations.DoNotStrip
4
+
5
+ @DoNotStrip
6
+ class NitroGeolocation : HybridNitroGeolocationSpec() {
7
+ override fun multiply(a: Double, b: Double): Double {
8
+ return a * b
9
+ }
10
+ }
@@ -0,0 +1,22 @@
1
+ package com.margelo.nitro.nitrogeolocation
2
+
3
+ import com.facebook.react.TurboReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.model.ReactModuleInfoProvider
7
+
8
+ class NitroGeolocationPackage : TurboReactPackage() {
9
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
10
+ return null
11
+ }
12
+
13
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
14
+ return ReactModuleInfoProvider { HashMap() }
15
+ }
16
+
17
+ companion object {
18
+ init {
19
+ System.loadLibrary("nitrogeolocation")
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,5 @@
1
+ class NitroGeolocation: HybridNitroGeolocationSpec {
2
+ public func multiply(a: Double, b: Double) throws -> Double {
3
+ return a * b
4
+ }
5
+ }
package/nitro.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "cxxNamespace": ["nitrogeolocation"],
3
+ "ios": {
4
+ "iosModuleName": "NitroGeolocation"
5
+ },
6
+ "android": {
7
+ "androidNamespace": ["nitrogeolocation"],
8
+ "androidCxxLibName": "nitrogeolocation"
9
+ },
10
+ "autolinking": {
11
+ "NitroGeolocation": {
12
+ "swift": "NitroGeolocation",
13
+ "kotlin": "NitroGeolocation"
14
+ }
15
+ },
16
+ "ignorePaths": ["node_modules"]
17
+ }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "react-native-nitro-geolocation",
3
+ "version": "0.0.1",
4
+ "description": "⚡🚀Blazing-fast geolocation for React Native powered by Nitro Modules",
5
+ "main": "src/index",
6
+ "codegenConfig": {
7
+ "name": "NitroGeolocationSpec",
8
+ "type": "modules",
9
+ "jsSrcsDir": "src"
10
+ },
11
+ "author": "jingjing2222",
12
+ "license": "MIT",
13
+ "homepage": "#readme",
14
+ "repository": "https://github.com/jingjing2222/react-native-nitro-geolocation",
15
+ "files": [
16
+ "src",
17
+ "android",
18
+ "ios",
19
+ "nitro.json",
20
+ "NitroGeolocation.podspec",
21
+ "turbo.json",
22
+ "LICENSE"
23
+ ],
24
+ "devDependencies": {
25
+ "@react-native/babel-preset": "0.81.1",
26
+ "@types/react": "^19.1.0",
27
+ "react": "19.1.0",
28
+ "react-native": "0.81.1"
29
+ },
30
+ "create-react-native-library": {
31
+ "languages": "kotlin-swift",
32
+ "type": "nitro-module",
33
+ "version": "0.54.3"
34
+ },
35
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
36
+ }
@@ -0,0 +1,6 @@
1
+ import type { HybridObject } from 'react-native-nitro-modules';
2
+
3
+ export interface NitroGeolocation
4
+ extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
5
+ multiply(a: number, b: number): number;
6
+ }
package/src/index.tsx ADDED
@@ -0,0 +1,9 @@
1
+ import { NitroModules } from 'react-native-nitro-modules';
2
+ import type { NitroGeolocation } from './NitroGeolocation.nitro';
3
+
4
+ const NitroGeolocationHybridObject =
5
+ NitroModules.createHybridObject<NitroGeolocation>('NitroGeolocation');
6
+
7
+ export function multiply(a: number, b: number): number {
8
+ return NitroGeolocationHybridObject.multiply(a, b);
9
+ }
package/turbo.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "$schema": "https://turbo.build/schema.json",
3
+ "globalDependencies": [".nvmrc", ".yarnrc.yml"],
4
+ "globalEnv": ["NODE_ENV"],
5
+ "tasks": {
6
+ "build:android": {
7
+ "env": ["ANDROID_HOME", "ORG_GRADLE_PROJECT_newArchEnabled"],
8
+ "inputs": [
9
+ "package.json",
10
+ "android",
11
+ "!android/build",
12
+ "src/*.ts",
13
+ "src/*.tsx",
14
+ "example/package.json",
15
+ "example/android",
16
+ "!example/android/.gradle",
17
+ "!example/android/build",
18
+ "!example/android/app/build"
19
+ ],
20
+ "outputs": []
21
+ },
22
+ "build:ios": {
23
+ "env": [
24
+ "RCT_NEW_ARCH_ENABLED",
25
+ "RCT_USE_RN_DEP",
26
+ "RCT_USE_PREBUILT_RNCORE"
27
+ ],
28
+ "inputs": [
29
+ "package.json",
30
+ "*.podspec",
31
+ "ios",
32
+ "src/*.ts",
33
+ "src/*.tsx",
34
+ "example/package.json",
35
+ "example/ios",
36
+ "!example/ios/build",
37
+ "!example/ios/Pods"
38
+ ],
39
+ "outputs": []
40
+ }
41
+ }
42
+ }