ios shared works on ipad

This commit is contained in:
Equilibrium ITO
2024-03-01 14:37:42 +01:00
parent 1f4274e3e0
commit b9d7226de7
14 changed files with 251 additions and 96 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ export class checkFileTypeService {
const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp','tiff','tif',
'image/jpg', 'image/jpeg', 'image/png', 'image/gif', 'image/bmp','image/tiff','image/tif', 'image/*']; // Add more if needed
const videoExtensions = ['mp4', 'webm', 'mpg', 'mpeg', 'ogg',
'video/mp4', 'video/webm', 'video/mpg', 'video/mpeg', 'video/ogg','video/quicktime','video/mov', 'video/*']; // Add more if needed
'video/mp4', 'video/webm', 'video/mpg', 'video/mpeg', 'video/ogg','video/quicktime', 'video/*']; // Add more if needed
// Check if it's an image
if (imageExtensions.includes(lowerCaseType)) {
+26 -2
View File
@@ -2,14 +2,17 @@ import { Filesystem } from '@capacitor/filesystem';
import { SendIntent } from "send-intent";
import { Router } from '@angular/router';
import { CallbackScheduler } from './callbackScheduler';
import { AlertController, Platform } from '@ionic/angular';
export class SendIntentService {
Router!: Router
callbackScheduler = new CallbackScheduler()
alertController = new AlertController()
constructor() {
constructor(
) {
SendIntent.checkSendIntentReceived().then((result: any) => {
// logger
@@ -36,11 +39,32 @@ export class SendIntentService {
private onReceive = this.callbackScheduler.function<any>((result)=> {
this.Router.navigateByUrl("/home/publications");
this.Router.navigateByUrl("/home/publications").then(() => {
if(Platform.prototype.is('ios')) {
this.alertIos();
}
});
window["sharedContent"] = result;
})
private alertIos() {
this.alertController .create({
header: 'Selecione uma acção para criar a publicação',
message: '',
buttons: [
{
text: 'Ok',
handler: () => {
}
}
]
}).then(res => {
res.present();
});
}
}
export const sendIntent = new SendIntentService()
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { VideoconvertService } from './videoconvert.service';
describe('VideoconvertService', () => {
let service: VideoconvertService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(VideoconvertService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+20
View File
@@ -0,0 +1,20 @@
import { Injectable } from '@angular/core';
import { FFMpeg } from '@awesome-cordova-plugins/ffmpeg/ngx';
@Injectable({
providedIn: 'root'
})
export class VideoconvertService {
constructor(
private ffmpeg: FFMpeg
) { }
async convertVideo(inputPath, outputPath, formart) {
const ffmpegCommand = `-i "${inputPath}" -c:v copy -c:a aac -strict experimental "${outputPath}output.${formart}"`;
const result = await this.ffmpeg.exec(ffmpegCommand)
console.log('Convert returns ', `${outputPath}output.${formart}`);
}
}