Skip to content

Commit

Permalink
Added navigator info to dev tools and general cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Unterreiner committed Mar 31, 2016
1 parent 79a6f25 commit ee8743e
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 40 deletions.
104 changes: 81 additions & 23 deletions src/Views/Settings/Developer/Developer.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,36 @@
<ion-content class="has-header">

<div class="list card">
<div class="item item-divider">HTTP API</div>
<div class="item item-divider item-dark item-dark">Test Tools</div>

<div class="item">

<button class="button button-block button-positive"
ng-click="controller.addServicesToGlobalScope_click()">
Add Services to Global Scope
</button>

<button class="button button-block button-positive"
ng-click="controller.setRequirePinThreshold_click()">
Set Require PIN Threshold
</button>

<button class="button button-block button-positive"
ng-click="controller.resetPinTimeout_click()">
Reset PIN Entry Timeout
</button>

<button class="button button-block button-positive"
ng-click="controller.reEnableOnboarding_click()">
Re-enable Onboarding
</button>

</div>

</div>

<div class="list card">
<div class="item item-divider item-dark">HTTP API</div>

<label class="item item-toggle">
Mock API Requests
Expand All @@ -29,7 +58,7 @@
</div>

<div class="list card">
<div class="item item-divider">Logging</div>
<div class="item item-divider item-dark">Logging</div>

<div ui-sref="app.logs" class="item item-icon-left item-icon-right">
<i class="icon ion-ios-copy-outline"></i>
Expand All @@ -40,15 +69,16 @@
</div>

<div class="list card">
<div class="item item-divider">Current User</div>
<div class="item item-divider item-dark">Current User</div>

<label class="item item-readonly-label">
<label class="item item-readonly-label"
ng-click="controller.copyValue_click(viewModel.userId, 'User ID')">
<span>User ID</span>
<span>{{viewModel.userId}}</span>
</label>

<label class="item item-readonly-label item-text-wrap"
ng-click="controller.userToken_click(viewModel.token)">
ng-click="controller.copyValue_click(viewModel.token, 'Token')">
Token
<br/>
{{viewModel.token}}
Expand All @@ -57,7 +87,7 @@
</div>

<div class="list card">
<div class="item item-divider">Platform Tools</div>
<div class="item item-divider item-dark">Platform Tools</div>

<label class="item item-readonly-label">
<span>Platform</span>
Expand All @@ -81,39 +111,67 @@
</label>

<label class="item item-readonly-label">
<span>Cordova</span>
<span>Cordova Platform</span>
<span>{{viewModel.deviceCordovaVersion}}</span>
</label>

<div class="item">
<button class="button button-block button-positive" ng-click="controller.addServicesToGlobalScope_click()">Add Services to Global Scope</button>
<button class="button button-block button-positive" ng-click="controller.setRequirePinThreshold_click()">Set Require PIN Threshold</button>
<button class="button button-block button-positive" ng-click="controller.resetPinTimeout_click()">Reset PIN Entry Timeout</button>
<button class="button button-block button-positive" ng-click="controller.reEnableOnboarding_click()">Re-enable Onboarding</button>
</div>

<div class="list card">

<div class="item item-divider item-dark item-dark item-icon-right">
Navigator Information
<i class="icon ion-ios-help-outline"
ng-click="controller.help_click('Information about the browser/navigator.')"></i>
</div>

<label class="item item-readonly-label">
<span>Platform</span>
<span>{{viewModel.navigatorPlatform}}</span>
</label>

<label class="item item-readonly-label">
<span>Product</span>
<span>{{viewModel.navigatorProduct}}</span>
</label>

<label class="item item-readonly-label">
<span>Vendor</span>
<span>{{viewModel.navigatorVendor}}</span>
</label>

<label class="item item-readonly-label">
<span>Viewport</span>
<span>{{viewModel.viewport.width}}x{{viewModel.viewport.height}}</span>
</label>

<label class="item item-readonly-label item-text-wrap"
ng-click="controller.copyValue_click(viewModel.userAgent, 'User Agent')">
User Agent
<br/>
{{viewModel.userAgent}}
</label>

</div>

<div class="list card">
<div class="item item-divider item-icon-right">
<div class="item item-divider item-dark item-icon-right">
Test Exception Handling
<i class="icon ion-ios-help-outline"
ng-click="controller.help_click('Used to simulate different exception types to test logging.')"></i>
</div>
<div class="row">
<div class="col col-33">
<button class="button button-block button-assertive" ng-click="controller.testNativeException_click()">Native</button>
</div>
<div class="col col-33">
<div class="col col-50">
<button class="button button-block button-assertive" ng-click="controller.testJsException_click()">JS</button>
</div>
<div class="col col-33">
<div class="col col-50">
<button class="button button-block button-assertive" ng-click="controller.testAngularException_click()">Angular</button>
</div>
</div>
</div>

