Skip to content

Commit b3a7f24

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/flutter
2 parents af0c347 + eb00331 commit b3a7f24

File tree

281 files changed

+16115
-6406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+16115
-6406
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# @nativescript/\* plugins
2+
3+
```
4+
npm run setup
5+
npm start
6+
```
7+
18
- [@nativescript/animated-circle](packages/animated-circle/README.md)
29
- [@nativescript/appavailability](packages/appavailability/README.md)
310
- [@nativescript/apple-sign-in](packages/apple-sign-in/README.md)
@@ -19,15 +26,19 @@
1926
- [@nativescript/geolocation](packages/geolocation/README.md)
2027
- [@nativescript/google-maps](packages/google-maps/README.md)
2128
- [@nativescript/google-signin](packages/google-signin/README.md)
29+
- [@nativescript/haptics](packages/haptics/README.md)
2230
- [@nativescript/imagepicker](packages/imagepicker/README.md)
2331
- [@nativescript/ionic-portals](packages/ionic-portals/README.md)
2432
- [@nativescript/ios-security](packages/ios-security/README.md)
2533
- [@nativescript/iqkeyboardmanager](packages/iqkeyboardmanager/README.md)
34+
- [@nativescript/jetpack-compose](packages/jetpack-compose/README.md)
2635
- [@nativescript/local-notifications](packages/local-notifications/README.md)
2736
- [@nativescript/localize](packages/localize/README.md)
37+
- [@nativescript/pdf](packages/pdf/README.md)
2838
- [@nativescript/picker](packages/picker/README.md)
2939
- [@nativescript/shared-notification-delegate](packages/shared-notification-delegate/README.md)
3040
- [@nativescript/social-share](packages/social-share/README.md)
41+
- [@nativescript/swift-ui](packages/swift-ui/README.md)
3142
- [@nativescript/theme-switcher](packages/theme-switcher/README.md)
3243
- [@nativescript/twitter](packages/twitter/README.md)
3344
- [@nativescript/zip](packages/zip/README.md)
@@ -36,6 +47,18 @@
3647

3748
This workspace manages the suite of plugins listed above.
3849

50+
## Prerequisites
51+
52+
- Node 18+ is recommended
53+
- [yarn v1](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable) is required
54+
55+
### Note about "focus modes"
56+
57+
`npm start` > `focus.{any-plugin}` ENTER will focus the workspace to a single plugin for working on it in isolation.
58+
59+
Generally we try to keep "UI" plugins away from "SDK" related plugins since UI plugins often bring in aspects which may need more resource setup. For example, since the swift-ui plugin is currently managed here, we have testing code for it here: https://github.com/NativeScript/plugins/blob/main/tools/assets/App_Resources/iOS/src/BasicViewProvider.swift ... however when focusing on any other plugins, you would need to rename those .swift > .off so they aren't included in the demo to work with other plugins. Since the supporting .swift files include SwiftUIProvider which comes from only the swift-ui plugin.
60+
To help contributors in the future, we will likely split some of these plugins out across other workspaces to pair it down. For now that tip can be applied where needed to work on any plugin.
61+
3962
In general, when in doubt with what to do, just `npm start`.
4063

