mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
shared image when app its close
This commit is contained in:
@@ -30,6 +30,7 @@
|
|||||||
<data android:mimeType="image/*" />
|
<data android:mimeType="image/*" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<provider android:authorities="${applicationId}.fileprovider" android:exported="false"
|
<provider android:authorities="${applicationId}.fileprovider" android:exported="false"
|
||||||
android:grantUriPermissions="true" android:name="androidx.core.content.FileProvider">
|
android:grantUriPermissions="true" android:name="androidx.core.content.FileProvider">
|
||||||
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
|
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ import { CreateProcessPageModule } from './modals/create-process/create-process.
|
|||||||
import { CreateProcessPage } from './modals/create-process/create-process.page';
|
import { CreateProcessPage } from './modals/create-process/create-process.page';
|
||||||
import { LoggingInterceptorService } from './services/logging-interceptor.service';
|
import { LoggingInterceptorService } from './services/logging-interceptor.service';
|
||||||
import { PopupQuestionPipe } from './modals/popup-question.pipe';
|
import { PopupQuestionPipe } from './modals/popup-question.pipe';
|
||||||
|
import { SendIntentService } from './services/shareIntent';
|
||||||
|
|
||||||
|
|
||||||
// import { ServiceWorkerModule } from '@angular/service-worker';
|
// import { ServiceWorkerModule } from '@angular/service-worker';
|
||||||
@@ -213,6 +214,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
|
|||||||
FileOpener,
|
FileOpener,
|
||||||
DocumentViewer,
|
DocumentViewer,
|
||||||
{ provide: HTTP_INTERCEPTORS, useClass: LoggingInterceptorService, multi: true },
|
{ provide: HTTP_INTERCEPTORS, useClass: LoggingInterceptorService, multi: true },
|
||||||
|
SendIntentService
|
||||||
|
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent],
|
bootstrap: [AppComponent],
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ export class HomePage implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
async checkSendIntentReceived(result) {
|
async checkSendIntentReceived() {
|
||||||
|
|
||||||
|
|
||||||
SendIntent.checkSendIntentReceived().then((result: any) => {
|
SendIntent.checkSendIntentReceived().then((result: any) => {
|
||||||
@@ -294,29 +294,9 @@ export class HomePage implements OnInit {
|
|||||||
if (!this.platform.is('desktop')) {
|
if (!this.platform.is('desktop')) {
|
||||||
App.addListener('appStateChange', ({ isActive }) => {
|
App.addListener('appStateChange', ({ isActive }) => {
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
/* this.checkSendIntentReceived("value") */
|
/* sendIntent.setRouteService(this.router) */
|
||||||
// The app is in the foreground.
|
|
||||||
/* fetchData()
|
|
||||||
.then((value) => {
|
|
||||||
console.log('fetchData was successful in file2.ts', value);
|
|
||||||
this.imageToBase64(value)
|
|
||||||
.then((base64Data) => {s
|
|
||||||
if (base64Data) {
|
|
||||||
// Use the base64 data as needed
|
|
||||||
console.log('Base64 data:', base64Data);
|
|
||||||
} else {
|
|
||||||
console.error('Base64 data is null');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (value)
|
|
||||||
this.checkSendIntentReceived(value)
|
|
||||||
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error('Error in file2.ts:', error);
|
|
||||||
}); */
|
|
||||||
console.log('App is in the foreground');
|
console.log('App is in the foreground');
|
||||||
/* this.checkSendIntentReceived() */
|
this.checkSendIntentReceived()
|
||||||
} else {
|
} else {
|
||||||
// The app is in the background.
|
// The app is in the background.
|
||||||
console.log('App is in the background');
|
console.log('App is in the background');
|
||||||
|
|||||||
@@ -70,13 +70,12 @@ export class PublicationsPage implements OnInit {
|
|||||||
public ThemeService: ThemeService,
|
public ThemeService: ThemeService,
|
||||||
public p: PermissionService,
|
public p: PermissionService,
|
||||||
private storage: Storage,
|
private storage: Storage,
|
||||||
private navParams: NavParams,
|
|
||||||
|
|
||||||
) {
|
) {
|
||||||
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
||||||
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
||||||
|
|
||||||
this.intent = this.navParams.get('intent');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -91,6 +90,7 @@ export class PublicationsPage implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.hideRefreshButton();
|
this.hideRefreshButton();
|
||||||
|
this.intent = window["sharedContent"]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { SendIntent } from "send-intent";
|
|||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { CallbackScheduler } from './callbackScheduler';
|
import { CallbackScheduler } from './callbackScheduler';
|
||||||
|
|
||||||
class SendIntent {
|
export class SendIntentService {
|
||||||
|
|
||||||
Router!: Router
|
Router!: Router
|
||||||
|
|
||||||
@@ -20,6 +20,7 @@ class SendIntent {
|
|||||||
// event handler
|
// event handler
|
||||||
if (result.url) {
|
if (result.url) {
|
||||||
this.onReceive(result)
|
this.onReceive(result)
|
||||||
|
|
||||||
}
|
}
|
||||||
}).catch(err => console.error(err));
|
}).catch(err => console.error(err));
|
||||||
}
|
}
|
||||||
@@ -38,13 +39,12 @@ class SendIntent {
|
|||||||
let resultUrl = decodeURIComponent(result.url);
|
let resultUrl = decodeURIComponent(result.url);
|
||||||
Filesystem.readFile({path: resultUrl}).then(async (content) => {
|
Filesystem.readFile({path: resultUrl}).then(async (content) => {
|
||||||
|
|
||||||
this.Router.navigateByUrl("/home/publication");
|
this.Router.navigateByUrl("/home/publications");
|
||||||
|
|
||||||
alert('shared')
|
window["sharedContent"] = content.data;
|
||||||
console.log(content.data);
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const sendIntent = new SendIntent()
|
export const sendIntent = new SendIntentService()
|
||||||
|
|||||||
Reference in New Issue
Block a user