Skip to content

Commit

Permalink
docs: update RN plugin guide + swap Storage with Preferences plugin (#…
Browse files Browse the repository at this point in the history
…283)

* docs: clarify RN instructions and class paths
* docs: replace Storage plugin with Preferences and set actual Cap version in code block
* chore: fix spelling mistakes
* docs: remove the "Register the Plugin" section for "Other Plugins" in the RN doc
  • Loading branch information
eric-horodyski authored Jul 3, 2024
1 parent cce2385 commit 7ccd296
Show file tree
Hide file tree
Showing 3 changed files with 532 additions and 138 deletions.
70 changes: 38 additions & 32 deletions website/docs/for-android/how-to/using-a-capacitor-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_label: Use a Capacitor Plugin
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';
import { getPortalsVersion, getPortalsVersionIos, getPortalsVersionAndroid } from '@site/src/util';
import { getPortalsVersion, getCapacitorVersion, getPortalsVersionIos, getPortalsVersionAndroid } from '@site/src/util';

<head>
<title>How to Use Capacitor Plugins: Core & Others | Ionic</title>
Expand All @@ -31,7 +31,7 @@ In order to use a Capacitor Core Plugin, you need to install the plugin as a dep
`
dependencies {
implementation 'io.ionic:portals:${getPortalsVersionAndroid()}'
implementation 'com.capacitorjs.storage:1.2.0'
implementation 'com.capacitorjs.preferences:${getCapacitorVersion()}'
}`.trim()
}
</CodeBlock>
Expand Down Expand Up @@ -70,89 +70,93 @@ builder = builder.addPlugin(MyPlugin.class)

### Published Plugins

In MavenCentral, the Capacitor plugins are prepended with `com.capacitorjs`. For example, the `@capacitor/storage` plugin on npm is named `com.capacitorjs.storage` on Maven. The following Plugins are available in MavenCentral.
In MavenCentral, the Capacitor plugins are prepended with `com.capacitorjs`. For example, the `@capacitor/preferences` plugin on npm is named `com.capacitorjs:preferences` on Maven. The following Plugins are available in MavenCentral.

