Skip to content

Commit a557a24

Browse files
committed
Add mobile v3 docs with plugin system documentation
- Add mobile/3/ docs directory with full documentation - Add 3.x to version switcher dropdown for mobile - Set mobile latest version to 3 in config - Update all navigation links to default to v3 for mobile - Remove plugins docs from v2 (plugins are v3+ only) - Document new plugin manifest features: - Android: features (uses-feature), meta_data - iOS: background_modes, entitlements
1 parent 0b28cbd commit a557a24

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+7190
-15
lines changed

config/docs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
'latest_versions' => [
1717
'desktop' => 2,
18-
'mobile' => 2,
18+
'mobile' => 3,
1919
],
2020

2121
];

resources/views/components/docs/platform-switcher.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@php
22
$isMobile = request()->is('docs/mobile/*');
3-
$mobileHref = '/docs/mobile/2';
3+
$mobileHref = '/docs/mobile/3';
44
$desktopHref = '/docs/desktop/2';
55
@endphp
66

resources/views/components/footer.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ class="flex flex-col items-start text-sm text-gray-500 dark:text-gray-400"
293293
>
294294
<li>
295295
<a
296-
href="/docs/mobile/2/getting-started/introduction"
296+
href="/docs/mobile/3/getting-started/introduction"
297297
class="inline-block px-px py-1.5 transition duration-300 will-change-transform hover:translate-x-1 hover:text-gray-700 dark:hover:text-gray-300"
298298
>
299299
Documentation

resources/views/components/navbar/device-dropdowns.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
id="mobile-dropdown"
1111
>
1212
<x-navbar.device-dropdown-item
13-
href="/docs/mobile/2/getting-started/introduction"
13+
href="/docs/mobile/3/getting-started/introduction"
1414
title="Documentation"
1515
subtitle="Get started with Mobile"
1616
icon="docs"

resources/views/docs/index.blade.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
@elseif($platform === 'mobile')
1414
<livewire:version-switcher :versions="[
1515
1 => '1.x',
16-
2 => '2.x'
16+
2 => '2.x',
17+
3 => '3.x'
1718
]" />
1819
@endif
1920

