funcRequestedAppcontrol: any;
funcGetAppInfo: any;
funcGetAppcerts: any;
+ funcGetContext: any;
funcGetSharedUri: any;
funcGetMetadata: any;
funcGetPackageInfo: any;
return global.webapis.getPackageId();
}
+ hasNoneOrNull(...args: any[]) {
+ return !args.length || null === args[0];
+ }
+
refineApplicationApis() {
// tizen.application.getCurrentApplication()
this.funcCurrentApplication = global.tizen.application.getCurrentApplication;
this.funcGetAppInfo = global.tizen.application.getAppInfo;
global.tizen.application.getAppInfo = (...args: any[]) => {
let app_id = args[0];
- if (!args.length || args[0] === null)
+ if (this.hasNoneOrNull(args))
app_id = this.getServiceId();
console.log(`Routing - getAppInfo()`);
return this.funcGetAppInfo(app_id);
this.funcGetAppcerts = global.tizen.application.getAppCerts;
global.tizen.application.getAppCerts = (...args: any[]) => {
let app_id = args[0];
- if (!args.length || args[0] === null)
+ if (this.hasNoneOrNull(args))
app_id = this.getServiceId();
console.log(`Routing - getAppCerts() ` + app_id);
return this.funcGetAppcerts(app_id);
}
+ // tizen.application.getAppContext()
+ this.funcGetContext = global.tizen.application.getAppContext;
+ global.tizen.application.getAppContext = (...args: any[]) => {
+ console.log(`Routing - getAppContext()`);
+ if (this.hasNoneOrNull(args)) {
+ const context = {"id": this.funcGetContext().id, "appId": this.getServiceId()};
+ Object.defineProperty(context, 'appId', { writable: false });
+ Object.defineProperty(context, 'id', { writable: false });
+ return context;
+ }
+ return this.funcGetContext(args[0]);
+ }
// tizen.application.getAppSharedURI()
this.funcGetSharedUri = global.tizen.application.getAppSharedURI;
global.tizen.application.getAppSharedURI = (...args: any[]) => {
let app_id = args[0];
- if (!args.length || args[0] === null)
+ if (this.hasNoneOrNull(args))
app_id = this.getServiceId();
console.log(`Routing - getAppSharedURI()`);
return this.funcGetSharedUri(app_id);
this.funcGetMetadata = global.tizen.application.getAppMetaData;
global.tizen.application.getAppMetaData = (...args: any[]) => {
let app_id = args[0];
- if (!args.length || args[0] === null)
+ if (this.hasNoneOrNull(args))
app_id = this.getServiceId();
console.log(`Routing - getAppMetaData()`);
return this.funcGetMetadata(app_id);
this.funcGetPackageInfo = global.tizen.package.getPackageInfo;
global.tizen.package.getPackageInfo = (...args: any[]) => {
let package_id = args[0];
- if (!args.length || args[0] === null)
+ if (this.hasNoneOrNull(args))
package_id = this.getPackageId();
console.log(`Routing - getPackageInfo() : ${package_id}`);
return this.funcGetPackageInfo(package_id);