Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5aa7b3f
Merge pull request #1198 from numbersprotocol/develop
shc261392 Jan 27, 2022
fe1813a
remove unused GoPro UI components
sultanmyrza Jan 28, 2022
d994209
style(go-pro-media-item-detail-on-camera.component.html)
sultanmyrza Jan 28, 2022
06808dd
fix(go-pro-media-item-detail-on-camera.component.ts)
sultanmyrza Jan 28, 2022
6b9a1d6
refactor(go-pro-bluetooth.service.ts)
sultanmyrza Jan 28, 2022
7b8786e
style(go-pro.page.html)
sultanmyrza Jan 28, 2022
4a53b02
feat: trigger bluetooth pairing at first connection
sultanmyrza Jan 28, 2022
ffaee21
change(go-pro-media.servie.ts): refactor, remove unused methods
sultanmyrza Jan 28, 2022
bee915c
feat(go-pro-media-list-on-camera): multi-select upload
sultanmyrza Jan 28, 2022
e045837
add missing "node_modules/ngx-long-press2"
sultanmyrza Jan 28, 2022
df37236
fix(go-pro-media-list-on-camera.component.scss):
sultanmyrza Jan 28, 2022
c98c7a0
move html styles to scss classes
sultanmyrza Feb 8, 2022
66191db
fix(go-pro.page): typo
sultanmyrza Feb 8, 2022
d03c833
refactor(go-pro-bluetooth.service.ts): use isEqual
sultanmyrza Feb 8, 2022
ccb1320
refactor(go-pro-bluetooth.service.ts): lazy init
sultanmyrza Feb 10, 2022
73668e0
refactor(go-pro-page.ts): use try-catch-finally block
sultanmyrza Feb 10, 2022
03dd1d6
refactor(go-pro-media-list-on-camera.component.ts)
sultanmyrza Feb 10, 2022
a8e8dac
refactor(go-pro-media-list-on-camera.component.ts):
sultanmyrza Feb 10, 2022
5c98461
refactor(go-pro.page.ts): remove unused comments
sultanmyrza Feb 10, 2022
8c26a53
refactor(go-pro-media.service.ts): remove unused methods
sultanmyrza Feb 10, 2022
2f0ce31
refactor(go-pro-media.service.ts): move url utility
sultanmyrza Feb 10, 2022
1688367
refactor(go-pro-wifi.service.ts): use preferenceManager
sultanmyrza Feb 12, 2022
4e5d9a3
refactor(go-pro-bluetooth.service.ts):
sultanmyrza Feb 12, 2022
f071852
refactor(home.page.ts): fix no-async-promise-executor
sultanmyrza Feb 12, 2022
cd713b0
fix(go-pro-bluetooth.service.ts): disconnect before connection to new…
sultanmyrza Feb 19, 2022
34ea1af
fix test related to GoPro Bluetoot and WiFi services
sultanmyrza Mar 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"immutable": "^4.0.0-rc.14",
"lodash-es": "^4.17.21",
"material-design-icons-iconfont": "^6.1.0",
"ngx-long-press2": "^2.0.0",
"ngx-pinch-zoom": "^2.6.0",
"process": "^0.11.10",
"rxjs": "^6.6.7",
Expand Down
66 changes: 34 additions & 32 deletions src/app/features/home/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Plugins } from '@capacitor/core';
import { ActionSheetController, AlertController } from '@ionic/angular';
import { TranslocoService } from '@ngneat/transloco';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { defer, EMPTY, iif, of } from 'rxjs';
import { combineLatest, defer, EMPTY, iif, of } from 'rxjs';
import {
catchError,
concatMap,
Expand Down Expand Up @@ -154,40 +154,42 @@ export class HomePage {
}

private presentCaptureActions$() {
return this.translocoService
.selectTranslateObject({
return combineLatest([
this.translocoService.selectTranslateObject({
takePicture: null,
recordVideo: null,
}),
this.goProBluetoothService.connectedDevice$,
]).pipe(
first(),
concatMap(([translations, connectedDevice]) => {
const [takePicture, recordVideo] = translations;

return new Promise<Media>(resolve => {
const buttons = [
{
text: takePicture,
handler: () => resolve(this.cameraService.takePhoto()),
},
{
text: recordVideo,
handler: () => resolve(this.recordVideo()),
},
];

if (connectedDevice) {
buttons.push({
text: 'Capture from GoPro',
handler: () => resolve(this.caputureFromGoPro()),
});
}

return this.actionSheetController
.create({ buttons })
.then(sheet => sheet.present());
});
})
.pipe(
first(),
concatMap(async ([takePicture, recordVideo]) => {
// eslint-disable-next-line no-async-promise-executor
return new Promise<Media>(async resolve => {
const buttons = [
{
text: takePicture,
handler: () => resolve(this.cameraService.takePhoto()),
},
{
text: recordVideo,
handler: () => resolve(this.recordVideo()),
},
];

if (await this.goProBluetoothService.getConnectedDevice()) {
buttons.push({
text: 'Capture from GoPro',
handler: () => resolve(this.caputureFromGoPro()),
});
}

return this.actionSheetController
.create({ buttons })
.then(sheet => sheet.present());
});
})
);
);
}

private async recordVideo() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@
Your browser does not support the video tag.
</video>

<div style="height: 24px"></div>
<ion-button (click)="uploadToCapture()" expand="block">
<div class="spacer"></div>
<ion-button
(click)="uploadToCapture()"
expand="block"
class="upload-to-capture-btn"
>
Upload to capture directly from camera
</ion-button>
</div>
Expand Down Expand Up @@ -184,7 +188,7 @@
</ion-slide>

<ion-slide>
<ion-item style="--background: #36393f" lines="none">
<ion-item lines="none">
<ion-checkbox
[checked]="dontShowAgainTutorialForMobileDataOnlyApps"
[(ngModel)]="dontShowAgainTutorialForMobileDataOnlyApps"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ ion-content {
padding-bottom: calc(5vh + env(safe-area-inset-bottom));
border: none;
}

ion-item {
--background: #36393f;
}
}
}
}
Expand All @@ -51,3 +55,14 @@ ion-content {
height: 90%;
}
}

