Я пытаюсь создать угловое приложение, используя компоненты Alfresco adf (https://github.com/Alfresco/alfresco-ng2-components), и мне тоже нужно мобильное приложение, поэтому я решил использовать cordova для создания apk.
Я следую следующему уроку(https://medium.com/@nacojohn/convert-your-angular-project-to-mobile-app-using-cordova-f0384a7711a6) для создания моего apk.
Кажется, все работает нормально, apk был сгенерирован и установлен в BlueStack, пока я не войду в свое приложение.
Источник не разрешен access-control-allow-origin
Я знаю, что мне нужна политика белого списка для навигации по веб-представлению приложения
config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.hello" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloWorld</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-navigation href="*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<plugin name="cordova-plugin-device" spec="^2.0.2" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<engine name="android" spec="^7.0.0" />
<engine name="ios" spec="^4.5.4" />
</widget>
index.html
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"
В моем угловом веб-приложении есть прокси-сервер dev-server для решения проблемы CORS
proxy.conf.json
{
"/alfresco": {
"target": "server-url",
"secure": false,
"changeOrigin": true
},
"/activiti-app": {
"target": "another-server-url",
"secure": false,
"changeOrigin": true
}
}
Я не знаю, что мне нужно сделать больше. Я сделал что-то не так? Нужно сделать что-то еще?
Спасибо