Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geolocation #13

Merged
merged 102 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from 88 commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
3aa4ece
Init geolocation
carlpoole Aug 13, 2020
6fed851
Split geolocation into plugin/implementation first pass
carlpoole Aug 17, 2020
de47dda
corrected dependency versions and cleanup
carlpoole Aug 20, 2020
3a278bb
Updated capacitor dependency version
carlpoole Aug 20, 2020
f2d6edf
Added pkg name to lerna and ran formatter
carlpoole Aug 20, 2020
b1c4893
Merged in main
carlpoole Aug 20, 2020
44a14b6
Merged in main
carlpoole Aug 20, 2020
737ab87
verify scripts
carlpoole Aug 20, 2020
08ecc4d
Merge branch 'main' into geolocation
carlpoole Aug 24, 2020
909119c
moved more geolocation out and testing
carlpoole Aug 24, 2020
47747c7
manifest update, temp util
carlpoole Aug 25, 2020
f384018
Merge branch 'main' into geolocation
carlpoole Sep 8, 2020
6e46ec7
Use of the interface method for defining Geolocation Prompt behavior
carlpoole Sep 10, 2020
22782d3
cleanup interface
carlpoole Sep 10, 2020
89252c4
changed interface method name
carlpoole Sep 10, 2020
b64019d
Merge branch 'main' into geolocation
carlpoole Sep 10, 2020
5d52c5a
package updates
carlpoole Sep 10, 2020
b97d556
New annotation, removed unused method
carlpoole Sep 18, 2020
ac54cc7
Merged in main
carlpoole Oct 5, 2020
228b6ce
Updated to work with new permissions changes WIP, some cleanup
carlpoole Oct 9, 2020
792d5ae
Merge branch 'main' into geolocation
carlpoole Oct 9, 2020
8f88773
Merge branch 'main' into geolocation
carlpoole Oct 14, 2020
b9af8fb
Implementing permissions on geolocation
carlpoole Oct 15, 2020
459bcc3
Comment stuff, cleanup
carlpoole Oct 15, 2020
43afd48
IOS Geolocation initial breakout
carlpoole Oct 15, 2020
a49fbb0
More ios work
carlpoole Oct 16, 2020
00c4398
chore: replace UnsupportedBrowserException with unavailable
jcesarmobile Oct 19, 2020
b6e231a
Merge branch 'main' into unavailable
jcesarmobile Oct 19, 2020
8f56be9
iOS plugin code
carlpoole Oct 20, 2020
068958c
fmt
carlpoole Oct 20, 2020
c23eea0
Merge branch 'main' into geolocation
carlpoole Oct 22, 2020
a89f4c8
Replaced UnsupportedBrowserException
carlpoole Oct 22, 2020
7a3c83b
chore(toast): use getString instead of get
jcesarmobile Oct 23, 2020
654038d
iOS fixes
carlpoole Oct 23, 2020
57a8d1d
Merge branch 'main' into geolocation
carlpoole Oct 23, 2020
b3cb361
Merge branch 'main' into getstring
imhoffd Oct 23, 2020
7943f82
Call to super class
carlpoole Oct 23, 2020
20409b2
simplify release call
carlpoole Oct 27, 2020
38e38b6
Changed request code so it doesnt conflict with core, and removed unu…
carlpoole Oct 27, 2020
b3041c0
Merge branch 'geolocation' of github.com:ionic-team/capacitor-plugins…
carlpoole Oct 27, 2020
d96de23
Merge branch 'unavailable' into geolocation
imhoffd Oct 27, 2020
24673e7
Update geolocation/src/definitions.ts
carlpoole Oct 28, 2020
cb05e97
Changed code to 90xx range
carlpoole Oct 28, 2020
f34587b
Merge branch 'geolocation' of github.com:ionic-team/capacitor-plugins…
carlpoole Oct 28, 2020
e8101b2
permission param fix
carlpoole Oct 29, 2020
6e4d986
chore(browser): remove unused request code
jcesarmobile Oct 29, 2020
7dbcd97
Merge remote-tracking branch 'origin/getstring' into geolocation
imhoffd Oct 29, 2020
bd511bf
Merge remote-tracking branch 'origin/jcesarmobile-patch-1' into geolo…
imhoffd Oct 29, 2020
d650131
Merge branch 'main' into geolocation
imhoffd Oct 29, 2020
d336c7c
Merge branch 'main' into geolocation
carlpoole Nov 2, 2020
588bd29
Merge branch 'geolocation' of github.com:ionic-team/capacitor-plugins…
carlpoole Nov 2, 2020
1ed3d5c
Merge branch 'main' into geolocation
carlpoole Nov 2, 2020
1770d50
changes
imhoffd Nov 2, 2020
0346e36
Merge branch 'main' into geolocation
carlpoole Nov 2, 2020
354d23f
iOS fixes
carlpoole Nov 3, 2020
15c5b03
Merge branch 'main' into geolocation
carlpoole Nov 3, 2020
8af8b3d
refactor swift
carlpoole Nov 3, 2020
0e9b94d
gradle wrapper 6.6.1
jcesarmobile Nov 3, 2020
1d3a85a
remove old files
jcesarmobile Nov 3, 2020
27d17b7
remove example test
carlpoole Nov 3, 2020
71246e1
throw unimplemented for web requestPermissions
carlpoole Nov 3, 2020
c7fc8e7
Merge branch 'geolocation' of github.com:ionic-team/capacitor-plugins…
carlpoole Nov 3, 2020
c59e127
remove npmignore
jcesarmobile Nov 4, 2020
3b0063d
Add license
jcesarmobile Nov 4, 2020
4b7201a
add android gitignore
jcesarmobile Nov 4, 2020
b33b3bd
return Location object instead of JSObject (#89)
jcesarmobile Nov 4, 2020
d8042c0
Uses new handlePermissions method
carlpoole Nov 5, 2020
50d5904
simplify requestPermissions
carlpoole Nov 5, 2020
623ebf1
new xcode project format
jcesarmobile Nov 6, 2020
a59f740
remove unused
jcesarmobile Nov 6, 2020
863c154
update docs
jcesarmobile Nov 6, 2020
0070149
reject msg more generic in case it wasnt the user that caused a deny
carlpoole Nov 6, 2020
fde0727
Merge branch 'geolocation' of github.com:ionic-team/capacitor-plugins…
carlpoole Nov 6, 2020
62e0889
Removed unused layout file
carlpoole Nov 10, 2020
6d43f0c
refactor
carlpoole Nov 16, 2020
8561457
Merge branch 'main' into geolocation
carlpoole Nov 16, 2020
7d754db
Using new permission annotation format and calls validatePermission h…
carlpoole Nov 19, 2020
d4c7a44
Merge branch 'geolocation' of github.com:ionic-team/capacitor-plugins…
carlpoole Nov 19, 2020
4eaed04
Updates for upcoming alpha 7
carlpoole Nov 24, 2020
233f959
Merge branch 'main' into geolocation
carlpoole Nov 24, 2020
9d5c01f
Merge in main
carlpoole Dec 9, 2020
0c6c15a
Alpha 7 and web updates
carlpoole Dec 9, 2020
6b05897
package.json updates
carlpoole Dec 9, 2020
bb08a21
Update ios permissions funcs
carlpoole Dec 9, 2020
5735a81
Web refactor/comments
carlpoole Dec 9, 2020
255d0d9
Update geolocation/src/web.ts
carlpoole Dec 9, 2020
0f17e30
Merge branch 'geolocation' of github.com:ionic-team/capacitor-plugins…
carlpoole Dec 9, 2020
918ab99
removed extend, not needed
carlpoole Dec 9, 2020
9d7af70
gradle 6.5
imhoffd Dec 10, 2020
b49db67
Merge branch 'main' into geolocation
imhoffd Dec 10, 2020
16e290e
Merge branch 'main' into geolocation
carlpoole Dec 11, 2020
5402501
Added undefined to type for altitudeAccuracy for Android
carlpoole Dec 11, 2020
35303b4
Apply suggestions from code review
carlpoole Dec 14, 2020
4aa9f03
Merge branch 'main' into geolocation
imhoffd Dec 15, 2020
e8763f4
Merge branch 'main' into geolocation
imhoffd Dec 16, 2020
cb91123
alpha.10
imhoffd Dec 16, 2020
0c16f7a
Import PermissionState type from capacitor core
carlpoole Dec 16, 2020
1c53c8b
iOS fix related to capacitor #3802
carlpoole Dec 16, 2020
337ecdf
Merge branch 'main' into geolocation
carlpoole Dec 16, 2020
8df4712
Merge branch 'main' into geolocation
carlpoole Dec 16, 2020
364fc33
Merge branch 'main' into geolocation
imhoffd Dec 16, 2020
ea2b017
docgen update
imhoffd Dec 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions geolocation/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
dist
61 changes: 61 additions & 0 deletions geolocation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# node files
dist
node_modules

# iOS files
Pods
Podfile.lock
Build
xcuserdata

# macOS files
.DS_Store



# Based on Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore

# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin
gen
out

# Gradle files
.gradle
build

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation

# Android Studio captures folder
captures

# IntelliJ
*.iml
.idea

# Keystore files
# Uncomment the following line if you do not want to check your keystore files in.
#*.jks

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
2 changes: 2 additions & 0 deletions geolocation/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
dist
17 changes: 17 additions & 0 deletions geolocation/CapacitorGeolocation.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'json'

package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

Pod::Spec.new do |s|
s.name = 'CapacitorGeolocation'
s.version = package['version']
s.summary = package['description']
s.license = package['license']
s.homepage = package['repository']['url']
s.author = package['author']
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
s.ios.deployment_target = '11.0'
s.dependency 'Capacitor'
s.swift_version = '5.1'
end
23 changes: 23 additions & 0 deletions geolocation/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Copyright 2020-present Ionic
https://ionic.io

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
139 changes: 139 additions & 0 deletions geolocation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# @capacitor/geolocation

The Geolocation API provides simple methods for getting and tracking the current position of the device using GPS, along with altitude, heading, and speed information if available.

## Install

```bash
npm install @capacitor/geolocation
npx cap sync
```

## API

<docgen-index>

* [`getCurrentPosition(...)`](#getcurrentposition)
* [`watchPosition(...)`](#watchposition)
* [`clearWatch(...)`](#clearwatch)
* [`checkPermissions()`](#checkpermissions)
* [`requestPermissions()`](#requestpermissions)
* [Interfaces](#interfaces)

</docgen-index>

<docgen-api>
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->

### getCurrentPosition(...)

```typescript
getCurrentPosition(options?: GeolocationOptions | undefined) => Promise<GeolocationPosition>
```

Get the current GPS location of the device

| Param | Type |
| ------------- | ----------------------------------------------------------------- |
| **`options`** | <code><a href="#geolocationoptions">GeolocationOptions</a></code> |

**Returns:** <code>Promise&lt;<a href="#geolocationposition">GeolocationPosition</a>&gt;</code>

**Since:** 1.0.0

--------------------


### watchPosition(...)

```typescript
watchPosition(options: GeolocationOptions, callback: GeolocationWatchCallback) => CallbackID
```

Set up a watch for location changes. Note that watching for location changes
can consume a large amount of energy. Be smart about listening only when you need to.

| Param | Type |
| -------------- | ------------------------------------------------------------------------------------------------------------- |
| **`options`** | <code><a href="#geolocationoptions">GeolocationOptions</a></code> |
| **`callback`** | <code>(position: <a href="#geolocationposition">GeolocationPosition</a> \| null, err?: any) =&gt; void</code> |

**Returns:** <code>string</code>

**Since:** 1.0.0

--------------------


### clearWatch(...)

```typescript
clearWatch(options: { id: string; }) => Promise<void>
```

Clear a given watch

| Param | Type |
| ------------- | ---------------------------- |
| **`options`** | <code>{ id: string; }</code> |

--------------------


### checkPermissions()

```typescript
checkPermissions() => Promise<GeolocationPermissionStatus>
```

Check location permissions

**Returns:** <code>Promise&lt;<a href="#geolocationpermissionstatus">GeolocationPermissionStatus</a>&gt;</code>

**Since:** 1.0.0

--------------------


### requestPermissions()

```typescript
requestPermissions() => Promise<GeolocationPermissionStatus>
```

Request location permissions

**Returns:** <code>Promise&lt;<a href="#geolocationpermissionstatus">GeolocationPermissionStatus</a>&gt;</code>

**Since:** 1.0.0

--------------------


### Interfaces


#### GeolocationPosition

| Prop | Type | Description | Since |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | ----- |
| **`timestamp`** | <code>number</code> | Creation timestamp for coords | 1.0.0 |
| **`coords`** | <code>{ latitude: number; longitude: number; accuracy: number; altitudeAccuracy: number \| null; altitude: number \| null; speed: number \| null; heading: number \| null; }</code> | The GPS coordinates along with the accuracy of the data | 1.0.0 |


#### GeolocationOptions

| Prop | Type |
| ------------------------ | -------------------- |
| **`enableHighAccuracy`** | <code>boolean</code> |
| **`timeout`** | <code>number</code> |
| **`maximumAge`** | <code>number</code> |


#### GeolocationPermissionStatus

| Prop | Type |
| -------------- | ---------------- |
| **`location`** | <code>any</code> |

</docgen-api>
1 change: 1 addition & 0 deletions geolocation/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
58 changes: 58 additions & 0 deletions geolocation/android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
ext {
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.12'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.1'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.2.0'
playServicesLocationVersion = project.hasProperty('playServicesLocationVersion') ? rootProject.ext.playServicesLocationVersion : '17.0.0'
}

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 29
defaultConfig {
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

repositories {
google()
jcenter()
mavenCentral()
}


dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':capacitor-android')
implementation "com.google.android.gms:play-services-location:$playServicesLocationVersion"
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
}
24 changes: 24 additions & 0 deletions geolocation/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
Binary file not shown.
5 changes: 5 additions & 0 deletions geolocation/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading