Add Quick Settings tile (#660)
* Add Quick Settings tile - Add multi-client support to AmneziaVpnService - Make AmneziaActivity permanently connected to AmneziaVpnService while it is running - Refactor processing of connection state changes on qt side - Add VpnState DataStore - Add check if AmneziaVpnService is running * Add tile reset when the server is removed from the application
This commit is contained in:
parent
ca633ae882
commit
080e1d98c6
22 changed files with 602 additions and 154 deletions
|
|
@ -270,6 +270,7 @@ QJsonObject VpnConnection::createVpnConfiguration(int serverIndex, const ServerC
|
|||
ErrorCode *errorCode)
|
||||
{
|
||||
QJsonObject vpnConfiguration;
|
||||
vpnConfiguration[config_key::serverIndex] = serverIndex;
|
||||
|
||||
for (ProtocolEnumNS::Proto proto : ContainerProps::protocolsForContainer(container)) {
|
||||
auto s = m_settings->server(serverIndex);
|
||||
|
|
@ -471,10 +472,15 @@ void VpnConnection::disconnectFromVpn()
|
|||
|
||||
#ifdef Q_OS_ANDROID
|
||||
if (m_vpnProtocol && m_vpnProtocol.data()) {
|
||||
connect(AndroidController::instance(), &AndroidController::vpnDisconnected, this,
|
||||
[this]() {
|
||||
onConnectionStateChanged(Vpn::ConnectionState::Disconnected);
|
||||
}, Qt::SingleShotConnection);
|
||||
auto *const connection = new QMetaObject::Connection;
|
||||
*connection = connect(AndroidController::instance(), &AndroidController::vpnStateChanged, this,
|
||||
[this, connection](AndroidController::ConnectionState state) {
|
||||
if (state == AndroidController::ConnectionState::DISCONNECTED) {
|
||||
onConnectionStateChanged(Vpn::ConnectionState::Disconnected);
|
||||
disconnect(*connection);
|
||||
delete connection;
|
||||
}
|
||||
});
|
||||
m_vpnProtocol.data()->stop();
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue