Skip to content

Commit 36cf8a2

Browse files
committed
Include new torservice
1 parent d11fb1f commit 36cf8a2

File tree

6 files changed

+66
-73
lines changed

6 files changed

+66
-73
lines changed

android/app/build.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ android {
7575
}
7676
}
7777

78-
ext.abiCodes = ['armeabi-v7a':2, 'arm64-v8a':3]
78+
ext.abiCodes = ['armeabi-v7a': 2, 'arm64-v8a': 3]
7979

8080
import com.android.build.OutputFile
8181

@@ -128,11 +128,15 @@ dependencies {
128128
implementation 'com.squareup.okhttp3:okhttp:4.4.0'
129129
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
130130
implementation('com.google.zxing:core:3.4.0') {
131-
transitive = true
131+
132+
}
133+
implementation(project(':torservice')) {
134+
exclude module: 'org.slf4j'
135+
exclude group:'org.slf4j'
132136
}
133137
implementation 'org.torproject:tor-android-binary:0.4.2.5'
134138
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
135-
testImplementation 'junit:junit:4.12'
139+
testImplementation 'junit:junit:4.13'
136140
androidTestImplementation 'androidx.test:runner:1.2.0'
137141
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
138142
}

android/app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88
In most cases you can leave this as-is, but you if you want to provide
99
additional functionality it is fine to subclass or reimplement
1010
FlutterApplication and put your custom class here.
11+
12+
usesCleartextTraffic is enabled in order to use onion urls
1113
-->
1214
<application
1315
android:name="io.flutter.app.FlutterApplication"
1416
android:icon="@mipmap/ic_launcher"
1517
android:label="@string/app_name"
18+
android:usesCleartextTraffic="true"
1619
tools:ignore="GoogleAppIndexingWarning">
1720
<activity
1821
android:name=".MainActivity"

android/gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
org.gradle.jvmargs=-Xmx1536M
22

3-
android.enableR8=true
43
android.useAndroidX=true
54
android.enableJetifier=true
5+
android.enableR8 = false
6+
android.enableD8 = true
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Mar 03 12:35:08 IST 2020
1+
#Tue Mar 10 13:20:04 IST 2020
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

lib/screens/settings.dart