@@ -44,7 +45,8 @@
4445
@elseif($platform === 'mobile')
4546
<livewire:version-switcher :versions="[
4647
1 => '1.x',
47-
2 => '2.x'
48+
2 => '2.x',
49+
3 => '3.x'
4850
]" />
4951
@endif
5052

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: Mobile
3+
order: 1
4+
---
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: APIs
3+
order: 50
4+
---
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
---
2+
title: Biometrics
3+
order: 100
4+
---
5+
6+
## Overview
7+
8+
The Biometrics API allows you to authenticate users using their device's biometric sensors like Face ID, Touch ID, or
9+
fingerprint scanners.
10+
11+
<x-snippet title="Import">
12+
13+
<x-snippet.tab name="PHP">
14+
15+
```php
16+
use Native\Mobile\Facades\Biometrics;
17+
```
18+
19+
</x-snippet.tab>
20+
<x-snippet.tab name="JS">
21+
22+
```js
23+
import { biometric, on, off, Events } from '#nativephp';
24+
```
25+
26+
</x-snippet.tab>
27+
</x-snippet>
28+
29+
## Methods
30+
31+
### `prompt()`
32+
33+
Prompts the user for biometric authentication.
34+
35+
<x-snippet title="Biometric Prompt">
36+
37+
<x-snippet.tab name="PHP">
38+
39+
```php
40+
use Native\Mobile\Facades\Biometrics;
41+
42+
Biometrics::prompt();
43+
```
44+
45+
</x-snippet.tab>
46+
<x-snippet.tab name="JS">
47+
48+
```js
49+
// Basic usage
50+
await biometric.prompt();
51+
52+
// With an identifier for tracking
53+
await biometric.prompt()
54+
.id('secure-action-auth');
55+
```
56+
57+
</x-snippet.tab>
58+
</x-snippet>
59+
60+
## Events
61+
62+
### `Completed`
63+
64+
Fired when biometric authentication completes (success or failure).
65+
66+
<x-snippet title="Completed Event">
67+
68+
<x-snippet.tab name="PHP">
69+
70+
```php
71+
use Native\Mobile\Attributes\OnNative;
72+
use Native\Mobile\Events\Biometric\Completed;
73+
74+
#[OnNative(Completed::class)]
75+
public function handle(bool $success)
76+
{
77+
if ($success) {
78+
// User authenticated successfully
79+
$this->unlockSecureFeature();
80+
} else {
81+
// Authentication failed
82+
$this->showErrorMessage();
83+
}
84+
}
85+
```
86+
87+
</x-snippet.tab>
88+
<x-snippet.tab name="Vue">
89+
90+
```js
91+
import { biometric, on, off, Events } from '#nativephp';
92+
import { ref, onMounted, onUnmounted } from 'vue';
93+
94+
const isAuthenticated = ref(false);
95+
96+
const handleBiometricComplete = (payload) => {
97+
if (payload.success) {
98+
isAuthenticated.value = true;
99+
unlockSecureFeature();
100+
} else {
101+
showErrorMessage();
102+
}
103+
};
104+
105+
const authenticate = async () => {
106+
await biometric.prompt();
107+
};
108+
109+
onMounted(() => {
110+
on(Events.Biometric.Completed, handleBiometricComplete);
111+
});
112+
113+
onUnmounted(() => {
114+
off(Events.Biometric.Completed, handleBiometricComplete);
115+
});
116+
```
117+
118+
</x-snippet.tab>
119+
<x-snippet.tab name="React">
120+
121+
```jsx
122+
import { biometric, on, off, Events } from '#nativephp';
123+
import { useState, useEffect } from 'react';
124+
125+
const [isAuthenticated, setIsAuthenticated] = useState(false);
126+
127+
const handleBiometricComplete = (payload) => {
128+
if (payload.success) {
129+
setIsAuthenticated(true);
130+
unlockSecureFeature();
131+
} else {
132+
showErrorMessage();
133+
}
134+
};
135+
136+
const authenticate = async () => {
137+
await biometric.prompt();
138+
};
139+
140+
useEffect(() => {
141+
on(Events.Biometric.Completed, handleBiometricComplete);
142+
143+
return () => {
144+
off(Events.Biometric.Completed, handleBiometricComplete);
145+
};
146+
}, []);
147+
```
148+
149+
</x-snippet.tab>
150+
</x-snippet>
151+
152+
## Platform Support
153+
154+
- **iOS:** Face ID, Touch ID
155+
- **Android:** Fingerprint, Face unlock, other biometric methods
156+
- **Fallback:** System authentication (PIN, password, pattern)
157+
158+
## Security Notes
159+
160+
- Biometric authentication provides **convenience**, not absolute security
161+
- Always combine with other authentication factors for sensitive operations
162+
- Consider implementing session timeouts for unlocked states
163+
- Users can potentially bypass biometrics if their device is compromised
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
title: Browser
3+
order: 200
4+
---
5+
6+
## Overview
7+
8+
The Browser API provides three methods for opening URLs, each designed for specific use cases:
9+
in-app browsing, system browser navigation, and web authentication flows.
10+
11+
<x-snippet title="Import">
12+
13+
<x-snippet.tab name="PHP">
14+
15+
```php
16+
use Native\Mobile\Facades\Browser;
17+
```
18+
19+
</x-snippet.tab>
20+
<x-snippet.tab name="JS">
21+
22+
```js
23+
import { browser } from '#nativephp';
24+
```
25+
26+
</x-snippet.tab>
27+
</x-snippet>
28+
29+
## Methods
30+
31+
### `inApp()`
32+
33+
Opens a URL in an embedded browser within your app using Custom Tabs (Android) or SFSafariViewController (iOS).
34+
35+
<x-snippet title="In-App Browser">
36+
37+
<x-snippet.tab name="PHP">
38+
39+
```php
40+
Browser::inApp('https://nativephp.com/mobile');
41+
```
42+
43+
</x-snippet.tab>
44+
<x-snippet.tab name="JS">
45+
46+
```js
47+
await browser.inApp('https://nativephp.com/mobile');
48+
```
49+
50+
</x-snippet.tab>
51+
</x-snippet>
52+
53+
### `open()`
54+
55+
Opens a URL in the device's default browser app, leaving your application entirely.
56+
57+
<x-snippet title="System Browser">
58+
59+
<x-snippet.tab name="PHP">
60+
61+
```php
62+
Browser::open('https://nativephp.com/mobile');
63+
```
64+
65+
</x-snippet.tab>
66+
<x-snippet.tab name="JS">
67+
68+
```js
69+
await browser.open('https://nativephp.com/mobile');
70+
```
71+
72+
</x-snippet.tab>
73+
</x-snippet>
74+
75+
### `auth()`
76+
77+
Opens a URL in a specialized authentication browser designed for OAuth flows with automatic `nativephp://` redirect handling.
78+
79+
<x-snippet title="Authentication Browser">
80+
81+
<x-snippet.tab name="PHP">
82+
83+
```php
84+
Browser::auth('https://provider.com/oauth/authorize?client_id=123&redirect_uri=nativephp://127.0.0.1/auth/callback');
85+
```
86+
87+
</x-snippet.tab>
88+
<x-snippet.tab name="JS">
89+
90+
```js
91+
await browser.auth('https://provider.com/oauth/authorize?client_id=123&redirect_uri=nativephp://127.0.0.1/auth/callback');
92+
```
93+
94+
</x-snippet.tab>
95+
</x-snippet>
96+
97+
## Use Cases
98+
99+
### When to Use Each Method
100+
101+
**`inApp()`** - Keep users within your app experience:
102+
- Documentation, help pages, terms of service
103+
- External content that relates to your app
104+
- When you want users to easily return to your app
105+
106+
**`open()`** - Full browser experience needed:
107+
- Complex web applications
108+
- Content requiring specific browser features
109+
- When users need bookmarking or sharing capabilities
110+
111+
**`auth()`** - OAuth authentication flows:
112+
- Login with WorkOS, Auth0, Google, Facebook, etc.
113+
- Secure authentication with automatic redirects
114+
- Isolated browser session for security

0 commit comments

Comments
 (0)