Skip to content

Commit f11df0d

Browse files
authored
Merge pull request #19 from YsnKsy/rename-package
refactor(rename project): rename project name
2 parents 95ade43 + 4e5b814 commit f11df0d

File tree

32 files changed

+166
-203
lines changed

32 files changed

+166
-203
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Remember to add tests for your change if possible. Run the unit tests by:
4343
yarn test
4444
```
4545

46-
To edit the Kotlin files, open `example/android` in Android studio and find the source files at `reactnativelocationsettingsenabler` under `Android`.
46+
To edit the Kotlin files, open `example/android` in Android studio and find the source files at `reactnativelocationenabler` under `Android`.
4747

4848
### Commit message convention
4949

README.md

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# react-native-location-settings-enabler
1+
# react-native-location-enabler
22

3-
[![GitHub version](https://badge.fury.io/gh/YsnKsy%2Freact-native-location-settings-enabler.svg)](https://github.com/YsnKsy/react-native-location-settings-enabler)
4-
[![npm version](https://badge.fury.io/js/react-native-location-settings-enabler.svg)](https://www.npmjs.com/package/react-native-location-settings-enabler/)
5-
![Last Release](https://github.com/YsnKsy/react-native-location-settings-enabler/workflows/Release/badge.svg)
6-
![Pull Request](https://github.com/YsnKsy/react-native-location-settings-enabler/workflows/Pull%20Request/badge.svg)
7-
[![GitHub issues](https://img.shields.io/github/issues/YsnKsy/react-native-location-settings-enabler)](https://github.com/YsnKsy/react-native-location-settings-enabler/issues)
8-
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/YsnKsy/react-native-location-settings-enabler/blob/master/CONTRIBUTING.md)
3+
[![GitHub version](https://badge.fury.io/gh/YsnKsy%2Freact-native-location-enabler.svg)](https://github.com/YsnKsy/react-native-location-enabler)
4+
[![npm version](https://badge.fury.io/js/react-native-location-enabler.svg)](https://www.npmjs.com/package/react-native-location-enabler/)
5+
![Last Release](https://github.com/YsnKsy/react-native-location-enabler/workflows/Release/badge.svg)
6+
![Pull Request](https://github.com/YsnKsy/react-native-location-enabler/workflows/Pull%20Request/badge.svg)
7+
[![GitHub issues](https://img.shields.io/github/issues/YsnKsy/react-native-location-enabler)](https://github.com/YsnKsy/react-native-location-enabler/issues)
8+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/YsnKsy/react-native-location-enabler/blob/master/CONTRIBUTING.md)
99

1010
![Platform - Android](https://img.shields.io/badge/platform-Android-green.svg)
1111
[![styled with Prettier](https://img.shields.io/badge/styled_with-Prettier-ff69b4.svg)](https://github.com/prettier/prettier)
1212
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
13-
[![GitHub license](https://img.shields.io/github/license/YsnKsy/react-native-location-settings-enabler)](https://github.com/YsnKsy/react-native-location-settings-enabler/blob/master/LICENSE)
13+
[![GitHub license](https://img.shields.io/github/license/YsnKsy/react-native-location-enabler)](https://github.com/YsnKsy/react-native-location-enabler/blob/master/LICENSE)
1414

1515
This package makes it easy for an React Native App to ensure that the Android device's system settings are properly configured for the app's location needs. If your app needs to request location, the device needs to enable the appropriate system settings, such as GPS or Wi-Fi scanning. Rather than directly enabling services such as the device's GPS, your app specifies the required level of accuracy/power consumption, and the device automatically makes the appropriate changes to system settings.
1616

@@ -21,7 +21,7 @@ This package makes it easy for an React Native App to ensure that the Android de
2121
## Installation
2222

2323
```sh
24-
yarn add react-native-location-settings-enabler
24+
yarn add react-native-location-enabler
2525
```
2626

2727
---
@@ -31,12 +31,12 @@ yarn add react-native-location-settings-enabler
3131
### Example using Hook (React Hooks API) :
3232

3333
```js
34-
import LocationSettingsEnabler from "react-native-location-settings-enabler"
34+
import LocationEnabler from "react-native-location-enabler"
3535

3636
const {
3737
PRIORITIES: { HIGH_ACCURACY },
3838
useLocationSettings,
39-
} = LocationSettingsEnabler
39+
} = LocationEnabler
4040

