Skip to content

Commit 9bf7068

Browse files
authored
feat: NativeScript 9 for demo app (#159)
1 parent c289b4a commit 9bf7068

File tree

12 files changed

+3435
-3182
lines changed

12 files changed

+3435
-3182
lines changed

apps/nativescript-demo-ng/App_Resources/Android/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
android:icon="@drawable/icon"
2121
android:usesCleartextTraffic="${isUnitTesting}"
2222
android:label="@string/app_name"
23-
android:theme="@style/AppTheme">
23+
android:theme="@style/AppTheme"
24+
android:networkSecurityConfig="@xml/network_security_config">
2425

2526
<activity
2627
android:name="com.tns.NativeScriptActivity"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<network-security-config>
3+
<base-config cleartextTrafficPermitted="true">
4+
<trust-anchors>
5+
<certificates src="system" />
6+
<certificates src="user" />
7+
</trust-anchors>
8+
</base-config>
9+
<domain-config cleartextTrafficPermitted="true">
10+
<domain includeSubdomains="true">localhost</domain>
11+
<domain includeSubdomains="true">127.0.0.1</domain>
12+
<domain includeSubdomains="true">10.0.2.2</domain>
13+
</domain-config>
14+
</network-security-config>
15+
16+

apps/nativescript-demo-ng/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
"@nativescript/core": "file:../../node_modules/@nativescript/core"
77
},
88
"devDependencies": {
9-
"@nativescript/android": "~8.9.0",
10-
"@nativescript/ios": "~8.9.0",
9+
"@nativescript/android": "~9.0.0",
10+
"@nativescript/ios": "~9.0.0",
1111
"@nativescript/tailwind": "^2.1.0",
12-
"@nativescript/unit-test-runner": "^3.0.1",
13-
"@nativescript/visionos": "~8.9.0"
12+
"@nativescript/unit-test-runner": "^4.0.0",
13+
"@nativescript/visionos": "~9.0.0"
1414
}
1515
}

apps/nativescript-demo-ng/project.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"uglify": false,
3939
"release": false,
4040
"forDevice": false,
41-
"prepare": false
41+
"prepare": false,
42+
"flags": "--env.commonjs"
4243
},
4344
"dependsOn": ["^build"]
4445
},
@@ -53,7 +54,8 @@
5354
"executor": "@nativescript/nx:test",
5455
"outputs": ["{workspaceRoot}/coverage/apps/nativescript-demo-ng"],
5556
"options": {
56-
"coverage": false
57+
"coverage": false,
58+
"flags": "--env.commonjs"
5759
},
5860
"configurations": {}
5961
}

apps/nativescript-demo-ng/src/main.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import {
55
provideNativeScriptRouter,
66
runNativeScriptAngularApp,
77
} from '@nativescript/angular';
8-
import { Trace } from '@nativescript/core';
8+
import { Trace, Utils } from '@nativescript/core';
99

1010
// import { AppModule } from './app/app.module';
1111
import { withInterceptorsFromDi } from '@angular/common/http';
12-
import { setWindowBackgroundColor } from '@nativescript/core/utils/ios';
1312
import { AppComponent } from './app/app.component';
1413
import { routes } from './app/app.routes';
1514
import { provideZonelessChangeDetection } from '@angular/core';
@@ -22,7 +21,7 @@ Trace.setCategories('ns-route-reuse-strategy,ns-router');
2221
runNativeScriptAngularApp({
2322
appModuleBootstrap: () => {
2423
if (__APPLE__) {
25-
setWindowBackgroundColor('#a6120d');
24+
Utils.ios.setWindowBackgroundColor('#a6120d');
2625
}
2726
return bootstrapApplication(AppComponent, {
2827
providers: [

apps/nativescript-demo-ng/src/tests/platform-filter-components.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('Platform filter directives', () => {
9595
fixture.detectChanges();
9696
const componentRef = fixture.componentRef;
9797
const componentRoot = componentRef.instance.elementRef.nativeElement;
98-
expect(dumpView(componentRoot, true).indexOf('(label[text=Apple])') >= 0).toBe(true);
98+
expect(dumpView(componentRoot, true).indexOf('(label[text=Apple])') >= 0).toBe(__APPLE__);
9999
});
100100
it('does not render android specific content', () => {
101101
const fixture = TestBed.createComponent(AndroidSpecificComponent);

apps/nativescript-demo-ng/src/tests/value-accessor-tests.spec.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
// make sure you import mocha-config before @angular/core
22
import { ElementRef } from '@angular/core';
3-
import { CheckedValueAccessor, DateValueAccessor, NumberValueAccessor, SelectedIndexValueAccessor, TextValueAccessor, TimeValueAccessor } from '@nativescript/angular';
3+
import {
4+
CheckedValueAccessor,
5+
DateValueAccessor,
6+
NumberValueAccessor,
7+
SelectedIndexValueAccessor,
8+
TextValueAccessor,
9+
TimeValueAccessor,
10+
} from '@nativescript/angular';
411
import { DatePicker, ListPicker, Slider, Switch, TextField, TimePicker, View } from '@nativescript/core';
512

613
class TestElementRef implements ElementRef {
@@ -80,7 +87,7 @@ describe('two-way binding via ng-model', () => {
8087
accessor.writeValue(null);
8188
expect(accessor.view.checked).withContext('setting null should reset the value').toBe(defaultValue);
8289

83-
expect(() => accessor.writeValue('blah')).toThrow();
90+
expect(() => accessor.writeValue('blah')).not.toThrow();
8491
});
8592

8693
it('converts strings to dates', () => {

apps/nativescript-demo-ng/tsconfig.app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
4-
"target": "es2017",
4+
"target": "es2020",
55
"baseUrl": ".",
66
"outDir": "../../dist/out-tsc",
77
"paths": {

apps/nativescript-demo-ng/tsconfig.spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
4-
"target": "es2017",
4+
"target": "es2020",
55
"baseUrl": ".",
66
"outDir": "../../dist/out-tsc",
77
"paths": {

0 commit comments

Comments
 (0)