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
Our `usePhotoGallery` function exposes a method called takePhoto, which in turn calls the Capacitor Camera API's `getPhoto` method.
51
+
Our `usePhotoGallery` function exposes a method called `addNewToGallery`, which in turn calls the Capacitor Camera API's `getPhoto` method.
52
52
53
53
Notice the magic here: there's no platform-specific code (web, iOS, or Android)! The Capacitor Camera plugin abstracts that away for us, leaving just one method call - `getPhoto()` - that will open up the device's camera and allow us to take photos.
54
54
55
55
The last step we need to take is to use the new function in the Tab2 page. Go back to `Tab2Page.vue`.
56
56
57
-
Import `usePhotoGallery` and destructure the `takePhoto` function so we can use it in our `template`:
57
+
Import `usePhotoGallery` and destructure the `addNewToGallery` function so we can use it in our `template`:
58
58
59
59
```html
60
60
<template>
@@ -71,7 +71,7 @@ Import `usePhotoGallery` and destructure the `takePhoto` function so we can use
When the camera is done taking a picture, the resulting `Photo` returned from Capacitor will be added to the `photos` array. Update the `takePhoto` function with the following:
141
+
When the camera is done taking a picture, the resulting `Photo` returned from Capacitor will be added to the `photos` array. Update the `addNewToGallery` function with the following:
0 commit comments