Skip to content

Commit

Permalink
Merge branch 'main' into chore/fix-toggle-local
Browse files Browse the repository at this point in the history
  • Loading branch information
IT-MikeS authored Nov 1, 2023
2 parents e4f5d5e + f5f84ee commit f593ffc
Show file tree
Hide file tree
Showing 29 changed files with 160 additions and 84 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/dev-releases-for-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ on:
jobs:
setup:
if: github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12]
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
plugins: ${{ steps.packages.outputs.paths }}
Expand Down Expand Up @@ -49,7 +46,7 @@ jobs:
files: ${{ steps.catjson.outputs.FILES_JSON }}

release-dev-of-plugins:
runs-on: macos-12
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
pull-requests: write
Expand All @@ -75,7 +72,7 @@ jobs:
- env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
npm version prerelease --no-git-tag-version -f --preid dev-$PR_NUMBER-$(date +\"%Y%m%dT%H%M%S\")
npm version prerelease --no-git-tag-version -f --preid dev-$PR_NUMBER-$(date +%Y%m%dT%H%M%S)
npm publish --tag dev --dry-run
working-directory: ${{ matrix.plugin }}
- name: get-npm-version
Expand Down
24 changes: 12 additions & 12 deletions app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ Only available for Android.
### addListener('appStateChange', ...)

```typescript
addListener(eventName: 'appStateChange', listenerFunc: StateChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: 'appStateChange', listenerFunc: StateChangeListener) => Promise<PluginListenerHandle>
```

Listen for changes in the app or the activity states.
Expand All @@ -185,7 +185,7 @@ On Web it's fired when the document's visibilitychange gets fired.
| **`eventName`** | <code>'appStateChange'</code> |
| **`listenerFunc`** | <code><a href="#statechangelistener">StateChangeListener</a></code> |

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

**Since:** 1.0.0

Expand All @@ -195,7 +195,7 @@ On Web it's fired when the document's visibilitychange gets fired.
### addListener('pause', ...)

```typescript
addListener(eventName: 'pause', listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: 'pause', listenerFunc: () => void) => Promise<PluginListenerHandle>
```

Listen for when the app or the activity are paused.
Expand All @@ -209,7 +209,7 @@ On Web it's fired when the document's visibilitychange gets fired and document.h
| **`eventName`** | <code>'pause'</code> |
| **`listenerFunc`** | <code>() =&gt; void</code> |

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

**Since:** 4.1.0

Expand All @@ -219,7 +219,7 @@ On Web it's fired when the document's visibilitychange gets fired and document.h
### addListener('resume', ...)

```typescript
addListener(eventName: 'resume', listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: 'resume', listenerFunc: () => void) => Promise<PluginListenerHandle>
```

Listen for when the app or activity are resumed.
Expand All @@ -234,7 +234,7 @@ On Web it's fired when the document's visibilitychange gets fired and document.h
| **`eventName`** | <code>'resume'</code> |
| **`listenerFunc`** | <code>() =&gt; void</code> |

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

**Since:** 4.1.0

Expand All @@ -244,7 +244,7 @@ On Web it's fired when the document's visibilitychange gets fired and document.h
### addListener('appUrlOpen', ...)

```typescript
addListener(eventName: 'appUrlOpen', listenerFunc: URLOpenListener) => Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: 'appUrlOpen', listenerFunc: URLOpenListener) => Promise<PluginListenerHandle>
```

Listen for url open events for the app. This handles both custom URL scheme links as well
Expand All @@ -255,7 +255,7 @@ as URLs your app handles (Universal Links on iOS and App Links on Android)
| **`eventName`** | <code>'appUrlOpen'</code> |
| **`listenerFunc`** | <code><a href="#urlopenlistener">URLOpenListener</a></code> |

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

**Since:** 1.0.0

Expand All @@ -265,7 +265,7 @@ as URLs your app handles (Universal Links on iOS and App Links on Android)
### addListener('appRestoredResult', ...)

```typescript
addListener(eventName: 'appRestoredResult', listenerFunc: RestoredListener) => Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: 'appRestoredResult', listenerFunc: RestoredListener) => Promise<PluginListenerHandle>
```

If the app was launched with previously persisted plugin call data, such as on Android
Expand Down Expand Up @@ -295,7 +295,7 @@ Activities (for example, Camera) to have this event and process handled.
| **`eventName`** | <code>'appRestoredResult'</code> |
| **`listenerFunc`** | <code><a href="#restoredlistener">RestoredListener</a></code> |

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

**Since:** 1.0.0

Expand All @@ -305,7 +305,7 @@ Activities (for example, Camera) to have this event and process handled.
### addListener('backButton', ...)

```typescript
addListener(eventName: 'backButton', listenerFunc: BackButtonListener) => Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: 'backButton', listenerFunc: BackButtonListener) => Promise<PluginListenerHandle>
```

Listen for the hardware back button event (Android only). Listening for this event will disable the
Expand All @@ -317,7 +317,7 @@ If you want to close the app, call `App.exitApp()`.
| **`eventName`** | <code>'backButton'</code> |
| **`listenerFunc`** | <code><a href="#backbuttonlistener">BackButtonListener</a></code> |

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

**Since:** 1.0.0

Expand Down
12 changes: 6 additions & 6 deletions app/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export interface AppPlugin {
addListener(
eventName: 'appStateChange',
listenerFunc: StateChangeListener,
): Promise<PluginListenerHandle> & PluginListenerHandle;
): Promise<PluginListenerHandle>;

/**
* Listen for when the app or the activity are paused.
Expand All @@ -198,7 +198,7 @@ export interface AppPlugin {
addListener(
eventName: 'pause',
listenerFunc: () => void,
): Promise<PluginListenerHandle> & PluginListenerHandle;
): Promise<PluginListenerHandle>;

/**
* Listen for when the app or activity are resumed.
Expand All @@ -213,7 +213,7 @@ export interface AppPlugin {
addListener(
eventName: 'resume',
listenerFunc: () => void,
): Promise<PluginListenerHandle> & PluginListenerHandle;
): Promise<PluginListenerHandle>;

/**
* Listen for url open events for the app. This handles both custom URL scheme links as well
Expand All @@ -224,7 +224,7 @@ export interface AppPlugin {
addListener(
eventName: 'appUrlOpen',
listenerFunc: URLOpenListener,
): Promise<PluginListenerHandle> & PluginListenerHandle;
): Promise<PluginListenerHandle>;

/**
* If the app was launched with previously persisted plugin call data, such as on Android
Expand Down Expand Up @@ -254,7 +254,7 @@ export interface AppPlugin {
addListener(
eventName: 'appRestoredResult',
listenerFunc: RestoredListener,
): Promise<PluginListenerHandle> & PluginListenerHandle;
): Promise<PluginListenerHandle>;

/**
* Listen for the hardware back button event (Android only). Listening for this event will disable the
Expand All @@ -266,7 +266,7 @@ export interface AppPlugin {
addListener(
eventName: 'backButton',
listenerFunc: BackButtonListener,
): Promise<PluginListenerHandle> & PluginListenerHandle;
): Promise<PluginListenerHandle>;

/**
* Remove all native listeners for this plugin
Expand Down
8 changes: 4 additions & 4 deletions browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ No-op on other platforms.
### addListener('browserFinished', ...)

```typescript
addListener(eventName: 'browserFinished', listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: 'browserFinished', listenerFunc: () => void) => Promise<PluginListenerHandle>
```

Android & iOS only: Listen for the browser finished event.
Expand All @@ -91,7 +91,7 @@ It fires when the Browser is closed by the user.
| **`eventName`** | <code>'browserFinished'</code> |
| **`listenerFunc`** | <code>() =&gt; void</code> |

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

**Since:** 1.0.0

Expand All @@ -101,7 +101,7 @@ It fires when the Browser is closed by the user.
### addListener('browserPageLoaded', ...)

```typescript
addListener(eventName: 'browserPageLoaded', listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: 'browserPageLoaded', listenerFunc: () => void) => Promise<PluginListenerHandle>
```

Android & iOS only: Listen for the page loaded event.
Expand All @@ -113,7 +113,7 @@ It is not invoked for any subsequent page loads.
| **`eventName`** | <code>'browserPageLoaded'</code> |
| **`listenerFunc`** | <code>() =&gt; void</code> |

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

**Since:** 1.0.0

Expand Down
4 changes: 2 additions & 2 deletions browser/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface BrowserPlugin {
addListener(
eventName: 'browserFinished',
listenerFunc: () => void,
): Promise<PluginListenerHandle> & PluginListenerHandle;
): Promise<PluginListenerHandle>;

/**
* Android & iOS only: Listen for the page loaded event.
Expand All @@ -38,7 +38,7 @@ export interface BrowserPlugin {
addListener(
eventName: 'browserPageLoaded',
listenerFunc: () => void,
): Promise<PluginListenerHandle> & PluginListenerHandle;
): Promise<PluginListenerHandle>;

/**
* Remove all native listeners for this plugin.
Expand Down
18 changes: 16 additions & 2 deletions filesystem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const readFilePath = async () => {
* [`requestPermissions()`](#requestpermissions)
* [`downloadFile(...)`](#downloadfile)
* [`addListener('progress', ...)`](#addlistenerprogress)
* [`removeAllListeners()`](#removealllisteners)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)
* [Enums](#enums)
Expand Down Expand Up @@ -365,7 +366,7 @@ Perform a http request to a server and download the file to the specified destin
### addListener('progress', ...)

```typescript
addListener(eventName: 'progress', listenerFunc: ProgressListener) => Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: 'progress', listenerFunc: ProgressListener) => Promise<PluginListenerHandle>
```

Add a listener to file download progress events.
Expand All @@ -375,13 +376,26 @@ Add a listener to file download progress events.
| **`eventName`** | <code>'progress'</code> |
| **`listenerFunc`** | <code><a href="#progresslistener">ProgressListener</a></code> |

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

**Since:** 5.1.0

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


### removeAllListeners()

```typescript
removeAllListeners() => Promise<void>
```

Remove all listeners for this plugin.

**Since:** 5.2.0

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


### Interfaces


Expand Down
8 changes: 7 additions & 1 deletion filesystem/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,13 @@ export interface FilesystemPlugin {
addListener(
eventName: 'progress',
listenerFunc: ProgressListener,
): Promise<PluginListenerHandle> & PluginListenerHandle;
): Promise<PluginListenerHandle>;
/**
* Remove all listeners for this plugin.
*
* @since 5.2.0
*/
removeAllListeners(): Promise<void>;
}

