Skip to content

Commit 90ae4c3

Browse files
committed
Update mobile documentation with API improvements and platform notes
- Add Android-only notes for ICU support across documentation - Update Dialog API documentation with new alert implementation - Enhance Geolocation API documentation - Improve API overview and navigation - Update Push Notifications API documentation - Enhance Secure Storage API documentation - Add database documentation improvements - Update CI/CD packaging commands with platform limitations - Ensure consistent platform availability information across docs
1 parent df3c84a commit 90ae4c3

File tree

8 files changed

+17
-1028
lines changed

8 files changed

+17
-1028
lines changed

resources/views/docs/mobile/1/apis/dialog.md

Lines changed: 0 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -94,104 +94,6 @@ public function handleAlertButton($index, $label)
9494
}
9595
```
9696

97-
## Example Usage
98-
99-
```php
100-
use Livewire\Component;
101-
use Livewire\Attributes\On;
102-
use Native\Mobile\Facades\Dialog;
103-
use Native\Mobile\Events\Alert\ButtonPressed;
104-
105-
class ItemManager extends Component
106-
{
107-
public array $items = [];
108-
public ?int $itemToDelete = null;
109-
110-
public function deleteItem(int $itemId)
111-
{
112-
$this->itemToDelete = $itemId;
113-
114-
Dialog::alert(
115-
'Delete Item',
116-
'This action cannot be undone. Are you sure?',
117-
['Cancel', 'Delete']
118-
);
119-
}
120-
121-
#[On('native:' . ButtonPressed::class)]
122-
public function handleDeleteConfirmation($index, $label)
123-
{
124-
if ($index === 1 && $this->itemToDelete) {
125-
// User confirmed deletion
126-
$this->performDelete($this->itemToDelete);
127-
Dialog::toast('Item deleted successfully');
128-
$this->itemToDelete = null;
129-
} else {
130-
// User cancelled
131-
Dialog::toast("You pressed '{$label}'");
132-
$this->itemToDelete = null;
133-
}
134-
}
135-
136-
public function shareItem(array $item)
137-
{
138-
Dialog::share(
139-
'Share Item',
140-
"Check out this item: {$item['name']}",
141-
"https://myapp.com/items/{$item['id']}"
142-
);
143-
}
144-
145-
public function showSuccess(string $message)
146-
{
147-
Dialog::toast($message);
148-
}
149-
150-
private function performDelete(int $itemId)
151-
{
152-
$this->items = array_filter(
153-
$this->items,
154-
fn($item) => $item['id'] !== $itemId
155-
);
156-
}
157-
158-
public function render()
159-
{
160-
return view('livewire.item-manager');
161-
}
162-
}
163-
```
164-
165-
## Alert Button Examples
166-
167-
### Simple Confirmation
168-
```php
169-
Dialog::alert(
170-
'Delete Account',
171-
'This will permanently delete your account and all data.',
172-
['Cancel', 'Delete']
173-
);
174-
```
175-
176-
### Three Button Options
177-
```php
178-
Dialog::alert(
179-
'Save Changes',
180-
'Do you want to save your changes before closing?',
181-
['Cancel', 'Don\'t Save', 'Save']
182-
);
183-
```
184-
185-
### Single Button Alert
186-
```php
187-
Dialog::alert(
188-
'Welcome!',
189-
'Thanks for downloading our app!',
190-
['OK']
191-
);
192-
```
193-
194-
19597
## Toast Guidelines
19698

19799
### Best Practices
@@ -210,29 +112,6 @@ Dialog::toast('Settings updated');
210112
Dialog::toast('Your photo has been successfully uploaded to the server and will be processed shortly');
211113
```
212114

