search added
This commit is contained in:
parent
4b4f14382d
commit
4f87f755b3
|
@ -37,45 +37,42 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
|
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
|
||||||
|
var success = true
|
||||||
print("application function called")
|
if CAPBridge.handleOpenUrl(url, options) {
|
||||||
|
success = ApplicationDelegateProxy.shared.application(app, open: url, options: options)
|
||||||
var success = true
|
|
||||||
if CAPBridge.handleOpenUrl(url, options) {
|
|
||||||
success = ApplicationDelegateProxy.shared.application(app, open: url, options: options)
|
|
||||||
}
|
|
||||||
|
|
||||||
guard let components = NSURLComponents(url: url, resolvingAgainstBaseURL: true),
|
|
||||||
let params = components.queryItems else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
let titles = params.filter { $0.name == "title" }
|
|
||||||
let descriptions = params.filter { $0.name == "description" }
|
|
||||||
let types = params.filter { $0.name == "type" }
|
|
||||||
let urls = params.filter { $0.name == "url" }
|
|
||||||
let webPaths = params.filter { $0.name == "webPath" }
|
|
||||||
|
|
||||||
store.shareItems.removeAll()
|
|
||||||
|
|
||||||
if (titles.count > 0){
|
|
||||||
for index in 0...titles.count-1 {
|
|
||||||
var shareItem: JSObject = JSObject()
|
|
||||||
shareItem["title"] = titles[index].value!
|
|
||||||
shareItem["description"] = descriptions[index].value!
|
|
||||||
shareItem["type"] = types[index].value!
|
|
||||||
shareItem["url"] = urls[index].value!
|
|
||||||
shareItem["webPath"] = webPaths[index].value!
|
|
||||||
store.shareItems.append(shareItem)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
store.processed = false
|
|
||||||
let nc = NotificationCenter.default
|
|
||||||
nc.post(name: Notification.Name("triggerSendIntent"), object: nil )
|
|
||||||
|
|
||||||
return success
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guard let components = NSURLComponents(url: url, resolvingAgainstBaseURL: true),
|
||||||
|
let params = components.queryItems else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
let titles = params.filter { $0.name == "title" }
|
||||||
|
let descriptions = params.filter { $0.name == "description" }
|
||||||
|
let types = params.filter { $0.name == "type" }
|
||||||
|
let urls = params.filter { $0.name == "url" }
|
||||||
|
let webPaths = params.filter { $0.name == "webPath" }
|
||||||
|
|
||||||
|
store.shareItems.removeAll()
|
||||||
|
|
||||||
|
if (titles.count > 0){
|
||||||
|
for index in 0...titles.count-1 {
|
||||||
|
var shareItem: JSObject = JSObject()
|
||||||
|
shareItem["title"] = titles[index].value!
|
||||||
|
shareItem["description"] = descriptions[index].value!
|
||||||
|
shareItem["type"] = types[index].value!
|
||||||
|
shareItem["url"] = urls[index].value!
|
||||||
|
shareItem["webPath"] = webPaths[index].value!
|
||||||
|
store.shareItems.append(shareItem)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
store.processed = false
|
||||||
|
let nc = NotificationCenter.default
|
||||||
|
nc.post(name: Notification.Name("triggerSendIntent"), object: nil )
|
||||||
|
|
||||||
|
return success
|
||||||
|
}
|
||||||
|
|
||||||
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
|
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
|
||||||
// Called when the app was launched with an activity, including Universal Links.
|
// Called when the app was launched with an activity, including Universal Links.
|
||||||
// Feel free to add additional processing here, but if you want the App API to support
|
// Feel free to add additional processing here, but if you want the App API to support
|
||||||
|
|
|
@ -21,7 +21,6 @@ class ShareViewController: UIViewController {
|
||||||
private var shareItems: [ShareItem] = []
|
private var shareItems: [ShareItem] = []
|
||||||
override public func viewDidAppear(_ animated: Bool) {
|
override public func viewDidAppear(_ animated: Bool) {
|
||||||
super.viewDidAppear(animated)
|
super.viewDidAppear(animated)
|
||||||
print("did appear called");
|
|
||||||
self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
|
self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +77,7 @@ class ShareViewController: UIViewController {
|
||||||
value: $0.webPath?.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? "")
|
value: $0.webPath?.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? "")
|
||||||
]
|
]
|
||||||
}.flatMap({ $0 })
|
}.flatMap({ $0 })
|
||||||
var urlComps = URLComponents(string: "d4sworkspace://share-input")!
|
var urlComps = URLComponents(string: "d4sworkspace:/")!
|
||||||
urlComps.queryItems = queryItems
|
urlComps.queryItems = queryItems
|
||||||
var opened = openURL(urlComps.url!)
|
var opened = openURL(urlComps.url!)
|
||||||
print("sending data %s",opened);
|
print("sending data %s",opened);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ModalController, ModalOptions, ToastController } from '@ionic/angular';
|
import { App } from '@capacitor/app';
|
||||||
|
import { isPlatform, LoadingController, ModalController, ModalOptions, ToastController } from '@ionic/angular';
|
||||||
import { ShareExtension } from 'capacitor-share-extension';
|
import { ShareExtension } from 'capacitor-share-extension';
|
||||||
import { EventService } from './event.service';
|
import { EventService } from './event.service';
|
||||||
import { UploadFile } from './model/actions/upload-file';
|
import { UploadFile } from './model/actions/upload-file';
|
||||||
|
@ -15,7 +16,8 @@ export class D4sIntentService {
|
||||||
private toastController: ToastController,
|
private toastController: ToastController,
|
||||||
private storagehub: StoragehubService,
|
private storagehub: StoragehubService,
|
||||||
private uploaderInfo: UploaderInfoService,
|
private uploaderInfo: UploaderInfoService,
|
||||||
private event: EventService) { }
|
private event: EventService,
|
||||||
|
private loadingCtrl: LoadingController) { }
|
||||||
|
|
||||||
|
|
||||||
async checkIntent() {
|
async checkIntent() {
|
||||||
|
@ -36,8 +38,8 @@ export class D4sIntentService {
|
||||||
*/
|
*/
|
||||||
if (result && result.payload && result.payload.length) {
|
if (result && result.payload && result.payload.length) {
|
||||||
console.log('Intent received: ', JSON.stringify(result.payload[0]));
|
console.log('Intent received: ', JSON.stringify(result.payload[0]));
|
||||||
var modalOptions: ModalOptions = new UploadFile().getModalOptions(this.storagehub, this.uploaderInfo, result.payload[0],
|
var modalOptions: ModalOptions = new UploadFile().getModalOptions(this.storagehub, this.uploaderInfo, this.loadingCtrl, result.payload[0],
|
||||||
(id : string) => this.event.ReloadEvent.emit(id), (text: string) => this.presentToast(text), ShareExtension.finish);
|
(id: string) => this.event.ReloadEvent.emit(id), (text: string) => this.presentToast(text), this.shareExtensionClose);
|
||||||
let modal = await this.modalCtrl.create(modalOptions);
|
let modal = await this.modalCtrl.create(modalOptions);
|
||||||
await modal.present();
|
await modal.present();
|
||||||
|
|
||||||
|
@ -56,4 +58,10 @@ export class D4sIntentService {
|
||||||
});
|
});
|
||||||
await toast.present();
|
await toast.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async shareExtensionClose() {
|
||||||
|
ShareExtension.finish();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ export class OpenFile {
|
||||||
Filesystem.deleteFile(
|
Filesystem.deleteFile(
|
||||||
{
|
{
|
||||||
path: item.getTitle(),
|
path: item.getTitle(),
|
||||||
directory: Directory.Documents
|
directory: Directory.Data
|
||||||
}).then(() => console.log("file deleted"));
|
}).then(() => console.log("file deleted"));
|
||||||
this.pluginListener?.remove();
|
this.pluginListener?.remove();
|
||||||
}).then((handler) => this.pluginListener = handler);
|
}).then((handler) => this.pluginListener = handler);
|
||||||
|
@ -52,7 +52,7 @@ export class OpenFile {
|
||||||
Filesystem.deleteFile(
|
Filesystem.deleteFile(
|
||||||
{
|
{
|
||||||
path: this.item.getTitle(),
|
path: this.item.getTitle(),
|
||||||
directory: Directory.Documents
|
directory: Directory.Data
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ModalOptions } from "@ionic/angular";
|
import { LoadingController, ModalOptions } from "@ionic/angular";
|
||||||
import { StoragehubService } from "src/app/storagehub.service";
|
import { StoragehubService } from "src/app/storagehub.service";
|
||||||
import { WsViewerComponent } from "src/app/ws-viewer/ws-viewer.component";
|
import { WsViewerComponent } from "src/app/ws-viewer/ws-viewer.component";
|
||||||
import { WSItem } from "../ws-item";
|
import { WSItem } from "../ws-item";
|
||||||
|
@ -9,7 +9,7 @@ export class UploadFile {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
getModalOptions(storagehub: StoragehubService, uploaderInfo: UploaderInfoService, data: any, reload: Function, notify: Function, onSelectionFinished: Function): ModalOptions {
|
getModalOptions(storagehub: StoragehubService, uploaderInfo: UploaderInfoService, loading: LoadingController, data: any, reload: Function, notify: Function, onSelectionFinished: Function): ModalOptions {
|
||||||
return {
|
return {
|
||||||
component: WsViewerComponent,
|
component: WsViewerComponent,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
@ -20,6 +20,7 @@ export class UploadFile {
|
||||||
onSelected: (destinationItem: WSItem) => {
|
onSelected: (destinationItem: WSItem) => {
|
||||||
const itemId = destinationItem.item.id;
|
const itemId = destinationItem.item.id;
|
||||||
|
|
||||||
|
this.showLoading(loading);
|
||||||
uploaderInfo.uploadStarted(itemId, data.title);
|
uploaderInfo.uploadStarted(itemId, data.title);
|
||||||
this.actionHandler(destinationItem, data, storagehub).then( obs => obs.subscribe({
|
this.actionHandler(destinationItem, data, storagehub).then( obs => obs.subscribe({
|
||||||
next: () => {},
|
next: () => {},
|
||||||
|
@ -30,6 +31,7 @@ export class UploadFile {
|
||||||
complete: () => {
|
complete: () => {
|
||||||
notify(`uploaded file ${data.title}`);
|
notify(`uploaded file ${data.title}`);
|
||||||
uploaderInfo.uploadFinished(itemId, data.title),
|
uploaderInfo.uploadFinished(itemId, data.title),
|
||||||
|
loading.dismiss();
|
||||||
reload(itemId);
|
reload(itemId);
|
||||||
onSelectionFinished();
|
onSelectionFinished();
|
||||||
},
|
},
|
||||||
|
@ -42,6 +44,17 @@ export class UploadFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async showLoading(loadingCtrl: LoadingController) {
|
||||||
|
const loading = await loadingCtrl.create({
|
||||||
|
message: 'Uploading...',
|
||||||
|
duration: 100000,
|
||||||
|
spinner: 'circles',
|
||||||
|
});
|
||||||
|
|
||||||
|
loading.present();
|
||||||
|
return loading;
|
||||||
|
}
|
||||||
|
|
||||||
async actionHandler(destinationItem: WSItem, result: any, storagehub: StoragehubService) {
|
async actionHandler(destinationItem: WSItem, result: any, storagehub: StoragehubService) {
|
||||||
const pathDecodedWebPath = decodeURIComponent(result.webPath);
|
const pathDecodedWebPath = decodeURIComponent(result.webPath);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</ion-segment>
|
</ion-segment>
|
||||||
<ion-toolbar>
|
<ion-toolbar>
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button #backbutton [hidden]="root" text="" defaultHref="/">
|
<ion-back-button #backbutton [hidden]="root" text="" defaultHref="/">
|
||||||
<mat-icon>arrow_back_ios_new</mat-icon>
|
<mat-icon>arrow_back_ios_new</mat-icon>
|
||||||
</ion-back-button>
|
</ion-back-button>
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
|
@ -24,12 +24,13 @@
|
||||||
<ion-button (click)="createFolder()"><mat-icon>create_new_folder</mat-icon></ion-button>
|
<ion-button (click)="createFolder()"><mat-icon>create_new_folder</mat-icon></ion-button>
|
||||||
<ion-button (click)="addFile()"><mat-icon>upload_file</mat-icon></ion-button>
|
<ion-button (click)="addFile()"><mat-icon>upload_file</mat-icon></ion-button>
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-progress-bar *ngIf="!filteredItems" type="indeterminate"></ion-progress-bar>
|
<ion-progress-bar *ngIf="!filtereBySearchItems" type="indeterminate"></ion-progress-bar>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
<div>
|
<div>
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-select [interfaceOptions]="customSortAlertOptions" (ionChange)="changeSortName($event)" interface="alert" [value]="currentSortName">
|
<ion-select [interfaceOptions]="customSortAlertOptions" (ionChange)="changeSortName($event)" interface="alert"
|
||||||
|
[value]="currentSortName">
|
||||||
<ion-select-option [value]="sortName.Name"> Name </ion-select-option>
|
<ion-select-option [value]="sortName.Name"> Name </ion-select-option>
|
||||||
<ion-select-option [value]="sortName.LastModificationTime"> Last Modified </ion-select-option>
|
<ion-select-option [value]="sortName.LastModificationTime"> Last Modified </ion-select-option>
|
||||||
<ion-select-option [value]="sortName.Size"> Size </ion-select-option>
|
<ion-select-option [value]="sortName.Size"> Size </ion-select-option>
|
||||||
|
@ -37,8 +38,12 @@
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-button (click)="changeSortType()"><mat-icon>{{ currentSortType }}</mat-icon></ion-button>
|
<ion-button (click)="changeSortType()"><mat-icon>{{ currentSortType }}</mat-icon></ion-button>
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
|
<ion-buttons slot="end">
|
||||||
|
<ion-searchbar [disabled]="!filtereBySearchItems || (filtereBySearchItems.length == 0 && currentSearch.length==0)"
|
||||||
|
[debounce]="500" (ionClear)="searchCleared()" (ionChange)="searchItems($event)"></ion-searchbar>
|
||||||
|
</ion-buttons>
|
||||||
</div>
|
</div>
|
||||||
<input hidden type="file" #filepicker (change)="fileSelected($event)" />
|
<input hidden type="file" #filepicker (change)="fileSelected($event)" />
|
||||||
<app-items-list [items]="filteredItems" [underUploadItem]="underUpload"
|
<app-items-list [items]="filtereBySearchItems" [underUploadItem]="underUpload"
|
||||||
(actionSheetClickedEvent)="presentActionSheet($event)" (itemClickedEvent)="itemClicked($event)"></app-items-list>
|
(actionSheetClickedEvent)="presentActionSheet($event)" (itemClickedEvent)="itemClicked($event)"></app-items-list>
|
||||||
</ion-content>
|
</ion-content>
|
|
@ -33,7 +33,8 @@ export class ShowFolderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
|
|
||||||
@Output() folderClickedEvent = new EventEmitter<WSItem>();
|
@Output() folderClickedEvent = new EventEmitter<WSItem>();
|
||||||
|
|
||||||
filteredItems: WSItem[] | undefined;
|
filteredBySegmentItems: WSItem[] | undefined;
|
||||||
|
filtereBySearchItems: WSItem[] | undefined;
|
||||||
_items: WSItem[] | undefined;
|
_items: WSItem[] | undefined;
|
||||||
|
|
||||||
currentSortName = SortName.Name;
|
currentSortName = SortName.Name;
|
||||||
|
@ -41,7 +42,8 @@ export class ShowFolderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
|
|
||||||
@Input() set items(items: WSItem[] | undefined) {
|
@Input() set items(items: WSItem[] | undefined) {
|
||||||
this._items = items?.sort(Sorting.getSortFunction(this.currentSortName, this.currentSortType));
|
this._items = items?.sort(Sorting.getSortFunction(this.currentSortName, this.currentSortType));
|
||||||
this.filteredItems = this._items;
|
this.filteredBySegmentItems = this._items;
|
||||||
|
this.filtereBySearchItems = this._items
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input() parentItem: WSItem | undefined = undefined;
|
@Input() parentItem: WSItem | undefined = undefined;
|
||||||
|
@ -59,6 +61,7 @@ export class ShowFolderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
underUpload: string[];
|
underUpload: string[];
|
||||||
|
currentSearch: string = "";
|
||||||
|
|
||||||
@ViewChild('filepicker') uploader!: ElementRef;
|
@ViewChild('filepicker') uploader!: ElementRef;
|
||||||
|
|
||||||
|
@ -98,7 +101,6 @@ export class ShowFolderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
var p: IonBackButtonDelegate
|
var p: IonBackButtonDelegate
|
||||||
this.reloadSubscription?.unsubscribe();
|
this.reloadSubscription?.unsubscribe();
|
||||||
|
@ -111,21 +113,23 @@ export class ShowFolderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadDocuments() {
|
loadDocuments() {
|
||||||
this.filteredItems = undefined;
|
this.filtereBySearchItems = undefined;
|
||||||
if (this.parentItem) {
|
if (this.parentItem) {
|
||||||
this.storagehub.getChildren(this.parentItem.item.id).then((obs) => obs.subscribe({
|
this.storagehub.getChildren(this.parentItem.item.id).then((obs) => obs.subscribe({
|
||||||
next: (res) => {
|
next: (res) => {
|
||||||
const tmpItems$: WSItem[] = []
|
const tmpItems$: WSItem[] = []
|
||||||
const tmpFiltered$: WSItem[] = []
|
const tmpFilteredBySegment$: WSItem[] = []
|
||||||
var segmentFilterFunction = this.getSegmentFilterFunction();
|
var segmentFilterFunction = this.getSegmentFilterFunction();
|
||||||
res.forEach(i => {
|
res.forEach(i => {
|
||||||
var localItem = new WSItem(i);
|
var localItem = new WSItem(i);
|
||||||
tmpItems$.push(localItem);
|
tmpItems$.push(localItem);
|
||||||
if (segmentFilterFunction(localItem))
|
if (segmentFilterFunction(localItem)){
|
||||||
tmpFiltered$.push(localItem);
|
tmpFilteredBySegment$.push(localItem);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this._items = tmpItems$.sort(Sorting.getSortFunction(this.currentSortName, this.currentSortType));
|
this._items = tmpItems$.sort(Sorting.getSortFunction(this.currentSortName, this.currentSortType));
|
||||||
this.filteredItems = tmpFiltered$.sort(Sorting.getSortFunction(this.currentSortName, this.currentSortType));
|
this.filteredBySegmentItems = tmpFilteredBySegment$.sort(Sorting.getSortFunction(this.currentSortName, this.currentSortType));
|
||||||
|
this.filtereBySearchItems = tmpFilteredBySegment$.filter(d => d.getTitle().toLowerCase().indexOf(this.currentSearch) > -1)
|
||||||
this.underUpload = this.getUnderUploadItems();
|
this.underUpload = this.getUnderUploadItems();
|
||||||
},
|
},
|
||||||
error: err => presentConnectionAlert(err, this.alertCtrl)
|
error: err => presentConnectionAlert(err, this.alertCtrl)
|
||||||
|
@ -142,7 +146,7 @@ export class ShowFolderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getSegmentFilterFunction(): (value: WSItem) => unknown {
|
getSegmentFilterFunction(): (value: WSItem) => boolean {
|
||||||
var filterItemFunction;
|
var filterItemFunction;
|
||||||
switch (this.selectedSegment) {
|
switch (this.selectedSegment) {
|
||||||
case "shared":
|
case "shared":
|
||||||
|
@ -162,15 +166,18 @@ export class ShowFolderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
|
|
||||||
filterBy(value: string) {
|
filterBy(value: string) {
|
||||||
if (value == this.selectedSegment) return;
|
if (value == this.selectedSegment) return;
|
||||||
this.filteredItems = undefined;
|
|
||||||
|
this.filtereBySearchItems = undefined;
|
||||||
this.selectedSegment = value;
|
this.selectedSegment = value;
|
||||||
|
|
||||||
if (this.selectedSegment == "all")
|
if (this.selectedSegment == "all")
|
||||||
this.filteredItems = this._items;
|
this.filtereBySearchItems = this._items;
|
||||||
else {
|
else
|
||||||
const tmpFiltered$: WSItem[] = []
|
this.filteredBySegmentItems = this._items?.filter(this.getSegmentFilterFunction());
|
||||||
this._items?.filter(this.getSegmentFilterFunction()).forEach((i) => tmpFiltered$.push(i));
|
|
||||||
this.filteredItems = tmpFiltered$;
|
if (this.currentSearch.length != 0)
|
||||||
}
|
this.filtereBySearchItems = this.filteredBySegmentItems?.filter(d => d.getTitle().toLowerCase().indexOf(this.currentSearch) > -1);
|
||||||
|
else this.filtereBySearchItems = this.filteredBySegmentItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
changeSortType() {
|
changeSortType() {
|
||||||
|
@ -190,7 +197,26 @@ export class ShowFolderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
|
|
||||||
updateSort() {
|
updateSort() {
|
||||||
this._items = this._items?.sort(Sorting.getSortFunction(this.currentSortName, this.currentSortType));
|
this._items = this._items?.sort(Sorting.getSortFunction(this.currentSortName, this.currentSortType));
|
||||||
this.filteredItems = this.filteredItems?.sort(Sorting.getSortFunction(this.currentSortName, this.currentSortType));
|
|
||||||
|
if (this.selectedSegment == "all")
|
||||||
|
this.filteredBySegmentItems = this._items;
|
||||||
|
else
|
||||||
|
this.filteredBySegmentItems = this.filteredBySegmentItems?.sort(Sorting.getSortFunction(this.currentSortName, this.currentSortType));
|
||||||
|
|
||||||
|
if (this.currentSearch.length!=0 )
|
||||||
|
this.filtereBySearchItems = this.filtereBySearchItems?.sort(Sorting.getSortFunction(this.currentSortName, this.currentSortType));
|
||||||
|
else this.filtereBySearchItems = this.filteredBySegmentItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
searchItems(event: any) {
|
||||||
|
const query: string = event.target.value.toLowerCase();
|
||||||
|
this.currentSearch = query;
|
||||||
|
this.filtereBySearchItems = this.filteredBySegmentItems?.filter(d => d.getTitle().toLowerCase().indexOf(query) > -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
searchCleared(){
|
||||||
|
this.currentSearch = "";
|
||||||
|
this.filtereBySearchItems = this.filteredBySegmentItems
|
||||||
}
|
}
|
||||||
|
|
||||||
itemClicked(item: WSItem) {
|
itemClicked(item: WSItem) {
|
||||||
|
@ -199,8 +225,6 @@ export class ShowFolderComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
else if (item.isFile()) {
|
else if (item.isFile()) {
|
||||||
new OpenFile(item).open(this.storagehub, this.fileOpener, this.loadingCtrl, this.alertCtrl);
|
new OpenFile(item).open(this.storagehub, this.fileOpener, this.loadingCtrl, this.alertCtrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addFile() {
|
addFile() {
|
||||||
|
|
Loading…
Reference in New Issue