From 006a48912204959f3269e5831d3813c67dc4b0d8 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Fri, 8 Jul 2022 20:01:38 -0700 Subject: [PATCH 1/7] feat(flutter): 1.0 setup --- README.md | 1 + apps/demo-angular/package.json | 3 +- apps/demo-angular/src/app-routing.module.ts | 69 +- apps/demo-angular/src/home.component.ts | 199 ++-- .../src/plugin-demos/flutter.component.html | 8 + .../src/plugin-demos/flutter.component.ts | 17 + .../src/plugin-demos/flutter.module.ts | 10 + apps/demo/package.json | 5 +- apps/demo/src/main-page.xml | 1 + apps/demo/src/modals/modal-flutter.ts | 8 + apps/demo/src/modals/modal-flutter.xml | 5 + apps/demo/src/plugin-demos/flutter.ts | 20 + apps/demo/src/plugin-demos/flutter.xml | 12 + packages/flutter/.eslintrc.json | 18 + packages/flutter/README.md | 13 + packages/flutter/common.ts | 3 + packages/flutter/index.android.ts | 3 + packages/flutter/index.d.ts | 3 + packages/flutter/index.ios.ts | 10 + packages/flutter/package.json | 35 + packages/flutter/platforms/ios/Podfile | 9 + packages/flutter/project.json | 64 ++ packages/flutter/references.d.ts | 2 + packages/flutter/tsconfig.json | 9 + packages/flutter/typings/objc!Flutter.d.ts | 1018 +++++++++++++++++ .../typings/objc!FlutterPluginRegistrant.d.ts | 11 + tools/assets/App_Resources/iOS/Info.plist | 6 + tools/assets/App_Resources/iOS/Podfile | 2 +- tools/demo/flutter/index.ts | 8 + tools/demo/index.ts | 1 + tools/workspace-scripts.js | 11 + tsconfig.base.json | 3 +- workspace.json | 1 + 33 files changed, 1451 insertions(+), 137 deletions(-) create mode 100644 apps/demo-angular/src/plugin-demos/flutter.component.html create mode 100644 apps/demo-angular/src/plugin-demos/flutter.component.ts create mode 100644 apps/demo-angular/src/plugin-demos/flutter.module.ts create mode 100644 apps/demo/src/modals/modal-flutter.ts create mode 100644 apps/demo/src/modals/modal-flutter.xml create mode 100644 apps/demo/src/plugin-demos/flutter.ts create mode 100644 apps/demo/src/plugin-demos/flutter.xml create mode 100644 packages/flutter/.eslintrc.json create mode 100644 packages/flutter/README.md create mode 100644 packages/flutter/common.ts create mode 100644 packages/flutter/index.android.ts create mode 100644 packages/flutter/index.d.ts create mode 100644 packages/flutter/index.ios.ts create mode 100644 packages/flutter/package.json create mode 100644 packages/flutter/platforms/ios/Podfile create mode 100644 packages/flutter/project.json create mode 100644 packages/flutter/references.d.ts create mode 100644 packages/flutter/tsconfig.json create mode 100644 packages/flutter/typings/objc!Flutter.d.ts create mode 100644 packages/flutter/typings/objc!FlutterPluginRegistrant.d.ts create mode 100644 tools/demo/flutter/index.ts diff --git a/README.md b/README.md index 9524b85e..4fde2879 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ - [@nativescript/email](packages/email/README.md) - [@nativescript/facebook](packages/facebook/README.md) - [@nativescript/fingerprint-auth](packages/fingerprint-auth/README.md) +- [@nativescript/flutter](packages/flutter/README.md) - [@nativescript/geolocation](packages/geolocation/README.md) - [@nativescript/google-maps](packages/google-maps/README.md) - [@nativescript/google-signin](packages/google-signin/README.md) diff --git a/apps/demo-angular/package.json b/apps/demo-angular/package.json index 0499e2fd..9bb28537 100644 --- a/apps/demo-angular/package.json +++ b/apps/demo-angular/package.json @@ -2,7 +2,7 @@ "main": "./src/main.ts", "dependencies": { "@nativescript/core": "file:../../node_modules/@nativescript/core", - "@nativescript/ionic-portals": "file:../../dist/packages/ionic-portals", + "@nativescript/flutter": "file:../../dist/packages/flutter", "@nativescript/animated-circle": "file:../../dist/packages/animated-circle", "@nativescript/appavailability": "file:../../dist/packages/appavailability", "@nativescript/apple-sign-in": "file:../../dist/packages/apple-sign-in", @@ -24,6 +24,7 @@ "@nativescript/google-maps": "file:../../dist/packages/google-maps", "@nativescript/google-signin": "file:../../dist/packages/google-signin", "@nativescript/imagepicker": "file:../../dist/packages/imagepicker", + "@nativescript/ionic-portals": "file:../../dist/packages/ionic-portals", "@nativescript/ios-security": "file:../../dist/packages/ios-security", "@nativescript/iqkeyboardmanager": "file:../../dist/packages/iqkeyboardmanager", "@nativescript/local-notifications": "file:../../dist/packages/local-notifications", diff --git a/apps/demo-angular/src/app-routing.module.ts b/apps/demo-angular/src/app-routing.module.ts index 4f32da22..fa817cc4 100644 --- a/apps/demo-angular/src/app-routing.module.ts +++ b/apps/demo-angular/src/app-routing.module.ts @@ -5,40 +5,41 @@ import { NativeScriptRouterModule } from '@nativescript/angular'; import { HomeComponent } from './home.component'; const routes: Routes = [ - { path: '', redirectTo: '/home', pathMatch: 'full' }, - { path: 'home', component: HomeComponent }, - { path: 'animated-circle', loadChildren: () => import('./plugin-demos/animated-circle.module').then(m => m.AnimatedCircleModule) }, - { path: 'appavailability', loadChildren: () => import('./plugin-demos/appavailability.module').then(m => m.AppavailabilityModule) }, - { path: 'apple-sign-in', loadChildren: () => import('./plugin-demos/apple-sign-in.module').then(m => m.AppleSignInModule) }, - { path: 'auto-fit-text', loadChildren: () => import('./plugin-demos/auto-fit-text.module').then(m => m.AutoFitTextModule) }, - { path: 'background-http', loadChildren: () => import('./plugin-demos/background-http.module').then(m => m.BackgroundHttpModule) }, - { path: 'biometrics', loadChildren: () => import('./plugin-demos/biometrics.module').then(m => m.BiometricsModule) }, - { path: 'brightness', loadChildren: () => import('./plugin-demos/brightness.module').then(m => m.BrightnessModule) }, - { path: 'camera', loadChildren: () => import('./plugin-demos/camera.module').then(m => m.CameraModule) }, - { path: 'contacts', loadChildren: () => import('./plugin-demos/contacts.module').then(m => m.ContactsModule) }, - { path: 'datetimepicker', loadChildren: () => import('./plugin-demos/datetimepicker.module').then(m => m.DatetimepickerModule) }, - { path: 'debug-android', loadChildren: () => import('./plugin-demos/debug-android.module').then(m => m.DebugAndroidModule) }, - { path: 'debug-ios', loadChildren: () => import('./plugin-demos/debug-ios.module').then(m => m.DebugIosModule) }, - { path: 'detox', loadChildren: () => import('./plugin-demos/detox.module').then(m => m.DetoxModule) }, - { path: 'directions', loadChildren: () => import('./plugin-demos/directions.module').then(m => m.DirectionsModule) }, - { path: 'email', loadChildren: () => import('./plugin-demos/email.module').then(m => m.EmailModule) }, - { path: 'facebook', loadChildren: () => import('./plugin-demos/facebook.module').then(m => m.FacebookModule) }, - { path: 'fingerprint-auth', loadChildren: () => import('./plugin-demos/fingerprint-auth.module').then(m => m.FingerprintAuthModule) }, - { path: 'geolocation', loadChildren: () => import('./plugin-demos/geolocation.module').then(m => m.GeolocationModule) }, - { path: 'google-maps', loadChildren: () => import('./plugin-demos/google-maps.module').then(m => m.GoogleMapsModule) }, - { path: 'google-signin', loadChildren: () => import('./plugin-demos/google-signin.module').then(m => m.GoogleSigninModule) }, - { path: 'imagepicker', loadChildren: () => import('./plugin-demos/imagepicker.module').then(m => m.ImagepickerModule) }, - { path: 'ionic-portals', loadChildren: () => import('./plugin-demos/ionic-portals.module').then(m => m.IonicPortalsModule) }, - { path: 'ios-security', loadChildren: () => import('./plugin-demos/ios-security.module').then(m => m.IosSecurityModule) }, - { path: 'iqkeyboardmanager', loadChildren: () => import('./plugin-demos/iqkeyboardmanager.module').then(m => m.IqkeyboardmanagerModule) }, - { path: 'local-notifications', loadChildren: () => import('./plugin-demos/local-notifications.module').then(m => m.LocalNotificationsModule) }, - { path: 'localize', loadChildren: () => import('./plugin-demos/localize.module').then(m => m.LocalizeModule) }, - { path: 'picker', loadChildren: () => import('./plugin-demos/picker.module').then(m => m.PickerModule) }, - { path: 'shared-notification-delegate', loadChildren: () => import('./plugin-demos/shared-notification-delegate.module').then(m => m.SharedNotificationDelegateModule) }, - { path: 'social-share', loadChildren: () => import('./plugin-demos/social-share.module').then(m => m.SocialShareModule) }, - { path: 'theme-switcher', loadChildren: () => import('./plugin-demos/theme-switcher.module').then(m => m.ThemeSwitcherModule) }, - { path: 'twitter', loadChildren: () => import('./plugin-demos/twitter.module').then(m => m.TwitterModule) }, - { path: 'zip', loadChildren: () => import('./plugin-demos/zip.module').then(m => m.ZipModule) } + { path: '', redirectTo: '/home', pathMatch: 'full' }, + { path: 'home', component: HomeComponent }, + { path: 'animated-circle', loadChildren: () => import('./plugin-demos/animated-circle.module').then((m) => m.AnimatedCircleModule) }, + { path: 'appavailability', loadChildren: () => import('./plugin-demos/appavailability.module').then((m) => m.AppavailabilityModule) }, + { path: 'apple-sign-in', loadChildren: () => import('./plugin-demos/apple-sign-in.module').then((m) => m.AppleSignInModule) }, + { path: 'auto-fit-text', loadChildren: () => import('./plugin-demos/auto-fit-text.module').then((m) => m.AutoFitTextModule) }, + { path: 'background-http', loadChildren: () => import('./plugin-demos/background-http.module').then((m) => m.BackgroundHttpModule) }, + { path: 'biometrics', loadChildren: () => import('./plugin-demos/biometrics.module').then((m) => m.BiometricsModule) }, + { path: 'brightness', loadChildren: () => import('./plugin-demos/brightness.module').then((m) => m.BrightnessModule) }, + { path: 'camera', loadChildren: () => import('./plugin-demos/camera.module').then((m) => m.CameraModule) }, + { path: 'contacts', loadChildren: () => import('./plugin-demos/contacts.module').then((m) => m.ContactsModule) }, + { path: 'datetimepicker', loadChildren: () => import('./plugin-demos/datetimepicker.module').then((m) => m.DatetimepickerModule) }, + { path: 'debug-android', loadChildren: () => import('./plugin-demos/debug-android.module').then((m) => m.DebugAndroidModule) }, + { path: 'debug-ios', loadChildren: () => import('./plugin-demos/debug-ios.module').then((m) => m.DebugIosModule) }, + { path: 'detox', loadChildren: () => import('./plugin-demos/detox.module').then((m) => m.DetoxModule) }, + { path: 'directions', loadChildren: () => import('./plugin-demos/directions.module').then((m) => m.DirectionsModule) }, + { path: 'email', loadChildren: () => import('./plugin-demos/email.module').then((m) => m.EmailModule) }, + { path: 'facebook', loadChildren: () => import('./plugin-demos/facebook.module').then((m) => m.FacebookModule) }, + { path: 'fingerprint-auth', loadChildren: () => import('./plugin-demos/fingerprint-auth.module').then((m) => m.FingerprintAuthModule) }, + { path: 'flutter', loadChildren: () => import('./plugin-demos/flutter.module').then((m) => m.FlutterModule) }, + { path: 'geolocation', loadChildren: () => import('./plugin-demos/geolocation.module').then((m) => m.GeolocationModule) }, + { path: 'google-maps', loadChildren: () => import('./plugin-demos/google-maps.module').then((m) => m.GoogleMapsModule) }, + { path: 'google-signin', loadChildren: () => import('./plugin-demos/google-signin.module').then((m) => m.GoogleSigninModule) }, + { path: 'imagepicker', loadChildren: () => import('./plugin-demos/imagepicker.module').then((m) => m.ImagepickerModule) }, + { path: 'ionic-portals', loadChildren: () => import('./plugin-demos/ionic-portals.module').then((m) => m.IonicPortalsModule) }, + { path: 'ios-security', loadChildren: () => import('./plugin-demos/ios-security.module').then((m) => m.IosSecurityModule) }, + { path: 'iqkeyboardmanager', loadChildren: () => import('./plugin-demos/iqkeyboardmanager.module').then((m) => m.IqkeyboardmanagerModule) }, + { path: 'local-notifications', loadChildren: () => import('./plugin-demos/local-notifications.module').then((m) => m.LocalNotificationsModule) }, + { path: 'localize', loadChildren: () => import('./plugin-demos/localize.module').then((m) => m.LocalizeModule) }, + { path: 'picker', loadChildren: () => import('./plugin-demos/picker.module').then((m) => m.PickerModule) }, + { path: 'shared-notification-delegate', loadChildren: () => import('./plugin-demos/shared-notification-delegate.module').then((m) => m.SharedNotificationDelegateModule) }, + { path: 'social-share', loadChildren: () => import('./plugin-demos/social-share.module').then((m) => m.SocialShareModule) }, + { path: 'theme-switcher', loadChildren: () => import('./plugin-demos/theme-switcher.module').then((m) => m.ThemeSwitcherModule) }, + { path: 'twitter', loadChildren: () => import('./plugin-demos/twitter.module').then((m) => m.TwitterModule) }, + { path: 'zip', loadChildren: () => import('./plugin-demos/zip.module').then((m) => m.ZipModule) }, ]; @NgModule({ diff --git a/apps/demo-angular/src/home.component.ts b/apps/demo-angular/src/home.component.ts index f908a75f..d031482a 100644 --- a/apps/demo-angular/src/home.component.ts +++ b/apps/demo-angular/src/home.component.ts @@ -6,101 +6,104 @@ import { Component } from '@angular/core'; }) export class HomeComponent { demos = [ - { - name: 'animated-circle' - }, - { - name: 'appavailability' - }, - { - name: 'apple-sign-in' - }, - { - name: 'auto-fit-text' - }, - { - name: 'background-http' - }, - { - name: 'biometrics' - }, - { - name: 'brightness' - }, - { - name: 'camera' - }, - { - name: 'contacts' - }, - { - name: 'datetimepicker' - }, - { - name: 'debug-android' - }, - { - name: 'debug-ios' - }, - { - name: 'detox' - }, - { - name: 'directions' - }, - { - name: 'email' - }, - { - name: 'facebook' - }, - { - name: 'fingerprint-auth' - }, - { - name: 'geolocation' - }, - { - name: 'google-maps' - }, - { - name: 'google-signin' - }, - { - name: 'imagepicker' - }, - { - name: 'ionic-portals' - }, - { - name: 'ios-security' - }, - { - name: 'iqkeyboardmanager' - }, - { - name: 'local-notifications' - }, - { - name: 'localize' - }, - { - name: 'picker' - }, - { - name: 'shared-notification-delegate' - }, - { - name: 'social-share' - }, - { - name: 'theme-switcher' - }, - { - name: 'twitter' - }, - { - name: 'zip' - } -]; -} \ No newline at end of file + { + name: 'animated-circle', + }, + { + name: 'appavailability', + }, + { + name: 'apple-sign-in', + }, + { + name: 'auto-fit-text', + }, + { + name: 'background-http', + }, + { + name: 'biometrics', + }, + { + name: 'brightness', + }, + { + name: 'camera', + }, + { + name: 'contacts', + }, + { + name: 'datetimepicker', + }, + { + name: 'debug-android', + }, + { + name: 'debug-ios', + }, + { + name: 'detox', + }, + { + name: 'directions', + }, + { + name: 'email', + }, + { + name: 'facebook', + }, + { + name: 'fingerprint-auth', + }, + { + name: 'flutter', + }, + { + name: 'geolocation', + }, + { + name: 'google-maps', + }, + { + name: 'google-signin', + }, + { + name: 'imagepicker', + }, + { + name: 'ionic-portals', + }, + { + name: 'ios-security', + }, + { + name: 'iqkeyboardmanager', + }, + { + name: 'local-notifications', + }, + { + name: 'localize', + }, + { + name: 'picker', + }, + { + name: 'shared-notification-delegate', + }, + { + name: 'social-share', + }, + { + name: 'theme-switcher', + }, + { + name: 'twitter', + }, + { + name: 'zip', + }, + ]; +} diff --git a/apps/demo-angular/src/plugin-demos/flutter.component.html b/apps/demo-angular/src/plugin-demos/flutter.component.html new file mode 100644 index 00000000..58a0940b --- /dev/null +++ b/apps/demo-angular/src/plugin-demos/flutter.component.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/apps/demo-angular/src/plugin-demos/flutter.component.ts b/apps/demo-angular/src/plugin-demos/flutter.component.ts new file mode 100644 index 00000000..95732312 --- /dev/null +++ b/apps/demo-angular/src/plugin-demos/flutter.component.ts @@ -0,0 +1,17 @@ +import { Component, NgZone } from '@angular/core'; +import { DemoSharedFlutter } from '@demo/shared'; +import {} from '@nativescript/flutter'; + +@Component({ + selector: 'demo-flutter', + templateUrl: 'flutter.component.html', +}) +export class FlutterComponent { + demoShared: DemoSharedFlutter; + + constructor(private _ngZone: NgZone) {} + + ngOnInit() { + this.demoShared = new DemoSharedFlutter(); + } +} diff --git a/apps/demo-angular/src/plugin-demos/flutter.module.ts b/apps/demo-angular/src/plugin-demos/flutter.module.ts new file mode 100644 index 00000000..8a1e8db2 --- /dev/null +++ b/apps/demo-angular/src/plugin-demos/flutter.module.ts @@ -0,0 +1,10 @@ +import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; +import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular'; +import { FlutterComponent } from './flutter.component'; + +@NgModule({ + imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: FlutterComponent }])], + declarations: [FlutterComponent], + schemas: [NO_ERRORS_SCHEMA], +}) +export class FlutterModule {} diff --git a/apps/demo/package.json b/apps/demo/package.json index a8793493..cd8d1adf 100644 --- a/apps/demo/package.json +++ b/apps/demo/package.json @@ -4,8 +4,8 @@ "license": "SEE LICENSE IN ", "repository": "", "dependencies": { - "@nativescript/ionic-portals": "file:../../packages/ionic-portals", "@nativescript/core": "file:../../node_modules/@nativescript/core", + "@nativescript/flutter": "file:../../packages/flutter", "@nativescript/animated-circle": "file:../../packages/animated-circle", "@nativescript/appavailability": "file:../../packages/appavailability", "@nativescript/apple-sign-in": "file:../../packages/apple-sign-in", @@ -27,10 +27,11 @@ "@nativescript/google-maps": "file:../../packages/google-maps", "@nativescript/google-signin": "file:../../packages/google-signin", "@nativescript/imagepicker": "file:../../packages/imagepicker", + "@nativescript/ionic-portals": "file:../../packages/ionic-portals", "@nativescript/ios-security": "file:../../packages/ios-security", "@nativescript/iqkeyboardmanager": "file:../../packages/iqkeyboardmanager", "@nativescript/local-notifications": "file:../../packages/local-notifications", - "@nativescript/localize": "file:../../dist/packages/localize", + "@nativescript/localize": "file:../../packages/localize", "@nativescript/picker": "file:../../packages/picker", "@nativescript/shared-notification-delegate": "file:../../packages/shared-notification-delegate", "@nativescript/social-share": "file:../../packages/social-share", diff --git a/apps/demo/src/main-page.xml b/apps/demo/src/main-page.xml index d6f65464..41d85cb9 100644 --- a/apps/demo/src/main-page.xml +++ b/apps/demo/src/main-page.xml @@ -22,6 +22,7 @@