Lines changed: 50 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter/services.dart';
23
import 'package:flutter/widgets.dart';
34
import 'package:package_info/package_info.dart';
5+
import 'package:sentinelx/channels/network_channel.dart';
46
import 'package:sentinelx/models/db/prefs_store.dart';
57
import 'package:sentinelx/models/db/sentinelx_db.dart';
68
import 'package:sentinelx/screens/Lock/lock_screen.dart';
79
import 'package:sentinelx/screens/dojo_configure.dart';
810
import 'package:sentinelx/shared_state/app_state.dart';
911
import 'package:sentinelx/shared_state/sentinel_state.dart';
1012
import 'package:sentinelx/widgets/confirm_modal.dart';
13+
import 'package:sentinelx/widgets/port_selector.dart';
1114
import 'package:sentinelx/widgets/qr_camera/push_up_camera_wrapper.dart';
1215
import 'package:sentinelx/widgets/sentinelx_icons.dart';
1316
import 'package:sentinelx/widgets/theme_chooser.dart';
@@ -44,9 +47,7 @@ class _SettingsState extends State<Settings> {
4447
centerTitle: true,
4548
primary: true,
4649
),
47-
backgroundColor: Theme
48-
.of(context)
49-
.backgroundColor,
50+
backgroundColor: Theme.of(context).backgroundColor,
5051
body: Container(
5152
margin: EdgeInsets.only(top: 12),
5253
child: ListView(
@@ -56,9 +57,7 @@ class _SettingsState extends State<Settings> {
5657
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 18),
5758
child: Text(
5859
"App",
59-
style: TextStyle(color: Theme
60-
.of(context)
61-
.accentColor),
60+
style: TextStyle(color: Theme.of(context).accentColor),
6261
),
6362
),
6463
Divider(),
@@ -69,19 +68,16 @@ class _SettingsState extends State<Settings> {
6968
),
7069
trailing: loadingErase
7170
? SizedBox(
72-
child: CircularProgressIndicator(
73-
strokeWidth: 1,
74-
),
75-
width: 12,
76-
height: 12,
77-
)
71+
child: CircularProgressIndicator(
72+
strokeWidth: 1,
73+
),
74+
width: 12,
75+
height: 12,
76+
)
7877
: SizedBox.shrink(),
7978
title: Text(
8079
"Clear all data",
81-
style: Theme
82-
.of(context)
83-
.textTheme
84-
.subtitle,
80+
style: Theme.of(context).textTheme.subtitle,
8581
),
8682
subtitle: Text("Clear all data from the device"),
8783
onTap: () {
@@ -96,10 +92,7 @@ class _SettingsState extends State<Settings> {
9692
),
9793
title: Text(
9894
"Theme",
99-
style: Theme
100-
.of(context)
101-
.textTheme
102-
.subtitle,
95+
style: Theme.of(context).textTheme.subtitle,
10396
),
10497
subtitle: Text("Customize theme"),
10598
onTap: () {
@@ -111,9 +104,7 @@ class _SettingsState extends State<Settings> {
111104
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 18),
112105
child: Text(
113106
"Security",
114-
style: TextStyle(color: Theme
115-
.of(context)
116-
.accentColor),
107+
style: TextStyle(color: Theme.of(context).accentColor),
117108
),
118109
),
119110
Divider(),
@@ -124,23 +115,17 @@ class _SettingsState extends State<Settings> {
124115
),
125116
title: Text(
126117
lockEnabled ? "Change Lock PIN" : "Enable Lock Screen",
127-
style: Theme
128-
.of(context)
129-
.textTheme
130-
.subtitle,
118+
style: Theme.of(context).textTheme.subtitle,
131119
),
132-
subtitle:
133-
Text("Database will be encrypted using the provided PIN"),
120+
subtitle: Text("Database will be encrypted using the provided PIN"),
134121
onTap: enableOrChangeLock,
135122
),
136123
Divider(),
137124
Container(
138125
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 18),
139126
child: Text(
140127
"Network",
141-
style: TextStyle(color: Theme
142-
.of(context)
143-
.accentColor),
128+
style: TextStyle(color: Theme.of(context).accentColor),
144129
),
145130
),
146131
Divider(),
@@ -151,27 +136,35 @@ class _SettingsState extends State<Settings> {
151136
),
152137
title: Text(
153138
"Tor",
154-
style: Theme
155-
.of(context)
156-
.textTheme
157-
.subtitle,
139+
style: Theme.of(context).textTheme.subtitle,
158140
),
159141
subtitle: Text("Manage Tor service"),
160142
onTap: () {
161143
showTorPanel(context);
162144
},
163145
),
146+
ListTile(
147+
leading: Padding(
148+
padding: const EdgeInsets.symmetric(vertical: 12),
149+
child: Icon(Icons.import_export),
150+
),
151+
title: Text(
152+
"Socks Port",
153+
style: Theme.of(context).textTheme.subtitle,
154+
),
155+
subtitle: Text("Set Tor service socks port"),
156+
onTap: () {
157+
showPortChooser();
158+
},
159+
),
164160
ListTile(
165161
leading: Padding(
166162
padding: const EdgeInsets.symmetric(vertical: 12),
167163
child: Icon(Icons.router),
168164
),
169165
title: Text(
170166
"Samourai DOJO",
171-
style: Theme
172-
.of(context)
173-
.textTheme
174-
.subtitle,
167+
style: Theme.of(context).textTheme.subtitle,
175168
),
176169
subtitle: Text("Power your sentinel with Dojo backend"),
177170
onTap: () {
@@ -191,14 +184,14 @@ class _SettingsState extends State<Settings> {
191184
Padding(
192185
padding: EdgeInsets.all(24),
193186
),
194-
Text("Version : $version", style: Theme
195-
.of(context)
196-
.textTheme
197-
.caption,),
198-
Text("build : $buildNumber", style: Theme
199-
.of(context)
200-
.textTheme
201-
.caption,)
187+
Text(
188+
"Version : $version",
189+
style: Theme.of(context).textTheme.caption,
190+
),
191+
Text(
192+
"build : $buildNumber",
193+
style: Theme.of(context).textTheme.caption,
194+
)
202195
],
203196
)
204197
],
@@ -222,11 +215,7 @@ class _SettingsState extends State<Settings> {
222215
void deleteConfirmModal() async {
223216
bool confirm = await showConfirmModel(
224217
context: context,
225-
title: Text("Are you sure want to continue?",
226-
style: Theme
227-
.of(context)
228-
.textTheme
229-
.subhead),
218+
title: Text("Are you sure want to continue?", style: Theme.of(context).textTheme.subhead),
230219
iconPositive: new Icon(
231220
Icons.check_circle,
232221
color: Colors.greenAccent[200],
@@ -262,10 +251,7 @@ class _SettingsState extends State<Settings> {
262251
}
263252
bool confirm = await showConfirmModel(
264253
context: context,
265-
title: Text("Choose option", style: Theme
266-
.of(context)
267-
.textTheme
268-
.subhead),
254+
title: Text("Choose option", style: Theme.of(context).textTheme.subhead),
269255
iconPositive: new Icon(
270256
Icons.dialpad,
271257
),
@@ -284,18 +270,15 @@ class _SettingsState extends State<Settings> {
284270
} catch (e) {
285271
debugPrint(e);
286272
}
287-
Navigator.of(context).pushNamedAndRemoveUntil(
288-
'/', (Route<dynamic> route) => false,
289-
arguments: "LOCK");
290-
}
273+
Navigator.of(context).pushNamedAndRemoveUntil('/', (Route<dynamic> route) => false, arguments: "LOCK");
274+
}
291275
}
292276

293277
void setPassword() async {
294278
final text = await Navigator.push(
295279
context,
296280
MaterialPageRoute(
297-
builder: (context) =>
298-
LockScreen(
281+
builder: (context) => LockScreen(
299282
lockScreenMode: LockScreenMode.CONFIRM,
300283
),
301284
fullscreenDialog: true),
@@ -321,4 +304,8 @@ class _SettingsState extends State<Settings> {
321304
return ThemeChooser();
322305
});
323306
}
307+
308+
void showPortChooser() {
309+
showModalBottomSheet(context: context, isScrollControlled: true, builder: (context) => PortSelector());
310+
}
324311
}

lib/widgets/breath_widget.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ class BreathingAnimation extends StatefulWidget {
99
_BreathingAnimationState createState() => _BreathingAnimationState();
1010
}
1111

12-
class _BreathingAnimationState extends State<BreathingAnimation>
13-
with SingleTickerProviderStateMixin {
12+
class _BreathingAnimationState extends State<BreathingAnimation> with SingleTickerProviderStateMixin {
1413
static final _opacityTween = Tween<double>(begin: 1, end: 0.1);
1514

1615
Animation<double> animation;
@@ -19,8 +18,7 @@ class _BreathingAnimationState extends State<BreathingAnimation>
1918
@override
2019
void initState() {
2120
super.initState();
22-
controller =
23-
AnimationController(duration: const Duration(seconds: 1), vsync: this);
21+
controller = AnimationController(duration: const Duration(seconds: 1), vsync: this);
2422
animation = CurvedAnimation(parent: controller, curve: Curves.easeOutSine);
2523
controller.repeat(reverse: true);
2624
}

0 commit comments

Comments
 (0)