From 42f0ab8f3883b92fd7274a5b6c21e39ee43dd9fa Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Mon, 4 Apr 2022 18:59:16 +0800 Subject: [PATCH 01/32] feat: update text to "Asset Wallet History" from "Transaction History" --- src/app/features/wallets/wallets.page.html | 4 ++-- src/app/features/wallets/wallets.page.ts | 4 ++-- src/assets/i18n/en-us.json | 2 +- src/assets/i18n/zh-tw.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/features/wallets/wallets.page.html b/src/app/features/wallets/wallets.page.html index 142cb1499..c1fe41728 100644 --- a/src/app/features/wallets/wallets.page.html +++ b/src/app/features/wallets/wallets.page.html @@ -119,9 +119,9 @@

NUM

history -
{{ t('wallets.numTransactionHistory') }}
+
{{ t('wallets.assetWalletHistory') }}
- {{ + {{ t('wallets.viewOnBscScan') }}
diff --git a/src/app/features/wallets/wallets.page.ts b/src/app/features/wallets/wallets.page.ts index af3cc3bc7..da5fbb5f0 100644 --- a/src/app/features/wallets/wallets.page.ts +++ b/src/app/features/wallets/wallets.page.ts @@ -3,9 +3,9 @@ import { MatDialog } from '@angular/material/dialog'; import { MatIconRegistry } from '@angular/material/icon'; import { MatSnackBar } from '@angular/material/snack-bar'; import { DomSanitizer } from '@angular/platform-browser'; +import { Router } from '@angular/router'; import { Browser } from '@capacitor/browser'; import { Clipboard } from '@capacitor/clipboard'; -import { Router } from '@angular/router'; import { TranslocoService } from '@ngneat/transloco'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { BehaviorSubject, combineLatest, forkJoin } from 'rxjs'; @@ -79,7 +79,7 @@ export class WalletsPage { .subscribe(totalBalance => this.totalBalance$.next(totalBalance)); } - openNUMTransactionHistory() { + openAssetWalletHistory() { this.diaBackendWalletService.assetWalletAddr$ .pipe( first(), diff --git a/src/assets/i18n/en-us.json b/src/assets/i18n/en-us.json index 0bd9175bc..e77da0557 100644 --- a/src/assets/i18n/en-us.json +++ b/src/assets/i18n/en-us.json @@ -252,12 +252,12 @@ "wallets": "Wallets", "pullToRefreshBalance": "Pull to refresh balance", "assetWallet": "Asset Wallet", + "assetWalletHistory": "Asset Wallet History", "myAssetWallet": "My Asset Wallet", "myAssetWalletTooltip": "Main asset vault for Capture NFT and NUM", "integrityKey": "Integrity Key", "integrityWallet": "Integrity Wallet", "integrityWalletTooltip": "Wallet used for creating Signatures", - "numTransactionHistory": "Transaction History", "viewOnBscScan": "View on BscScan", "exportIntegrityKey": "Export Integrity Key", "transfer": "Transfer", diff --git a/src/assets/i18n/zh-tw.json b/src/assets/i18n/zh-tw.json index 656ecab2f..b13f5e3f1 100644 --- a/src/assets/i18n/zh-tw.json +++ b/src/assets/i18n/zh-tw.json @@ -252,6 +252,7 @@ "wallets": "錢包", "pullToRefreshBalance": "下拉以刷新餘額", "assetWallet": "資產錢包", + "assetWalletHistory": "資產錢包歷史", "myAssetWallet": "我的資產錢包", "myAssetWalletTooltip": "Capture NFT 和 NUM 的主要資產庫", "integrityKey": "完整性金鑰", @@ -265,7 +266,6 @@ "moveNumBetweenAssetWallet": "在資產錢包和完整性錢包", "andIntegrityWallet": "之間移動 NUM", "requestSent": "請求已送出", - "numTransactionHistory": "交易紀錄", "viewOnBscScan": "在 BscScan 上查看", "exportIntegrityKey": "匯出完整性金鑰", "gasFee": "油費", From 00ab118d53dc0cd2cda4cd577f5cbb769da48c20 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Mon, 4 Apr 2022 19:32:45 +0800 Subject: [PATCH 02/32] fix: change IPFS url to "http://ipfs-pin.numbersprotocol.io/ipfs/$CID" from "https://ipfs.io/ipfs/$CID" --- src/app/features/home/details/details.page.ts | 4 ++-- src/assets/i18n/en-us.json | 2 +- src/assets/i18n/zh-tw.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/features/home/details/details.page.ts b/src/app/features/home/details/details.page.ts index fdace8482..bf81055bc 100644 --- a/src/app/features/home/details/details.page.ts +++ b/src/app/features/home/details/details.page.ts @@ -272,7 +272,7 @@ export class DetailsPage { buttons.push({ text: messageCopyIpfsAddress, handler: () => { - const ipfsAddress = `https://ipfs.io/ipfs/${diaBackendAsset.cid}`; + const ipfsAddress = `http://ipfs-pin.numbersprotocol.io/ipfs/${diaBackendAsset.cid}`; this.copyToClipboard(ipfsAddress); resolve(); }, @@ -431,7 +431,7 @@ export class DetailsPage { return Browser.open({ url: diaBackendAsset.supporting_file.replace( 'ipfs://', - 'https://ipfs.io/ipfs/' + 'http://ipfs-pin.numbersprotocol.io/ipfs/' ), toolbarColor: '#564dfc', }); diff --git a/src/assets/i18n/en-us.json b/src/assets/i18n/en-us.json index 0bd9175bc..67035f640 100644 --- a/src/assets/i18n/en-us.json +++ b/src/assets/i18n/en-us.json @@ -152,7 +152,7 @@ "pleaseWait": "Please wait...", "copiedToClipboard": "Copied to clipboard.", "invitationEmail": "Enter friend's email to send the invitation.", - "clickingSignupToAgreePolicy": "By clicking Sign Up, you agree to our Privacy Policy.", + "clickingSignupToAgreePolicy": "By clicking Sign Up, you agree to our Privacy Policy.", "sendPostCaptureAlert": "After this Capture is sent, the ownership will be transferred to the selected friend. Are you sure?", "transactionReceived": "A new Capture received.", "transactionExpired": "A Capture you sent is returned.", diff --git a/src/assets/i18n/zh-tw.json b/src/assets/i18n/zh-tw.json index 656ecab2f..eb1b7d217 100644 --- a/src/assets/i18n/zh-tw.json +++ b/src/assets/i18n/zh-tw.json @@ -152,7 +152,7 @@ "pleaseWait": "請稍候...", "copiedToClipboard": "已複製至剪貼簿。", "invitationEmail": "輸入好友電子信箱發送邀請。", - "clickingSignupToAgreePolicy": "點擊「註冊」即表示你同意我們的《服務條款》和《資料政策》。", + "clickingSignupToAgreePolicy": "點擊「註冊」即表示你同意我們的《服務條款》和《資料政策》。", "sendPostCaptureAlert": "瞬時影像送出後,它的所有權將轉移至選定的朋友。您確定嗎?", "transactionReceived": "收到了新的瞬時影像。", "transactionExpired": "您寄出的瞬時影像已被退回。", From c4dd34fa5e86cb74e5439a97c8a7bf3b9008bec8 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Mon, 4 Apr 2022 21:20:43 +0800 Subject: [PATCH 03/32] feat: add icon to indicate capture with caption --- .../capture-item/capture-item.component.html | 31 ++++++++++++------- .../capture-item/capture-item.component.scss | 28 ++++++++++++----- .../capture-item/capture-item.component.ts | 9 +++++- 3 files changed, 49 insertions(+), 19 deletions(-) diff --git a/src/app/features/home/capture-tab/capture-item/capture-item.component.html b/src/app/features/home/capture-tab/capture-item/capture-item.component.html index adb4c2ea0..9bdf21344 100644 --- a/src/app/features/home/capture-tab/capture-item/capture-item.component.html +++ b/src/app/features/home/capture-tab/capture-item/capture-item.component.html @@ -6,17 +6,26 @@ name="hourglass-outline" class="collecting" > - - - + +
+ + + + +
+ this.diaBackendAssetRepository.fetchByProof$(proof)), + map(asset => asset.caption !== '') + ); + readonly isVideo$ = this.proof$.pipe( concatMap(proof => proof.getFirstAssetMeta()), map(meta => meta.mimeType.startsWith('video')) @@ -81,7 +87,8 @@ export class CaptureItemComponent { private readonly captureService: CaptureService, private readonly router: Router, private readonly route: ActivatedRoute, - private readonly sanitizer: DomSanitizer + private readonly sanitizer: DomSanitizer, + private readonly diaBackendAssetRepository: DiaBackendAssetRepository ) {} @HostListener('click') From e87bda6ab293a1611b2359469c70ce786577d510 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Wed, 6 Apr 2022 13:45:33 +0800 Subject: [PATCH 04/32] fix: change to https from http --- src/app/features/home/details/details.page.ts | 4 ++-- src/assets/i18n/en-us.json | 2 +- src/assets/i18n/zh-tw.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/features/home/details/details.page.ts b/src/app/features/home/details/details.page.ts index bf81055bc..ad24ce68d 100644 --- a/src/app/features/home/details/details.page.ts +++ b/src/app/features/home/details/details.page.ts @@ -272,7 +272,7 @@ export class DetailsPage { buttons.push({ text: messageCopyIpfsAddress, handler: () => { - const ipfsAddress = `http://ipfs-pin.numbersprotocol.io/ipfs/${diaBackendAsset.cid}`; + const ipfsAddress = `https://ipfs-pin.numbersprotocol.io/ipfs/${diaBackendAsset.cid}`; this.copyToClipboard(ipfsAddress); resolve(); }, @@ -431,7 +431,7 @@ export class DetailsPage { return Browser.open({ url: diaBackendAsset.supporting_file.replace( 'ipfs://', - 'http://ipfs-pin.numbersprotocol.io/ipfs/' + 'https://ipfs-pin.numbersprotocol.io/ipfs/' ), toolbarColor: '#564dfc', }); diff --git a/src/assets/i18n/en-us.json b/src/assets/i18n/en-us.json index 67035f640..b877f2123 100644 --- a/src/assets/i18n/en-us.json +++ b/src/assets/i18n/en-us.json @@ -152,7 +152,7 @@ "pleaseWait": "Please wait...", "copiedToClipboard": "Copied to clipboard.", "invitationEmail": "Enter friend's email to send the invitation.", - "clickingSignupToAgreePolicy": "By clicking Sign Up, you agree to our Privacy Policy.", + "clickingSignupToAgreePolicy": "By clicking Sign Up, you agree to our Privacy Policy.", "sendPostCaptureAlert": "After this Capture is sent, the ownership will be transferred to the selected friend. Are you sure?", "transactionReceived": "A new Capture received.", "transactionExpired": "A Capture you sent is returned.", diff --git a/src/assets/i18n/zh-tw.json b/src/assets/i18n/zh-tw.json index eb1b7d217..fcbd898a6 100644 --- a/src/assets/i18n/zh-tw.json +++ b/src/assets/i18n/zh-tw.json @@ -152,7 +152,7 @@ "pleaseWait": "請稍候...", "copiedToClipboard": "已複製至剪貼簿。", "invitationEmail": "輸入好友電子信箱發送邀請。", - "clickingSignupToAgreePolicy": "點擊「註冊」即表示你同意我們的《服務條款》和《資料政策》。", + "clickingSignupToAgreePolicy": "點擊「註冊」即表示你同意我們的《服務條款》和《資料政策》。", "sendPostCaptureAlert": "瞬時影像送出後,它的所有權將轉移至選定的朋友。您確定嗎?", "transactionReceived": "收到了新的瞬時影像。", "transactionExpired": "您寄出的瞬時影像已被退回。", From 3a77e8c7ebe02401f4e2065a1776adb7f4214866 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Wed, 6 Apr 2022 13:47:17 +0800 Subject: [PATCH 05/32] =?UTF-8?q?fix:=20translate=20assetWalletHistory=20a?= =?UTF-8?q?s=20=E8=B3=87=E7=94=A2=E4=BA=A4=E6=98=93=E7=B4=80=E9=8C=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/i18n/zh-tw.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/i18n/zh-tw.json b/src/assets/i18n/zh-tw.json index b13f5e3f1..ceb303cdc 100644 --- a/src/assets/i18n/zh-tw.json +++ b/src/assets/i18n/zh-tw.json @@ -252,7 +252,7 @@ "wallets": "錢包", "pullToRefreshBalance": "下拉以刷新餘額", "assetWallet": "資產錢包", - "assetWalletHistory": "資產錢包歷史", + "assetWalletHistory": "資產交易紀錄", "myAssetWallet": "我的資產錢包", "myAssetWalletTooltip": "Capture NFT 和 NUM 的主要資產庫", "integrityKey": "完整性金鑰", From d64d087a7bb65aadbc5b97930293a993a54bb810 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Fri, 8 Apr 2022 14:21:58 +0800 Subject: [PATCH 06/32] install fixed version for iOS of http plugin --- package-lock.json | 11 +++++------ package.json | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index c503a8b22..b851c4b80 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@angular/platform-browser-dynamic": "^12.2.4", "@angular/router": "^12.2.4", "@capacitor-community/bluetooth-le": "^1.7.0", - "@capacitor-community/http": "^1.4.1", + "@capacitor-community/http": "github:sultanmyrza/http#fix-catch-disabled-Local-Network-case-on-iOS", "@capacitor-community/wifi": "github:numbersprotocol/community-capacitor-wifi#capacitor3", "@capacitor/android": "https://gitpkg.now.sh/numbersprotocol/capacitor/android?release-3.4.1-range-request-fix", "@capacitor/app": "^1.1.0", @@ -2561,8 +2561,8 @@ }, "node_modules/@capacitor-community/http": { "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@capacitor-community/http/-/http-1.4.1.tgz", - "integrity": "sha512-+pCkBXrwfm97UfjOgjV950H/qZ8SE36Mrcb46BlL1ps3VIsGuIO+AulL8GqTC6LewheRVtGJpRspNtneXQotNA==", + "resolved": "git+ssh://git@github.com/sultanmyrza/http.git#5be0ddd0d55b5ff99467d5da86c88a173a677001", + "license": "MIT", "dependencies": { "@capacitor/android": "^3.0.0", "@capacitor/core": "^3.0.0", @@ -27083,9 +27083,8 @@ } }, "@capacitor-community/http": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@capacitor-community/http/-/http-1.4.1.tgz", - "integrity": "sha512-+pCkBXrwfm97UfjOgjV950H/qZ8SE36Mrcb46BlL1ps3VIsGuIO+AulL8GqTC6LewheRVtGJpRspNtneXQotNA==", + "version": "git+ssh://git@github.com/sultanmyrza/http.git#5be0ddd0d55b5ff99467d5da86c88a173a677001", + "from": "@capacitor-community/http@github:sultanmyrza/http#fix-catch-disabled-Local-Network-case-on-iOS", "requires": { "@capacitor/android": "^3.0.0", "@capacitor/core": "^3.0.0", diff --git a/package.json b/package.json index 8c8f20238..d8ad82c87 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@angular/platform-browser-dynamic": "^12.2.4", "@angular/router": "^12.2.4", "@capacitor-community/bluetooth-le": "^1.7.0", - "@capacitor-community/http": "^1.4.1", + "@capacitor-community/http": "github:sultanmyrza/http#fix-catch-disabled-Local-Network-case-on-iOS", "@capacitor-community/wifi": "github:numbersprotocol/community-capacitor-wifi#capacitor3", "@capacitor/android": "https://gitpkg.now.sh/numbersprotocol/capacitor/android?release-3.4.1-range-request-fix", "@capacitor/app": "^1.1.0", From bdac76ac2ff7f261a1eeda0f377c787899b0ec22 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Fri, 8 Apr 2022 14:22:38 +0800 Subject: [PATCH 07/32] use observable pref key to get GoPro lastConnected Device --- src/app/features/home/home.page.ts | 2 +- .../settings/go-pro/services/go-pro-bluetooth.service.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/features/home/home.page.ts b/src/app/features/home/home.page.ts index 685e67838..9015fabe2 100644 --- a/src/app/features/home/home.page.ts +++ b/src/app/features/home/home.page.ts @@ -172,7 +172,7 @@ export class HomePage { takePicture: null, recordVideo: null, }), - this.goProBluetoothService.connectedDevice$, + this.goProBluetoothService.lastConnectedDevice$, ]).pipe( first(), concatMap(([translations, connectedDevice]) => { diff --git a/src/app/features/settings/go-pro/services/go-pro-bluetooth.service.ts b/src/app/features/settings/go-pro/services/go-pro-bluetooth.service.ts index 8294fe2bc..1749c1150 100644 --- a/src/app/features/settings/go-pro/services/go-pro-bluetooth.service.ts +++ b/src/app/features/settings/go-pro/services/go-pro-bluetooth.service.ts @@ -65,6 +65,10 @@ export class GoProBluetoothService { undefined ); + readonly lastConnectedDevice$ = this.preferences.getString$( + PrefKeys.LAST_CONNECTED_BLUETOOTH_DEVICE + ); + constructor(private readonly preferenceManager: PreferenceManager) {} private async initialize() { From 24565c6f31ad4c63c6f7a86ae66c9807eaa76823 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Fri, 8 Apr 2022 14:29:18 +0800 Subject: [PATCH 08/32] fix: go pro connection related iOS edge cases --- ...go-pro-media-list-on-camera.component.html | 1 + .../go-pro-media-list-on-camera.component.ts | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.html b/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.html index 7f3854597..48aeac7d5 100644 --- a/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.html +++ b/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.html @@ -26,6 +26,7 @@

{{ t('gopro.connectedWiFi') }}: {{ connectedWifiSSID }}

{{ t('gopro.connectToGoProWiFi') }} diff --git a/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.ts b/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.ts index f57c7538c..9febd7a56 100644 --- a/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.ts +++ b/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.ts @@ -4,6 +4,7 @@ import { Router } from '@angular/router'; import { AlertController, NavController, + Platform, ToastController, } from '@ionic/angular'; import { GoProFile } from '../go-pro-media-file'; @@ -25,6 +26,7 @@ export class GoProMediaListOnCameraComponent implements OnInit { connectedWifiSSID: string | null = null; isConnectedToGoProWifi: boolean | undefined; + isConnectingToGoProWifi: boolean | undefined; isScrollingContent = false; @@ -42,6 +44,7 @@ export class GoProMediaListOnCameraComponent implements OnInit { private readonly alertCtrl: AlertController, private readonly goProBluetoothService: GoProBluetoothService, private readonly goProWifiService: GoProWifiService, + private readonly platform: Platform, public toastController: ToastController ) {} @@ -64,21 +67,34 @@ export class GoProMediaListOnCameraComponent implements OnInit { this.fetchingFilesError = undefined; this.fetchingFiles = true; this.allMediaFiles = await this.goProMediaService.getFilesFromGoPro(); - this.fetchingFiles = false; } catch (error: any) { - this.fetchingFilesError = error.toString(); + this.fetchingFilesError = 'Failed to fetch media from GoPro'; + if (this.platform.is('ios')) { + this.fetchingFilesError = + 'Please check iOS Settings > Capture > Local Network, make sure the permission of Local Network is allowed Capture app.'; + } this.allMediaFiles = []; + } finally { this.fetchingFiles = false; } } async connectToGoProWifi() { try { + this.isConnectingToGoProWifi = true; + + if (!(await this.goProBluetoothService.getConnectedDevice())) { + alert('Connect to GoPro via bluetooth first'); + // I need to show alert because when catching error below for some reason it's empty + throw new Error('Connect to GoPro via bluetooth first'); + } this.connectedWifiSSID = await this.goProWifiService.connectToGoProWiFi(); this.isConnectedToGoProWifi = true; await this.fetchFilesFromGoProWiFi(); } catch (error) { this.presentToast(JSON.stringify(error)); + } finally { + this.isConnectingToGoProWifi = false; } } From 8fccf463d16c749c7f85deb37cef7b6be6c8eba1 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Fri, 8 Apr 2022 14:34:47 +0800 Subject: [PATCH 09/32] install preview-video plugin for GoPro videos --- android/app/capacitor.build.gradle | 1 + android/app/src/main/assets/capacitor.plugins.json | 4 ++++ android/capacitor.settings.gradle | 3 +++ ios/App/Podfile | 1 + package-lock.json | 14 ++++++++++++++ package.json | 1 + 6 files changed, 24 insertions(+) diff --git a/android/app/capacitor.build.gradle b/android/app/capacitor.build.gradle index e390d9e4a..8dc57e7fc 100644 --- a/android/app/capacitor.build.gradle +++ b/android/app/capacitor.build.gradle @@ -25,6 +25,7 @@ dependencies { implementation project(':capacitor-share') implementation project(':capacitor-splash-screen') implementation project(':capacitor-storage') + implementation project(':numbersprotocol-preview-video') implementation project(':capacitor-blob-writer') } diff --git a/android/app/src/main/assets/capacitor.plugins.json b/android/app/src/main/assets/capacitor.plugins.json index aa76ce170..c2efb9086 100644 --- a/android/app/src/main/assets/capacitor.plugins.json +++ b/android/app/src/main/assets/capacitor.plugins.json @@ -63,6 +63,10 @@ "pkg": "@capacitor/storage", "classpath": "com.capacitorjs.plugins.storage.StoragePlugin" }, + { + "pkg": "@numbersprotocol/preview-video", + "classpath": "io.numbersprotocol.capturelite.plugins.previewvideo.PreviewVideoPlugin" + }, { "pkg": "capacitor-blob-writer", "classpath": "com.equimaps.capacitorblobwriter.BlobWriter" diff --git a/android/capacitor.settings.gradle b/android/capacitor.settings.gradle index 72c6a0451..00fd4567c 100644 --- a/android/capacitor.settings.gradle +++ b/android/capacitor.settings.gradle @@ -50,5 +50,8 @@ project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capa include ':capacitor-storage' project(':capacitor-storage').projectDir = new File('../node_modules/@capacitor/storage/android') +include ':numbersprotocol-preview-video' +project(':numbersprotocol-preview-video').projectDir = new File('../node_modules/@numbersprotocol/preview-video/android') + include ':capacitor-blob-writer' project(':capacitor-blob-writer').projectDir = new File('../node_modules/capacitor-blob-writer/android') diff --git a/ios/App/Podfile b/ios/App/Podfile index 39afafc75..4af80fd62 100644 --- a/ios/App/Podfile +++ b/ios/App/Podfile @@ -25,6 +25,7 @@ def capacitor_pods pod 'CapacitorShare', :path => '../../node_modules/@capacitor/share' pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen' pod 'CapacitorStorage', :path => '../../node_modules/@capacitor/storage' + pod 'NumbersprotocolPreviewVideo', :path => '../../node_modules/@numbersprotocol/preview-video' pod 'CapacitorBlobWriter', :path => '../../node_modules/capacitor-blob-writer' end diff --git a/package-lock.json b/package-lock.json index b851c4b80..75e4994e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,6 +46,7 @@ "@ngx-formly/core": "^5.10.22", "@ngx-formly/material": "^5.10.22", "@ngx-formly/schematics": "^5.10.22", + "@numbersprotocol/preview-video": "github:sultanmyrza/preview-video", "async-mutex": "^0.3.2", "buffer": "^5.7.1", "capacitor-blob-writer": "^1.0.4", @@ -4116,6 +4117,14 @@ "node": ">=10" } }, + "node_modules/@numbersprotocol/preview-video": { + "version": "0.0.1", + "resolved": "git+ssh://git@github.com/sultanmyrza/preview-video.git#2d19456109c8c9d364324d9c08e766580256f1f7", + "license": "MIT", + "peerDependencies": { + "@capacitor/core": "^3.0.0" + } + }, "node_modules/@schematics/angular": { "version": "12.2.4", "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-12.2.4.tgz", @@ -28212,6 +28221,11 @@ } } }, + "@numbersprotocol/preview-video": { + "version": "git+ssh://git@github.com/sultanmyrza/preview-video.git#2d19456109c8c9d364324d9c08e766580256f1f7", + "from": "@numbersprotocol/preview-video@github:sultanmyrza/preview-video", + "requires": {} + }, "@schematics/angular": { "version": "12.2.4", "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-12.2.4.tgz", diff --git a/package.json b/package.json index d8ad82c87..209587919 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "@ngx-formly/core": "^5.10.22", "@ngx-formly/material": "^5.10.22", "@ngx-formly/schematics": "^5.10.22", + "@numbersprotocol/preview-video": "github:sultanmyrza/preview-video", "async-mutex": "^0.3.2", "buffer": "^5.7.1", "capacitor-blob-writer": "^1.0.4", From ea9948351670e3268eb87f04ee2c4dc7ade84410 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Fri, 8 Apr 2022 14:36:07 +0800 Subject: [PATCH 10/32] enable the dataBinding build option, needed for preview-video plugin --- android/app/build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/android/app/build.gradle b/android/app/build.gradle index 874c579a3..1f74d8a69 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -10,6 +10,9 @@ android { versionName "0.54.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } + buildFeatures { + dataBinding true + } buildTypes { release { minifyEnabled false From a7d8e3a61ba6fb3850a7598e3f4518d28cdab48b Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Fri, 8 Apr 2022 14:39:54 +0800 Subject: [PATCH 11/32] use preivew-video plugin to play GoPro videos --- ...media-item-detail-on-camera.component.html | 29 +++++++---- ...media-item-detail-on-camera.component.scss | 22 ++++++++ ...o-media-item-detail-on-camera.component.ts | 21 ++++++++ ...a-viewer-with-native-player.component.html | 5 ++ ...a-viewer-with-native-player.component.scss | 15 ++++++ ...iewer-with-native-player.component.spec.ts | 28 ++++++++++ ...dia-viewer-with-native-player.component.ts | 52 +++++++++++++++++++ .../settings/go-pro/go-pro-routing.module.ts | 5 ++ .../features/settings/go-pro/go-pro.module.ts | 2 + 9 files changed, 170 insertions(+), 9 deletions(-) create mode 100644 src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.html create mode 100644 src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.scss create mode 100644 src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts create mode 100644 src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.ts diff --git a/src/app/features/settings/go-pro/go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component.html b/src/app/features/settings/go-pro/go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component.html index 1ce9a20cf..1693cd425 100644 --- a/src/app/features/settings/go-pro/go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component.html +++ b/src/app/features/settings/go-pro/go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component.html @@ -15,15 +15,26 @@ loading="lazy" > - +
+
+ + play_circle_outline +
+ + + + + +

Blur image (remove after Q&A)

+

GoPro thumbnails come in low quality.

+
+
+ + + +

go-pro-media-viewer-with-native-player

diff --git a/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.scss b/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.scss new file mode 100644 index 000000000..70df54079 --- /dev/null +++ b/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.scss @@ -0,0 +1,15 @@ +:host { + background-color: black; +} + +.dismiss { + position: absolute; + left: 0; + z-index: 1; + width: 48px; + height: 48px; + + --border-radius: 50%; + --padding-end: 0; + --padding-start: 0; +} diff --git a/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts b/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts new file mode 100644 index 000000000..cc7bfa756 --- /dev/null +++ b/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts @@ -0,0 +1,28 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { GoProMediaViewerWithNativePlayerComponent } from './go-pro-media-viewer-with-native-player.component'; + +describe('GoProMediaViewerWithNativePlayerComponent', () => { + let component: GoProMediaViewerWithNativePlayerComponent; + let fixture: ComponentFixture; + + beforeEach( + waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [GoProMediaViewerWithNativePlayerComponent], + imports: [IonicModule.forRoot()], + }).compileComponents(); + + fixture = TestBed.createComponent( + GoProMediaViewerWithNativePlayerComponent + ); + component = fixture.componentInstance; + fixture.detectChanges(); + }) + ); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.ts b/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.ts new file mode 100644 index 000000000..181740813 --- /dev/null +++ b/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.ts @@ -0,0 +1,52 @@ +import { Component, OnDestroy, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { NavController } from '@ionic/angular'; +import { PreviewVideo } from '@numbersprotocol/preview-video'; +import { GoProFile } from '../go-pro-media-file'; + +@Component({ + selector: 'app-go-pro-media-viewer-with-native-player', + templateUrl: './go-pro-media-viewer-with-native-player.component.html', + styleUrls: ['./go-pro-media-viewer-with-native-player.component.scss'], +}) +export class GoProMediaViewerWithNativePlayerComponent + implements OnInit, OnDestroy +{ + mediaFile: GoProFile | undefined; + + onIOSPlayerDismissedListener?: any; + + constructor( + private readonly route: ActivatedRoute, + private readonly router: Router, + private readonly navController: NavController + ) { + this.route.queryParams.subscribe(_ => { + const state = this.router.getCurrentNavigation()?.extras.state; + if (state) { + this.mediaFile = state.goProMediaFile; + } + }); + } + + ngOnInit(): void { + if (!this.mediaFile?.url) return; + PreviewVideo.playFullScreenFromRemote({ url: this.mediaFile.url }); + PreviewVideo.addListener('iosPlayerDismissed', (_info: any) => { + // eslint-disable-next-line no-console + console.log('ITS WORKING'); + this.navController.back(); + }); + } + + ngOnDestroy(): void { + PreviewVideo.stopFullScreen(); + // TODO: check if .remove() really get called + this.onIOSPlayerDismissedListener?.remove(); + } + + dismiss() { + PreviewVideo.stopFullScreen(); + this.navController.back(); + } +} diff --git a/src/app/features/settings/go-pro/go-pro-routing.module.ts b/src/app/features/settings/go-pro/go-pro-routing.module.ts index 04bc09385..4c63210fc 100644 --- a/src/app/features/settings/go-pro/go-pro-routing.module.ts +++ b/src/app/features/settings/go-pro/go-pro-routing.module.ts @@ -2,6 +2,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { GoProMediaItemDetailOnCameraComponent } from './go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component'; import { GoProMediaListOnCameraComponent } from './go-pro-media-list-on-camera/go-pro-media-list-on-camera.component'; +import { GoProMediaViewerWithNativePlayerComponent } from './go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component'; import { GoProPage } from './go-pro.page'; const routes: Routes = [ @@ -17,6 +18,10 @@ const routes: Routes = [ path: 'media-item-detail-on-camera', component: GoProMediaItemDetailOnCameraComponent, }, + { + path: 'media-item-viewer', + component: GoProMediaViewerWithNativePlayerComponent, + }, ]; @NgModule({ diff --git a/src/app/features/settings/go-pro/go-pro.module.ts b/src/app/features/settings/go-pro/go-pro.module.ts index 8b8e739e6..b4f8d245c 100644 --- a/src/app/features/settings/go-pro/go-pro.module.ts +++ b/src/app/features/settings/go-pro/go-pro.module.ts @@ -5,6 +5,7 @@ import { GoProMediaItemDetailOnCameraComponent } from './go-pro-media-item-detai import { GoProMediaListItemOnCameraComponent } from './go-pro-media-list-item-on-camera/go-pro-media-list-item-on-camera.component'; import { GoProMediaListOnCameraComponent } from './go-pro-media-list-on-camera/go-pro-media-list-on-camera.component'; import { GoProMediaLoadingBarComponent } from './go-pro-media-loading-bar/go-pro-media-loading-bar.component'; +import { GoProMediaViewerWithNativePlayerComponent } from './go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component'; import { GoProPageRoutingModule } from './go-pro-routing.module'; import { GoProPage } from './go-pro.page'; @@ -16,6 +17,7 @@ import { GoProPage } from './go-pro.page'; GoProMediaListItemOnCameraComponent, GoProMediaItemDetailOnCameraComponent, GoProMediaLoadingBarComponent, + GoProMediaViewerWithNativePlayerComponent, ], }) export class GoProPageModule {} From 18a851d03230414f35bc1a4542201aa8afe3edb5 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Fri, 8 Apr 2022 15:45:48 +0800 Subject: [PATCH 12/32] use preview-video plugin from numbersprotocol repo --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 75e4994e1..b369d94ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,7 +46,7 @@ "@ngx-formly/core": "^5.10.22", "@ngx-formly/material": "^5.10.22", "@ngx-formly/schematics": "^5.10.22", - "@numbersprotocol/preview-video": "github:sultanmyrza/preview-video", + "@numbersprotocol/preview-video": "github:numbersprotocol/preview-video", "async-mutex": "^0.3.2", "buffer": "^5.7.1", "capacitor-blob-writer": "^1.0.4", @@ -4119,7 +4119,7 @@ }, "node_modules/@numbersprotocol/preview-video": { "version": "0.0.1", - "resolved": "git+ssh://git@github.com/sultanmyrza/preview-video.git#2d19456109c8c9d364324d9c08e766580256f1f7", + "resolved": "git+ssh://git@github.com/numbersprotocol/preview-video.git#2d19456109c8c9d364324d9c08e766580256f1f7", "license": "MIT", "peerDependencies": { "@capacitor/core": "^3.0.0" @@ -28222,8 +28222,8 @@ } }, "@numbersprotocol/preview-video": { - "version": "git+ssh://git@github.com/sultanmyrza/preview-video.git#2d19456109c8c9d364324d9c08e766580256f1f7", - "from": "@numbersprotocol/preview-video@github:sultanmyrza/preview-video", + "version": "git+ssh://git@github.com/numbersprotocol/preview-video.git#2d19456109c8c9d364324d9c08e766580256f1f7", + "from": "@numbersprotocol/preview-video@numbersprotocol/preview-video", "requires": {} }, "@schematics/angular": { diff --git a/package.json b/package.json index 209587919..b18cad46a 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "@ngx-formly/core": "^5.10.22", "@ngx-formly/material": "^5.10.22", "@ngx-formly/schematics": "^5.10.22", - "@numbersprotocol/preview-video": "github:sultanmyrza/preview-video", + "@numbersprotocol/preview-video": "github:numbersprotocol/preview-video", "async-mutex": "^0.3.2", "buffer": "^5.7.1", "capacitor-blob-writer": "^1.0.4", From c7e22171e8a7c277160150e83cedb2efb5e980c3 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Fri, 8 Apr 2022 15:46:57 +0800 Subject: [PATCH 13/32] use http plugin fix from numbersprotocol repo --- package-lock.json | 10 +++++----- package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index b369d94ff..fc1c8d8ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@angular/platform-browser-dynamic": "^12.2.4", "@angular/router": "^12.2.4", "@capacitor-community/bluetooth-le": "^1.7.0", - "@capacitor-community/http": "github:sultanmyrza/http#fix-catch-disabled-Local-Network-case-on-iOS", + "@capacitor-community/http": "github:numbersprotocol/http#fix-catch-disabled-Local-Network-case-on-iOS", "@capacitor-community/wifi": "github:numbersprotocol/community-capacitor-wifi#capacitor3", "@capacitor/android": "https://gitpkg.now.sh/numbersprotocol/capacitor/android?release-3.4.1-range-request-fix", "@capacitor/app": "^1.1.0", @@ -2562,7 +2562,7 @@ }, "node_modules/@capacitor-community/http": { "version": "1.4.1", - "resolved": "git+ssh://git@github.com/sultanmyrza/http.git#5be0ddd0d55b5ff99467d5da86c88a173a677001", + "resolved": "git+ssh://git@github.com/numbersprotocol/http.git#a67d9fac94f8455a7fb00fc4b934ebff724afe9d", "license": "MIT", "dependencies": { "@capacitor/android": "^3.0.0", @@ -27092,8 +27092,8 @@ } }, "@capacitor-community/http": { - "version": "git+ssh://git@github.com/sultanmyrza/http.git#5be0ddd0d55b5ff99467d5da86c88a173a677001", - "from": "@capacitor-community/http@github:sultanmyrza/http#fix-catch-disabled-Local-Network-case-on-iOS", + "version": "git+ssh://git@github.com/numbersprotocol/http.git#a67d9fac94f8455a7fb00fc4b934ebff724afe9d", + "from": "@capacitor-community/http@numbersprotocol/http#fix-catch-disabled-Local-Network-case-on-iOS", "requires": { "@capacitor/android": "^3.0.0", "@capacitor/core": "^3.0.0", @@ -28223,7 +28223,7 @@ }, "@numbersprotocol/preview-video": { "version": "git+ssh://git@github.com/numbersprotocol/preview-video.git#2d19456109c8c9d364324d9c08e766580256f1f7", - "from": "@numbersprotocol/preview-video@numbersprotocol/preview-video", + "from": "@numbersprotocol/preview-video@github:numbersprotocol/preview-video", "requires": {} }, "@schematics/angular": { diff --git a/package.json b/package.json index b18cad46a..f26844384 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@angular/platform-browser-dynamic": "^12.2.4", "@angular/router": "^12.2.4", "@capacitor-community/bluetooth-le": "^1.7.0", - "@capacitor-community/http": "github:sultanmyrza/http#fix-catch-disabled-Local-Network-case-on-iOS", + "@capacitor-community/http": "github:numbersprotocol/http#fix-catch-disabled-Local-Network-case-on-iOS", "@capacitor-community/wifi": "github:numbersprotocol/community-capacitor-wifi#capacitor3", "@capacitor/android": "https://gitpkg.now.sh/numbersprotocol/capacitor/android?release-3.4.1-range-request-fix", "@capacitor/app": "^1.1.0", From ab892884ff9ed02adc9b5b22811c5786468fc61d Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Fri, 8 Apr 2022 16:01:17 +0800 Subject: [PATCH 14/32] use http plugin fix from numbersprotocol repo --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index b851c4b80..f7d0fd4e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@angular/platform-browser-dynamic": "^12.2.4", "@angular/router": "^12.2.4", "@capacitor-community/bluetooth-le": "^1.7.0", - "@capacitor-community/http": "github:sultanmyrza/http#fix-catch-disabled-Local-Network-case-on-iOS", + "@capacitor-community/http": "github:numbersprotocol/http#fix-catch-disabled-Local-Network-case-on-iOS", "@capacitor-community/wifi": "github:numbersprotocol/community-capacitor-wifi#capacitor3", "@capacitor/android": "https://gitpkg.now.sh/numbersprotocol/capacitor/android?release-3.4.1-range-request-fix", "@capacitor/app": "^1.1.0", @@ -2561,7 +2561,7 @@ }, "node_modules/@capacitor-community/http": { "version": "1.4.1", - "resolved": "git+ssh://git@github.com/sultanmyrza/http.git#5be0ddd0d55b5ff99467d5da86c88a173a677001", + "resolved": "git+ssh://git@github.com/numbersprotocol/http.git#a67d9fac94f8455a7fb00fc4b934ebff724afe9d", "license": "MIT", "dependencies": { "@capacitor/android": "^3.0.0", @@ -27083,8 +27083,8 @@ } }, "@capacitor-community/http": { - "version": "git+ssh://git@github.com/sultanmyrza/http.git#5be0ddd0d55b5ff99467d5da86c88a173a677001", - "from": "@capacitor-community/http@github:sultanmyrza/http#fix-catch-disabled-Local-Network-case-on-iOS", + "version": "git+ssh://git@github.com/numbersprotocol/http.git#a67d9fac94f8455a7fb00fc4b934ebff724afe9d", + "from": "@capacitor-community/http@numbersprotocol/http#fix-catch-disabled-Local-Network-case-on-iOS", "requires": { "@capacitor/android": "^3.0.0", "@capacitor/core": "^3.0.0", diff --git a/package.json b/package.json index d8ad82c87..7b35fb03e 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@angular/platform-browser-dynamic": "^12.2.4", "@angular/router": "^12.2.4", "@capacitor-community/bluetooth-le": "^1.7.0", - "@capacitor-community/http": "github:sultanmyrza/http#fix-catch-disabled-Local-Network-case-on-iOS", + "@capacitor-community/http": "github:numbersprotocol/http#fix-catch-disabled-Local-Network-case-on-iOS", "@capacitor-community/wifi": "github:numbersprotocol/community-capacitor-wifi#capacitor3", "@capacitor/android": "https://gitpkg.now.sh/numbersprotocol/capacitor/android?release-3.4.1-range-request-fix", "@capacitor/app": "^1.1.0", From 91003b4fb1c9ef49eac076e75a107c02415b4d45 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Mon, 11 Apr 2022 18:05:45 +0800 Subject: [PATCH 15/32] fix(go-pro-media-list-on-camera): use ErrorService instead of alert --- .../go-pro-media-list-on-camera.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.ts b/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.ts index 9febd7a56..243a56a5c 100644 --- a/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.ts +++ b/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.ts @@ -7,6 +7,7 @@ import { Platform, ToastController, } from '@ionic/angular'; +import { ErrorService } from '../../../../shared/error/error.service'; import { GoProFile } from '../go-pro-media-file'; import { GoProBluetoothService } from '../services/go-pro-bluetooth.service'; import { GoProMediaService } from '../services/go-pro-media.service'; @@ -45,6 +46,7 @@ export class GoProMediaListOnCameraComponent implements OnInit { private readonly goProBluetoothService: GoProBluetoothService, private readonly goProWifiService: GoProWifiService, private readonly platform: Platform, + private readonly errorService: ErrorService, public toastController: ToastController ) {} @@ -84,7 +86,7 @@ export class GoProMediaListOnCameraComponent implements OnInit { this.isConnectingToGoProWifi = true; if (!(await this.goProBluetoothService.getConnectedDevice())) { - alert('Connect to GoPro via bluetooth first'); + this.errorService.toastError$('Connect to GoPro via bluetooth first'); // I need to show alert because when catching error below for some reason it's empty throw new Error('Connect to GoPro via bluetooth first'); } From c736859e4f0a8f19eb71f8715e72c203e8e7b344 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Mon, 11 Apr 2022 18:30:36 +0800 Subject: [PATCH 16/32] fix: remove blurred effect on go pro cover image --- .../go-pro-media-item-detail-on-camera.component.html | 10 ---------- .../go-pro-media-item-detail-on-camera.component.scss | 5 ----- .../go-pro-media-item-detail-on-camera.component.ts | 3 --- 3 files changed, 18 deletions(-) diff --git a/src/app/features/settings/go-pro/go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component.html b/src/app/features/settings/go-pro/go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component.html index 1693cd425..20ebddae1 100644 --- a/src/app/features/settings/go-pro/go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component.html +++ b/src/app/features/settings/go-pro/go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component.html @@ -18,7 +18,6 @@
play_circle_outline
- - - - -

Blur image (remove after Q&A)

-

GoPro thumbnails come in low quality.

-
-
-
Date: Mon, 11 Apr 2022 18:49:57 +0800 Subject: [PATCH 17/32] fix: await on `errorService.toastError$` --- .../go-pro-media-list-on-camera.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.ts b/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.ts index 243a56a5c..b5e8f70cc 100644 --- a/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.ts +++ b/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.ts @@ -86,7 +86,9 @@ export class GoProMediaListOnCameraComponent implements OnInit { this.isConnectingToGoProWifi = true; if (!(await this.goProBluetoothService.getConnectedDevice())) { - this.errorService.toastError$('Connect to GoPro via bluetooth first'); + await this.errorService + .toastError$('Connect to GoPro via bluetooth first') + .toPromise(); // I need to show alert because when catching error below for some reason it's empty throw new Error('Connect to GoPro via bluetooth first'); } From da14b46291cc1bb7e6637ba0eda14c2e8f3739e8 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Mon, 11 Apr 2022 18:51:30 +0800 Subject: [PATCH 18/32] fix(go-pro-media-item-detail-on-camera): remove unused comments --- .../go-pro-media-item-detail-on-camera.component.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/app/features/settings/go-pro/go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component.ts b/src/app/features/settings/go-pro/go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component.ts index d735b6a6a..6971b3a4d 100644 --- a/src/app/features/settings/go-pro/go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component.ts +++ b/src/app/features/settings/go-pro/go-pro-media-item-detail-on-camera/go-pro-media-item-detail-on-camera.component.ts @@ -43,17 +43,6 @@ export class GoProMediaItemDetailOnCameraComponent implements OnInit { } ngOnInit() { - // TODO: git reset this function - // const goProMediaFile: GoProFile = { - // url: 'http://192.168.0.11:3000/thumbnail.mp4', - // name: 'thumbnail', - // size: 0, - // storageKey: '', - // thumbnailUrl: 'http://192.168.0.11:3000/thumbnail.jpeg', - // }; - // this.mediaFile = goProMediaFile; - // this.mediaType = getFileType(this.mediaFile.url); - this.mediaType = getFileType(this.mediaFile?.url); } From 3dc9cec5acf1d22c8d96d28818831b21715b2efc Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Mon, 11 Apr 2022 18:54:11 +0800 Subject: [PATCH 19/32] fix(go-pro-media-list-on-camera): remove unused comment --- .../go-pro-media-list-on-camera.component.html | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.html b/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.html index 48aeac7d5..03618e7a7 100644 --- a/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.html +++ b/src/app/features/settings/go-pro/go-pro-media-list-on-camera/go-pro-media-list-on-camera.component.html @@ -41,7 +41,6 @@

{{ t('gopro.connectedWiFi') }}: {{ connectedWifiSSID }}

{{ t('gopro.uploadToCapture') }}
-

{{ t('gopro.makeSureYouAreConnectedToGoProWiFiFirst') }}

From 8825052b96d895233b9a7cda67866ef2744e58f5 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Wed, 13 Apr 2022 18:57:30 +0800 Subject: [PATCH 20/32] install preview-camera plugin from sultanmyrza repo will change to numbersprotocol repo before pull request --- android/app/capacitor.build.gradle | 1 + .../app/src/main/assets/capacitor.plugins.json | 4 ++++ android/capacitor.settings.gradle | 3 +++ ios/App/Podfile | 1 + package-lock.json | 16 +++++++++++++++- package.json | 1 + 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/android/app/capacitor.build.gradle b/android/app/capacitor.build.gradle index 8dc57e7fc..3f80fddfe 100644 --- a/android/app/capacitor.build.gradle +++ b/android/app/capacitor.build.gradle @@ -25,6 +25,7 @@ dependencies { implementation project(':capacitor-share') implementation project(':capacitor-splash-screen') implementation project(':capacitor-storage') + implementation project(':numbersprotocol-preview-camera') implementation project(':numbersprotocol-preview-video') implementation project(':capacitor-blob-writer') diff --git a/android/app/src/main/assets/capacitor.plugins.json b/android/app/src/main/assets/capacitor.plugins.json index c2efb9086..952ae273f 100644 --- a/android/app/src/main/assets/capacitor.plugins.json +++ b/android/app/src/main/assets/capacitor.plugins.json @@ -63,6 +63,10 @@ "pkg": "@capacitor/storage", "classpath": "com.capacitorjs.plugins.storage.StoragePlugin" }, + { + "pkg": "@numbersprotocol/preview-camera", + "classpath": "io.numbersprotocol.capturelite.plugins.previewcamera.PreviewCameraPlugin" + }, { "pkg": "@numbersprotocol/preview-video", "classpath": "io.numbersprotocol.capturelite.plugins.previewvideo.PreviewVideoPlugin" diff --git a/android/capacitor.settings.gradle b/android/capacitor.settings.gradle index 00fd4567c..82f3a2aa4 100644 --- a/android/capacitor.settings.gradle +++ b/android/capacitor.settings.gradle @@ -50,6 +50,9 @@ project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capa include ':capacitor-storage' project(':capacitor-storage').projectDir = new File('../node_modules/@capacitor/storage/android') +include ':numbersprotocol-preview-camera' +project(':numbersprotocol-preview-camera').projectDir = new File('../node_modules/@numbersprotocol/preview-camera/android') + include ':numbersprotocol-preview-video' project(':numbersprotocol-preview-video').projectDir = new File('../node_modules/@numbersprotocol/preview-video/android') diff --git a/ios/App/Podfile b/ios/App/Podfile index 4af80fd62..3a6b06b05 100644 --- a/ios/App/Podfile +++ b/ios/App/Podfile @@ -25,6 +25,7 @@ def capacitor_pods pod 'CapacitorShare', :path => '../../node_modules/@capacitor/share' pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen' pod 'CapacitorStorage', :path => '../../node_modules/@capacitor/storage' + pod 'NumbersprotocolPreviewCamera', :path => '../../node_modules/@numbersprotocol/preview-camera' pod 'NumbersprotocolPreviewVideo', :path => '../../node_modules/@numbersprotocol/preview-video' pod 'CapacitorBlobWriter', :path => '../../node_modules/capacitor-blob-writer' end diff --git a/package-lock.json b/package-lock.json index fc1c8d8ba..43624ef53 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,6 +46,7 @@ "@ngx-formly/core": "^5.10.22", "@ngx-formly/material": "^5.10.22", "@ngx-formly/schematics": "^5.10.22", + "@numbersprotocol/preview-camera": "github:sultanmyrza/preview-camera", "@numbersprotocol/preview-video": "github:numbersprotocol/preview-video", "async-mutex": "^0.3.2", "buffer": "^5.7.1", @@ -4117,6 +4118,14 @@ "node": ">=10" } }, + "node_modules/@numbersprotocol/preview-camera": { + "version": "0.0.1", + "resolved": "git+ssh://git@github.com/sultanmyrza/preview-camera.git#6bbe8d2495d3b25238952ec442525405b0d9a48b", + "license": "MIT", + "peerDependencies": { + "@capacitor/core": "^3.0.0" + } + }, "node_modules/@numbersprotocol/preview-video": { "version": "0.0.1", "resolved": "git+ssh://git@github.com/numbersprotocol/preview-video.git#2d19456109c8c9d364324d9c08e766580256f1f7", @@ -27093,7 +27102,7 @@ }, "@capacitor-community/http": { "version": "git+ssh://git@github.com/numbersprotocol/http.git#a67d9fac94f8455a7fb00fc4b934ebff724afe9d", - "from": "@capacitor-community/http@numbersprotocol/http#fix-catch-disabled-Local-Network-case-on-iOS", + "from": "@capacitor-community/http@github:numbersprotocol/http#fix-catch-disabled-Local-Network-case-on-iOS", "requires": { "@capacitor/android": "^3.0.0", "@capacitor/core": "^3.0.0", @@ -28221,6 +28230,11 @@ } } }, + "@numbersprotocol/preview-camera": { + "version": "git+ssh://git@github.com/sultanmyrza/preview-camera.git#6bbe8d2495d3b25238952ec442525405b0d9a48b", + "from": "@numbersprotocol/preview-camera@github:sultanmyrza/preview-camera", + "requires": {} + }, "@numbersprotocol/preview-video": { "version": "git+ssh://git@github.com/numbersprotocol/preview-video.git#2d19456109c8c9d364324d9c08e766580256f1f7", "from": "@numbersprotocol/preview-video@github:numbersprotocol/preview-video", diff --git a/package.json b/package.json index f26844384..52cfe86d3 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "@ngx-formly/core": "^5.10.22", "@ngx-formly/material": "^5.10.22", "@ngx-formly/schematics": "^5.10.22", + "@numbersprotocol/preview-camera": "github:sultanmyrza/preview-camera", "@numbersprotocol/preview-video": "github:numbersprotocol/preview-video", "async-mutex": "^0.3.2", "buffer": "^5.7.1", From 2ad94abda8d77e5ff05e8fe60d3d2829158938e7 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Wed, 13 Apr 2022 19:01:27 +0800 Subject: [PATCH 21/32] install ng-circle-progress pkg for circle progress UI --- package-lock.json | 22 ++++++++++++++++++++++ package.json | 1 + 2 files changed, 23 insertions(+) diff --git a/package-lock.json b/package-lock.json index 43624ef53..7e98a1558 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,6 +55,7 @@ "immutable": "^4.0.0-rc.14", "lodash-es": "^4.17.21", "material-design-icons-iconfont": "^6.1.0", + "ng-circle-progress": "^1.6.0", "ngx-long-press2": "^2.0.0", "ngx-pinch-zoom": "^2.6.0", "process": "^0.11.10", @@ -14745,6 +14746,19 @@ "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, + "node_modules/ng-circle-progress": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/ng-circle-progress/-/ng-circle-progress-1.6.0.tgz", + "integrity": "sha512-HD7Uthog/QjRBFKrrnbOrm313CrkkWiTxENR7PjUy9lSUkuys5HdT0+E8UiHDk8VLSxC/pMmrx3eyYLhNq7EnQ==", + "dependencies": { + "tslib": "^2.0.0" + }, + "peerDependencies": { + "@angular/common": ">=9.1.0", + "@angular/core": ">=9.1.0", + "rxjs": ">=6.4.0" + } + }, "node_modules/ngx-long-press2": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ngx-long-press2/-/ngx-long-press2-2.0.0.tgz", @@ -36549,6 +36563,14 @@ "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, + "ng-circle-progress": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/ng-circle-progress/-/ng-circle-progress-1.6.0.tgz", + "integrity": "sha512-HD7Uthog/QjRBFKrrnbOrm313CrkkWiTxENR7PjUy9lSUkuys5HdT0+E8UiHDk8VLSxC/pMmrx3eyYLhNq7EnQ==", + "requires": { + "tslib": "^2.0.0" + } + }, "ngx-long-press2": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ngx-long-press2/-/ngx-long-press2-2.0.0.tgz", diff --git a/package.json b/package.json index 52cfe86d3..e0faf2a16 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "immutable": "^4.0.0-rc.14", "lodash-es": "^4.17.21", "material-design-icons-iconfont": "^6.1.0", + "ng-circle-progress": "^1.6.0", "ngx-long-press2": "^2.0.0", "ngx-pinch-zoom": "^2.6.0", "process": "^0.11.10", From 78859b9a44dfaf564a413b6aa91e2a5088fc3b31 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Wed, 13 Apr 2022 19:23:28 +0800 Subject: [PATCH 22/32] add custom-camera-service component --- .../custom-camera.service.spec.ts | 16 +++ .../custom-camera/custom-camera.service.ts | 101 ++++++++++++++++++ .../home/custom-camera/custom-camera.ts | 15 +++ 3 files changed, 132 insertions(+) create mode 100644 src/app/features/home/custom-camera/custom-camera.service.spec.ts create mode 100644 src/app/features/home/custom-camera/custom-camera.service.ts create mode 100644 src/app/features/home/custom-camera/custom-camera.ts diff --git a/src/app/features/home/custom-camera/custom-camera.service.spec.ts b/src/app/features/home/custom-camera/custom-camera.service.spec.ts new file mode 100644 index 000000000..288da8ca1 --- /dev/null +++ b/src/app/features/home/custom-camera/custom-camera.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; +import { SharedTestingModule } from '../../../shared/shared-testing.module'; +import { CustomCameraService } from './custom-camera.service'; + +describe('CustomCameraService', () => { + let service: CustomCameraService; + + beforeEach(() => { + TestBed.configureTestingModule({ imports: [SharedTestingModule] }); + service = TestBed.inject(CustomCameraService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/features/home/custom-camera/custom-camera.service.ts b/src/app/features/home/custom-camera/custom-camera.service.ts new file mode 100644 index 000000000..30febf614 --- /dev/null +++ b/src/app/features/home/custom-camera/custom-camera.service.ts @@ -0,0 +1,101 @@ +import { HttpClient } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { DomSanitizer } from '@angular/platform-browser'; +import { Capacitor } from '@capacitor/core'; +import { TranslocoService } from '@ngneat/transloco'; +import { PreviewCamera } from '@numbersprotocol/preview-camera'; +import { BehaviorSubject } from 'rxjs'; +import { CaptureService } from '../../../shared/capture/capture.service'; +import { ErrorService } from '../../../shared/error/error.service'; +import { blobToBase64 } from '../../../utils/encoding/encoding'; +import { + CustomCameraMediaItem, + CustomCameraMediaType, + CustomCameraMimeType, +} from './custom-camera'; + +@Injectable({ + providedIn: 'root', +}) +export class CustomCameraService { + private readonly globalCSSClass = 'custom-camera-transparent-background'; + + uploadInProgress$ = new BehaviorSubject(false); + + constructor( + private readonly sanitizer: DomSanitizer, + private readonly httpClient: HttpClient, + private readonly captureService: CaptureService, + private readonly errorService: ErrorService, + private readonly translocoService: TranslocoService + ) {} + + private mediaItemFromFilePath( + filePath: string, + type: CustomCameraMediaType + ): CustomCameraMediaItem { + const src = Capacitor.convertFileSrc(filePath); + const safeUrl = this.sanitizer.bypassSecurityTrustUrl(src); + const mimeType: CustomCameraMimeType = + type === 'image' ? 'image/jpeg' : 'video/mp4'; + const newItem = { filePath, src, safeUrl, type, mimeType }; + return newItem; + } + + async uploadToCapture(filePath: string, type: CustomCameraMediaType) { + const itemToUpload = this.mediaItemFromFilePath(filePath, type); + + try { + const itemBlob = await this.httpClient + .get(itemToUpload.src, { responseType: 'blob' }) + .toPromise(); + const base64 = await blobToBase64(itemBlob); + const mimeType = itemToUpload.mimeType; + await this.captureService.capture({ base64, mimeType }); + } catch (error) { + const errMsg = this.translocoService.translate(`error.internetError`); + await this.errorService.toastError$(errMsg).toPromise(); + } + } + + async startPreviewCamera() { + return PreviewCamera.startPreview() + .then(this.changeGlobalCSSBackgroundToTransparent.bind(this)) + .catch(() => ({})); + } + + async stopPreviewCamera() { + this.changeGlobalCSSBackgroundToTransparentRevert(); + return PreviewCamera.stopPreview().catch(() => ({})); + } + + // eslint-disable-next-line class-methods-use-this + async flipCamera() { + return PreviewCamera.flipCamera().catch(() => ({})); + } + + // eslint-disable-next-line class-methods-use-this + async takePhoto() { + return PreviewCamera.takePhoto().catch(() => ({})); + } + + // eslint-disable-next-line class-methods-use-this + async startRecord() { + return PreviewCamera.startRecord().catch(() => ({})); + } + + // eslint-disable-next-line class-methods-use-this + async stopRecord() { + return PreviewCamera.stopRecord().catch(() => ({})); + } + + private changeGlobalCSSBackgroundToTransparent() { + document.querySelector('body')?.classList.add(this.globalCSSClass); + document.querySelector('ion-app')?.classList.add(this.globalCSSClass); + } + + private changeGlobalCSSBackgroundToTransparentRevert() { + document.querySelector('body')?.classList.remove(this.globalCSSClass); + document.querySelector('ion-app')?.classList.remove(this.globalCSSClass); + } +} diff --git a/src/app/features/home/custom-camera/custom-camera.ts b/src/app/features/home/custom-camera/custom-camera.ts new file mode 100644 index 000000000..c380352ed --- /dev/null +++ b/src/app/features/home/custom-camera/custom-camera.ts @@ -0,0 +1,15 @@ +import { SafeUrl } from '@angular/platform-browser'; + +export const MAX_RECORD_TIME_IN_MILLISECONDS = 15000; + +export type CustomCameraMediaType = 'image' | 'video'; + +export type CustomCameraMimeType = 'image/jpeg' | 'video/mp4'; + +export interface CustomCameraMediaItem { + filePath: string; + src: string; + safeUrl: SafeUrl; + type: CustomCameraMediaType; + mimeType: CustomCameraMimeType; +} From 6e8b714fc301cf22c5673f3e0681cc47f1dd1f2c Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Wed, 13 Apr 2022 19:47:30 +0800 Subject: [PATCH 23/32] add custom camera page --- .../custom-camera-routing.module.ts | 17 ++ .../custom-camera/custom-camera.module.ts | 19 +++ .../custom-camera/custom-camera.page.html | 42 +++++ .../custom-camera/custom-camera.page.scss | 59 +++++++ .../custom-camera/custom-camera.page.spec.ts | 25 +++ .../home/custom-camera/custom-camera.page.ts | 160 ++++++++++++++++++ src/app/features/home/home-routing.module.ts | 7 + src/app/features/home/home.page.html | 2 +- src/app/features/home/home.page.ts | 6 + src/global.scss | 4 + 10 files changed, 340 insertions(+), 1 deletion(-) create mode 100644 src/app/features/home/custom-camera/custom-camera-routing.module.ts create mode 100644 src/app/features/home/custom-camera/custom-camera.module.ts create mode 100644 src/app/features/home/custom-camera/custom-camera.page.html create mode 100644 src/app/features/home/custom-camera/custom-camera.page.scss create mode 100644 src/app/features/home/custom-camera/custom-camera.page.spec.ts create mode 100644 src/app/features/home/custom-camera/custom-camera.page.ts diff --git a/src/app/features/home/custom-camera/custom-camera-routing.module.ts b/src/app/features/home/custom-camera/custom-camera-routing.module.ts new file mode 100644 index 000000000..471a97ef7 --- /dev/null +++ b/src/app/features/home/custom-camera/custom-camera-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { CustomCameraPage } from './custom-camera.page'; + +const routes: Routes = [ + { + path: '', + component: CustomCameraPage, + }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class CustomCameraPageRoutingModule {} diff --git a/src/app/features/home/custom-camera/custom-camera.module.ts b/src/app/features/home/custom-camera/custom-camera.module.ts new file mode 100644 index 000000000..2b8996205 --- /dev/null +++ b/src/app/features/home/custom-camera/custom-camera.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; +import { NgCircleProgressModule } from 'ng-circle-progress'; +import { NgxLongPress2Module } from 'ngx-long-press2'; +import { SharedModule } from '../../../shared/shared.module'; +import { CustomCameraPageRoutingModule } from './custom-camera-routing.module'; +import { CustomCameraPage } from './custom-camera.page'; +import { CustomCameraService } from './custom-camera.service'; + +@NgModule({ + imports: [ + SharedModule, + CustomCameraPageRoutingModule, + NgxLongPress2Module, + NgCircleProgressModule.forRoot({}), + ], + providers: [CustomCameraService], + declarations: [CustomCameraPage], +}) +export class CustomCameraPageModule {} diff --git a/src/app/features/home/custom-camera/custom-camera.page.html b/src/app/features/home/custom-camera/custom-camera.page.html new file mode 100644 index 000000000..0b25da128 --- /dev/null +++ b/src/app/features/home/custom-camera/custom-camera.page.html @@ -0,0 +1,42 @@ + +
+ GoPro + featured_video +
+ + + close + + +
+ + video_collection + + + + + flip_camera_android +
+
diff --git a/src/app/features/home/custom-camera/custom-camera.page.scss b/src/app/features/home/custom-camera/custom-camera.page.scss new file mode 100644 index 000000000..4eaf05912 --- /dev/null +++ b/src/app/features/home/custom-camera/custom-camera.page.scss @@ -0,0 +1,59 @@ +:host { + background-color: transparent !important; +} + +ion-content { + --background: transparent !important; +} + +mat-icon { + color: #f2f2f2; + font-size: 36px; + height: 36px; + width: 36px; +} + +mat-icon.close-camera-button { + position: absolute; + top: 16px; + right: 16px; + // border-radius: 50%; + // box-shadow: 0 0 8px rgb(100, 100, 100); +} + +mat-icon.temporarily-hidden { + visibility: hidden; +} + +// mat-icon +.select-from-go-pro-camera-button { + position: absolute; + top: 16px; + left: 16px; + // border-radius: 24px; + // box-shadow: 0 0 2px rgb(100, 100, 100); + color: var(--ion-color-primary); + display: flex; + align-items: center; + padding: 4px 8px; + font-size: 22px; + + mat-icon { + margin-left: 4px; + font-size: 24px; + height: 24px; + width: 24px; + } +} + +.camera-buttons-container { + display: flex; + flex-direction: row; + justify-content: space-around; + align-items: center; + position: absolute; + left: 0; + right: 0; + bottom: 0; + padding: 16px 8px; +} diff --git a/src/app/features/home/custom-camera/custom-camera.page.spec.ts b/src/app/features/home/custom-camera/custom-camera.page.spec.ts new file mode 100644 index 000000000..802def4f6 --- /dev/null +++ b/src/app/features/home/custom-camera/custom-camera.page.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { SharedTestingModule } from '../../../shared/shared-testing.module'; +import { CustomCameraPage } from './custom-camera.page'; + +describe('CustomCameraPage', () => { + let component: CustomCameraPage; + let fixture: ComponentFixture; + + beforeEach( + waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [CustomCameraPage], + imports: [SharedTestingModule], + }).compileComponents(); + + fixture = TestBed.createComponent(CustomCameraPage); + component = fixture.componentInstance; + fixture.detectChanges(); + }) + ); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/features/home/custom-camera/custom-camera.page.ts b/src/app/features/home/custom-camera/custom-camera.page.ts new file mode 100644 index 000000000..2efeb98d6 --- /dev/null +++ b/src/app/features/home/custom-camera/custom-camera.page.ts @@ -0,0 +1,160 @@ +/* eslint-disable no-console */ +import { Location } from '@angular/common'; +import { Component, OnDestroy, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { PluginListenerHandle } from '@capacitor/core'; +import { UntilDestroy } from '@ngneat/until-destroy'; +import { CaptureResult, PreviewCamera } from '@numbersprotocol/preview-camera'; +import { ErrorService } from '../../../shared/error/error.service'; +import { GoProBluetoothService } from '../../settings/go-pro/services/go-pro-bluetooth.service'; +import { + CustomCameraMediaItem, + MAX_RECORD_TIME_IN_MILLISECONDS, +} from './custom-camera'; +import { CustomCameraService } from './custom-camera.service'; + +@UntilDestroy({ checkProperties: true }) +@Component({ + selector: 'app-custom-camera', + templateUrl: './custom-camera.page.html', + styleUrls: ['./custom-camera.page.scss'], +}) +export class CustomCameraPage implements OnInit, OnDestroy { + private captureVideoFinishedListener?: PluginListenerHandle; + private capturePhotoFinishedListener?: PluginListenerHandle; + + maxRecordTimeInMilliseconds = MAX_RECORD_TIME_IN_MILLISECONDS; + curRecordTimeInMilliseconds = 0; + curRecordTimeInPercent = 0; + + // eslint-disable-next-line @typescript-eslint/no-magic-numbers + scaleDownAnimationAfterDelay = 230; + + curSessionCaptureMediaItems: CustomCameraMediaItem[] = []; + + readonly lastConnectedGoProDevice$ = + this.goProBluetoothService.lastConnectedDevice$; + + constructor( + private readonly location: Location, + private readonly router: Router, + private readonly customCameraService: CustomCameraService, + private readonly goProBluetoothService: GoProBluetoothService, + private readonly errorService: ErrorService + ) {} + + ngOnInit(): void { + this.debugOnlyPreventContextMenuFromLongPressContextMenu(); + + PreviewCamera.addListener( + 'capturePhotoFinished', + this.onCapturePhotoFinished.bind(this) + ).then((listener: any) => (this.capturePhotoFinishedListener = listener)); + + PreviewCamera.addListener( + 'captureVideoFinished', + this.onCaptureVideoFinished.bind(this) + ).then((listener: any) => (this.captureVideoFinishedListener = listener)); + + this.startPreviewCamera(); + } + + ngOnDestroy(): void { + this.capturePhotoFinishedListener?.remove(); + this.captureVideoFinishedListener?.remove(); + this.stopPreviewCamera(); + } + + // PreviewCamera Plugin methods + private async onCapturePhotoFinished(data: CaptureResult): Promise { + this.uploadItem(data, 'image'); + } + + private async onCaptureVideoFinished(data: CaptureResult): Promise { + this.uploadItem(data, 'video'); + } + + private async uploadItem(data: CaptureResult, type: 'image' | 'video') { + if (data.errorMessage) { + await this.errorService.toastError$(data.errorMessage).toPromise(); + } else if (data.filePath) { + this.customCameraService.uploadToCapture(data.filePath, type); + } + } + + startPreviewCamera() { + this.customCameraService.startPreviewCamera(); + } + + // eslint-disable-next-line class-methods-use-this + stopPreviewCamera() { + this.customCameraService.stopPreviewCamera(); + } + + flipCamera() { + this.customCameraService.flipCamera(); + } + + onPress() { + this.customCameraService.takePhoto(); + } + + onLongPress() { + this.customCameraService.startRecord(); + } + + onLongPressing(longPressDurationInMilliSeconds: any) { + this.curRecordTimeInMilliseconds = longPressDurationInMilliSeconds; + + this.curRecordTimeInPercent = Math.floor( + (this.curRecordTimeInMilliseconds / this.maxRecordTimeInMilliseconds) * + // eslint-disable-next-line @typescript-eslint/no-magic-numbers + 100 + ); + } + + onReleasePressing() { + this.customCameraService.stopRecord(); + + if (this.curRecordTimeInMilliseconds > 0) { + this.curRecordTimeInMilliseconds = 0; + this.curRecordTimeInPercent = 0; + } + } + + async leaveCustomCamera() { + return this.location.back(); + } + + async captureFromGoPro() { + await this.customCameraService.stopPreviewCamera(); + this.router.navigate(['/settings', 'go-pro', 'media-list-on-camera'], { + state: { shouldStartPreviewCameraOnLeave: true }, + }); + } + + // eslint-disable-next-line class-methods-use-this + private debugOnlyPreventContextMenuFromLongPressContextMenu() { + // Prevent showing context menu on long press + window.oncontextmenu = function (event: any) { + const pointerEvent = event as PointerEvent; + if (pointerEvent.pointerType === 'touch') return false; + + return true; + }; + } + + // eslint-disable-next-line class-methods-use-this + private scaleUpGalleryButton() { + // TODO: use @ViewChild elementRef + const element = document.getElementById('gallery-icon'); + element?.classList.add('scaled-mat-icon'); + } + + // eslint-disable-next-line class-methods-use-this + private scaleDownGalleryButton() { + // TODO: use @ViewChild elementRef + const element = document.getElementById('gallery-icon'); + element?.classList.remove('scaled-mat-icon'); + } +} diff --git a/src/app/features/home/home-routing.module.ts b/src/app/features/home/home-routing.module.ts index 53c62da9d..9a9c9a305 100644 --- a/src/app/features/home/home-routing.module.ts +++ b/src/app/features/home/home-routing.module.ts @@ -45,6 +45,13 @@ const routes: Routes = [ loadChildren: () => import('./details/details.module').then(m => m.DetailsPageModule), }, + { + path: 'custom-camera', + loadChildren: () => + import('./custom-camera/custom-camera.module').then( + m => m.CustomCameraPageModule + ), + }, ]; @NgModule({ diff --git a/src/app/features/home/home.page.html b/src/app/features/home/home.page.html index 9095666a1..daebe9521 100644 --- a/src/app/features/home/home.page.html +++ b/src/app/features/home/home.page.html @@ -82,7 +82,7 @@ - diff --git a/src/app/features/home/home.page.ts b/src/app/features/home/home.page.ts index 9015fabe2..1b660c59d 100644 --- a/src/app/features/home/home.page.ts +++ b/src/app/features/home/home.page.ts @@ -166,6 +166,12 @@ export class HomePage { .subscribe(); } + captureWithCustomCamera() { + const captureIndex = 0; + this.selectedTabIndex = captureIndex; + this.router.navigate(['home', 'custom-camera']); + } + private presentCaptureActions$() { return combineLatest([ this.translocoService.selectTranslateObject({ diff --git a/src/global.scss b/src/global.scss index 3ea54acc2..deefc6f80 100644 --- a/src/global.scss +++ b/src/global.scss @@ -140,3 +140,7 @@ body.dark .mat-tab-group { object-fit: cover; align-self: center; } + +.custom-camera-transparent-background { + background-color: transparent !important; +} From 0223988e06bafb49fa2655596e9abae1daae228f Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Wed, 13 Apr 2022 20:08:23 +0800 Subject: [PATCH 24/32] increase `compileSdkVersion` to `31` for android required by preview-camera plugin --- android/variables.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/variables.gradle b/android/variables.gradle index 080ca73a1..9819e2f16 100644 --- a/android/variables.gradle +++ b/android/variables.gradle @@ -1,6 +1,6 @@ ext { minSdkVersion = 21 - compileSdkVersion = 30 + compileSdkVersion = 31 targetSdkVersion = 30 androidxActivityVersion = '1.2.0' androidxAppCompatVersion = '1.2.0' From acc312097f94bae4e18df705003734b95048bd8c Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Wed, 13 Apr 2022 20:32:12 +0800 Subject: [PATCH 25/32] install preview-camera plugin from numbersprotocol repo --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7e98a1558..292de3f3a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,7 +46,7 @@ "@ngx-formly/core": "^5.10.22", "@ngx-formly/material": "^5.10.22", "@ngx-formly/schematics": "^5.10.22", - "@numbersprotocol/preview-camera": "github:sultanmyrza/preview-camera", + "@numbersprotocol/preview-camera": "github:numbersprotocol/preview-camera", "@numbersprotocol/preview-video": "github:numbersprotocol/preview-video", "async-mutex": "^0.3.2", "buffer": "^5.7.1", @@ -4121,7 +4121,7 @@ }, "node_modules/@numbersprotocol/preview-camera": { "version": "0.0.1", - "resolved": "git+ssh://git@github.com/sultanmyrza/preview-camera.git#6bbe8d2495d3b25238952ec442525405b0d9a48b", + "resolved": "git+ssh://git@github.com/numbersprotocol/preview-camera.git#6bbe8d2495d3b25238952ec442525405b0d9a48b", "license": "MIT", "peerDependencies": { "@capacitor/core": "^3.0.0" @@ -28245,8 +28245,8 @@ } }, "@numbersprotocol/preview-camera": { - "version": "git+ssh://git@github.com/sultanmyrza/preview-camera.git#6bbe8d2495d3b25238952ec442525405b0d9a48b", - "from": "@numbersprotocol/preview-camera@github:sultanmyrza/preview-camera", + "version": "git+ssh://git@github.com/numbersprotocol/preview-camera.git#6bbe8d2495d3b25238952ec442525405b0d9a48b", + "from": "@numbersprotocol/preview-camera@github:numbersprotocol/preview-camera", "requires": {} }, "@numbersprotocol/preview-video": { diff --git a/package.json b/package.json index e0faf2a16..8c72c5adf 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "@ngx-formly/core": "^5.10.22", "@ngx-formly/material": "^5.10.22", "@ngx-formly/schematics": "^5.10.22", - "@numbersprotocol/preview-camera": "github:sultanmyrza/preview-camera", + "@numbersprotocol/preview-camera": "github:numbersprotocol/preview-camera", "@numbersprotocol/preview-video": "github:numbersprotocol/preview-video", "async-mutex": "^0.3.2", "buffer": "^5.7.1", From facc9585b9a46c2001df7feba282414470295d13 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Wed, 13 Apr 2022 21:03:41 +0800 Subject: [PATCH 26/32] add missing modules for testing --- .../home/custom-camera/custom-camera.page.spec.ts | 8 +++++++- ...-pro-media-viewer-with-native-player.component.spec.ts | 5 ++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app/features/home/custom-camera/custom-camera.page.spec.ts b/src/app/features/home/custom-camera/custom-camera.page.spec.ts index 802def4f6..2e7290140 100644 --- a/src/app/features/home/custom-camera/custom-camera.page.spec.ts +++ b/src/app/features/home/custom-camera/custom-camera.page.spec.ts @@ -1,4 +1,6 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { NgCircleProgressModule } from 'ng-circle-progress'; +import { NgxLongPress2Module } from 'ngx-long-press2'; import { SharedTestingModule } from '../../../shared/shared-testing.module'; import { CustomCameraPage } from './custom-camera.page'; @@ -10,7 +12,11 @@ describe('CustomCameraPage', () => { waitForAsync(() => { TestBed.configureTestingModule({ declarations: [CustomCameraPage], - imports: [SharedTestingModule], + imports: [ + SharedTestingModule, + NgxLongPress2Module, + NgCircleProgressModule.forRoot({}), + ], }).compileComponents(); fixture = TestBed.createComponent(CustomCameraPage); diff --git a/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts b/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts index cc7bfa756..1857b9b59 100644 --- a/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts +++ b/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts @@ -1,6 +1,5 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import { IonicModule } from '@ionic/angular'; - +import { SharedTestingModule } from '../../../../shared/shared-testing.module'; import { GoProMediaViewerWithNativePlayerComponent } from './go-pro-media-viewer-with-native-player.component'; describe('GoProMediaViewerWithNativePlayerComponent', () => { @@ -11,7 +10,7 @@ describe('GoProMediaViewerWithNativePlayerComponent', () => { waitForAsync(() => { TestBed.configureTestingModule({ declarations: [GoProMediaViewerWithNativePlayerComponent], - imports: [IonicModule.forRoot()], + imports: [SharedTestingModule], }).compileComponents(); fixture = TestBed.createComponent( From 51838c7b0b6a4aa2747558821169789e9e89cb3b Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Thu, 14 Apr 2022 18:25:50 +0800 Subject: [PATCH 27/32] fix: linting for global.scss and custom-camera-page --- .../features/home/custom-camera/custom-camera.page.scss | 8 ++------ src/global.scss | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/app/features/home/custom-camera/custom-camera.page.scss b/src/app/features/home/custom-camera/custom-camera.page.scss index 4eaf05912..9cca8339f 100644 --- a/src/app/features/home/custom-camera/custom-camera.page.scss +++ b/src/app/features/home/custom-camera/custom-camera.page.scss @@ -1,9 +1,9 @@ :host { - background-color: transparent !important; + background-color: transparent; } ion-content { - --background: transparent !important; + --background: transparent; } mat-icon { @@ -17,8 +17,6 @@ mat-icon.close-camera-button { position: absolute; top: 16px; right: 16px; - // border-radius: 50%; - // box-shadow: 0 0 8px rgb(100, 100, 100); } mat-icon.temporarily-hidden { @@ -30,8 +28,6 @@ mat-icon.temporarily-hidden { position: absolute; top: 16px; left: 16px; - // border-radius: 24px; - // box-shadow: 0 0 2px rgb(100, 100, 100); color: var(--ion-color-primary); display: flex; align-items: center; diff --git a/src/global.scss b/src/global.scss index deefc6f80..7dc53dfea 100644 --- a/src/global.scss +++ b/src/global.scss @@ -142,5 +142,5 @@ body.dark .mat-tab-group { } .custom-camera-transparent-background { - background-color: transparent !important; + background-color: transparent; } From 5e15f033f17986497e0e272685d2411332a95537 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Mon, 18 Apr 2022 03:46:18 -0700 Subject: [PATCH 28/32] fix(wallets.page.html): temporarily hide buy NUM button --- src/app/features/wallets/wallets.page.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/features/wallets/wallets.page.html b/src/app/features/wallets/wallets.page.html index 553aa407b..22b8225f8 100644 --- a/src/app/features/wallets/wallets.page.html +++ b/src/app/features/wallets/wallets.page.html @@ -49,13 +49,14 @@

NUM

> - + Date: Fri, 22 Apr 2022 11:20:50 +0800 Subject: [PATCH 29/32] Revert "Merge pull request #1523 from sultanmyrza/feature-custom-camera-ux" This reverts commit 3aa077f8b51b06bae0f81ab75a38ba5bbdfaf0d2, reversing changes made to 11c83e6a1b74d60c1894391bdf47b0f91790b22e. --- android/app/capacitor.build.gradle | 1 - .../src/main/assets/capacitor.plugins.json | 4 - android/capacitor.settings.gradle | 3 - android/variables.gradle | 2 +- ios/App/Podfile | 1 - package-lock.json | 38 +---- package.json | 2 - .../custom-camera-routing.module.ts | 17 -- .../custom-camera/custom-camera.module.ts | 19 --- .../custom-camera/custom-camera.page.html | 42 ----- .../custom-camera/custom-camera.page.scss | 55 ------ .../custom-camera/custom-camera.page.spec.ts | 31 ---- .../home/custom-camera/custom-camera.page.ts | 160 ------------------ .../custom-camera.service.spec.ts | 16 -- .../custom-camera/custom-camera.service.ts | 101 ----------- .../home/custom-camera/custom-camera.ts | 15 -- src/app/features/home/home-routing.module.ts | 7 - src/app/features/home/home.page.html | 2 +- src/app/features/home/home.page.ts | 6 - ...iewer-with-native-player.component.spec.ts | 5 +- src/global.scss | 4 - 21 files changed, 6 insertions(+), 525 deletions(-) delete mode 100644 src/app/features/home/custom-camera/custom-camera-routing.module.ts delete mode 100644 src/app/features/home/custom-camera/custom-camera.module.ts delete mode 100644 src/app/features/home/custom-camera/custom-camera.page.html delete mode 100644 src/app/features/home/custom-camera/custom-camera.page.scss delete mode 100644 src/app/features/home/custom-camera/custom-camera.page.spec.ts delete mode 100644 src/app/features/home/custom-camera/custom-camera.page.ts delete mode 100644 src/app/features/home/custom-camera/custom-camera.service.spec.ts delete mode 100644 src/app/features/home/custom-camera/custom-camera.service.ts delete mode 100644 src/app/features/home/custom-camera/custom-camera.ts diff --git a/android/app/capacitor.build.gradle b/android/app/capacitor.build.gradle index 3f80fddfe..8dc57e7fc 100644 --- a/android/app/capacitor.build.gradle +++ b/android/app/capacitor.build.gradle @@ -25,7 +25,6 @@ dependencies { implementation project(':capacitor-share') implementation project(':capacitor-splash-screen') implementation project(':capacitor-storage') - implementation project(':numbersprotocol-preview-camera') implementation project(':numbersprotocol-preview-video') implementation project(':capacitor-blob-writer') diff --git a/android/app/src/main/assets/capacitor.plugins.json b/android/app/src/main/assets/capacitor.plugins.json index 952ae273f..c2efb9086 100644 --- a/android/app/src/main/assets/capacitor.plugins.json +++ b/android/app/src/main/assets/capacitor.plugins.json @@ -63,10 +63,6 @@ "pkg": "@capacitor/storage", "classpath": "com.capacitorjs.plugins.storage.StoragePlugin" }, - { - "pkg": "@numbersprotocol/preview-camera", - "classpath": "io.numbersprotocol.capturelite.plugins.previewcamera.PreviewCameraPlugin" - }, { "pkg": "@numbersprotocol/preview-video", "classpath": "io.numbersprotocol.capturelite.plugins.previewvideo.PreviewVideoPlugin" diff --git a/android/capacitor.settings.gradle b/android/capacitor.settings.gradle index 82f3a2aa4..00fd4567c 100644 --- a/android/capacitor.settings.gradle +++ b/android/capacitor.settings.gradle @@ -50,9 +50,6 @@ project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capa include ':capacitor-storage' project(':capacitor-storage').projectDir = new File('../node_modules/@capacitor/storage/android') -include ':numbersprotocol-preview-camera' -project(':numbersprotocol-preview-camera').projectDir = new File('../node_modules/@numbersprotocol/preview-camera/android') - include ':numbersprotocol-preview-video' project(':numbersprotocol-preview-video').projectDir = new File('../node_modules/@numbersprotocol/preview-video/android') diff --git a/android/variables.gradle b/android/variables.gradle index 9819e2f16..080ca73a1 100644 --- a/android/variables.gradle +++ b/android/variables.gradle @@ -1,6 +1,6 @@ ext { minSdkVersion = 21 - compileSdkVersion = 31 + compileSdkVersion = 30 targetSdkVersion = 30 androidxActivityVersion = '1.2.0' androidxAppCompatVersion = '1.2.0' diff --git a/ios/App/Podfile b/ios/App/Podfile index 3a6b06b05..4af80fd62 100644 --- a/ios/App/Podfile +++ b/ios/App/Podfile @@ -25,7 +25,6 @@ def capacitor_pods pod 'CapacitorShare', :path => '../../node_modules/@capacitor/share' pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen' pod 'CapacitorStorage', :path => '../../node_modules/@capacitor/storage' - pod 'NumbersprotocolPreviewCamera', :path => '../../node_modules/@numbersprotocol/preview-camera' pod 'NumbersprotocolPreviewVideo', :path => '../../node_modules/@numbersprotocol/preview-video' pod 'CapacitorBlobWriter', :path => '../../node_modules/capacitor-blob-writer' end diff --git a/package-lock.json b/package-lock.json index 292de3f3a..fc1c8d8ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,7 +46,6 @@ "@ngx-formly/core": "^5.10.22", "@ngx-formly/material": "^5.10.22", "@ngx-formly/schematics": "^5.10.22", - "@numbersprotocol/preview-camera": "github:numbersprotocol/preview-camera", "@numbersprotocol/preview-video": "github:numbersprotocol/preview-video", "async-mutex": "^0.3.2", "buffer": "^5.7.1", @@ -55,7 +54,6 @@ "immutable": "^4.0.0-rc.14", "lodash-es": "^4.17.21", "material-design-icons-iconfont": "^6.1.0", - "ng-circle-progress": "^1.6.0", "ngx-long-press2": "^2.0.0", "ngx-pinch-zoom": "^2.6.0", "process": "^0.11.10", @@ -4119,14 +4117,6 @@ "node": ">=10" } }, - "node_modules/@numbersprotocol/preview-camera": { - "version": "0.0.1", - "resolved": "git+ssh://git@github.com/numbersprotocol/preview-camera.git#6bbe8d2495d3b25238952ec442525405b0d9a48b", - "license": "MIT", - "peerDependencies": { - "@capacitor/core": "^3.0.0" - } - }, "node_modules/@numbersprotocol/preview-video": { "version": "0.0.1", "resolved": "git+ssh://git@github.com/numbersprotocol/preview-video.git#2d19456109c8c9d364324d9c08e766580256f1f7", @@ -14746,19 +14736,6 @@ "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, - "node_modules/ng-circle-progress": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/ng-circle-progress/-/ng-circle-progress-1.6.0.tgz", - "integrity": "sha512-HD7Uthog/QjRBFKrrnbOrm313CrkkWiTxENR7PjUy9lSUkuys5HdT0+E8UiHDk8VLSxC/pMmrx3eyYLhNq7EnQ==", - "dependencies": { - "tslib": "^2.0.0" - }, - "peerDependencies": { - "@angular/common": ">=9.1.0", - "@angular/core": ">=9.1.0", - "rxjs": ">=6.4.0" - } - }, "node_modules/ngx-long-press2": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ngx-long-press2/-/ngx-long-press2-2.0.0.tgz", @@ -27116,7 +27093,7 @@ }, "@capacitor-community/http": { "version": "git+ssh://git@github.com/numbersprotocol/http.git#a67d9fac94f8455a7fb00fc4b934ebff724afe9d", - "from": "@capacitor-community/http@github:numbersprotocol/http#fix-catch-disabled-Local-Network-case-on-iOS", + "from": "@capacitor-community/http@numbersprotocol/http#fix-catch-disabled-Local-Network-case-on-iOS", "requires": { "@capacitor/android": "^3.0.0", "@capacitor/core": "^3.0.0", @@ -28244,11 +28221,6 @@ } } }, - "@numbersprotocol/preview-camera": { - "version": "git+ssh://git@github.com/numbersprotocol/preview-camera.git#6bbe8d2495d3b25238952ec442525405b0d9a48b", - "from": "@numbersprotocol/preview-camera@github:numbersprotocol/preview-camera", - "requires": {} - }, "@numbersprotocol/preview-video": { "version": "git+ssh://git@github.com/numbersprotocol/preview-video.git#2d19456109c8c9d364324d9c08e766580256f1f7", "from": "@numbersprotocol/preview-video@github:numbersprotocol/preview-video", @@ -36563,14 +36535,6 @@ "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, - "ng-circle-progress": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/ng-circle-progress/-/ng-circle-progress-1.6.0.tgz", - "integrity": "sha512-HD7Uthog/QjRBFKrrnbOrm313CrkkWiTxENR7PjUy9lSUkuys5HdT0+E8UiHDk8VLSxC/pMmrx3eyYLhNq7EnQ==", - "requires": { - "tslib": "^2.0.0" - } - }, "ngx-long-press2": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ngx-long-press2/-/ngx-long-press2-2.0.0.tgz", diff --git a/package.json b/package.json index 8c72c5adf..f26844384 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,6 @@ "@ngx-formly/core": "^5.10.22", "@ngx-formly/material": "^5.10.22", "@ngx-formly/schematics": "^5.10.22", - "@numbersprotocol/preview-camera": "github:numbersprotocol/preview-camera", "@numbersprotocol/preview-video": "github:numbersprotocol/preview-video", "async-mutex": "^0.3.2", "buffer": "^5.7.1", @@ -66,7 +65,6 @@ "immutable": "^4.0.0-rc.14", "lodash-es": "^4.17.21", "material-design-icons-iconfont": "^6.1.0", - "ng-circle-progress": "^1.6.0", "ngx-long-press2": "^2.0.0", "ngx-pinch-zoom": "^2.6.0", "process": "^0.11.10", diff --git a/src/app/features/home/custom-camera/custom-camera-routing.module.ts b/src/app/features/home/custom-camera/custom-camera-routing.module.ts deleted file mode 100644 index 471a97ef7..000000000 --- a/src/app/features/home/custom-camera/custom-camera-routing.module.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; - -import { CustomCameraPage } from './custom-camera.page'; - -const routes: Routes = [ - { - path: '', - component: CustomCameraPage, - }, -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class CustomCameraPageRoutingModule {} diff --git a/src/app/features/home/custom-camera/custom-camera.module.ts b/src/app/features/home/custom-camera/custom-camera.module.ts deleted file mode 100644 index 2b8996205..000000000 --- a/src/app/features/home/custom-camera/custom-camera.module.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { NgModule } from '@angular/core'; -import { NgCircleProgressModule } from 'ng-circle-progress'; -import { NgxLongPress2Module } from 'ngx-long-press2'; -import { SharedModule } from '../../../shared/shared.module'; -import { CustomCameraPageRoutingModule } from './custom-camera-routing.module'; -import { CustomCameraPage } from './custom-camera.page'; -import { CustomCameraService } from './custom-camera.service'; - -@NgModule({ - imports: [ - SharedModule, - CustomCameraPageRoutingModule, - NgxLongPress2Module, - NgCircleProgressModule.forRoot({}), - ], - providers: [CustomCameraService], - declarations: [CustomCameraPage], -}) -export class CustomCameraPageModule {} diff --git a/src/app/features/home/custom-camera/custom-camera.page.html b/src/app/features/home/custom-camera/custom-camera.page.html deleted file mode 100644 index 0b25da128..000000000 --- a/src/app/features/home/custom-camera/custom-camera.page.html +++ /dev/null @@ -1,42 +0,0 @@ - -
- GoPro - featured_video -
- - - close - - -
- - video_collection - - - - - flip_camera_android -
-
diff --git a/src/app/features/home/custom-camera/custom-camera.page.scss b/src/app/features/home/custom-camera/custom-camera.page.scss deleted file mode 100644 index 9cca8339f..000000000 --- a/src/app/features/home/custom-camera/custom-camera.page.scss +++ /dev/null @@ -1,55 +0,0 @@ -:host { - background-color: transparent; -} - -ion-content { - --background: transparent; -} - -mat-icon { - color: #f2f2f2; - font-size: 36px; - height: 36px; - width: 36px; -} - -mat-icon.close-camera-button { - position: absolute; - top: 16px; - right: 16px; -} - -mat-icon.temporarily-hidden { - visibility: hidden; -} - -// mat-icon -.select-from-go-pro-camera-button { - position: absolute; - top: 16px; - left: 16px; - color: var(--ion-color-primary); - display: flex; - align-items: center; - padding: 4px 8px; - font-size: 22px; - - mat-icon { - margin-left: 4px; - font-size: 24px; - height: 24px; - width: 24px; - } -} - -.camera-buttons-container { - display: flex; - flex-direction: row; - justify-content: space-around; - align-items: center; - position: absolute; - left: 0; - right: 0; - bottom: 0; - padding: 16px 8px; -} diff --git a/src/app/features/home/custom-camera/custom-camera.page.spec.ts b/src/app/features/home/custom-camera/custom-camera.page.spec.ts deleted file mode 100644 index 2e7290140..000000000 --- a/src/app/features/home/custom-camera/custom-camera.page.spec.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import { NgCircleProgressModule } from 'ng-circle-progress'; -import { NgxLongPress2Module } from 'ngx-long-press2'; -import { SharedTestingModule } from '../../../shared/shared-testing.module'; -import { CustomCameraPage } from './custom-camera.page'; - -describe('CustomCameraPage', () => { - let component: CustomCameraPage; - let fixture: ComponentFixture; - - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [CustomCameraPage], - imports: [ - SharedTestingModule, - NgxLongPress2Module, - NgCircleProgressModule.forRoot({}), - ], - }).compileComponents(); - - fixture = TestBed.createComponent(CustomCameraPage); - component = fixture.componentInstance; - fixture.detectChanges(); - }) - ); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/features/home/custom-camera/custom-camera.page.ts b/src/app/features/home/custom-camera/custom-camera.page.ts deleted file mode 100644 index 2efeb98d6..000000000 --- a/src/app/features/home/custom-camera/custom-camera.page.ts +++ /dev/null @@ -1,160 +0,0 @@ -/* eslint-disable no-console */ -import { Location } from '@angular/common'; -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { Router } from '@angular/router'; -import { PluginListenerHandle } from '@capacitor/core'; -import { UntilDestroy } from '@ngneat/until-destroy'; -import { CaptureResult, PreviewCamera } from '@numbersprotocol/preview-camera'; -import { ErrorService } from '../../../shared/error/error.service'; -import { GoProBluetoothService } from '../../settings/go-pro/services/go-pro-bluetooth.service'; -import { - CustomCameraMediaItem, - MAX_RECORD_TIME_IN_MILLISECONDS, -} from './custom-camera'; -import { CustomCameraService } from './custom-camera.service'; - -@UntilDestroy({ checkProperties: true }) -@Component({ - selector: 'app-custom-camera', - templateUrl: './custom-camera.page.html', - styleUrls: ['./custom-camera.page.scss'], -}) -export class CustomCameraPage implements OnInit, OnDestroy { - private captureVideoFinishedListener?: PluginListenerHandle; - private capturePhotoFinishedListener?: PluginListenerHandle; - - maxRecordTimeInMilliseconds = MAX_RECORD_TIME_IN_MILLISECONDS; - curRecordTimeInMilliseconds = 0; - curRecordTimeInPercent = 0; - - // eslint-disable-next-line @typescript-eslint/no-magic-numbers - scaleDownAnimationAfterDelay = 230; - - curSessionCaptureMediaItems: CustomCameraMediaItem[] = []; - - readonly lastConnectedGoProDevice$ = - this.goProBluetoothService.lastConnectedDevice$; - - constructor( - private readonly location: Location, - private readonly router: Router, - private readonly customCameraService: CustomCameraService, - private readonly goProBluetoothService: GoProBluetoothService, - private readonly errorService: ErrorService - ) {} - - ngOnInit(): void { - this.debugOnlyPreventContextMenuFromLongPressContextMenu(); - - PreviewCamera.addListener( - 'capturePhotoFinished', - this.onCapturePhotoFinished.bind(this) - ).then((listener: any) => (this.capturePhotoFinishedListener = listener)); - - PreviewCamera.addListener( - 'captureVideoFinished', - this.onCaptureVideoFinished.bind(this) - ).then((listener: any) => (this.captureVideoFinishedListener = listener)); - - this.startPreviewCamera(); - } - - ngOnDestroy(): void { - this.capturePhotoFinishedListener?.remove(); - this.captureVideoFinishedListener?.remove(); - this.stopPreviewCamera(); - } - - // PreviewCamera Plugin methods - private async onCapturePhotoFinished(data: CaptureResult): Promise { - this.uploadItem(data, 'image'); - } - - private async onCaptureVideoFinished(data: CaptureResult): Promise { - this.uploadItem(data, 'video'); - } - - private async uploadItem(data: CaptureResult, type: 'image' | 'video') { - if (data.errorMessage) { - await this.errorService.toastError$(data.errorMessage).toPromise(); - } else if (data.filePath) { - this.customCameraService.uploadToCapture(data.filePath, type); - } - } - - startPreviewCamera() { - this.customCameraService.startPreviewCamera(); - } - - // eslint-disable-next-line class-methods-use-this - stopPreviewCamera() { - this.customCameraService.stopPreviewCamera(); - } - - flipCamera() { - this.customCameraService.flipCamera(); - } - - onPress() { - this.customCameraService.takePhoto(); - } - - onLongPress() { - this.customCameraService.startRecord(); - } - - onLongPressing(longPressDurationInMilliSeconds: any) { - this.curRecordTimeInMilliseconds = longPressDurationInMilliSeconds; - - this.curRecordTimeInPercent = Math.floor( - (this.curRecordTimeInMilliseconds / this.maxRecordTimeInMilliseconds) * - // eslint-disable-next-line @typescript-eslint/no-magic-numbers - 100 - ); - } - - onReleasePressing() { - this.customCameraService.stopRecord(); - - if (this.curRecordTimeInMilliseconds > 0) { - this.curRecordTimeInMilliseconds = 0; - this.curRecordTimeInPercent = 0; - } - } - - async leaveCustomCamera() { - return this.location.back(); - } - - async captureFromGoPro() { - await this.customCameraService.stopPreviewCamera(); - this.router.navigate(['/settings', 'go-pro', 'media-list-on-camera'], { - state: { shouldStartPreviewCameraOnLeave: true }, - }); - } - - // eslint-disable-next-line class-methods-use-this - private debugOnlyPreventContextMenuFromLongPressContextMenu() { - // Prevent showing context menu on long press - window.oncontextmenu = function (event: any) { - const pointerEvent = event as PointerEvent; - if (pointerEvent.pointerType === 'touch') return false; - - return true; - }; - } - - // eslint-disable-next-line class-methods-use-this - private scaleUpGalleryButton() { - // TODO: use @ViewChild elementRef - const element = document.getElementById('gallery-icon'); - element?.classList.add('scaled-mat-icon'); - } - - // eslint-disable-next-line class-methods-use-this - private scaleDownGalleryButton() { - // TODO: use @ViewChild elementRef - const element = document.getElementById('gallery-icon'); - element?.classList.remove('scaled-mat-icon'); - } -} diff --git a/src/app/features/home/custom-camera/custom-camera.service.spec.ts b/src/app/features/home/custom-camera/custom-camera.service.spec.ts deleted file mode 100644 index 288da8ca1..000000000 --- a/src/app/features/home/custom-camera/custom-camera.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; -import { SharedTestingModule } from '../../../shared/shared-testing.module'; -import { CustomCameraService } from './custom-camera.service'; - -describe('CustomCameraService', () => { - let service: CustomCameraService; - - beforeEach(() => { - TestBed.configureTestingModule({ imports: [SharedTestingModule] }); - service = TestBed.inject(CustomCameraService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/src/app/features/home/custom-camera/custom-camera.service.ts b/src/app/features/home/custom-camera/custom-camera.service.ts deleted file mode 100644 index 30febf614..000000000 --- a/src/app/features/home/custom-camera/custom-camera.service.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { HttpClient } from '@angular/common/http'; -import { Injectable } from '@angular/core'; -import { DomSanitizer } from '@angular/platform-browser'; -import { Capacitor } from '@capacitor/core'; -import { TranslocoService } from '@ngneat/transloco'; -import { PreviewCamera } from '@numbersprotocol/preview-camera'; -import { BehaviorSubject } from 'rxjs'; -import { CaptureService } from '../../../shared/capture/capture.service'; -import { ErrorService } from '../../../shared/error/error.service'; -import { blobToBase64 } from '../../../utils/encoding/encoding'; -import { - CustomCameraMediaItem, - CustomCameraMediaType, - CustomCameraMimeType, -} from './custom-camera'; - -@Injectable({ - providedIn: 'root', -}) -export class CustomCameraService { - private readonly globalCSSClass = 'custom-camera-transparent-background'; - - uploadInProgress$ = new BehaviorSubject(false); - - constructor( - private readonly sanitizer: DomSanitizer, - private readonly httpClient: HttpClient, - private readonly captureService: CaptureService, - private readonly errorService: ErrorService, - private readonly translocoService: TranslocoService - ) {} - - private mediaItemFromFilePath( - filePath: string, - type: CustomCameraMediaType - ): CustomCameraMediaItem { - const src = Capacitor.convertFileSrc(filePath); - const safeUrl = this.sanitizer.bypassSecurityTrustUrl(src); - const mimeType: CustomCameraMimeType = - type === 'image' ? 'image/jpeg' : 'video/mp4'; - const newItem = { filePath, src, safeUrl, type, mimeType }; - return newItem; - } - - async uploadToCapture(filePath: string, type: CustomCameraMediaType) { - const itemToUpload = this.mediaItemFromFilePath(filePath, type); - - try { - const itemBlob = await this.httpClient - .get(itemToUpload.src, { responseType: 'blob' }) - .toPromise(); - const base64 = await blobToBase64(itemBlob); - const mimeType = itemToUpload.mimeType; - await this.captureService.capture({ base64, mimeType }); - } catch (error) { - const errMsg = this.translocoService.translate(`error.internetError`); - await this.errorService.toastError$(errMsg).toPromise(); - } - } - - async startPreviewCamera() { - return PreviewCamera.startPreview() - .then(this.changeGlobalCSSBackgroundToTransparent.bind(this)) - .catch(() => ({})); - } - - async stopPreviewCamera() { - this.changeGlobalCSSBackgroundToTransparentRevert(); - return PreviewCamera.stopPreview().catch(() => ({})); - } - - // eslint-disable-next-line class-methods-use-this - async flipCamera() { - return PreviewCamera.flipCamera().catch(() => ({})); - } - - // eslint-disable-next-line class-methods-use-this - async takePhoto() { - return PreviewCamera.takePhoto().catch(() => ({})); - } - - // eslint-disable-next-line class-methods-use-this - async startRecord() { - return PreviewCamera.startRecord().catch(() => ({})); - } - - // eslint-disable-next-line class-methods-use-this - async stopRecord() { - return PreviewCamera.stopRecord().catch(() => ({})); - } - - private changeGlobalCSSBackgroundToTransparent() { - document.querySelector('body')?.classList.add(this.globalCSSClass); - document.querySelector('ion-app')?.classList.add(this.globalCSSClass); - } - - private changeGlobalCSSBackgroundToTransparentRevert() { - document.querySelector('body')?.classList.remove(this.globalCSSClass); - document.querySelector('ion-app')?.classList.remove(this.globalCSSClass); - } -} diff --git a/src/app/features/home/custom-camera/custom-camera.ts b/src/app/features/home/custom-camera/custom-camera.ts deleted file mode 100644 index c380352ed..000000000 --- a/src/app/features/home/custom-camera/custom-camera.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { SafeUrl } from '@angular/platform-browser'; - -export const MAX_RECORD_TIME_IN_MILLISECONDS = 15000; - -export type CustomCameraMediaType = 'image' | 'video'; - -export type CustomCameraMimeType = 'image/jpeg' | 'video/mp4'; - -export interface CustomCameraMediaItem { - filePath: string; - src: string; - safeUrl: SafeUrl; - type: CustomCameraMediaType; - mimeType: CustomCameraMimeType; -} diff --git a/src/app/features/home/home-routing.module.ts b/src/app/features/home/home-routing.module.ts index 9a9c9a305..53c62da9d 100644 --- a/src/app/features/home/home-routing.module.ts +++ b/src/app/features/home/home-routing.module.ts @@ -45,13 +45,6 @@ const routes: Routes = [ loadChildren: () => import('./details/details.module').then(m => m.DetailsPageModule), }, - { - path: 'custom-camera', - loadChildren: () => - import('./custom-camera/custom-camera.module').then( - m => m.CustomCameraPageModule - ), - }, ]; @NgModule({ diff --git a/src/app/features/home/home.page.html b/src/app/features/home/home.page.html index daebe9521..9095666a1 100644 --- a/src/app/features/home/home.page.html +++ b/src/app/features/home/home.page.html @@ -82,7 +82,7 @@
- diff --git a/src/app/features/home/home.page.ts b/src/app/features/home/home.page.ts index 1b660c59d..9015fabe2 100644 --- a/src/app/features/home/home.page.ts +++ b/src/app/features/home/home.page.ts @@ -166,12 +166,6 @@ export class HomePage { .subscribe(); } - captureWithCustomCamera() { - const captureIndex = 0; - this.selectedTabIndex = captureIndex; - this.router.navigate(['home', 'custom-camera']); - } - private presentCaptureActions$() { return combineLatest([ this.translocoService.selectTranslateObject({ diff --git a/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts b/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts index 1857b9b59..cc7bfa756 100644 --- a/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts +++ b/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts @@ -1,5 +1,6 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import { SharedTestingModule } from '../../../../shared/shared-testing.module'; +import { IonicModule } from '@ionic/angular'; + import { GoProMediaViewerWithNativePlayerComponent } from './go-pro-media-viewer-with-native-player.component'; describe('GoProMediaViewerWithNativePlayerComponent', () => { @@ -10,7 +11,7 @@ describe('GoProMediaViewerWithNativePlayerComponent', () => { waitForAsync(() => { TestBed.configureTestingModule({ declarations: [GoProMediaViewerWithNativePlayerComponent], - imports: [SharedTestingModule], + imports: [IonicModule.forRoot()], }).compileComponents(); fixture = TestBed.createComponent( diff --git a/src/global.scss b/src/global.scss index 7dc53dfea..3ea54acc2 100644 --- a/src/global.scss +++ b/src/global.scss @@ -140,7 +140,3 @@ body.dark .mat-tab-group { object-fit: cover; align-self: center; } - -.custom-camera-transparent-background { - background-color: transparent; -} From fd354d1a6b00932cec3ec5e3f11d8162397ca466 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Fri, 22 Apr 2022 11:26:41 +0800 Subject: [PATCH 30/32] build: bump version to 0.54.2 --- CHANGELOG.md | 10 ++++++++++ android/app/build.gradle | 4 ++-- package-lock.json | 6 +++--- package.json | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91153a189..cb51e8b89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.54.2 - 2022-04-21 + +### Changed + +- Hide buy NUM button at wallets page + +### Removed + +- Temporarely remove custom camera ux + ## 0.54.1 - 2022-04-07 ### Removed diff --git a/android/app/build.gradle b/android/app/build.gradle index 1f74d8a69..daeaec837 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "io.numbersprotocol.capturelite" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 371 - versionName "0.54.1" + versionCode 372 + versionName "0.54.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildFeatures { diff --git a/package-lock.json b/package-lock.json index fc1c8d8ba..2c6367a88 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "capture-lite", - "version": "0.54.1", + "version": "0.54.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "capture-lite", - "version": "0.54.1", + "version": "0.54.2", "dependencies": { "@angular/animations": "^12.2.4", "@angular/cdk": "^12.2.4", @@ -27093,7 +27093,7 @@ }, "@capacitor-community/http": { "version": "git+ssh://git@github.com/numbersprotocol/http.git#a67d9fac94f8455a7fb00fc4b934ebff724afe9d", - "from": "@capacitor-community/http@numbersprotocol/http#fix-catch-disabled-Local-Network-case-on-iOS", + "from": "@capacitor-community/http@github:numbersprotocol/http#fix-catch-disabled-Local-Network-case-on-iOS", "requires": { "@capacitor/android": "^3.0.0", "@capacitor/core": "^3.0.0", diff --git a/package.json b/package.json index f26844384..952e14cb0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "capture-lite", - "version": "0.54.1", + "version": "0.54.2", "author": "numbersprotocol", "homepage": "https://numbersprotocol.io/", "scripts": { From 00c28e2990492242e916d1ccb1a65750d0494cba Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Fri, 22 Apr 2022 14:36:12 +0800 Subject: [PATCH 31/32] fix(go-pro-media-viewer-with-native-player.component.spec): imported SharedTestingModule in TestBed --- .../go-pro-media-viewer-with-native-player.component.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts b/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts index cc7bfa756..93e32ed15 100644 --- a/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts +++ b/src/app/features/settings/go-pro/go-pro-media-viewer-with-native-player/go-pro-media-viewer-with-native-player.component.spec.ts @@ -1,6 +1,6 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { IonicModule } from '@ionic/angular'; - +import { SharedTestingModule } from '../../../../shared/shared-testing.module'; import { GoProMediaViewerWithNativePlayerComponent } from './go-pro-media-viewer-with-native-player.component'; describe('GoProMediaViewerWithNativePlayerComponent', () => { @@ -11,7 +11,7 @@ describe('GoProMediaViewerWithNativePlayerComponent', () => { waitForAsync(() => { TestBed.configureTestingModule({ declarations: [GoProMediaViewerWithNativePlayerComponent], - imports: [IonicModule.forRoot()], + imports: [IonicModule.forRoot(), SharedTestingModule], }).compileComponents(); fixture = TestBed.createComponent( From d47443088fd8df3ab95242d5f3cffb2fb7dc323a Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Fri, 22 Apr 2022 14:36:59 +0800 Subject: [PATCH 32/32] install latest preview-video plugin to pass test.ci --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2c6367a88..84d3ca2fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4119,7 +4119,7 @@ }, "node_modules/@numbersprotocol/preview-video": { "version": "0.0.1", - "resolved": "git+ssh://git@github.com/numbersprotocol/preview-video.git#2d19456109c8c9d364324d9c08e766580256f1f7", + "resolved": "git+ssh://git@github.com/numbersprotocol/preview-video.git#4ed0d5f00a644ed29c434e666a1b39de97da6954", "license": "MIT", "peerDependencies": { "@capacitor/core": "^3.0.0" @@ -28222,7 +28222,7 @@ } }, "@numbersprotocol/preview-video": { - "version": "git+ssh://git@github.com/numbersprotocol/preview-video.git#2d19456109c8c9d364324d9c08e766580256f1f7", + "version": "git+ssh://git@github.com/numbersprotocol/preview-video.git#4ed0d5f00a644ed29c434e666a1b39de97da6954", "from": "@numbersprotocol/preview-video@github:numbersprotocol/preview-video", "requires": {} },