4164
```bash
@@ -96,4 +119,4 @@ npm run publish-packages
96119
- You will then be prompted for the version to use. Leaving blank will auto bump the patch version (it also handles prerelease types like alpha, beta, rc, etc. - It even auto tags the corresponding prelease type on npm).
97120
- You will then be given a brief sanity check 🧠😊
98121

99-
<h3 align="center">Made with ❤️</h3>
122+
<h3 align="center">Made with ❤️</h3>

apps/demo-angular/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"main": "./src/main.ts",
33
"dependencies": {
44
"@nativescript/core": "file:../../node_modules/@nativescript/core",
5-
"@nativescript/flutter": "file:../../dist/packages/flutter",
5+
"@nativescript/jetpack-compose": "file:../../dist/packages/jetpack-compose",
66
"@nativescript/animated-circle": "file:../../dist/packages/animated-circle",
77
"@nativescript/appavailability": "file:../../dist/packages/appavailability",
88
"@nativescript/apple-sign-in": "file:../../dist/packages/apple-sign-in",
@@ -20,24 +20,28 @@
2020
"@nativescript/email": "file:../../dist/packages/email",
2121
"@nativescript/facebook": "file:../../dist/packages/facebook",
2222
"@nativescript/fingerprint-auth": "file:../../dist/packages/fingerprint-auth",
23+
"@nativescript/flutter": "file:../../dist/packages/flutter",
2324
"@nativescript/geolocation": "file:../../dist/packages/geolocation",
2425
"@nativescript/google-maps": "file:../../dist/packages/google-maps",
2526
"@nativescript/google-signin": "file:../../dist/packages/google-signin",
27+
"@nativescript/haptics": "file:../../dist/packages/haptics",
2628
"@nativescript/imagepicker": "file:../../dist/packages/imagepicker",
2729
"@nativescript/ionic-portals": "file:../../dist/packages/ionic-portals",
2830
"@nativescript/ios-security": "file:../../dist/packages/ios-security",
2931
"@nativescript/iqkeyboardmanager": "file:../../dist/packages/iqkeyboardmanager",
3032
"@nativescript/local-notifications": "file:../../dist/packages/local-notifications",
3133
"@nativescript/localize": "file:../../dist/packages/localize",
34+
"@nativescript/pdf": "file:../../dist/packages/pdf",
3235
"@nativescript/picker": "file:../../dist/packages/picker",
3336
"@nativescript/shared-notification-delegate": "file:../../dist/packages/shared-notification-delegate",
3437
"@nativescript/social-share": "file:../../dist/packages/social-share",
38+
"@nativescript/swift-ui": "file:../../dist/packages/swift-ui",
3539
"@nativescript/theme-switcher": "file:../../dist/packages/theme-switcher",
3640
"@nativescript/twitter": "file:../../dist/packages/twitter",
3741
"@nativescript/zip": "file:../../dist/packages/zip"
3842
},
3943
"devDependencies": {
40-
"@nativescript/android": "~8.2.0",
41-
"@nativescript/ios": "~8.2.0"
44+
"@nativescript/android": "~8.4.0",
45+
"@nativescript/ios": "~8.4.0"
4246
}
4347
}

apps/demo-angular/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"root": "apps/demo-angular/",
2+
"name": "demo-angular",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
34
"sourceRoot": "apps/demo-angular/src",
45
"projectType": "application",
56
"prefix": "demo",

apps/demo-angular/src/app-routing.module.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,19 @@ const routes: Routes = [
2828
{ path: 'geolocation', loadChildren: () => import('./plugin-demos/geolocation.module').then((m) => m.GeolocationModule) },
2929
{ path: 'google-maps', loadChildren: () => import('./plugin-demos/google-maps.module').then((m) => m.GoogleMapsModule) },
3030
{ path: 'google-signin', loadChildren: () => import('./plugin-demos/google-signin.module').then((m) => m.GoogleSigninModule) },
31+
{ path: 'haptics', loadChildren: () => import('./plugin-demos/haptics.module').then((m) => m.HapticsModule) },
3132
{ path: 'imagepicker', loadChildren: () => import('./plugin-demos/imagepicker.module').then((m) => m.ImagepickerModule) },
3233
{ path: 'ionic-portals', loadChildren: () => import('./plugin-demos/ionic-portals.module').then((m) => m.IonicPortalsModule) },
33-
{ path: 'ios-security', loadChildren: () => import('./plugin-demos/ios-security.module').then((m) => m.IosSecurityModule) },
34+
{ path: 'ios-security', loadChildren: () => import('./plugin-demos/ios-security.module').then((m) => m.IOSSecurityModule) },
3435
{ path: 'iqkeyboardmanager', loadChildren: () => import('./plugin-demos/iqkeyboardmanager.module').then((m) => m.IqkeyboardmanagerModule) },
36+
{ path: 'jetpack-compose', loadChildren: () => import('./plugin-demos/jetpack-compose.module').then((m) => m.JetpackComposeModule) },
3537
{ path: 'local-notifications', loadChildren: () => import('./plugin-demos/local-notifications.module').then((m) => m.LocalNotificationsModule) },
3638
{ path: 'localize', loadChildren: () => import('./plugin-demos/localize.module').then((m) => m.LocalizeModule) },
39+
{ path: 'pdf', loadChildren: () => import('./plugin-demos/pdf.module').then((m) => m.PdfModule) },
3740
{ path: 'picker', loadChildren: () => import('./plugin-demos/picker.module').then((m) => m.PickerModule) },
3841
{ path: 'shared-notification-delegate', loadChildren: () => import('./plugin-demos/shared-notification-delegate.module').then((m) => m.SharedNotificationDelegateModule) },
3942
{ path: 'social-share', loadChildren: () => import('./plugin-demos/social-share.module').then((m) => m.SocialShareModule) },
43+
{ path: 'swift-ui', loadChildren: () => import('./plugin-demos/swift-ui.module').then((m) => m.SwiftUiModule) },
4044
{ path: 'theme-switcher', loadChildren: () => import('./plugin-demos/theme-switcher.module').then((m) => m.ThemeSwitcherModule) },
4145
{ path: 'twitter', loadChildren: () => import('./plugin-demos/twitter.module').then((m) => m.TwitterModule) },
4246
{ path: 'zip', loadChildren: () => import('./plugin-demos/zip.module').then((m) => m.ZipModule) },

apps/demo-angular/src/home.component.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ export class HomeComponent {
6969
{
7070
name: 'google-signin',
7171
},
72+
{
73+
name: 'haptics',
74+
},
7275
{
7376
name: 'imagepicker',
7477
},
@@ -81,12 +84,18 @@ export class HomeComponent {
8184
{
8285
name: 'iqkeyboardmanager',
8386
},
87+
{
88+
name: 'jetpack-compose',
89+
},
8490
{
8591
name: 'local-notifications',
8692
},
8793
{
8894
name: 'localize',
8995
},
96+
{
97+
name: 'pdf',
98+
},
9099
{
91100
name: 'picker',
92101
},
@@ -96,6 +105,9 @@ export class HomeComponent {
96105
{
97106
name: 'social-share',
98107
},
108+
{
109+
name: 'swift-ui',
110+
},
99111
{
100112
name: 'theme-switcher',
101113
},

apps/demo-angular/src/plugin-demos/email.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<ScrollView class="h-full">
44
<StackLayout>
55
<Button text="Test email" (tap)="demoShared.testIt()" class="btn btn-primary"></Button>
6+
<Button text="Is available?" (tap)="demoShared.checkAvailability()" class="btn btn-primary"></Button>
67
</StackLayout>
78
</ScrollView>
89
</StackLayout>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<ActionBar title="haptics" class="action-bar"> </ActionBar>
2+
<StackLayout class="p-20">
3+
<ScrollView class="h-full">
4+
<StackLayout>
5+
<Button text="Test haptics" (tap)="demoShared.testIt()" class="btn btn-primary"></Button>
6+
</StackLayout>
7+
</ScrollView>
8+
</StackLayout>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Component, NgZone } from '@angular/core';
2+
import { DemoSharedHaptics } from '@demo/shared';
3+
import {} from '@nativescript/haptics';
4+
5+
@Component({
6+
selector: 'demo-haptics',
7+
templateUrl: 'haptics.component.html',
8+
})
9+
export class HapticsComponent {
10+
demoShared: DemoSharedHaptics;
11+
12+
constructor(private _ngZone: NgZone) {}
13+
14+
ngOnInit() {
15+
this.demoShared = new DemoSharedHaptics();
16+
}
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
2+
import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
3+
import { HapticsComponent } from './haptics.component';
4+
5+
@NgModule({
6+
imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: HapticsComponent }])],
7+
declarations: [HapticsComponent],
8+
schemas: [NO_ERRORS_SCHEMA],
9+
})
10+
export class HapticsModule {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<ActionBar title="jetpack-compose" class="action-bar"> </ActionBar>
2+
<StackLayout class="p-20">
3+
<ScrollView class="h-full">
4+
<StackLayout>
5+
<Button text="Test jetpack-compose" class="btn btn-primary"></Button>
6+
</StackLayout>
7+
</ScrollView>
8+
</StackLayout>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Component, NgZone } from '@angular/core';
2+
import { DemoSharedJetpackCompose } from '@demo/shared';
3+
import {} from '@nativescript/jetpack-compose';
4+
5+
@Component({
6+
selector: 'demo-jetpack-compose',
7+
templateUrl: 'jetpack-compose.component.html',
8+
})
9+
export class JetpackComposeComponent {
10+
demoShared: DemoSharedJetpackCompose;
11+
12+
constructor(private _ngZone: NgZone) {}
13+
14+
ngOnInit() {
15+
this.demoShared = new DemoSharedJetpackCompose();
16+
}
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
2+
import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
3+
import { JetpackComposeComponent } from './jetpack-compose.component';
4+
5+
@NgModule({
6+
imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: JetpackComposeComponent }])],
7+
declarations: [JetpackComposeComponent],
8+
schemas: [NO_ERRORS_SCHEMA],
9+
})
10+
export class JetpackComposeModule {}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ActionBar title="pdf" class="action-bar"> </ActionBar>
2+
3+
<GridLayout class="page__content" columns="*" rows="auto, *">
4+
<PDFView row="1" col="0" [src]="pdfSrc" (load)="onLoad()"></PDFView>
5+
</GridLayout>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Component, NgZone } from '@angular/core';
2+
3+
@Component({
4+
selector: 'demo-pdf',
5+
templateUrl: 'pdf.component.html',
6+
})
7+
export class PdfComponent {
8+
pdfSrc: string = 'https://riptutorial.com/Download/nativescript.pdf';
9+
10+
constructor(private _ngZone: NgZone) {}
11+
12+
onLoad() {
13+
console.log('PDF loaded');
14+
}
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
2+
import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
3+
import { NativeScriptPdfModule } from '@nativescript/pdf/angular';
4+
import { PdfComponent } from './pdf.component';
5+
6+
@NgModule({
7+
imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: PdfComponent }]), NativeScriptPdfModule],
8+
declarations: [PdfComponent],
9+
schemas: [NO_ERRORS_SCHEMA],
10+
})
11+
export class PdfModule {}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<ActionBar title="SwiftUI" class="action-bar"> </ActionBar>
2+
<StackLayout class="p-20">
3+
<SwiftUI swiftId="basicView" [data]="demoShared.nativeCount" (swiftUIEvent)="demoShared.onEvent($event)" (loaded)="demoShared.loadedSwiftUI($event)" height="150"></SwiftUI>
4+
<Label row="1" [text]="'NativeScript Label: ' + demoShared.nativeCount.count" class="h2" marginTop="60"></Label>
5+
<Button row="2" text="NativeScript data bindings: Decrement" (tap)="demoShared.updateNativeScriptData()" class="btn btn-primary m-t-30"></Button>
6+
<Button row="3" text="SwiftUI data bindings: Decrement" (tap)="demoShared.updateSwiftData()" class="btn btn-primary"></Button>
7+
</StackLayout>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Component, NgZone } from '@angular/core';
2+
import { DemoSharedSwiftUi } from '@demo/shared';
3+
import { registerElement } from '@nativescript/angular';
4+
import { SwiftUI } from '@nativescript/swift-ui';
5+
6+
registerElement('SwiftUI', () => SwiftUI);
7+
8+
@Component({
9+
selector: 'demo-swift-ui',
10+
templateUrl: 'swift-ui.component.html',
11+
})
12+
export class SwiftUiComponent {
13+
demoShared: DemoSharedSwiftUi;
14+
15+
constructor(private _ngZone: NgZone) {}
16+
17+
ngOnInit() {
18+
this.demoShared = new DemoSharedSwiftUi();
19+
}
20+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
2+
import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
3+
import { SwiftUiComponent } from './swift-ui.component';
4+
5+
@NgModule({
6+
imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: SwiftUiComponent }])],
7+
declarations: [SwiftUiComponent],
8+
schemas: [NO_ERRORS_SCHEMA],
9+
})
10+
export class SwiftUiModule {}

apps/demo/package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"repository": "<fill-your-repository-here>",
66
"dependencies": {
77
"@nativescript/core": "file:../../node_modules/@nativescript/core",
8-
"@nativescript/flutter": "file:../../packages/flutter",
8+
"@nativescript/jetpack-compose": "file:../../packages/jetpack-compose",
99
"@nativescript/animated-circle": "file:../../packages/animated-circle",
1010
"@nativescript/appavailability": "file:../../packages/appavailability",
1111
"@nativescript/apple-sign-in": "file:../../packages/apple-sign-in",
@@ -23,24 +23,28 @@
2323
"@nativescript/email": "file:../../packages/email",
2424
"@nativescript/facebook": "file:../../packages/facebook",
2525
"@nativescript/fingerprint-auth": "file:../../packages/fingerprint-auth",
26+
"@nativescript/flutter": "file:../../packages/flutter",
2627
"@nativescript/geolocation": "file:../../packages/geolocation",
2728
"@nativescript/google-maps": "file:../../packages/google-maps",
2829
"@nativescript/google-signin": "file:../../packages/google-signin",
30+
"@nativescript/haptics": "file:../../packages/haptics",
2931
"@nativescript/imagepicker": "file:../../packages/imagepicker",
3032
"@nativescript/ionic-portals": "file:../../packages/ionic-portals",
3133
"@nativescript/ios-security": "file:../../packages/ios-security",
3234
"@nativescript/iqkeyboardmanager": "file:../../packages/iqkeyboardmanager",
3335
"@nativescript/local-notifications": "file:../../packages/local-notifications",
34-
"@nativescript/localize": "file:../../packages/localize",
36+
"@nativescript/localize": "file:../../dist/packages/localize",
37+
"@nativescript/pdf": "file:../../packages/pdf",
3538
"@nativescript/picker": "file:../../packages/picker",
3639
"@nativescript/shared-notification-delegate": "file:../../packages/shared-notification-delegate",
3740
"@nativescript/social-share": "file:../../packages/social-share",
41+
"@nativescript/swift-ui": "file:../../packages/swift-ui",
3842
"@nativescript/theme-switcher": "file:../../packages/theme-switcher",
3943
"@nativescript/twitter": "file:../../packages/twitter",
4044
"@nativescript/zip": "file:../../packages/zip"
4145
},
4246
"devDependencies": {
43-
"@nativescript/android": "~8.2.0",
44-
"@nativescript/ios": "~8.2.0"
47+
"@nativescript/android": "~8.4.0",
48+
"@nativescript/ios": "~8.4.0"
4549
}
4650
}

apps/demo/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"root": "apps/demo/",
2+
"name": "demo",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
34
"sourceRoot": "apps/demo/src",
45
"projectType": "application",
56
"prefix": "demo",

apps/demo/src/app.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ import { FlutterDelegate } from '@nativescript/flutter';
1414

1515
// uncomment to test Ionic Portals
1616
// import { IonicPortalManager } from '@nativescript/ionic-portals';
17+
// IonicPortalManager.configureLiveUpdates('ionicWebPortalSample', {
18+
// appId: 'e29e2c2e',
19+
// channel: 'production',
20+
// syncOnAdd: true
21+
// })
1722

1823
// Application.on(Application.launchEvent, () => {
1924
// // Register IonicPortals

0 commit comments

Comments
 (0)