.upload-to-capture-btn {
color: white;
margin: 0 16px;

--box-shadow: 0;
}

.spacer {
height: 24px;
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Location } from '@angular/common';
import { Component, Inject, OnInit } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { NetworkPlugin } from '@capacitor/core';
import {
AlertController,
LoadingController,
ToastController,
} from '@ionic/angular';
import { NETOWRK_PLUGIN } from '../../../../shared/capacitor-plugins/capacitor-plugins.module';
import { getFileType } from '../../../../../utils/url';
import { GoProFile } from '../go-pro-media-file';
import { GoProMediaService } from '../services/go-pro-media.service';
import { GoProWifiService } from '../services/go-pro-wifi.service';
Expand All @@ -33,11 +32,9 @@ export class GoProMediaItemDetailOnCameraComponent implements OnInit {
public alertController: AlertController,
public loadingController: LoadingController,
public goProMediaService: GoProMediaService,
public goProWiFiService: GoProWifiService,
@Inject(NETOWRK_PLUGIN)
private readonly networkPlugin: NetworkPlugin
public goProWiFiService: GoProWifiService
) {
this.route.queryParams.subscribe(() => {
this.route.queryParams.subscribe(_ => {
const state = this.router.getCurrentNavigation()?.extras.state;
if (state) {
this.mediaFile = state.goProMediaFile;
Expand All @@ -46,31 +43,7 @@ export class GoProMediaItemDetailOnCameraComponent implements OnInit {
}

ngOnInit() {
this.mediaType = GoProMediaService.getFileType(this.mediaFile?.url);
}

async downloadFileFromGoProCamera() {
if (!this.mediaFile) {
return;
}

const fileName = GoProMediaService.extractFileNameFromUrl(
this.mediaFile.url
);

const loading = await this.loadingController.create({
message: 'Please wait... Download in progress',
});
await loading.present();

try {
await this.goProMediaService.downloadFromGoProCamera(this.mediaFile);
this.presentToast(`${fileName} downloaded ✅`);
} catch (error) {
this.presentToast(`Failed to download ${fileName} ❌`);
}

await loading.dismiss();
this.mediaType = getFileType(this.mediaFile?.url);
}

async uploadToCapture() {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading