src/here_utils.cpp
src/here_view.cpp
src/here_view_objects.cpp
- src/heremaps-check-uc.cpp
+ src/here_userconsent.cpp
# UC-DBus
src/heremaps-uc-dbus.c
int HerePluginCaptureSnapshot(maps_view_h hView, void **data, int *w, int *h, maps_view_colorspace_type_e *cs);
-int HerePluginCheckUC(const char *provider, maps_service_request_user_consent_cb pCbFunc, void *user_data);
+int HerePluginRequestUC(const char *provider, void *pCbFunc, void *user_data);
+
+int HerePluginGetUC(bool *consent);
+
+int HerePluginSetUserConsent(bool consent);
int HerePluginGetViewScale(maps_view_h hView, double *scale);
#include "here_api.h"
#include "here_types.h"
#include "here_utils.h"
+#include "here_userconsent.h"
//map engine header
#include <common/ApplicationContext.h>
static bool Create();
static HereManager* GetHandler();
static void Close();
- static here_error_e CheckAgreement();
+
+ //User Consent Object
+ HereUserConsent *m_UserConsent;
private:
here_error_e SetCredentials();
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _LOCATION_HERE_USERCONSENT_H_
+#define _LOCATION_HERE_USERCONSENT_H_
+
+#include "here_utils.h"
+
+HERE_PLUGIN_BEGIN_NAMESPACE
+
+using namespace HERE_MAPS_NAMESPACE_PREFIX;
+
+class HereUserConsent
+{
+public:
+ /**
+ *This is the default constructor for UserConsent.
+ */
+
+ HereUserConsent(const char *provider, void *pCbFunc, void *pUserData);
+
+ /**
+ *This is the default destructor for UserConsent.
+ */
+
+ ~HereUserConsent();
+
+ static here_error_e GetUserConsent(bool *consent);
+ static here_error_e SetUserConsent(bool consent);
+
+ here_error_e RequestUserConsent();
+
+ bool isSetVconfCb;
+ const char *m_provider; //provider
+ void *m_pCbFunc; //callback function
+ void *m_pUserData; //user data
+
+private:
+
+};
+
+HERE_PLUGIN_END_NAMESPACE
+
+#endif //_LOCATION_HERE_USERCONSENT_H_
\ No newline at end of file
#include <maps_service.h>
#include <maps_view.h>
#include <maps_extra_types.h>
+#include <maps_service_internal.h>
//plug-in header
#include "here_types.h"
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _LOCATION_HEREMAPS_CHECK_UC_H_
-#define _LOCATION_HEREMAPS_CHECK_UC_H_
-
-//plug-in header
-#include "here_utils.h"
-#include <common/BaseReply.h>
-
-typedef struct _data
-{
- const char *provider;
- maps_service_request_user_consent_cb pCbFunc;
- void *user_data;
-} heremaps_uc_cb_data;
-
-bool heremaps_check_agreement();
-
-#endif //_LOCATION_HEREMAPS_CHECK_UC_H_
-
#include "here_route.h"
#include "here_view.h"
#include "heremaps-uc-dbus.h"
-#include "heremaps-check-uc.h"
+#include "here_userconsent.h"
#include <common/HereConfig.h>
-#include <app.h>
-#include <vconf.h>
-#include <vconf-internal-location-keys.h>
using namespace HERE_PLUGIN_NAMESPACE_PREFIX;
if (!hPlugin)
return HERE_ERROR_INVALID_PARAMETER;
- here_error_e error = HereManager::CheckAgreement();
- if (error != HERE_ERROR_NONE)
- return error;
+ if (!module || strcmp(module, "NOUC") != 0) {
+ bool consent = false;
+ here_error_e error = HereUserConsent::GetUserConsent(&consent);
+ if (error != HERE_ERROR_NONE)
+ return error;
+ if (consent != true)
+ return HERE_ERROR_USER_NOT_CONSENTED;
+ }
HereManager::Create();
if (!szAddr || (szAddr && *szAddr == '\0') || !pCbFunc || !nReqId)
return HERE_ERROR_INVALID_PARAMETER;
- if (HereManager::CheckAgreement() != HERE_ERROR_NONE)
+ here_error_e error = HERE_ERROR_NONE;
+ bool consent = false;
+
+ error = HereUserConsent::GetUserConsent(&consent);
+ if (error != HERE_ERROR_NONE || consent != true)
return HERE_ERROR_PERMISSION_DENIED;
if (!HereManager::GetHandler())
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
/* sending request */
- here_error_e error = HERE_ERROR_NONE;
-
do {
error = pGeocode->PrepareQuery();
if (error != HERE_ERROR_NONE) break;
if (!hAddr || !pCbFunc || !nReqId)
return HERE_ERROR_INVALID_PARAMETER;
- if (HereManager::CheckAgreement() != HERE_ERROR_NONE)
+ here_error_e error = HERE_ERROR_NONE;
+ bool consent = false;
+
+ error = HereUserConsent::GetUserConsent(&consent);
+ if (error != HERE_ERROR_NONE || consent != true)
return HERE_ERROR_PERMISSION_DENIED;
if (!HereManager::GetHandler())
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
/* sending request */
- here_error_e error = HERE_ERROR_NONE;
-
do {
error = pGeocode->PrepareQuery();
if (error != HERE_ERROR_NONE) break;
if (!hArea || !HereUtils::IsValid(*(maps_area_s*)hArea))
return HERE_ERROR_INVALID_PARAMETER;
- if (HereManager::CheckAgreement() != HERE_ERROR_NONE)
+ here_error_e error = HERE_ERROR_NONE;
+ bool consent = false;
+
+ error = HereUserConsent::GetUserConsent(&consent);
+ if (error != HERE_ERROR_NONE || consent != true)
return HERE_ERROR_PERMISSION_DENIED;
if (!HereManager::GetHandler())
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
/* sending request */
- here_error_e error = HERE_ERROR_NONE;
-
do {
error = pGeocode->PrepareQuery();
if (error != HERE_ERROR_NONE) break;
if (!pCbFunc || !nReqId)
return HERE_ERROR_INVALID_PARAMETER;
- if (HereManager::CheckAgreement() != HERE_ERROR_NONE)
+ here_error_e error = HERE_ERROR_NONE;
+ bool consent = false;
+
+ error = HereUserConsent::GetUserConsent(&consent);
+ if (error != HERE_ERROR_NONE || consent != true)
return HERE_ERROR_PERMISSION_DENIED;
if (!HereManager::GetHandler())
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
/* sending request */
- here_error_e error = HERE_ERROR_UNKNOWN;
-
do {
error = pRevGeocode->PrepareQuery();
if (error != HERE_ERROR_NONE) break;
if (!hGeocodeList || !pCbFunc || !nReqId)
return HERE_ERROR_INVALID_PARAMETER;
- if (HereManager::CheckAgreement() != HERE_ERROR_NONE)
+ here_error_e error = HERE_ERROR_NONE;
+ bool consent = false;
+
+ error = HereUserConsent::GetUserConsent(&consent);
+ if (error != HERE_ERROR_NONE || consent != true)
return HERE_ERROR_PERMISSION_DENIED;
if (!HereManager::GetHandler())
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
/* sending request */
- here_error_e error = HERE_ERROR_UNKNOWN;
-
do {
error = pMultiRevGeocode->PrepareQuery();
if (error != HERE_ERROR_NONE) break;
if (!hFilter || !pCbFunc || !nReqId)
return HERE_ERROR_INVALID_PARAMETER;
- if (HereManager::CheckAgreement() != HERE_ERROR_NONE)
+ here_error_e error = HERE_ERROR_NONE;
+ bool consent = false;
+
+ error = HereUserConsent::GetUserConsent(&consent);
+ if (error != HERE_ERROR_NONE || consent != true)
return HERE_ERROR_PERMISSION_DENIED;
if (!HereManager::GetHandler())
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
/* sending request */
- here_error_e error = HERE_ERROR_NONE;
-
do {
error = pPlace->PrepareDiscoveryQuery();
if (error != HERE_ERROR_NONE) break;
if (!hFilter || !pCbFunc || !nReqId)
return HERE_ERROR_INVALID_PARAMETER;
- if (HereManager::CheckAgreement() != HERE_ERROR_NONE)
+ here_error_e error = HERE_ERROR_NONE;
+ bool consent = false;
+
+ error = HereUserConsent::GetUserConsent(&consent);
+ if (error != HERE_ERROR_NONE || consent != true)
return HERE_ERROR_PERMISSION_DENIED;
if (!HereManager::GetHandler())
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
/* sending request */
- here_error_e error = HERE_ERROR_NONE;
-
do {
error = pPlace->PrepareDiscoveryQuery();
if (error != HERE_ERROR_NONE) break;
if (!hArea || !HereUtils::IsValid(*(maps_area_s*)hArea))
return HERE_ERROR_INVALID_PARAMETER;
- if (HereManager::CheckAgreement() != HERE_ERROR_NONE)
+ here_error_e error = HERE_ERROR_NONE;
+ bool consent = false;
+
+ error = HereUserConsent::GetUserConsent(&consent);
+ if (error != HERE_ERROR_NONE || consent != true)
return HERE_ERROR_PERMISSION_DENIED;
if (!HereManager::GetHandler())
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
/* sending request */
- here_error_e error = HERE_ERROR_NONE;
-
do {
error = pPlace->PrepareDiscoveryQuery();
if (error != HERE_ERROR_NONE) break;
if (!hArea || !HereUtils::IsValid(*(maps_area_s*)hArea))
return HERE_ERROR_INVALID_PARAMETER;
- if (HereManager::CheckAgreement() != HERE_ERROR_NONE)
+ here_error_e error = HERE_ERROR_NONE;
+ bool consent = false;
+
+ error = HereUserConsent::GetUserConsent(&consent);
+ if (error != HERE_ERROR_NONE || consent != true)
return HERE_ERROR_PERMISSION_DENIED;
if (!HereManager::GetHandler())
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
/* sending request */
- here_error_e error = HERE_ERROR_NONE;
-
do {
error = pPlace->PrepareDiscoveryQuery();
if (error != HERE_ERROR_NONE) break;
if (!szUrl || (szUrl && *szUrl == '\0') || !pCbFunc || !nReqId)
return HERE_ERROR_INVALID_PARAMETER;
- if (HereManager::CheckAgreement() != HERE_ERROR_NONE)
+ here_error_e error = HERE_ERROR_NONE;
+ bool consent = false;
+
+ error = HereUserConsent::GetUserConsent(&consent);
+ if (error != HERE_ERROR_NONE || consent != true)
return HERE_ERROR_PERMISSION_DENIED;
if (!HereManager::GetHandler())
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
/* sending request */
- here_error_e error = HERE_ERROR_NONE;
-
do {
error = pPlace->PreparePlaceDetailsQuery();
if (error != HERE_ERROR_NONE) break;
!HereUtils::IsValid(*(maps_coordinates_s*)hDestination))
return HERE_ERROR_INVALID_PARAMETER;
- if (HereManager::CheckAgreement() != HERE_ERROR_NONE)
+ here_error_e error = HERE_ERROR_NONE;
+ bool consent = false;
+
+ error = HereUserConsent::GetUserConsent(&consent);
+ if (error != HERE_ERROR_NONE || consent != true)
return HERE_ERROR_PERMISSION_DENIED;
if (!HereManager::GetHandler())
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
/* sending request */
- here_error_e error = HERE_ERROR_NONE;
-
do {
error = pRoute->PrepareQuery();
if (error != HERE_ERROR_NONE) break;
return HERE_ERROR_INVALID_PARAMETER;
}
- if (HereManager::CheckAgreement() != HERE_ERROR_NONE)
+ here_error_e error = HERE_ERROR_NONE;
+ bool consent = false;
+
+ error = HereUserConsent::GetUserConsent(&consent);
+ if (error != HERE_ERROR_NONE || consent != true)
return HERE_ERROR_PERMISSION_DENIED;
if (!HereManager::GetHandler())
return HERE_ERROR_SERVICE_NOT_AVAILABLE;
/* sending request */
- here_error_e error = HERE_ERROR_NONE;
-
do {
error = pRoute->PrepareQuery();
if (error != HERE_ERROR_NONE) break;
return error;
}
-static void _heremaps_consent_changed_cb(keynode_t *node EINA_UNUSED, void *user_data)
+int HerePluginRequestUC(const char *provider, void *pCbFunc, void *user_data)
{
- MAPS_FUNC_ENTER
-
- heremaps_uc_cb_data *uc_data = (heremaps_uc_cb_data *)user_data;
- int enabled = 0;
-
- if (!uc_data) {
- MAPS_LOGD("uc_data is NULL");
- return;
- }
- if (!uc_data->pCbFunc) {
- MAPS_LOGD("pCbFunc is NULL");
- g_free(uc_data);
- return;
- }
-
- vconf_get_int(VCONFKEY_LOCATION_HEREMAPS_CONSENT, &enabled);
- if (enabled != 0 && enabled != 1)
- return;
- vconf_ignore_key_changed(VCONFKEY_LOCATION_HEREMAPS_CONSENT, _heremaps_consent_changed_cb);
+ if(!HereManager::GetHandler()->m_UserConsent)
+ HereManager::GetHandler()->m_UserConsent = new (std::nothrow) HereUserConsent(provider, pCbFunc, user_data);
- MAPS_LOGD("Vconf value of HereMaps is %d", enabled);
- if (enabled == 0)
- uc_data->pCbFunc(FALSE, uc_data->provider, uc_data->user_data);
+ if (HereManager::GetHandler()->m_UserConsent)
+ return HereManager::GetHandler()->m_UserConsent->RequestUserConsent();
else
- uc_data->pCbFunc(TRUE, uc_data->provider, uc_data->user_data);
- g_free(uc_data);
-
- MAPS_FUNC_EXIT
-}
-
-int HerePluginCheckUC(const char *provider, maps_service_request_user_consent_cb pCbFunc, void *user_data)
-{
- int ret = HEREMAPS_UC_DBUS_ERROR_NONE;
- bool agreed = heremaps_check_agreement();
-
- if (agreed != TRUE) {
- heremaps_uc_cb_data *uc_data = (heremaps_uc_cb_data *)g_malloc0(sizeof(heremaps_uc_cb_data));
- if (!uc_data)
- return HERE_ERROR_OUT_OF_MEMORY;
- uc_data->provider = provider;
- uc_data->pCbFunc = pCbFunc;
- uc_data->user_data = user_data;
-
- if (vconf_notify_key_changed(VCONFKEY_LOCATION_HEREMAPS_CONSENT, _heremaps_consent_changed_cb, uc_data) < 0) {
- MAPS_LOGD("Unable to register a vconf changed cb to VCONFKEY_LOCATION_HEREMAPS_CONSENT");
- g_free(uc_data);
- return HERE_ERROR_SERVICE_NOT_AVAILABLE;
- }
- MAPS_LOGD("heremaps_uc_dbus_launch_receiver is called");
- ret = heremaps_uc_dbus_launch_receiver();
- if (ret != HEREMAPS_UC_DBUS_ERROR_NONE)
- MAPS_LOGD("heremaps_uc_dbus_launch_receiver fail");
- return HERE_ERROR_USER_NOT_CONSENTED;
- } else {
- MAPS_LOGD("Vconf value of HereMaps is true");
- pCbFunc(TRUE, provider, user_data);
- }
+ return HERE_ERROR_OUT_OF_MEMORY;
+}
- return HERE_ERROR_NONE;
+int HerePluginGetUC(bool *consent)
+{
+ return HereUserConsent::GetUserConsent(consent);
+}
+
+int HerePluginSetUserConsent(bool consent)
+{
+ return HereUserConsent::SetUserConsent(consent);
}
int HerePluginGetViewScale(maps_view_h hView, double *scale)
#include "here_utils.h"
#include "here_view.h"
#include "heremaps-uc-dbus.h"
-#include "heremaps-check-uc.h"
#include <common/HereConfig.h>
#include <iostream>
m_hConnection = NULL;
pthread_mutex_init(&m_mtxHereList, NULL);
pthread_mutex_init(&g_mtxRef, NULL);
+
+ m_UserConsent = NULL;
}
HereManager::~HereManager()
{
+ if (m_UserConsent) {
+ delete m_UserConsent;
+ m_UserConsent = NULL;
+ }
if (m_hConnection)
{
connection_unset_type_changed_cb(m_hConnection);
pManager->SetProxyAddress();
}
-here_error_e HereManager::CheckAgreement()
-{
- here_error_e error = HERE_ERROR_NONE;
-
- if (heremaps_check_agreement() == FALSE)
- error = HERE_ERROR_USER_NOT_CONSENTED;
-
- return error;
-}
-
HERE_PLUGIN_END_NAMESPACE
void *user_data)
{
MAPS_LOGD("maps_plugin_request_user_consent");
- int ret = HerePluginCheckUC(provider, callback, user_data);
+ int ret = HerePluginRequestUC(provider, (void *)callback, user_data);
+ MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
+ return ConvertToMapsError(ret);
+}
+
+EXPORT_API int maps_plugin_request_user_consent_with_handle(maps_service_request_user_consent_with_handle_cb callback,
+ void *user_data)
+{
+ MAPS_LOGD("maps_plugin_request_user_consent_with_handle");
+ int ret = HerePluginRequestUC(NULL, (void *)callback, user_data);
+ MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
+ return ConvertToMapsError(ret);
+}
+
+EXPORT_API int maps_plugin_get_user_consent(bool *consent)
+{
+ MAPS_LOGD("maps_plugin_get_user_consent");
+ int ret = HerePluginGetUC(consent);
+ MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
+ return ConvertToMapsError(ret);
+}
+
+EXPORT_API int maps_plugin_set_user_consent(bool consent)
+{
+ MAPS_LOGD("maps_plugin_set_user_consent");
+ int ret = HerePluginSetUserConsent(consent);
MAPS_LOGD("here_error_e = %d, %s", ret, ConverHereErrorToString(ret));
return ConvertToMapsError(ret);
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <unistd.h>
+#include <app.h>
+#include <app_manager.h>
+#include <vconf.h>
+#include <vconf-internal-location-keys.h>
+
+#include "heremaps-uc-dbus.h"
+#include "here_userconsent.h"
+
+HERE_PLUGIN_BEGIN_NAMESPACE
+
+static void UserConsentChangedCb(keynode_t *node EINA_UNUSED, void *user_data)
+{
+ MAPS_FUNC_ENTER
+
+ HereUserConsent *pUserConsent = (HereUserConsent *)user_data;
+
+ if (!pUserConsent->m_pCbFunc) {
+ MAPS_LOGD("m_pCbFunc and is NULL");
+ return;
+ }
+
+ int enabled = 0;
+ vconf_get_int(VCONFKEY_LOCATION_HEREMAPS_CONSENT, &enabled);
+ if (enabled != 0 && enabled != 1)
+ return;
+ vconf_ignore_key_changed(VCONFKEY_LOCATION_HEREMAPS_CONSENT, UserConsentChangedCb);
+ pUserConsent->isSetVconfCb = false;
+
+ MAPS_LOGD("Vconf value of HereMaps is %d", enabled);
+ if (pUserConsent->m_provider)
+ ((maps_service_request_user_consent_cb)pUserConsent->m_pCbFunc)((bool)enabled, pUserConsent->m_provider, pUserConsent->m_pUserData);
+ else
+ ((maps_service_request_user_consent_with_handle_cb)pUserConsent->m_pCbFunc)((bool)enabled, pUserConsent->m_pUserData);
+
+ MAPS_FUNC_EXIT
+}
+
+HereUserConsent::HereUserConsent(const char *provider, void *pCbFunc, void *pUserData)
+{
+ isSetVconfCb = false;
+ m_provider = provider;
+ m_pCbFunc = pCbFunc;
+ m_pUserData = pUserData;
+}
+
+HereUserConsent::~HereUserConsent()
+{
+ if (isSetVconfCb)
+ vconf_ignore_key_changed(VCONFKEY_LOCATION_HEREMAPS_CONSENT, UserConsentChangedCb);
+ isSetVconfCb = false;
+}
+
+here_error_e HereUserConsent::GetUserConsent(bool *consent)
+{
+ const int testAppIdCount = 7;
+ const char* testAppIdList[testAppIdCount] = {
+ "org.tizen.capi-maps-service-native-utc",
+ "org.tizen.capi-maps-service-native-itc",
+ "core.capi-maps-service-tests",
+ "native.capi-maps-service-itc",
+ "Tizen.Maps.Test",
+ "Tizen.Maps.Manual.Test",
+ "Tizen.XamarinFormsMaps.Tests"
+ };
+
+ int enabled = 0;
+ int ret = 0;
+
+ ret = vconf_get_int(VCONFKEY_LOCATION_HEREMAPS_CONSENT, &enabled);
+ MAPS_LOGD("VCONFKEY_LOCATION_HEREMAPS_CONSENT is %d", enabled);
+ if (ret != 0) {
+ MAPS_LOGD("Fail to get vconf value");
+ *consent = FALSE;
+ return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+ }
+ if (enabled != 1) {
+ pid_t nProcessId = getpid();
+ char *strAppId = NULL;
+
+ ret = app_manager_get_app_id(nProcessId, &strAppId);
+ if (ret != APP_MANAGER_ERROR_NONE) {
+ MAPS_LOGI("Get app_id [%ld]. nRet[%d]", nProcessId, ret);
+ } else {
+ for (int i = 0; i < testAppIdCount; i++) {
+ if (!strncmp(strAppId, testAppIdList[i], strlen(testAppIdList[i]))) {
+ MAPS_LOGD("Requested by tct");
+ enabled = 1;
+ break;
+ }
+ }
+ }
+ g_free(strAppId);
+ }
+ *consent = (enabled == 1);
+
+ return HERE_ERROR_NONE;
+}
+
+here_error_e HereUserConsent::SetUserConsent(bool consent)
+{
+ int enabled = (int)consent;
+ int ret = 0;
+
+ ret = vconf_set_int(VCONFKEY_LOCATION_HEREMAPS_CONSENT, enabled);
+ MAPS_LOGD("set VCONFKEY_LOCATION_HEREMAPS_CONSENT : %d", enabled);
+ if (ret != 0) {
+ MAPS_LOGD("Fail to set vconf value");
+ return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+ }
+
+ return HERE_ERROR_NONE;
+}
+
+here_error_e HereUserConsent::RequestUserConsent()
+{
+ bool agreed = false;
+ HereUserConsent::GetUserConsent(&agreed);
+
+ if (agreed != TRUE) {
+ if (vconf_notify_key_changed(VCONFKEY_LOCATION_HEREMAPS_CONSENT, UserConsentChangedCb, this) < 0) {
+ MAPS_LOGD("Unable to register a vconf changed cb to VCONFKEY_LOCATION_HEREMAPS_CONSENT");
+ return HERE_ERROR_SERVICE_NOT_AVAILABLE;
+ }
+ isSetVconfCb = true;
+ int ret = HEREMAPS_UC_DBUS_ERROR_NONE;
+ MAPS_LOGD("heremaps_uc_dbus_launch_receiver is called");
+ ret = heremaps_uc_dbus_launch_receiver();
+ if (ret != HEREMAPS_UC_DBUS_ERROR_NONE)
+ MAPS_LOGD("heremaps_uc_dbus_launch_receiver fail");
+ return HERE_ERROR_USER_NOT_CONSENTED;
+ } else {
+ MAPS_LOGD("Vconf value of HereMaps is true");
+ if (m_provider)
+ ((maps_service_request_user_consent_cb)m_pCbFunc)(TRUE, m_provider, m_pUserData);
+ else
+ ((maps_service_request_user_consent_with_handle_cb)m_pCbFunc)(TRUE, m_pUserData);
+ }
+
+ return HERE_ERROR_NONE;
+}
+
+HERE_PLUGIN_END_NAMESPACE
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <unistd.h>
-#include <libxml/xpath.h>
-#include <common/HereConfig.h>
-#include <app.h>
-#include <app_manager.h>
-#include <vconf.h>
-#include <vconf-internal-location-keys.h>
-
-#include "here_utils.h"
-#include "heremaps-check-uc.h"
-
-bool heremaps_check_agreement()
-{
- const int testAppIdCount = 7;
- const char* testAppIdList[testAppIdCount] = {
- "org.tizen.capi-maps-service-native-utc",
- "org.tizen.capi-maps-service-native-itc",
- "core.capi-maps-service-tests",
- "native.capi-maps-service-itc",
- "Tizen.Maps.Test",
- "Tizen.Maps.Manual.Test",
- "Tizen.XamarinFormsMaps.Tests"
- };
-
- int enabled = 0;
- int ret = 0;
- char *strAppId = NULL;
-
- ret = vconf_get_int(VCONFKEY_LOCATION_HEREMAPS_CONSENT, &enabled);
- MAPS_LOGD("VCONFKEY_LOCATION_HEREMAPS_CONSENT is %d", enabled);
- if (ret != 0 || enabled != 1) {
- if (ret != 0)
- MAPS_LOGD("Fail to get vconf value");
-
- pid_t nProcessId = getpid();
- ret = app_manager_get_app_id(nProcessId, &strAppId);
- if (ret != APP_MANAGER_ERROR_NONE) {
- MAPS_LOGI("Get app_id [%ld]. nRet[%d]", nProcessId, ret);
- } else {
- for (int i = 0; i < testAppIdCount; i++) {
- if (!strncmp(strAppId, testAppIdList[i], strlen(testAppIdList[i]))) {
- MAPS_LOGD("Requested by tct");
- enabled = 1;
- break;
- }
- }
- }
- }
-
- if (strAppId != NULL)
- g_free(strAppId);
-
- if (enabled != 1)
- return FALSE;
- else
- return TRUE;
-}
-