<div class="list card">
<div class="item item-divider item-icon-right">
<div class="item item-divider item-dark item-icon-right">
HTTP Progress Bar
<i class="icon ion-ios-help-outline"
ng-click="controller.help_click('Used to test the progress indicator functionality that is utilized during HTTP requests.')"></i>
Expand All @@ -136,7 +194,7 @@
</div>

<div class="list card">
<div class="item item-divider item-icon-right">
<div class="item item-divider item-dark item-icon-right">
Toast Notifications
<i class="icon ion-ios-help-outline"
ng-click="controller.help_click('Used to test the native toast notification plugin.')"></i>
Expand All @@ -156,7 +214,7 @@
</div>

<div class="list card">
<div class="item item-divider item-icon-right">
<div class="item item-divider item-dark item-icon-right">
Clipboard
<i class="icon ion-ios-help-outline"
ng-click="controller.help_click('Used to test the native clipboard plugin.')"></i>
Expand All @@ -172,7 +230,7 @@
</div>

<div class="list card">
<div class="item item-divider item-icon-right">
<div class="item item-divider item-dark item-icon-right">
File System I/O
<i class="icon ion-ios-help-outline"
ng-click="controller.help_click('Used to test the native file plugin; this requires cordova-plugin-file.')"></i>
Expand All @@ -185,7 +243,7 @@
</label>

<label class="item item-text-wrap"
ng-click="controller.defaultStoragePath_click(viewModel.defaultStoragePath)">
ng-click="controller.copyValue_click(viewModel.defaultStoragePath, 'Default Storage Path')">
Default Storage Path
<br/>
{{viewModel.defaultStoragePath}}
Expand Down
34 changes: 17 additions & 17 deletions src/Views/Settings/Developer/DeveloperController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
public static get $inject(): string[] {
return [
"$scope",
"$window",
Services.Plugins.ID,
Services.Utilities.ID,
Services.UiHelper.ID,
Expand All @@ -22,6 +23,7 @@

constructor(
$scope: ng.IScope,
private $window: ng.IWindowService,
private Plugins: Services.Plugins,
private Utilities: Services.Utilities,
private UiHelper: Services.UiHelper,
Expand Down Expand Up @@ -51,6 +53,12 @@
this.viewModel.deviceUuid = this.Utilities.device.uuid;
this.viewModel.deviceCordovaVersion = this.Utilities.device.cordova;

this.viewModel.navigatorPlatform = this.$window.navigator.platform;
this.viewModel.navigatorProduct = this.$window.navigator.product;
this.viewModel.navigatorVendor = this.$window.navigator.vendor;
this.viewModel.viewport = this.Utilities.viewport;
this.viewModel.userAgent = this.$window.navigator.userAgent;

this.viewModel.defaultStoragePathId = this.FileUtilities.getDefaultRootPathId();
this.viewModel.defaultStoragePath = this.FileUtilities.getDefaultRootPath();

Expand Down Expand Up @@ -83,6 +91,15 @@
this.UiHelper.alert(helpMessage, "Help");
}

protected copyValue_click(value: any, name: string): void {
this.UiHelper.confirm("Copy " + name + " to clipboard?").then((result: string) => {
if (result === Constants.Buttons.Yes) {
this.Plugins.clipboard.copy(value);
this.Plugins.toast.showShortBottom(name + " copied to clipboard.");
}
});
}

protected mockApiRequests_change(): void {

this.Configuration.enableMockHttpCalls = this.viewModel.mockApiRequests;
Expand Down Expand Up @@ -111,15 +128,6 @@
});
}

protected userToken_click(token: string): void {
this.UiHelper.confirm("Copy token to clipboard?").then((result: string) => {
if (result === Constants.Buttons.Yes) {
this.Plugins.clipboard.copy(token);
this.Plugins.toast.showShortBottom("Token copied to clipboard.");
}
});
}

protected addServicesToGlobalScope_click(): void {

/* tslint:disable:no-string-literal */
Expand Down Expand Up @@ -172,14 +180,6 @@
this.UiHelper.alert("Onboarding has been enabled and will occur upon next app boot.");
}

protected testNativeException_click(): void {
this.UiHelper.confirm("Are you sure you want to cause a native crash? This requires the Crashlytics plug-in to be installed.").then((result: string) => {
if (result === Constants.Buttons.Yes) {
this.Plugins.crashlytics.simulateCrash();
}
});
}

protected testJsException_click(): void {
/* tslint:disable:no-string-literal */

Expand Down
6 changes: 6 additions & 0 deletions src/Views/Settings/Developer/DeveloperViewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
deviceUuid: string;
deviceCordovaVersion: string;

navigatorPlatform: string;
navigatorProduct: string;
navigatorVendor: string;
viewport: { width: number; height: number; };
userAgent: string;

userId: string;
token: string;

Expand Down

0 comments on commit ee8743e

Please sign in to comment.