diff --git a/ios/App/App/AppDelegate.swift b/ios/App/App/AppDelegate.swift
index e6a6964..1fa43c1 100644
--- a/ios/App/App/AppDelegate.swift
+++ b/ios/App/App/AppDelegate.swift
@@ -37,44 +37,41 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
-
- print("application function called")
-
- 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
+ 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
+ }
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
// Called when the app was launched with an activity, including Universal Links.
diff --git a/ios/App/upload/ShareViewController.swift b/ios/App/upload/ShareViewController.swift
index 7c1d68b..14baa3a 100644
--- a/ios/App/upload/ShareViewController.swift
+++ b/ios/App/upload/ShareViewController.swift
@@ -21,7 +21,6 @@ class ShareViewController: UIViewController {
private var shareItems: [ShareItem] = []
override public func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
- print("did appear called");
self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
}
@@ -78,7 +77,7 @@ class ShareViewController: UIViewController {
value: $0.webPath?.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? "")
]
}.flatMap({ $0 })
- var urlComps = URLComponents(string: "d4sworkspace://share-input")!
+ var urlComps = URLComponents(string: "d4sworkspace:/")!
urlComps.queryItems = queryItems
var opened = openURL(urlComps.url!)
print("sending data %s",opened);
diff --git a/src/app/d4s-intent.service.ts b/src/app/d4s-intent.service.ts
index fe2d841..318d86f 100644
--- a/src/app/d4s-intent.service.ts
+++ b/src/app/d4s-intent.service.ts
@@ -1,5 +1,6 @@
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 { EventService } from './event.service';
import { UploadFile } from './model/actions/upload-file';
@@ -15,9 +16,10 @@ export class D4sIntentService {
private toastController: ToastController,
private storagehub: StoragehubService,
private uploaderInfo: UploaderInfoService,
- private event: EventService) { }
+ private event: EventService,
+ private loadingCtrl: LoadingController) { }
+
-
async checkIntent() {
try {
const result: any = await ShareExtension.checkSendIntentReceived();
@@ -36,8 +38,8 @@ export class D4sIntentService {
*/
if (result && result.payload && result.payload.length) {
console.log('Intent received: ', JSON.stringify(result.payload[0]));
- var modalOptions: ModalOptions = new UploadFile().getModalOptions(this.storagehub, this.uploaderInfo, result.payload[0],
- (id : string) => this.event.ReloadEvent.emit(id), (text: string) => this.presentToast(text), ShareExtension.finish);
+ 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), this.shareExtensionClose);
let modal = await this.modalCtrl.create(modalOptions);
await modal.present();
@@ -56,4 +58,10 @@ export class D4sIntentService {
});
await toast.present();
}
+
+
+ async shareExtensionClose() {
+ ShareExtension.finish();
+ }
+
}
diff --git a/src/app/model/actions/open-file.ts b/src/app/model/actions/open-file.ts
index 5dfed9e..b231f08 100644
--- a/src/app/model/actions/open-file.ts
+++ b/src/app/model/actions/open-file.ts
@@ -21,7 +21,7 @@ export class OpenFile {
Filesystem.deleteFile(
{
path: item.getTitle(),
- directory: Directory.Documents
+ directory: Directory.Data
}).then(() => console.log("file deleted"));
this.pluginListener?.remove();
}).then((handler) => this.pluginListener = handler);
@@ -52,7 +52,7 @@ export class OpenFile {
Filesystem.deleteFile(
{
path: this.item.getTitle(),
- directory: Directory.Documents
+ directory: Directory.Data
});
})
diff --git a/src/app/model/actions/upload-file.ts b/src/app/model/actions/upload-file.ts
index 53c4eaa..a20ffae 100644
--- a/src/app/model/actions/upload-file.ts
+++ b/src/app/model/actions/upload-file.ts
@@ -1,4 +1,4 @@
-import { ModalOptions } from "@ionic/angular";
+import { LoadingController, ModalOptions } from "@ionic/angular";
import { StoragehubService } from "src/app/storagehub.service";
import { WsViewerComponent } from "src/app/ws-viewer/ws-viewer.component";
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 {
component: WsViewerComponent,
componentProps: {
@@ -20,6 +20,7 @@ export class UploadFile {
onSelected: (destinationItem: WSItem) => {
const itemId = destinationItem.item.id;
+ this.showLoading(loading);
uploaderInfo.uploadStarted(itemId, data.title);
this.actionHandler(destinationItem, data, storagehub).then( obs => obs.subscribe({
next: () => {},
@@ -30,6 +31,7 @@ export class UploadFile {
complete: () => {
notify(`uploaded file ${data.title}`);
uploaderInfo.uploadFinished(itemId, data.title),
+ loading.dismiss();
reload(itemId);
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) {
const pathDecodedWebPath = decodeURIComponent(result.webPath);
diff --git a/src/app/show-folder/show-folder.component.html b/src/app/show-folder/show-folder.component.html
index ff52574..4e2b8f0 100644
--- a/src/app/show-folder/show-folder.component.html
+++ b/src/app/show-folder/show-folder.component.html
@@ -15,7 +15,7 @@