Skip to content

Commit 1dd6a12

Browse files
committed
update(photo service): Add better types
1 parent 214a160 commit 1dd6a12

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/app/services/photo.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ export class PhotoService {
105105
}
106106
else {
107107
// Fetch the photo, read as a blob, then convert to base64 format
108-
const response = await fetch(cameraPhoto.webPath);
108+
const response = await fetch(cameraPhoto.webPath!);
109109
const blob = await response.blob();
110110

111111
return await this.convertBlobToBase64(blob) as string;
112112
}
113113
}
114114

115115
// Retrieve the photo metadata based on the platform the app is running on
116-
private async getPhotoFile(cameraPhoto, fileName) {
116+
private async getPhotoFile(cameraPhoto: CameraPhoto, fileName: string) {
117117
if (this.platform.is('hybrid')) {
118118
// Get the new, complete filepath of the photo saved on filesystem
119119
const fileUri = await Filesystem.getUri({
@@ -157,7 +157,7 @@ export class PhotoService {
157157
});
158158
}
159159

160-
convertBlobToBase64 = blob => new Promise((resolve, reject) => {
160+
convertBlobToBase64 = (blob: Blob) => new Promise((resolve, reject) => {
161161
const reader = new FileReader;
162162
reader.onerror = reject;
163163
reader.onload = () => {
@@ -167,7 +167,7 @@ export class PhotoService {
167167
});
168168
}
169169

170-
class Photo {
170+
interface Photo {
171171
filepath: string;
172172
webviewPath: string;
173173
base64?: string;

0 commit comments

Comments
 (0)