**[com.capacitorjs.action-sheet](https://capacitorjs.com/docs/apis/action-sheet)**
**[com.capacitorjs:action-sheet](https://capacitorjs.com/docs/apis/action-sheet)**

The Action Sheet API provides access to native Action Sheets, which come up from the bottom of the screen and display actions a user can take.

**[com.capacitorjs.app-launcher](https://capacitorjs.com/docs/apis/app-launcher)**
**[com.capacitorjs:app](https://capacitorjs.com/docs/apis/app)**

The AppLauncher API allows to open other apps
The App API handles high level App state and events. For example, this API emits events when the app enters and leaves the foreground, handles deeplinks, opens other apps, and manages persisted plugin state.

**[com.capacitorjs.browser](https://capacitorjs.com/docs/apis/browser)**
**[com.capacitorjs:app-launcher](https://capacitorjs.com/docs/apis/app-launcher)**

The AppLauncher API allows the opening of other apps.

**[com.capacitorjs:browser](https://capacitorjs.com/docs/apis/browser)**

The Browser API provides the capability to open an in-app browser and subscribe to browser events.

**[com.capacitorjs.camera](https://capacitorjs.com/docs/apis/camera)**
**[com.capacitorjs:camera](https://capacitorjs.com/docs/apis/camera)**

The Camera API provides the capability to take a photo with the camera or to choose photos from the photo album.

**[com.capacitorjs.clipboard](https://capacitorjs.com/docs/apis/clipboard)**
**[com.capacitorjs:clipboard](https://capacitorjs.com/docs/apis/clipboard)**

The Clipboard API enables copy and pasting to/from the system clipboard.

**[com.capacitorjs.device](https://capacitorjs.com/docs/apis/device)**
**[com.capacitorjs:device](https://capacitorjs.com/docs/apis/device)**

The Device API exposes internal information about the device, such as the model and operating system version, along with user information such as unique ids.

**[com.capacitorjs.dialog](https://capacitorjs.com/docs/apis/dialog)**
**[com.capacitorjs:dialog](https://capacitorjs.com/docs/apis/dialog)**

The Dialog API provides methods for triggering native dialog windows for alerts, confirmations, and input prompts.

**[com.capacitorjs.filesystem](https://capacitorjs.com/docs/apis/filesystem)**
**[com.capacitorjs:filesystem](https://capacitorjs.com/docs/apis/filesystem)**

The Filesystem API provides a NodeJS-like API for working with files on the device.

**[com.capacitorjs.geolocation](https://capacitorjs.com/docs/apis/geolocation)**
**[com.capacitorjs:geolocation](https://capacitorjs.com/docs/apis/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.

**[com.capacitorjs.haptics](https://capacitorjs.com/docs/apis/haptics)**
**[com.capacitorjs:haptics](https://capacitorjs.com/docs/apis/haptics)**

The Haptics API provides physical feedback to the user through touch or vibration.

**[com.capacitorjs.keyboard](https://capacitorjs.com/docs/apis/keyboard)**
**[com.capacitorjs:keyboard](https://capacitorjs.com/docs/apis/keyboard)**

The Keyboard API provides keyboard display and visibility control, along with event tracking when the keyboard shows and hides.

**[com.capacitorjs.local-notifications](https://capacitorjs.com/docs/apis/local-notifications)**
**[com.capacitorjs:local-notifications](https://capacitorjs.com/docs/apis/local-notifications)**

The Local Notifications API provides a way to schedule device notifications locally (i.e. without a server sending push notifications).

**[com.capacitorjs.network](https://capacitorjs.com/docs/apis/network)**
**[com.capacitorjs:network](https://capacitorjs.com/docs/apis/network)**

The Network API provides network and connectivity information.

**[com.capacitorjs.push-notifications](https://capacitorjs.com/docs/apis/push-notifications)**
**[com.capacitorjs:preferences](https://capacitorjs.com/docs/apis/preferences)**

The Preferences API provides a simple key/value persistent store for lightweight data.

**[com.capacitorjs:push-notifications](https://capacitorjs.com/docs/apis/push-notifications)**

The Push Notifications API provides access to native push notifications.

**[com.capacitorjs.screen-reader](https://capacitorjs.com/docs/apis/screen-reader)**
**[com.capacitorjs:screen-reader](https://capacitorjs.com/docs/apis/screen-reader)**

The Screen Reader API provides access to TalkBack/VoiceOver/etc. and provides simple text-to-speech capabilities for visual accessibility.

**[com.capacitorjs.share](https://capacitorjs.com/docs/apis/share)**
**[com.capacitorjs:share](https://capacitorjs.com/docs/apis/share)**

The Share API provides methods for sharing content to any sharing-enabled apps that the user may have installed.

**[com.capacitorjs.splash-screen](https://capacitorjs.com/docs/apis/splash-screen)**
**[com.capacitorjs:splash-screen](https://capacitorjs.com/docs/apis/splash-screen)**

The Splash Screen API provides methods for showing or hiding a Splash image.

**[com.capacitorjs.status-bar](https://capacitorjs.com/docs/apis/status-bar)**
**[com.capacitorjs:status-bar](https://capacitorjs.com/docs/apis/status-bar)**

The StatusBar API Provides methods for configuring the style of the Status Bar, along with showing or hiding it.

**[com.capacitorjs.storage](https://capacitorjs.com/docs/apis/storage)**

The Storage API provides a simple key/value persistent store for lightweight data.

**[com.capacitorjs.text-zoom](https://capacitorjs.com/docs/apis/text-zoom)**
**[com.capacitorjs:text-zoom](https://capacitorjs.com/docs/apis/text-zoom)**

The Text Zoom API provides the ability to change Web View text size for visual accessibility.

**[com.capacitorjs.toast](https://capacitorjs.com/docs/apis/toast)**
**[com.capacitorjs:toast](https://capacitorjs.com/docs/apis/toast)**

The Toast API provides a notification pop up for displaying important information to a user. Just like real toast!

Expand Down Expand Up @@ -191,14 +195,16 @@ project(':capacitor-plugin-name').projectDir = new File('../../webapp/node_modul

Then in your project module level `build.gradle` file, add the project to the dependencies.

```groovy
<CodeBlock className="language-groovy" title="build.gradle">
{
`
dependencies {
implementation project(':capacitor-plugin-name')
implementation 'io.ionic:portals:0.5.0'
implementation 'io.ionic:portals:${getPortalsVersionAndroid()}'
//...
}`.trim()
}
```
</CodeBlock>

If successful, you should now see a section in the Android Studio project browser for your plugin, be able to browse its source code, and reference classes in the plugin within your native application source code.

Expand Down
18 changes: 9 additions & 9 deletions website/docs/for-ios/how-to/using-a-capacitor-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_label: Use a Capacitor Plugin
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';
import { getPortalsVersion, getPortalsVersionIos, getPortalsVersionAndroid } from '@site/src/util';
import { getPortalsVersion, getCapacitorVersion, getPortalsVersionIos, getPortalsVersionAndroid } from '@site/src/util';

<head>
<title>How to Use Capacitor Plugins: Core & Others | Ionic</title>
Expand All @@ -29,7 +29,7 @@ In order to use a Capacitor Core Plugin, you need to install the plugin as a dep
<CodeBlock className="language-ruby" title="Podfile">
{
`pod 'IonicPortals', '~> ${getPortalsVersionIos()}'
pod 'CapacitorStorage', '~> 1.2.0'
pod 'CapacitorPreferences', '~> ${getCapacitorVersion()}'
`.trim()
}
</CodeBlock>
Expand Down Expand Up @@ -82,19 +82,19 @@ If you want all plugins to be automatically registered, then leaving the default

### Published Plugins

In CocoaPods, the Capacitor plugins are prepended with `Capacitor`. For example, the `@capacitor/storage` plugin on npm is named `CapacitorStorage` on CocoaPods. The following Plugins are available in CocoaPods.
In CocoaPods, the Capacitor plugins are prepended with `Capacitor`. For example, the `@capacitor/preferences` plugin on npm is named `CapacitorPreferences` on CocoaPods. The following Plugins are available in CocoaPods.

**[CapacitorActionSheet](https://capacitorjs.com/docs/apis/action-sheet)**

The Action Sheet API provides access to native Action Sheets, which come up from the bottom of the screen and display actions a user can take.

**[CappacitorApp](https://capacitorjs.com/docs/apis/app)**
**[CapacitorApp](https://capacitorjs.com/docs/apis/app)**

The App API handles high level App state and events. For example, this API emits events when the app enters and leaves the foreground, handles deeplinks, opens other apps, and manages persisted plugin state.

**[CapacitorAppLauncher](https://capacitorjs.com/docs/apis/app-launcher)**

The AppLauncher API allows to open other apps
The AppLauncher API allows the opening of other apps.

**[CapacitorBrowser](https://capacitorjs.com/docs/apis/browser)**

Expand Down Expand Up @@ -144,6 +144,10 @@ The Motion API tracks accelerometer and device orientation (compass heading, etc

The Network API provides network and connectivity information.

**[CapacitorPreferences](https://capacitorjs.com/docs/apis/preferences)**

The Preferences API provides a simple key/value persistent store for lightweight data.

**[CapacitorPushNotifications](https://capacitorjs.com/docs/apis/push-notifications)**

The Push Notifications API provides access to native push notifications.
Expand All @@ -164,10 +168,6 @@ The Splash Screen API provides methods for showing or hiding a Splash image.

The StatusBar API Provides methods for configuring the style of the Status Bar, along with showing or hiding it.

**[CapacitorStorage](https://capacitorjs.com/docs/apis/storage)**

The Storage API provides a simple key/value persistent store for lightweight data.

**[CapacitorTextZoom](https://capacitorjs.com/docs/apis/text-zoom)**

The Text Zoom API provides the ability to change Web View text size for visual accessibility.
Expand Down
Loading

0 comments on commit 7ccd296

Please sign in to comment.