4141
// React Component
4242
const App = () => {
@@ -64,14 +64,14 @@ const App = () => {
6464
### Example using Listener :
6565

6666
```js
67-
import LocationSettingsEnabler from "react-native-location-settings-enabler"
67+
import LocationEnabler from "react-native-location-enabler"
6868

6969
const {
7070
PRIORITIES: { HIGH_ACCURACY },
7171
addListener,
7272
checkSettings,
7373
requestResolutionSettings
74-
} = LocationSettingsEnabler
74+
} = LocationEnabler
7575

7676
// Adds a listener to be invoked when location settings checked using
7777
// [checkSettings] or changed using [requestResolutionSettings]
@@ -104,7 +104,7 @@ listener.remove();
104104
Clone the repo
105105

106106
```sh
107-
git clone https://github.com/YsnKsy/react-native-location-settings-enabler.git && cd react-native-location-settings-enabler
107+
git clone https://github.com/YsnKsy/react-native-location-enabler.git && cd react-native-location-enabler
108108
```
109109

110110
Install npm dependencies
@@ -138,14 +138,9 @@ yarn example android
138138
> `PRIORITIES`
139139
140140
```js
141-
import LocationSettingsEnabler from "react-native-location-settings-enabler"
141+
import LocationEnabler from "react-native-location-enabler"
142142

143-
const {
144-
HIGH_ACCURACY,
145-
BALANCED_POWER_ACCURACY,
146-
LOW_POWER,
147-
NO_POWER,
148-
} = LocationSettingsEnabler.PRIORITIES
143+
const { HIGH_ACCURACY, BALANCED_POWER_ACCURACY, LOW_POWER, NO_POWER } = LocationEnabler.PRIORITIES
149144
```
150145

151146
Static object contain a list quality of service for location updates. If your application wants high accuracy location it should set prioprity to 'HIGH_ACCURACY'. If you want negligible power impact, but to still receive location updates when available, then set priority to 'NO_POWER'.
@@ -157,12 +152,12 @@ Static object contain a list quality of service for location updates. If your ap
157152
> ### `useLocationSettings({ priority, alwaysShow, needBle }, initialStatus?)`
158153
159154
```js
160-
import LocationSettingsEnabler from "react-native-location-settings-enabler"
155+
import LocationEnabler from "react-native-location-enabler"
161156

162157
const {
163158
useLocationSettings,
164159
PRIORITIES: { HIGH_ACCURACY },
165-
} = LocationSettingsEnabler
160+
} = LocationEnabler
166161

167162
const [enabled, requestResolution] = useLocationSettings({
168163
priority: HIGH_ACCURACY, // optional: default BALANCED_POWER_ACCURACY
@@ -185,12 +180,12 @@ Hook let you check the user's device location status 'on' / 'off' and method let
185180
> ### `checkSettings({ priority, alwaysShow, needBle })`
186181
187182
```js
188-
import LocationSettingsEnabler from "react-native-location-settings-enabler"
183+
import LocationEnabler from "react-native-location-enabler"
189184

190185
const {
191186
checkSettings,
192187
PRIORITIES: { HIGH_ACCURACY },
193-
} = LocationSettingsEnabler
188+
} = LocationEnabler
194189

195190
checkSettings({
196191
priority: HIGH_ACCURACY, // optional: default BALANCED_POWER_ACCURACY
@@ -206,12 +201,12 @@ Checking if the user's device location is turned on / off.
206201
> ### `requestResolutionSettings({ priority, alwaysShow, needBle })`
207202
208203
```js
209-
import LocationSettingsEnabler from "react-native-location-settings-enabler"
204+
import LocationEnabler from "react-native-location-enabler"
210205

211206
const {
212207
requestResolutionSettings,
213208
PRIORITIES: { HIGH_ACCURACY },
214-
} = LocationSettingsEnabler
209+
} = LocationEnabler
215210

216211
requestResolutionSettings({
217212
priority: HIGH_ACCURACY, // optional: default BALANCED_POWER_ACCURACY
@@ -227,7 +222,7 @@ Display an activity where they can turn location 'on' using a location request.
227222
> ### `addListener(callback, context?)`
228223
229224
```js
230-
import LocationSettingsEnabler from "react-native-location-settings-enabler"
225+
import LocationEnabler from "react-native-location-enabler"
231226

232227
let listener = null
233228

@@ -242,7 +237,7 @@ function cb(result) {
242237
}
243238
}
244239

245-
listener = LocationSettingsEnabler.addListener(cb)
240+
listener = LocationEnabler.addListener(cb)
246241
```
247242

248243
Adds a listener to be invoked when onChangeLocationSettings are emitted. An optional calling context may be provided. The data arguments emitted will be passed to the listener function.

android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
buildscript {
22
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
3-
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['LocationSettingsEnabler_kotlinVersion']
3+
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['LocationEnabler_kotlinVersion']
44

55
repositories {
66
google()
@@ -18,11 +18,11 @@ apply plugin: 'com.android.library'
1818
apply plugin: 'kotlin-android'
1919

2020
def getExtOrDefault(name) {
21-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['LocationSettingsEnabler_' + name]
21+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['LocationEnabler_' + name]
2222
}
2323

2424
def getExtOrIntegerDefault(name) {
25-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['LocationSettingsEnabler_' + name]).toInteger()
25+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['LocationEnabler_' + name]).toInteger()
2626
}
2727

2828
android {

android/gradle.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
LocationSettingsEnabler_kotlinVersion=1.3.50
2-
LocationSettingsEnabler_kotlinCoroutinesVersion=1.3.4
3-
LocationSettingsEnabler_compileSdkVersion=29
4-
LocationSettingsEnabler_buildToolsVersion=29.0.2
5-
LocationSettingsEnabler_targetSdkVersion=29
6-
LocationSettingsEnabler_minSdkVersion=16
1+
LocationEnabler_kotlinVersion=1.3.50
2+
LocationEnabler_kotlinCoroutinesVersion=1.3.4
3+
LocationEnabler_compileSdkVersion=29
4+
LocationEnabler_buildToolsVersion=29.0.2
5+
LocationEnabler_targetSdkVersion=29
6+
LocationEnabler_minSdkVersion=16

android/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.reactnativelocationsettingsenabler">
2+
package="com.reactnativelocationenabler">
33

44
</manifest>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.reactnativelocationsettingsenabler
1+
package com.reactnativelocationenabler
22

33
import android.app.Activity
44
import android.content.Intent
@@ -17,7 +17,7 @@ import kotlinx.coroutines.Dispatchers
1717
import kotlinx.coroutines.runBlocking
1818
import java.util.*
1919

20-
class LocationSettingsEnablerModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
20+
class LocationEnablerModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
2121

2222
init {
2323
val activityEventListener = object : BaseActivityEventListener() {
@@ -35,7 +35,7 @@ class LocationSettingsEnablerModule(reactContext: ReactApplicationContext) : Rea
3535
reactContext.addActivityEventListener(activityEventListener)
3636
}
3737

38-
private val TAG = "LocationSettingsEnabler"
38+
private val TAG = "LocationEnabler"
3939
private val REQUEST_TURN_DEVICE_LOCATION_ON = 29
4040
private val EVENT_NAME = "onChangeLocationSettings"
4141
private val context: ReactApplicationContext = reactContext
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
package com.reactnativelocationsettingsenabler
1+
package com.reactnativelocationenabler
22

33
import com.facebook.react.ReactPackage
44
import com.facebook.react.bridge.NativeModule
55
import com.facebook.react.bridge.ReactApplicationContext
66
import com.facebook.react.uimanager.ViewManager
77

8-
class LocationSettingsEnablerPackage : ReactPackage {
8+
class LocationEnablerPackage : ReactPackage {
99
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> =
10-
listOf<NativeModule>(LocationSettingsEnablerModule(reactContext))
10+
listOf<NativeModule>(LocationEnablerModule(reactContext))
1111

1212
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> =
1313
emptyList<ViewManager<*, *>>()

example/android/app/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import com.android.build.OutputFile
3737
* // bundleInBeta: true,
3838
*
3939
* // whether to disable dev mode in custom build variants (by default only disabled in release)
40-
* // for LocationSettingsEnablerExample: to disable dev mode in the staging build type (if configured)
40+
* // for LocationEnablerExample: to disable dev mode in the staging build type (if configured)
4141
* devDisabledInStaging: true,
4242
* // The configuration property can be in the following formats
4343
* // 'devDisabledIn${productFlavor}${buildType}'
@@ -64,7 +64,7 @@ import com.android.build.OutputFile
6464
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
6565
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
6666
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
67-
* // for LocationSettingsEnablerExample, you might want to remove it from here.
67+
* // for LocationEnablerExample, you might want to remove it from here.
6868
* inputExcludes: ["android/**", "ios/**"],
6969
*
7070
* // override which node gets called and with what additional arguments
@@ -99,7 +99,7 @@ def enableProguardInReleaseBuilds = false
9999
/**
100100
* The preferred build flavor of JavaScriptCore.
101101
*
102-
* For LocationSettingsEnablerExample, to use the international variant, you can use:
102+
* For LocationEnablerExample, to use the international variant, you can use:
103103
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
104104
*
105105
* The international variant includes ICU i18n library and necessary data
@@ -127,7 +127,7 @@ android {
127127
}
128128

129129
defaultConfig {
130-
applicationId "com.example.reactnativelocationsettingsenabler"
130+
applicationId "com.example.reactnativelocationenabler"
131131
minSdkVersion rootProject.ext.minSdkVersion
132132
targetSdkVersion rootProject.ext.targetSdkVersion
133133
versionCode 1
@@ -209,7 +209,7 @@ dependencies {
209209
implementation jscFlavor
210210
}
211211

212-
implementation project(':reactnativelocationsettingsenabler')
212+
implementation project(':reactnativelocationenabler')
213213
}
214214

215215
// Run this once to be able to run the application with BUCK

example/android/app/src/debug/java/com/example/reactnativelocationsettingsenabler/ReactNativeFlipper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
55
* directory of this source tree.
66
*/
7-
package com.example.reactnativelocationsettingsenabler;
7+
package com.example.reactnativelocationenabler;
88

99
import android.content.Context;
1010
import com.facebook.flipper.android.AndroidFlipperClient;

example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.reactnativelocationsettingsenabler">
2+
package="com.example.reactnativelocationenabler">
33

44
<uses-permission android:name="android.permission.INTERNET" />
55

0 commit comments

Comments
 (0)