Skip to content

Commit 0d23a76

Browse files
committed
Update demo for NS7
1 parent e726355 commit 0d23a76

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

demo/app/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import * as application from 'tns-core-modules/application';
1+
import * as application from '@nativescript/core/application';
22

33
application.run({moduleName: "main-page"});

demo/app/main-page.ts

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import * as Https from "nativescript-https";
2-
import * as Observable from "tns-core-modules/data/observable";
3-
import * as fs from "tns-core-modules/file-system";
4-
import * as dialogs from "tns-core-modules/ui/dialogs";
5-
import * as Page from "tns-core-modules/ui/page";
6-
2+
import {fromObject, Dialogs as dialogs, Page, EventData} from "@nativescript/core";
3+
import * as fs from "@nativescript/core/file-system";
74
let page;
85
let viewModel;
9-
export function pageLoaded(args: Page.NavigatedData) {
10-
page = args.object as Page.Page;
11-
viewModel = Observable.fromObject({
6+
export function pageLoaded(args: EventData) {
7+
page = args.object as Page;
8+
viewModel = fromObject({
129
enabled: false,
1310
progress: 0,
1411
currentRequest: null,
@@ -138,10 +135,24 @@ export function getMockbin() {
138135
}
139136

140137
export function get404() {
141-
getRequest("https://mockbin.com/reque2st");
138+
Https.request({
139+
url: "https://httpbin.org/json",
140+
method: "GET",
141+
headers: {
142+
"Content-Type": "application/json; charset=utf-8"
143+
},
144+
body: {foo:"bar"},
145+
allowLargeResponse: true
146+
}).then(res => {
147+
console.log(res.content)
148+
console.log(res.content.slideshow)
149+
}).catch(err => {
150+
console.log("error >>>", err);
151+
})
152+
//getRequest("https://mockbin.com/reque2st");
142153
}
143154

144-
export function enableSSLPinning(args: Observable.EventData) {
155+
export function enableSSLPinning(args: EventData) {
145156
let dir = fs.knownFolders.currentApp().getFolder("assets");
146157
let certificate = dir.getFile("httpbin.org.cer").path;
147158
Https.enableSSLPinning({
@@ -152,14 +163,14 @@ export function enableSSLPinning(args: Observable.EventData) {
152163
console.log("enabled");
153164
}
154165

155-
export function enableSSLPinningExpired(args: Observable.EventData) {
166+
export function enableSSLPinningExpired(args: EventData) {
156167
let dir = fs.knownFolders.currentApp().getFolder("assets");
157168
let certificate = dir.getFile("httpbin.org.expired.cer").path;
158169
Https.enableSSLPinning({ host: "httpbin.org", certificate });
159170
console.log("enabled");
160171
}
161172

162-
export function disableSSLPinning(args: Observable.EventData) {
173+
export function disableSSLPinning(args: EventData) {
163174
Https.disableSSLPinning();
164175
console.log("disabled");
165176
}

0 commit comments

Comments
 (0)