Skip to content

Commit

Permalink
feat: visionos platform filter (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
herefishyfish authored Oct 10, 2023
1 parent 476dc3a commit b760502
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-disable @angular-eslint/component-selector */
import { Component, Inject } from '@angular/core';
import { platformNames, IDevice } from '@nativescript/core';
import { DEVICE } from '../../tokens';

@Component({
selector: 'visionos',
template: `<ng-content *ngIf="show"></ng-content>`,
})
export class VisionOSFilterComponent {
public show: boolean;

constructor(@Inject(DEVICE) device: IDevice) {
// Note: casting any to be backwards compatible
// Available in 8.6+ only
this.show = device.os === (platformNames as any).visionos;
}
}
3 changes: 2 additions & 1 deletion packages/angular/src/lib/nativescript-common.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import { ModalDialogService } from './legacy/directives/dialogs';
import { TabViewDirective, TabViewItemDirective } from './cdk/tab-view';
import { AndroidFilterComponent } from './cdk/platform-filters/android-filter.component';
import { IOSFilterComponent } from './cdk/platform-filters/ios-filter.component';
import { VisionOSFilterComponent } from './cdk/platform-filters/vision-filter.component';

const CDK_COMPONENTS = [ActionBarComponent, ActionBarScope, ActionItemDirective, NavigationButtonDirective, ListViewComponent, TemplateKeyDirective, TabViewDirective, TabViewItemDirective, AndroidFilterComponent, IOSFilterComponent];
const CDK_COMPONENTS = [ActionBarComponent, ActionBarScope, ActionItemDirective, NavigationButtonDirective, ListViewComponent, TemplateKeyDirective, TabViewDirective, TabViewItemDirective, AndroidFilterComponent, IOSFilterComponent, VisionOSFilterComponent];

registerNativeScriptViewComponents();

Expand Down
1 change: 1 addition & 0 deletions packages/angular/src/lib/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export * from './cdk/dialog';
export * from './cdk/tab-view';
export * from './cdk/platform-filters/android-filter.component';
export * from './cdk/platform-filters/ios-filter.component';
export * from './cdk/platform-filters/vision-filter.component';
export * from './file-system';
export * from './nativescript-common.module';
export * from './loading.service';
Expand Down

0 comments on commit b760502

Please sign in to comment.