Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions resources/views/docs/mobile/2/apis/device.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,27 @@ Return information about the underlying device/os/platform.
Returns JSON encoded: `string`


### `vibrate()`

Triggers device vibration for tactile feedback.

**Returns:** `void`

```php
Device::vibrate();
```

### `flashlight()`

Toggles the device flashlight (camera flash LED) on and off.

**Returns:** `void`

```php
Device::flashlight(); // Toggle flashlight state
```


### `getBatteryInfo()`

Return information about the battery.
Expand Down
8 changes: 8 additions & 0 deletions resources/views/docs/mobile/2/apis/haptics.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ title: Haptics
order: 800
---

<aside>

#### Deprecated

The `Haptics` facade is marked deprecated and will be removed in a future release, use [Device](../apis/device) instead.

</aside>

## Overview

The Haptics API provides access to the device's vibration and haptic feedback system for tactile user interactions.
Expand Down
2 changes: 2 additions & 0 deletions resources/views/docs/mobile/2/apis/microphone.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ public function handleAudioRecorded(string $path, string $mimeType, ?string $id)

- **Microphone Permission:** The first time your app requests microphone access, users will be prompted for permission. If denied, recording functions will fail silently.

- **Microphone Background Permission:** You can allow your app to record audio while the device is locked by toggling `microphone_background` to true in [the config](../getting-started/configuration)

- **File Format:** Recordings are stored as M4A/AAC audio files (`.m4a`). This format is optimized for small file sizes while maintaining quality.

- **Recording State:** Only one recording can be active at a time. Calling `start()` while a recording is in progress will return `false`.
Expand Down
8 changes: 7 additions & 1 deletion resources/views/docs/mobile/2/apis/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use Native\Mobile\Facades\System;

## Methods

### `flashlight()`
### `flashlight()` - Deprecated, see [Device](device)

Toggles the device flashlight (camera flash LED) on and off.

Expand All @@ -34,3 +34,9 @@ Determines if the current device is running iOS.
Determines if the current device is running Android.

**Returns:** `true` if Android, `false` otherwise

### `isMobile()`

Determines if the current device is running Android or iOS.

**Returns:** `true` if Android or iOS, `false` otherwise
16 changes: 16 additions & 0 deletions resources/views/docs/mobile/2/edge-components/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,19 @@ use Blade's battle-tested processing engine to rapidly compile the necessary tra
They can be defined in any Blade file, but for them to be processed, that Blade file will need to be rendered. We
recommend putting your components in a Blade component that is likely to be rendered on every request, such as your
main layout, e.g. `layouts/app.blade.php` or one of its child views/components.

## Using Inertia?

Each link in an EDGE component will do a full post back to PHP, which may not be what you want if you are using Inertia. To transform these requests into Inertia `<Link>`, add `router` to your `window` object:

```typescript
import { router } from '@inertiajs/vue3';

declare global {
interface Window {
router: typeof router;
}
}

window.router = router;
```
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ reasons why your app needs certain permissions. You can do this easily from the
- `location` - Allows your application to request access to the device's GPS receiver, if present. Note that the user
may deny this and any location functions will then result in a no-op.
- `vibrate` - In modern Android devices this is a requirement for most haptic feedback.
- `storage_read` - Grants your app access to read from device storage locations.
- `storage_write` - Allows your app to write to device storage.
- `storage_read` - Grants your app access to read from device storage locations. This is not required for basic app file manipulation.
- `storage_write` - Allows your app to write to device storage. This is not required for basic app file manipulation.
- `microphone` - Allows your application to request access to the device's microphone, if present. Required for audio
recording functionality. Note that the user may deny access and any microphone functions will then result in a no-op.
- `microphone_background` - Allows your application to request access to the device's microphone, if present. Required
Expand Down
2 changes: 1 addition & 1 deletion resources/views/docs/mobile/2/the-basics/app-icon.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Place a single high-resolution icon file at: `public/icon.png`.
### Requirements
- Format: PNG
- Size: 1024 × 1024 pixels
- Background: Transparent or solid — your choice
- Background: Must not contain any transparencies.
- GD PHP extension must be enabled, ensure it has enough memory (~2GB should be enough)

This image will be automatically resized for all Android densities and used as the base iOS app icon.
Expand Down
2 changes: 1 addition & 1 deletion resources/views/docs/mobile/2/the-basics/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ register your event listeners. Here's an example using the amazing Vue:
import { on, Events } from '#nativephp';
import { onMounted } from 'vue';

const handleButtonPressed = (index, label) => {};
const handleButtonPressed = (payload: any) => {};

onMounted(() => {
on(Events.Alert.ButtonPressed, handleButtonPressed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Though this will be optional, so you have total freedom of choice and could even
When using a web view and using JavaScript you may also interact with the native functions easily from JavaScript using
our convenient `Native` library.

This is especially useful if you're building applications with an SPA framework, like Vue or React, as you can simply
This is especially useful if you're building applications with a SPA framework, like Vue or React, as you can simply
import the functions you need and move a lot of work into the reactive part of your UI.

### Install the plugin
Expand Down
Loading