diff --git a/procentric/application/lib/hoteltv.hcap.js b/procentric/application/lib/hoteltv.hcap.js index 879da96..021e8f8 100755 --- a/procentric/application/lib/hoteltv.hcap.js +++ b/procentric/application/lib/hoteltv.hcap.js @@ -62,6 +62,7 @@ HotelTV.hal = (function() { const g_nativApps_info = { 'preapp': null, + 'generalapp': null, }; @@ -1520,30 +1521,104 @@ HotelTV.hal = (function() { } }, - PreAppGetInfo: function(_en_show_msg) { - // if (g_nativApps_info.preapp == null) { - // hcap.preloadedApplication.getPreloadedApplicationList({ - // "onSuccess": function(s) { - // if (_en_show_msg == true) { - // console.log("onSuccess : list length = " + s.list.length); - // for (var i = 0; i < s.list.length; i++) { - // console.log( - // "list[" + i + "].id = " + s.list[i].id + - // "list[" + i + "].title = " + s.list[i].title + - // "list[" + i + "].iconFilePath = " + s.list[i].iconFilePath - // ); - // } - // } - // if (s.result == true) { - // g_nativApps_info.preapp = s.list; - // } - // }, - // "onFailure": function(f) { - // console.log("onFailure : errorMessage = " + f.errorMessage); - // } - // }); - // } + AppGetInfo: function(_en_show_msg) { + return new Promise((resolve, reject) => { + hcap.application.getApplicationList({ + "onSuccess": function(s) { + if (_en_show_msg == true) { + console.log("onSuccess : list length = " + s.list.length); + for (var i = 0; i < s.list.length; i++) { + console.log( + "list[" + i + "].appId = " + s.list[i].appId + + "list[" + i + "].title = " + s.list[i].title + + "list[" + i + "].version = " + s.list[i].version + + "list[" + i + "].valid = " + s.list[i].valid + + "list[" + i + "].iconPath = " + s.list[i].iconPath + ); + } + } + if (s.result == true) { + g_nativApps_info.generalapp = s.list; + resolve({ "error": 0, "applist": g_nativApps_info.generalapp }); + } + }, + "onFailure": function(f) { + console.log("onFailure : errorMessage = " + f.errorMessage); + resolve({ "error": -1, "applist": null }); + } + }); + }); + }, + AppInstall: function(list_app_id, _en_show_msg) { + return new Promise((resolve, reject) => { + hcap.application.installApplications({ + "AppList" : list_app_id, + "onSuccess": function(s) { + if (_en_show_msg == true) { + console.log("onSuccess"); + } + resolve({ "error": 0, "msg": "success" }); + }, + "onFailure": function(f) { + console.log("onFailure : errorMessage = " + f.errorMessage); + resolve({ "error": -1, "msg": f.errorMessage }); + } + }); + }); + }, + + LaunchApp: function(_name, _param) { + if (g_nativApps_info.generalapp != null) { + if (_name == "coupangplay") { + for (const [key, item] of Object.entries(g_nativApps_info.generalapp)) { + if (item.title == 'Coupang Play') { + hcap.application.launchApplication({ + "id" : item.appId, + "onSuccess" : function() { + console.info("onSuccess"); + }, + "onFailure" : function(f) { + console.info("onFailure : errorMessage = " + f.errorMessage); + } + }); + } + } + } else if (_name == "wavve") { + for (const [key, item] of Object.entries(g_nativApps_info.generalapp)) { + if (item.title == 'wavve') { + hcap.application.launchApplication({ + "id" : item.appId, + "onSuccess" : function() { + console.info("onSuccess"); + }, + "onFailure" : function(f) { + console.info("onFailure : errorMessage = " + f.errorMessage); + } + }); + } + } + } else if (_name == "tving") { + for (const [key, item] of Object.entries(g_nativApps_info.generalapp)) { + if (item.title == 'TVING') { + hcap.application.launchApplication({ + "id" : item.appId, + "onSuccess" : function() { + console.info("onSuccess"); + }, + "onFailure" : function(f) { + console.info("onFailure : errorMessage = " + f.errorMessage); + } + }); + } + } + } + } else { + console.log("General Application doesn't exist"); + } + }, + + PreAppGetInfo: function(_en_show_msg) { return new Promise((resolve, reject) => { hcap.preloadedApplication.getPreloadedApplicationList({ "onSuccess": function(s) { diff --git a/procentric/application/lib/hoteltv.js b/procentric/application/lib/hoteltv.js index 793f9b9..3050da5 100755 --- a/procentric/application/lib/hoteltv.js +++ b/procentric/application/lib/hoteltv.js @@ -794,17 +794,50 @@ HotelTV.LoadAppFull = async function() { //STEP#03: INIT HCAP for HotelTV FullAPP let tmrAppAuth = setInterval(async function() { + let _list_install_appIDs = []; + let _NeedToDeleteTimer = false; let _foundNetflix = false; - let _hcapAppInfo = await HotelTV.hal.PreAppGetInfo(false); - HotelTV.state['hcap_app'] = _hcapAppInfo.applist; - for (_i = 0; _i < HotelTV.state['hcap_app'].length; _i++) { - if (HotelTV.state['hcap_app'][_i].title == "Netflix") { + let _hcapPreloadAppInfo = await HotelTV.hal.PreAppGetInfo(false); + let _hcapGeneralAppInfo = await HotelTV.hal.AppGetInfo(false); + HotelTV.state['hcap_app_preload'] = _hcapPreloadAppInfo.applist; + HotelTV.state['hcap_app_general'] = _hcapGeneralAppInfo.applist; + for (_i = 0; _i < HotelTV.state['hcap_app_preload'].length; _i++) { + if (HotelTV.state['hcap_app_preload'][_i].title == "Netflix") { console.log("Found out netflix among of pre hcap app-list.") - clearInterval(tmrAppAuth); + _foundNetflix = true; + _NeedToDeleteTimer = true; } } - if (_foundNetflix == false) { + for (_i = 0; _i < HotelTV.state['hcap_app_general'].length; _i++) { + if (HotelTV.state['hcap_app_general'][_i].title == "TVING") { + if ( HotelTV.state['hcap_app_general'][_i].valid == false ){ + console.warn("Found out TVING but not installed..."); + _list_install_appIDs.push(HotelTV.state['hcap_app_general'][_i].appId); + } + } else if (HotelTV.state['hcap_app_general'][_i].title == "Coupang Play") { + if ( HotelTV.state['hcap_app_general'][_i].valid == false ){ + console.warn("Found out Coupang Play but not installed..."); + _list_install_appIDs.push(HotelTV.state['hcap_app_general'][_i].appId); + } + } else if (HotelTV.state['hcap_app_general'][_i].title == "wavve") { + if ( HotelTV.state['hcap_app_general'][_i].valid == false ){ + console.warn("Found out wavve but not installed..."); + _list_install_appIDs.push(HotelTV.state['hcap_app_general'][_i].appId); + } + } + } + + if ( _list_install_appIDs.length>0 ){ + await HotelTV.hal.AppInstall(_list_install_appIDs, false); + } + + if ( _foundNetflix == true && _list_install_appIDs.length==0 ){ + console.info("Preparing APP Done..."); + clearInterval(tmrAppAuth); + } + + if ( _foundNetflix == false ) { try { let siAppToken = null; let siAppName = null; diff --git a/procentric/application/lib/hoteltv.ui_appfull.js b/procentric/application/lib/hoteltv.ui_appfull.js index 6810268..4626be4 100755 --- a/procentric/application/lib/hoteltv.ui_appfull.js +++ b/procentric/application/lib/hoteltv.ui_appfull.js @@ -502,8 +502,8 @@ HotelTV.ui_appfull = (function() { _state.menu.stage.prev = _state.menu.stage.cur; _state.menu.stage.cur = "external_av_hdmi"; _state.external_input.connected = true; - // NOTE: US741H0ND모델에서 HDMI셋팅 인덱스는 0부터, 이 부분은 LG에 문의 필요 - if (_devinfo.model_name.includes("US761H0ND")) { + // NOTE: UR762H0NC모델에서 HDMI셋팅 인덱스는 0부터, 이 부분은 LG에 문의 필요 + if (_devinfo.model_name.includes("US761H0ND") || _devinfo.model_name.includes("UM662H0NC")) { _state.external_input.last_input.index = Number(_evt.index); } else { _state.external_input.last_input.index = Number(_evt.index)-1; @@ -7080,8 +7080,8 @@ HotelTV.ui_appfull = (function() { HotelTV.hal.LaunchPreApp(_program[Number(_state.menu.main.cur)].service, null); } else if (_program[Number(_state.menu.main.cur)].service == "netflix") { let _foundNetflix = false; - for (_i = 0; _i < _state['hcap_app'].length; _i++) { - if (_state['hcap_app'][_i].title == 'Netflix') { + for (_i = 0; _i < _state['hcap_app_preload'].length; _i++) { + if (_state['hcap_app_preload'][_i].title == 'Netflix') { _foundNetflix = true; } } @@ -7093,7 +7093,13 @@ HotelTV.ui_appfull = (function() { } } else if (_program[Number(_state.menu.main.cur)].service == "screenmirroring") { HotelTV.hal.LaunchPreApp(_program[Number(_state.menu.main.cur)].service, null); - } + } else if (_program[Number(_state.menu.main.cur)].service == "coupangplay") { + HotelTV.hal.LaunchApp(_program[Number(_state.menu.main.cur)].service, null); + } else if (_program[Number(_state.menu.main.cur)].service == "wavve") { + HotelTV.hal.LaunchApp(_program[Number(_state.menu.main.cur)].service, null); + } else if (_program[Number(_state.menu.main.cur)].service == "tving") { + HotelTV.hal.LaunchApp(_program[Number(_state.menu.main.cur)].service, null); + } } else if (_program[Number(_state.menu.main.cur)].type.toLowerCase() == "language") { console.log("Preparing language select sub menu..."); __uifxn_AppFull_Build_LangSel();