-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/experiments/go pro/multi select file upload #1205
Feature/experiments/go pro/multi select file upload #1205
Conversation
Bump version to 0.47.0
change button color to match design
remove unused imports, init logic.
src/app/features/home/home.page.ts
Outdated
) | ||
) | ||
concatMap(async ([takePicture, recordVideo]) => { | ||
// eslint-disable-next-line no-async-promise-executor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We follow eslint as much as possible whenever it is reasonable. Using async function as Promise executor is a common anti-pattern which sometimes causes some unexpected behavior so it is best avoided.
To use the getConnectedDevice()
async function's result, you can use a combineLatest
to combine it with the translteObject observable, see https://github.com/numbersprotocol/capture-lite/blob/master/src/app/features/home/details/details.page.ts#L254 for example
The goal here is to refactor this part so that // eslint-disable-next-line no-async-promise-executor
won't be needed to pass lint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f071852 should resolve
<ion-button | ||
(click)="uploadToCapture()" | ||
expand="block" | ||
style="color: white; --box-shadow: 0; margin: 0 16px 0 16px" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good if these styles can be put in the .scss
file and keep inline styling usage minimal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hope this commit "move all html styles to" will resolve
// // eslint-disable-next-line no-console | ||
// console.log(fileToUpload); | ||
|
||
// await new Promise(resolve => { | ||
// setTimeout(() => { | ||
// resolve(fileToUpload); | ||
// // eslint-disable-next-line @typescript-eslint/no-magic-numbers | ||
// }, 4000); | ||
// }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These code should be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
03dd1d6 should resolve
const { role } = await alert.onDidDismiss(); | ||
// eslint-disable-next-line no-console | ||
console.log('onDidDismiss resolved with role', role); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If role
does not do anything here, it should be removed to avoid confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a8e8dac should resolve
(click)="scanForBluetoothDevices()" | ||
style="color: white; --box-shadow: 0; margin: 0 16px 0 16px" | ||
> | ||
{{ bluetoothIsScanning ? 'Scaning' : 'Scan for bluetooth devices' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{{ bluetoothIsScanning ? 'Scaning' : 'Scan for bluetooth devices' }} | |
{{ bluetoothIsScanning ? 'Scanning' : 'Scan for bluetooth devices' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try { | ||
this.bluetoothIsScanning = true; | ||
this.bluetoothScanResults = | ||
await this.goProBluetoothService.scanForBluetoothDevices(); | ||
this.bluetoothIsScanning = false; | ||
} catch (error) { | ||
this.bluetoothScanResults = []; | ||
this.bluetoothIsScanning = false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try { | |
this.bluetoothIsScanning = true; | |
this.bluetoothScanResults = | |
await this.goProBluetoothService.scanForBluetoothDevices(); | |
this.bluetoothIsScanning = false; | |
} catch (error) { | |
this.bluetoothScanResults = []; | |
this.bluetoothIsScanning = false; | |
} | |
try { | |
this.bluetoothIsScanning = true; | |
this.bluetoothScanResults = | |
await this.goProBluetoothService.scanForBluetoothDevices(); | |
} catch (error) { | |
this.bluetoothScanResults = []; | |
} finally { | |
this.bluetoothIsScanning = false; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
73668e0 should resolve
private readonly enableGoProWiFiCommand = [0x03, 0x17, 0x01, 0x01]; | ||
|
||
constructor() { | ||
BleClient.initialize(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because these services are provided in shared module which is loaded when the app/test starts running, I would suggest leave the service constructor empty, and do a late initialization when the Bluetooth-related functionalities are really needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commit ccb1320 should resolve
await this.checkBluetoothDeviceConnection(); | ||
|
||
// TODO: find better solution for comparing 2 arrays with numbers | ||
if (JSON.stringify(command) === JSON.stringify(this.shutdownCommand)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (JSON.stringify(command) === JSON.stringify(this.shutdownCommand)) { | |
import { isEqual } from 'lodash-es'; | |
... | |
if (isEqual(command, this.shutdownCommand)) { |
We already uses lodash in other places so the best way to compare array or objects is by using lodash.isEqual
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private readonly httpClient: HttpClient | ||
) {} | ||
|
||
// eslint-disable-next-line class-methods-use-this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all the lint rule class-methods-use-this
issues, I would suggest define these functions in a standalone file and export them, instead of defining them as GoProMediaService's class methods. See src/app/utils/url.ts
for example (it is also a good place to put url-handling functions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2f0ce31 should resolve
import { GoProBluetoothService } from './go-pro-bluetooth.service'; | ||
const Wifi: WifiPlugin = Plugins.Wifi as WifiPlugin; | ||
|
||
const { Storage } = Plugins; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The App already has a PreferenceManager
class which wraps the Storage
plugin and makes values as subscriptables. Please use PreferenceManager
directly instead of access Storage
plugin directly here so that the App has a single uniform way to handle key-value storages.
You can check WebCryptoApiSignatureProvider
for usage example for the PreferenceManager
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1688367 using PreferenceManager for WiFi
4e5d9a3 using PreferenceManager for BLE
However running locally npm run test.ci
giving this error:
after commit 1688367
test logs
GoProWifiService should be created FAILED
NullInjectorError: R3InjectorError(DynamicTestModule)[GoProWifiService -> PreferenceManager -> InjectionToken STORAGE_PLUGIN -> InjectionToken STORAGE_PLUGIN]:
NullInjectorError: No provider for InjectionToken STORAGE_PLUGIN!
error properties: Object({ ngTempTokenPath: null, ngTokenPath: [ 'GoProWifiService', 'PreferenceManager', 'InjectionToken STORAGE_PLUGIN', 'InjectionToken STORAGE_PLUGIN' ] })
NullInjectorError: R3InjectorError(DynamicTestModule)[GoProWifiService -> PreferenceManager -> InjectionToken STORAGE_PLUGIN -> InjectionToken STORAGE_PLUGIN]:
NullInjectorError: No provider for InjectionToken STORAGE_PLUGIN!
at NullInjector.get (http://localhost:9876/_karma_webpack_/vendor.js:74891:27)
at R3Injector.get (http://localhost:9876/_karma_webpack_/vendor.js:75058:33)
at R3Injector.get (http://localhost:9876/_karma_webpack_/vendor.js:75058:33)
at injectInjectorOnly (http://localhost:9876/_karma_webpack_/vendor.js:68541:33)
at ɵɵinject (http://localhost:9876/_karma_webpack_/vendor.js:68545:61)
at Object.PreferenceManager_Factory [as factory] (ng:///PreferenceManager/ɵfac.js:4:45)
at R3Injector.hydrate (http://localhost:9876/_karma_webpack_/vendor.js:75228:35)
at R3Injector.get (http://localhost:9876/_karma_webpack_/vendor.js:75047:33)
at injectInjectorOnly (http://localhost:9876/_karma_webpack_/vendor.js:68541:33)
at ɵɵinject (http://localhost:9876/_karma_webpack_/vendor.js:68545:61)
Error: Expected undefined to be truthy.
at <Jasmine>
at UserContext.<anonymous> (http://localhost:9876/_karma_webpack_/main.js:1131:25)
at ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/polyfills.js:8285:26)
at ProxyZoneSpec.onInvoke (http://localhost:9876/_karma_webpack_/vendor.js:340077:39)
after commit 4e5d9a3
test logs
[31mChrome Headless 98.0.4758.80 (Mac OS 10.15.7) GoProBluetoothService should be created FAILED
NullInjectorError: R3InjectorError(DynamicTestModule)[GoProBluetoothService -> PreferenceManager -> InjectionToken STORAGE_PLUGIN -> InjectionToken STORAGE_PLUGIN]:
NullInjectorError: No provider for InjectionToken STORAGE_PLUGIN!
error properties: Object({ ngTempTokenPath: null, ngTokenPath: [ 'GoProBluetoothService', 'PreferenceManager', 'InjectionToken STORAGE_PLUGIN', 'InjectionToken STORAGE_PLUGIN' ] })
NullInjectorError: R3InjectorError(DynamicTestModule)[GoProBluetoothService -> PreferenceManager -> InjectionToken STORAGE_PLUGIN -> InjectionToken STORAGE_PLUGIN]:
NullInjectorError: No provider for InjectionToken STORAGE_PLUGIN!
at NullInjector.get (http://localhost:9876/_karma_webpack_/vendor.js:74891:27)
at R3Injector.get (http://localhost:9876/_karma_webpack_/vendor.js:75058:33)
at R3Injector.get (http://localhost:9876/_karma_webpack_/vendor.js:75058:33)
at injectInjectorOnly (http://localhost:9876/_karma_webpack_/vendor.js:68541:33)
at ɵɵinject (http://localhost:9876/_karma_webpack_/vendor.js:68545:61)
at Object.PreferenceManager_Factory [as factory] (ng:///PreferenceManager/ɵfac.js:4:45)
at R3Injector.hydrate (http://localhost:9876/_karma_webpack_/vendor.js:75228:35)
at R3Injector.get (http://localhost:9876/_karma_webpack_/vendor.js:75047:33)
at injectInjectorOnly (http://localhost:9876/_karma_webpack_/vendor.js:68541:33)
at ɵɵinject (http://localhost:9876/_karma_webpack_/vendor.js:68545:61)
Error: Expected undefined to be truthy.
at <Jasmine>
at UserContext.<anonymous> (http://localhost:9876/_karma_webpack_/main.js:1077:25)
at ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/polyfills.js:8285:26)
at ProxyZoneSpec.onInvoke (http://localhost:9876/_karma_webpack_/vendor.js:340077:39)
method from lodash to compare objects
bluetooth plugin
to wrap scanForBluetooth call
remove unused comments
remove unused variable
methods to src/utils/url.ts
instead of Plugins.Storage
use preferenceManager instead of Plugins.Storage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
487e684
into
numbersprotocol:feature/experiments/go-pro/beta/1.0
┆Issue is synchronized with this Asana task by Unito
┆Created By: Tammy Yang