/**
Expand Down
1 change: 0 additions & 1 deletion geolocation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ npx cap sync

Apple requires privacy descriptions to be specified in `Info.plist` for location information:

- `NSLocationAlwaysUsageDescription` (`Privacy - Location Always Usage Description`)
- `NSLocationWhenInUseUsageDescription` (`Privacy - Location When In Use Usage Description`)

Read about [Configuring `Info.plist`](https://capacitorjs.com/docs/ios/configuration#configuring-infoplist) in the [iOS Guide](https://capacitorjs.com/docs/ios) for more information on setting iOS permissions in Xcode
Expand Down
4 changes: 3 additions & 1 deletion google-maps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ To use the Google Maps SDK on any platform, API keys associated with an account

The Google Maps SDK supports the use of showing the users current location via `enableCurrentLocation(bool)`. To use this, Apple requires privacy descriptions to be specified in `Info.plist`:

- `NSLocationAlwaysUsageDescription` (`Privacy - Location Always Usage Description`)
- `NSLocationWhenInUseUsageDescription` (`Privacy - Location When In Use Usage Description`)

Read about [Configuring `Info.plist`](https://capacitorjs.com/docs/ios/configuration#configuring-infoplist) in the [iOS Guide](https://capacitorjs.com/docs/ios) for more information on setting iOS permissions in Xcode.
Expand Down Expand Up @@ -900,6 +899,9 @@ For iOS and Android only the config options declared on <a href="#googlemapconfi
| **`androidLiteMode`** | <code>boolean</code> | Enables image-based lite mode on Android. | <code>false</code> | |
| **`devicePixelRatio`** | <code>number</code> | Override pixel ratio for native map. | | |
| **`styles`** | <code>MapTypeStyle[] \| null</code> | Styles to apply to each of the default map types. Note that for satellite, hybrid and terrain modes, these styles will only apply to labels and geometry. | | 4.3.0 |
| **`mapId`** | <code>string</code> | A map id associated with a specific map style or feature. [Use Map IDs](https://developers.google.com/maps/documentation/get-map-id) Only for Web. | | 6.0.0 |
| **`androidMapId`** | <code>string</code> | A map id associated with a specific map style or feature. [Use Map IDs](https://developers.google.com/maps/documentation/get-map-id) Only for Android. | | 6.0.0 |
| **`iOSMapId`** | <code>string</code> | A map id associated with a specific map style or feature. [Use Map IDs](https://developers.google.com/maps/documentation/get-map-id) Only for iOS. | | 6.0.0 |


#### LatLng
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.getcapacitor.annotation.CapacitorPlugin
import com.getcapacitor.annotation.Permission
import com.getcapacitor.annotation.PermissionCallback
import com.google.android.gms.maps.MapsInitializer
import com.google.android.gms.maps.OnMapsSdkInitializedCallback
import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.LatLngBounds
import kotlinx.coroutines.CoroutineScope
Expand All @@ -29,7 +30,7 @@ import org.json.JSONObject
),
],
)
class CapacitorGoogleMapsPlugin : Plugin() {
class CapacitorGoogleMapsPlugin : Plugin(), OnMapsSdkInitializedCallback {
private var maps: HashMap<String, CapacitorGoogleMap> = HashMap()
private var cachedTouchEvents: HashMap<String, MutableList<MotionEvent>> = HashMap()
private val tag: String = "CAP-GOOGLE-MAPS"
Expand All @@ -43,7 +44,8 @@ class CapacitorGoogleMapsPlugin : Plugin() {
override fun load() {
super.load()

MapsInitializer.initialize(this.context, MapsInitializer.Renderer.LATEST, null)
MapsInitializer.initialize(this.context, MapsInitializer.Renderer.LATEST, this)


this.bridge.webView.setOnTouchListener(
object : View.OnTouchListener {
Expand Down Expand Up @@ -90,6 +92,13 @@ class CapacitorGoogleMapsPlugin : Plugin() {
)
}

override fun onMapsSdkInitialized(renderer: MapsInitializer.Renderer) {
when (renderer) {
MapsInitializer.Renderer.LATEST -> Logger.debug("Capacitor Google Maps", "Latest Google Maps renderer enabled")
MapsInitializer.Renderer.LEGACY -> Logger.debug("Capacitor Google Maps", "Legacy Google Maps renderer enabled - Cloud based map styling and advanced drawing not available")
}
}

override fun handleOnStart() {
super.handleOnStart()
maps.forEach { it.value.onStart() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class GoogleMapConfig(fromJSONObject: JSONObject) {
var liteMode: Boolean = false
var devicePixelRatio: Float = 1.00f
var styles: String? = null
var mapId: String? = null

init {
if (!fromJSONObject.has("width")) {
Expand Down Expand Up @@ -81,8 +82,14 @@ class GoogleMapConfig(fromJSONObject: JSONObject) {
center = LatLng(lat, lng)

val cameraPosition = CameraPosition(center, zoom.toFloat(), 0.0F, 0.0F)
googleMapOptions = GoogleMapOptions().camera(cameraPosition).liteMode(liteMode)

styles = fromJSONObject.getString("styles")

mapId = fromJSONObject.getString("androidMapId")

googleMapOptions = GoogleMapOptions().camera(cameraPosition).liteMode(liteMode)
if (mapId != null) {
googleMapOptions?.mapId(mapId!!)
}
}
}
Loading

0 comments on commit f593ffc

Please sign in to comment.