213-
## Sharing Content
214-
215-
### Supported Content Types
216-
- Plain text
217-
- URLs
218-
- Images (when sharing files)
219-
- Mixed content
220-
221-
```php
222-
// Share just text
223-
Dialog::share('', 'Check out this amazing app!', '');
224-
225-
// Share a URL
226-
Dialog::share('', '', 'https://nativephp.com');
227-
228-
// Share text and URL together
229-
Dialog::share(
230-
'NativePHP for Mobile',
231-
'Build mobile apps with PHP and Laravel!',
232-
'https://nativephp.com'
233-
);
234-
```
235-
236115
## Platform Differences
237116

238117
### iOS

resources/views/docs/mobile/1/apis/geolocation.md

Lines changed: 0 additions & 207 deletions
Original file line numberDiff line numberDiff line change
@@ -164,142 +164,6 @@ public function handlePermissionRequest($location, $coarseLocation, $fineLocatio
164164
}
165165
```
166166

167-
## Complete Example
168-
169-
```php
170-
use Livewire\Component;
171-
use Livewire\Attributes\On;
172-
use Native\Mobile\Facades\Geolocation;
173-
use Native\Mobile\Events\Geolocation\LocationReceived;
174-
use Native\Mobile\Events\Geolocation\PermissionStatusReceived;
175-
use Native\Mobile\Events\Geolocation\PermissionRequestResult;
176-
177-
class LocationTracker extends Component
178-
{
179-
public ?float $latitude = null;
180-
public ?float $longitude = null;
181-
public ?float $accuracy = null;
182-
public ?string $provider = null;
183-
public bool $isLoading = false;
184-
public string $error = '';
185-
public bool $showSettingsPrompt = false;
186-
187-
// Permission states
188-
public string $locationPermission = 'unknown';
189-
public string $coarsePermission = 'unknown';
190-
public string $finePermission = 'unknown';
191-
192-
public function mount()
193-
{
194-
// Check current permissions on load
195-
$this->checkPermissions();
196-
}
197-
198-
public function checkPermissions()
199-
{
200-
$this->error = '';
201-
Geolocation::checkPermissions();
202-
}
203-
204-
public function requestPermissions()
205-
{
206-
$this->error = '';
207-
$this->isLoading = true;
208-
Geolocation::requestPermissions();
209-
}
210-
211-
public function getCurrentLocation()
212-
{
213-
$this->isLoading = true;
214-
$this->error = '';
215-
216-
// Use high accuracy GPS
217-
Geolocation::getCurrentPosition(true);
218-
}
219-
220-
#[On('native:' . PermissionStatusReceived::class)]
221-
public function handlePermissionStatus($location, $coarseLocation, $fineLocation)
222-
{
223-
$this->locationPermission = $location;
224-
$this->coarsePermission = $coarseLocation;
225-
$this->finePermission = $fineLocation;
226-
227-
if ($coarseLocation === 'granted' || $fineLocation === 'granted') {
228-
// Has some level of location permission
229-
$this->showLocationButton = true;
230-
} elseif ($location === 'denied') {
231-
// Permission denied - can request again
232-
$this->showRequestButton = true;
233-
} else {
234-
// Permission not determined - can request
235-
$this->showRequestButton = true;
236-
}
237-
}
238-
239-
#[On('native:' . PermissionRequestResult::class)]
240-
public function handlePermissionRequest($location, $coarseLocation, $fineLocation, $message = null, $needsSettings = null)
241-
{
242-
$this->isLoading = false;
243-
244-
if ($location === 'permanently_denied') {
245-
$this->error = $message ?? 'Location access permanently denied. Please enable location services in your device Settings app.';
246-
$this->showSettingsPrompt = true;
247-
} elseif ($coarseLocation === 'granted' || $fineLocation === 'granted') {
248-
// Permission granted - automatically get location
249-
$this->getCurrentLocation();
250-
} else {
251-
$this->error = 'Location permission is required to use this feature.';
252-
}
253-
}
254-
255-
#[On('native:' . LocationReceived::class)]
256-
public function handleLocationReceived($success = null, $latitude = null, $longitude = null, $accuracy = null, $timestamp = null, $provider = null, $error = null)
257-
{
258-
$this->isLoading = false;
259-
260-
if ($success) {
261-
$this->latitude = $latitude;
262-
$this->longitude = $longitude;
263-
$this->accuracy = $accuracy;
264-
$this->provider = $provider;
265-
$this->error = '';
266-
267-
// Store for later use
268-
session([
269-
'last_location' => [
270-
'lat' => $latitude,
271-
'lng' => $longitude,
272-
'accuracy' => $accuracy,
273-
'timestamp' => $timestamp,
274-
'provider' => $provider
275-
]
276-
]);
277-
278-
Log::info('Location updated', [
279-
'lat' => $latitude,
280-
'lng' => $longitude,
281-
'accuracy' => $accuracy
282-
]);
283-
284-
} else {
285-
$this->error = $error ?? 'Failed to get current location';
286-
Log::warning('Location request failed', ['error' => $error]);
287-
}
288-
}
289-
290-
public function openSettings()
291-
{
292-
// You might want to show instructions or deep link to settings
293-
$this->dispatch('show-settings-instructions');
294-
}
295-
296-
public function render()
297-
{
298-
return view('livewire.location-tracker');
299-
}
300-
}
301-
```
302-
303167
## Understanding Permission States
304168

305169
### Permission Types
@@ -316,45 +180,6 @@ class LocationTracker extends Component
316180
- More battery usage
317181
- Slower initial location fix
318182

319-
### Permission Flow
320-
321-
```php
322-
class PermissionFlowExample extends Component
323-
{
324-
public function handleLocationFlow()
325-
{
326-
// 1. Check current permissions
327-
Geolocation::checkPermissions();
328-
}
329-
330-
#[On('native:' . PermissionStatusReceived::class)]
331-
public function handleCheck($location, $coarseLocation, $fineLocation)
332-
{
333-
if ($coarseLocation === 'granted' || $fineLocation === 'granted') {
334-
// 2a. Permission already granted - get location
335-
Geolocation::getCurrentPosition(true);
336-
} else {
337-
// 2b. Need to request permission
338-
Geolocation::requestPermissions();
339-
}
340-
}
341-
342-
#[On('native:' . PermissionRequestResult::class)]
343-
public function handleRequest($location, $coarseLocation, $fineLocation, $message = null, $needsSettings = null)
344-
{
345-
if ($location === 'permanently_denied') {
346-
// 3a. User must enable in Settings
347-
$this->showSettingsInstructions($message);
348-
} elseif ($coarseLocation === 'granted' || $fineLocation === 'granted') {
349-
// 3b. Permission granted - get location
350-
Geolocation::getCurrentPosition(true);
351-
} else {
352-
// 3c. Permission denied - show explanation
353-
$this->showPermissionExplanation();
354-
}
355-
}
356-
}
357-
```
358183

359184
## Platform Support
360185

@@ -379,38 +204,6 @@ class PermissionFlowExample extends Component
379204
- **Use appropriate accuracy** - don't request fine location if coarse is sufficient
380205
- **Limit frequency** - don't request location updates constantly
381206

382-
### User Experience Tips
383-
384-
```php
385-
class LocationUX extends Component
386-
{
387-
public function requestLocationWithExplanation()
388-
{
389-
// Show explanation first
390-
$this->showExplanation = true;
391-
}
392-
393-
public function proceedWithLocationRequest()
394-
{
395-
$this->showExplanation = false;
396-
397-
// Now request permission
398-
Geolocation::requestPermissions();
399-
}
400-
401-
public function handleDeniedGracefully($location, $coarseLocation, $fineLocation)
402-
{
403-
if ($location === 'permanently_denied') {
404-
// Offer manual location entry
405-
$this->showManualLocationEntry = true;
406-
} else {
407-
// Show benefit of enabling location
408-
$this->showLocationBenefits = true;
409-
}
410-
}
411-
}
412-
```
413-
414207
## Accuracy and Performance
415208

416209
### Choosing Accuracy Level

0 commit comments

Comments
 (0)