Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ginkgo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vjrj
ginkgo
Commits
d681fb05
Commit
d681fb05
authored
1 year ago
by
vjrj
Browse files
Options
Downloads
Patches
Plain Diff
Fix for VPN issue
#45
parent
89040bed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/ui/widgets/connectivity_widget_wrapper_wrapper.dart
+31
-6
31 additions, 6 deletions
lib/ui/widgets/connectivity_widget_wrapper_wrapper.dart
pubspec.lock
+8
-0
8 additions, 0 deletions
pubspec.lock
pubspec.yaml
+1
-0
1 addition, 0 deletions
pubspec.yaml
with
40 additions
and
6 deletions
lib/ui/widgets/connectivity_widget_wrapper_wrapper.dart
+
31
−
6
View file @
d681fb05
import
'dart:io'
;
import
'package:check_vpn_connection/check_vpn_connection.dart'
;
import
'package:connectivity_wrapper/connectivity_wrapper.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/
widgets
.dart'
;
import
'package:flutter/
material
.dart'
;
import
'../ui_helpers.dart'
;
...
...
@@ -20,14 +21,14 @@ class ConnectivityWidgetWrapperWrapper extends ConnectivityWidgetWrapper {
?
<
AddressCheckOptions
>[]
:
List
<
AddressCheckOptions
>
.
unmodifiable
(
<
AddressCheckOptions
>[
AddressCheckOptions
(
/*
AddressCheckOptions(
hostname: 'duniter.org',
port: 443,
),
AddressCheckOptions(
hostname: 'moneda-libre.org',
port: 443,
),
),
*/
// Cloudflare
AddressCheckOptions
(
address:
InternetAddress
(
...
...
@@ -88,9 +89,33 @@ class ConnectivityWidgetWrapperWrapper extends ConnectivityWidgetWrapper {
);
}
@override
Widget
build
(
BuildContext
context
)
{
return
FutureBuilder
<
bool
>(
future:
CheckVpnConnection
.
isVpnActive
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
<
bool
>
snapshot
)
{
if
(
snapshot
.
hasData
&&
snapshot
.
data
!=
null
)
{
final
bool
isVpnActive
=
snapshot
.
data
!
;
if
(
isVpnActive
)
{
return
child
;
}
else
{
return
super
.
build
(
context
);
}
}
else
{
return
super
.
build
(
context
);
}
});
}
// This package does not work in IOS so we just return true
// Also does not detect well in web production mode
static
Future
<
bool
>
get
isConnected
=
>
kIsWeb
||
isIOS
?
Future
<
bool
>
.
value
(
true
)
:
ConnectivityWrapper
.
instance
.
isConnected
;
static
Future
<
bool
>
get
isConnected
async
{
final
bool
vpn
=
await
CheckVpnConnection
.
isVpnActive
();
if
(
vpn
)
{
return
true
;
}
return
kIsWeb
||
isIOS
?
Future
<
bool
>
.
value
(
true
)
:
ConnectivityWrapper
.
instance
.
isConnected
;
}
}
This diff is collapsed.
Click to expand it.
pubspec.lock
+
8
−
0
View file @
d681fb05
...
...
@@ -201,6 +201,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.1"
check_vpn_connection:
dependency: "direct main"
description:
name: check_vpn_connection
sha256: "68029b66124eb5de2bc877f516ad9773f8b57e0a9ccf5c64609bb7cb8f14f3a0"
url: "https://pub.dev"
source: hosted
version: "0.0.2"
checked_yaml:
dependency: transitive
description:
...
...
This diff is collapsed.
Click to expand it.
pubspec.yaml
+
1
−
0
View file @
d681fb05
...
...
@@ -93,6 +93,7 @@ dependencies:
uni_links
:
^0.5.1
feedback
:
^2.6.0
sentry_dart_plugin
:
^1.5.0
check_vpn_connection
:
^0.0.2
dev_dependencies
:
flutter_test
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment