Skip to content

Commit e660463

Browse files
committed
demo: update
1 parent bb72427 commit e660463

File tree

5 files changed

+33
-357
lines changed

5 files changed

+33
-357
lines changed

demo/app/App_Resources/Android/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
android:name="com.tns.NativeScriptActivity"
3030
android:label="@string/title_activity_kimera"
3131
android:configChanges="keyboardHidden|orientation|screenSize"
32-
android:theme="@style/LaunchScreenTheme">
32+
android:theme="@style/LaunchScreenTheme" android:exported="true">
3333

3434
<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />
3535

@@ -38,6 +38,6 @@
3838
<category android:name="android.intent.category.LAUNCHER" />
3939
</intent-filter>
4040
</activity>
41-
<activity android:name="com.tns.ErrorReportActivity"/>
41+
<activity android:name="com.tns.ErrorReportActivity" android:exported="false"/>
4242
</application>
4343
</manifest>

demo/app/main-page.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export function pageLoaded(args: Page.NavigatedData) {
1818

1919
function createRequest(url: string, options?: Partial<Https.HttpsRequestOptions>) {
2020
return Https.createRequest({
21-
useLegacy: true,
2221
url,
2322
method: 'GET',
2423
timeout: 1,
@@ -35,7 +34,6 @@ function onError(error) {
3534
}
3635
function getRequest(url: string, options?: Partial<Https.HttpsRequestOptions>) {
3736
return Https.request({
38-
useLegacy: true,
3937
url,
4038
method: 'GET',
4139
timeout: 1,
@@ -44,15 +42,14 @@ function getRequest(url: string, options?: Partial<Https.HttpsRequestOptions>) {
4442
.then((response) => {
4543
page.bindingContext.currentRequest = null;
4644
page.bindingContext.progress = 0;
47-
console.log('Https.request response', response);
45+
console.log('Https.request response', response.statusCode, response.content.contentLength, response.content.toString());
4846
return response;
4947
})
5048
.catch(onError);
5149
}
5250

5351
function postRequest(url: string, options?: Partial<Https.HttpsRequestOptions>) {
5452
return Https.request({
55-
useLegacy: true,
5653
url,
5754
method: 'POST',
5855
...options,

demo/app/main-page.xml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
1-
<Page class="page" loaded="pageLoaded"
2-
xmlns="http://schemas.nativescript.org/tns.xsd">
1+
<Page class="page" loaded="pageLoaded" xmlns="http://schemas.nativescript.org/tns.xsd">
32
<Page.actionBar>
43
<ActionBar title="HTTPS Playground" class="action-bar"></ActionBar>
54
</Page.actionBar>
65
<GridLayout class="p-20" rows="auto,auto,auto,*">
7-
<Label class="h2 text-center" color="{{ enabled ? 'green' : 'red' }}" text="{{ enabled ? 'Httpbin SSL Pinning Enabled' : 'SSL Pinning Disabled' }}"/>
6+
<Label class="h2 text-center" color="{{ enabled ? 'green' : 'red' }}" text="{{ enabled ? 'Httpbin SSL Pinning Enabled' : 'SSL Pinning Disabled' }}" />
87
<GridLayout row="1" rows="auto" columns="*,auto">
9-
<Label fontSize="13" text="Here's a spinner to show the main thread is not blocked by network IO" textWrap="true" class="m-20"/>
10-
<ActivityIndicator col="1" busy="true"/>
8+
<Label fontSize="13" text="Here's a spinner to show the main thread is not blocked by network IO" textWrap="true" class="m-20" />
9+
<ActivityIndicator col="1" busy="true" />
1110
</GridLayout>
1211
<GridLayout row="2" rows="auto" columns="*,auto" visibility="{{ currentRequest ? 'visible' : 'collapsed'}}">
13-
<Progress minValue="0" maxValue="100" value="{{ progress}}"/>
14-
<Button col="1" text="cancel" tap="cancelCurrentRequest"/>
12+
<Progress minValue="0" maxValue="100" value="{{ progress}}" />
13+
<Button col="1" text="cancel" tap="cancelCurrentRequest" />
1514
</GridLayout>
1615
<ScrollView row="3">
1716
<StackLayout>
18-
<Button text="GET Bigfile" tap="getBigFile" class="t-20 btn btn-primary btn-active"/>
19-
<Button text="GET 404" tap="get404" class="t-20 btn btn-primary btn-active"/>
20-
<Button text="GET Mockbin" tap="getMockbin" class="t-20 btn btn-primary btn-active"/>
21-
<Button text="GET Httpbin" tap="getHttpbin" class="t-20 btn btn-primary btn-active"/>
22-
<Button text="GET Httpbin (large response)" tap="getHttpbinLargeResponse" class="t-20 btn btn-primary btn-active"/>
23-
<Button text="POST Httpbin " tap="postHttpbin" class="t-20 btn btn-primary btn-active"/>
24-
<Button text="POST Httpbin UTF-8" tap="postHttpbinWithUTF8" class="t-20 btn btn-primary btn-active"/>
25-
<Button text="Httpbin Pinning ON" tap="enableSSLPinning" class="t-20 btn btn-primary btn-active"/>
26-
<Button text="Httpbin Pinning ON, expired cert" tap="enableSSLPinningExpired" class="t-20 btn btn-primary btn-active"/>
27-
<Button text="Httpbin Pinning OFF" tap="disableSSLPinning" class="t-20 btn btn-primary btn-active"/>
17+
<Button text="GET Bigfile" tap="getBigFile" class="t-20 btn btn-primary btn-active" />
18+
<Button text="GET 404" tap="get404" class="t-20 btn btn-primary btn-active" />
19+
<Button text="GET Mockbin" tap="getMockbin" class="t-20 btn btn-primary btn-active" />
20+
<Button text="GET Httpbin" tap="getHttpbin" class="t-20 btn btn-primary btn-active" />
21+
<Button text="GET Httpbin (large response)" tap="getHttpbinLargeResponse" class="t-20 btn btn-primary btn-active" />
22+
<Button text="POST Httpbin " tap="postHttpbin" class="t-20 btn btn-primary btn-active" />
23+
<Button text="POST Httpbin UTF-8" tap="postHttpbinWithUTF8" class="t-20 btn btn-primary btn-active" />
24+
<Button text="Httpbin Pinning ON" tap="enableSSLPinning" class="t-20 btn btn-primary btn-active" />
25+
<Button text="Httpbin Pinning ON, expired cert" tap="enableSSLPinningExpired" class="t-20 btn btn-primary btn-active" />
26+
<Button text="Httpbin Pinning OFF" tap="disableSSLPinning" class="t-20 btn btn-primary btn-active" />
2827
</StackLayout>
2928
</ScrollView>
3029
</GridLayout>
31-
</Page>
30+
</Page>

demo/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"dependencies": {
33
"@nativescript-community/https": "file:../plugin",
4-
"@nativescript/core": "7.2.0",
5-
"@nativescript/webpack": "4.1.0",
4+
"@nativescript/core": "~8.2.0",
65
"nativescript-theme-core": "^2.0.24",
7-
"nativescript-unit-test-runner": "0.7.0"
6+
"@nativescript/unit-test-runner": "~3.0.0"
87
},
98
"devDependencies": {
10-
"@nativescript/android": "7.0.1",
11-
"@nativescript/types": "7.0.0",
9+
"@nativescript/android": "~8.2.0",
10+
"@nativescript/types": "~8.2.0",
1211
"nativescript-css-loader": "~0.26.1",
13-
"typescript": "3.9.7"
12+
"typescript": "~4.5.5",
13+
"@nativescript/webpack": "~5.0.0"
1414
},
1515
"scripts": {
1616
"build.plugin": "cd ../src && npm run build",
1717
"ci.tslint": "npm i && tslint --config '../tslint.json' 'app/**/*.ts' --exclude '**/node_modules/**'"
1818
},
19-
"main": "app.js"
19+
"main": "./app/app.ts"
2020
}

0 commit comments

Comments
 (0)