You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/angular/your-first-app.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,9 +34,9 @@ We'll create a Photo Gallery app that offers the ability to take photos with you
34
34
35
35
Highlights include:
36
36
37
-
- One Angular-based codebase that runs on the web, iOS, and Android using Ionic Framework [UI components](https://ionicframework.com/docs/components).
37
+
- One Angular-based codebase that runs on the web, iOS, and Android using Ionic Framework [UI components](../components.md).
38
38
- Deployed as a native iOS and Android mobile app using [Capacitor](https://capacitorjs.com), Ionic's official native app runtime.
39
-
- Photo Gallery functionality powered by the Capacitor [Camera](https://capacitorjs.com/docs/apis/camera), [Filesystem](https://capacitorjs.com/docs/apis/filesystem), and [Preferences](https://capacitorjs.com/docs/apis/preferences) APIs.
39
+
- Photo Gallery functionality powered by the Capacitor [Camera](../native/camera.md), [Filesystem](../native/filesystem.md), and [Preferences](../native/preferences.md) APIs.
40
40
41
41
Find the complete app code referenced in this guide [on GitHub](https://github.com/ionic-team/photo-gallery-capacitor-ng).
42
42
@@ -114,7 +114,7 @@ import { AppModule } from './app/app.module';
Copy file name to clipboardExpand all lines: docs/angular/your-first-app/2-taking-photos.md
+3-7Lines changed: 3 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ sidebar_label: Taking Photos
11
11
/>
12
12
</head>
13
13
14
-
Now for the fun part - adding the ability to take photos with the device’s camera using the Capacitor [Camera API](https://capacitorjs.com/docs/apis/camera). We’ll begin with building it for the web, then make some small tweaks to make it work on mobile (iOS and Android).
14
+
Now for the fun part - adding the ability to take photos with the device’s camera using the Capacitor [Camera API](../../native/camera.md). We’ll begin with building it for the web, then make some small tweaks to make it work on mobile (iOS and Android).
15
15
16
16
## Photo Service
17
17
@@ -147,9 +147,10 @@ export class PhotoService {
147
147
}
148
148
```
149
149
150
-
Over in the `addNewToGallery` method, add the newly captured photo to the beginning of the Photos array.
150
+
Over in the `addNewToGallery` method, add the newly captured photo to the beginning of the `photos` array.
151
151
152
152
```ts
153
+
// CHANGE: Update `addNewToGallery()` method.
153
154
publicasyncaddNewToGallery() {
154
155
const capturedPhoto =awaitCamera.getPhoto({
155
156
resultType: CameraResultType.Uri,
@@ -169,7 +170,6 @@ public async addNewToGallery() {
Copy file name to clipboardExpand all lines: docs/angular/your-first-app/5-adding-mobile.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ export class PhotoService {
42
42
43
43
## Platform-specific Logic
44
44
45
-
First, we’ll update the photo saving functionality to support mobile. In the `readAsBase64()`function, check which platform the app is running on. If it’s “hybrid” (Capacitor or Cordova, two native runtimes), then read the photo file into base64 format using the `Filesystem`'s' `readFile()` method. Otherwise, use the same logic as before when running the app on the web.
45
+
First, we’ll update the photo saving functionality to support mobile. In the `readAsBase64()`method, check which platform the app is running on. If it’s “hybrid” (Capacitor or Cordova, two native runtimes), then read the photo file into base64 format using the `Filesystem`'s' `readFile()` method. Otherwise, use the logic as before when running the app on the web.
46
46
47
47
Update `readAsBase64()` to look like the following:
Next, head back over to the `loadSaved()` method we implemented for the web earlier. On mobile, we can directly set the source of an image tag - `<img src="x" />` - to each photo file on the `Filesystem`, displaying them automatically. Thus, only the web requires reading each image from the `Filesystem` into base64 format. Update this method to add an _if statement_ around the `Filesystem` code:
109
+
Next, add a new bit of logic in the `loadSaved()` method. On mobile, we can directly point to each photo file on the Filesystem and display them automatically. On the web, however, we must read each image from the Filesystem into base64 format. This is because the Filesystem API uses [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) under the hood. Update the `loadSaved()` method:
0 commit comments