Skip to content

Commit 7daf953

Browse files
committed
v 0.7.3
- UX Changes. - Bug Fixes and Improvements.
1 parent 5ba8f31 commit 7daf953

File tree

6 files changed

+62
-44
lines changed

6 files changed

+62
-44
lines changed

android/version.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
flutter.versionName=0.7.2
2-
flutter.versionCode=4120
1+
flutter.versionName=0.7.3
2+
flutter.versionCode=4125

lib/others/common.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ bool isZeroNetDownloadedm = false;
99
bool isDownloadExec = false;
1010
bool canLaunchUrl = false;
1111
bool firstTime = false;
12+
bool kIsPlayStoreInstall = false;
1213
int downloadStatus = 0;
1314
Map downloadsMap = {};
1415
Map downloadStatusMap = {};
@@ -56,6 +57,7 @@ List<String> files(String arch) => [
5657

5758
init() async {
5859
getArch();
60+
kIsPlayStoreInstall = await isPlayStoreInstall();
5961
zeroNetNativeDir = await getNativeDir();
6062
tempDir = await getTemporaryDirectory();
6163
appPrivDir = await getExternalStorageDirectory();

lib/others/zeronet_utils.dart

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,16 @@ bool isZeroNetUserDataExists() {
195195
return getZeroNetUsersFilePath().isNotEmpty;
196196
}
197197

198+
bool isZeroNetUsersFileExists() {
199+
var dataDir = getZeroNetDataDir();
200+
if (dataDir.existsSync()) {
201+
File f = File(dataDir.path + '/users.json');
202+
return f.existsSync();
203+
} else {
204+
return false;
205+
}
206+
}
207+
198208
String getZeroNetUsersFilePath() {
199209
var dataDir = getZeroNetDataDir();
200210
if (dataDir.existsSync()) {
@@ -203,13 +213,8 @@ String getZeroNetUsersFilePath() {
203213
if (exists) {
204214
return f.path;
205215
}
206-
return zeroNetDir + '/data/users.json';
207-
} else {
208-
dataDir.createSync(recursive: true);
209-
File f = File(dataDir.path + '/users.json');
210-
f.createSync(recursive: true);
211-
return f.path;
212216
}
217+
return '';
213218
}
214219

215220
Directory getZeroNetDataDir() => Directory(

lib/widgets/common.dart

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -65,45 +65,52 @@ class _PluginManagerState extends State<PluginManager> {
6565
Widget build(BuildContext context) {
6666
var size = MediaQuery.of(context).size;
6767
List<String> plugins = [];
68+
List<String> disabledPlugins = [];
6869
var pluginsPath = zeroNetDir + '/plugins/';
6970
Directory(pluginsPath).listSync().forEach((entity) {
7071
var pycacheDir = entity.path.endsWith('__pycache__');
7172
if (entity is Directory && !pycacheDir) {
7273
printOut(entity.path);
73-
plugins.insert(0, entity.path.replaceAll(pluginsPath, ''));
74+
String pluginName = entity.path.replaceAll(pluginsPath, '');
75+
if (pluginName.startsWith('disabled-')) {
76+
pluginName = pluginName.replaceAll('disabled-', '');
77+
disabledPlugins.add(pluginName);
78+
}
79+
plugins.insert(0, pluginName);
7480
}
7581
});
7682
plugins.sort();
7783
return Container(
78-
height: size.height * 0.70,
7984
width: size.width,
80-
child: ListView.builder(
81-
itemCount: plugins.length,
82-
itemBuilder: (ctx, i) {
83-
final isDisabled = plugins[i].startsWith('disabled-');
84-
final pluginName = isDisabled
85-
? plugins[i].replaceFirst('disabled-', '')
86-
: plugins[i];
87-
return Row(
88-
mainAxisSize: MainAxisSize.min,
89-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
90-
children: <Widget>[
91-
Text(pluginName),
92-
Switch(
93-
onChanged: (value) {
94-
if (isDisabled)
95-
Directory(pluginsPath + plugins[i])
96-
.renameSync(pluginsPath + pluginName);
97-
else
98-
Directory(pluginsPath + plugins[i])
99-
.renameSync(pluginsPath + 'disabled-' + plugins[i]);
100-
_reload();
101-
},
102-
value: !isDisabled,
103-
)
104-
],
105-
);
106-
},
85+
child: SingleChildScrollView(
86+
child: ListView.builder(
87+
physics: BouncingScrollPhysics(),
88+
shrinkWrap: true,
89+
itemCount: plugins.length,
90+
itemBuilder: (ctx, i) {
91+
final isDisabled = disabledPlugins.contains(plugins[i]);
92+
final pluginName = plugins[i];
93+
return Row(
94+
mainAxisSize: MainAxisSize.min,
95+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
96+
children: <Widget>[
97+
Text(pluginName),
98+
Switch(
99+
onChanged: (value) {
100+
if (isDisabled)
101+
Directory(pluginsPath + 'disabled-' + plugins[i])
102+
.renameSync(pluginsPath + pluginName);
103+
else
104+
Directory(pluginsPath + plugins[i])
105+
.renameSync(pluginsPath + 'disabled-' + plugins[i]);
106+
_reload();
107+
},
108+
value: !isDisabled,
109+
)
110+
],
111+
);
112+
},
113+
),
107114
),
108115
);
109116
}

lib/widgets/home_page.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ class HomePage extends StatelessWidget {
2828
Padding(
2929
padding: EdgeInsets.only(bottom: 5),
3030
),
31-
if (!unImplementedFeatures.contains(Feature.IN_APP_UPDATES))
32-
InAppUpdateWidget(),
33-
Padding(
34-
padding: EdgeInsets.only(bottom: 15),
35-
),
36-
RatingButtonWidget(),
31+
InAppUpdateWidget(),
32+
if (kIsPlayStoreInstall)
33+
Padding(
34+
padding: EdgeInsets.only(bottom: 15),
35+
),
36+
if (kIsPlayStoreInstall) RatingButtonWidget(),
3737
Padding(
3838
padding: EdgeInsets.only(bottom: 15),
3939
),
@@ -120,7 +120,6 @@ class RatingButtonWidget extends StatelessWidget {
120120
return RaisedButton(
121121
onPressed: () async {
122122
final InAppReview inAppReview = InAppReview.instance;
123-
final kIsPlayStoreInstall = await isPlayStoreInstall();
124123
//TODO: remove this once we support non playstore reviews.
125124
if (await inAppReview.isAvailable() && kIsPlayStoreInstall) {
126125
inAppReview.requestReview();
@@ -186,6 +185,7 @@ class ZeroNetStatusWidget extends StatelessWidget {
186185
return InkWell(
187186
onTap: uiStore.zeroNetStatus.onAction,
188187
child: Chip(
188+
elevation: 8.0,
189189
label: Padding(
190190
padding: const EdgeInsets.all(2.0),
191191
child: Text(

lib/widgets/settings_page.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ class SettingsPage extends StatelessWidget {
2626
itemBuilder: (ctx, i) {
2727
Setting current = Utils()
2828
.defSettings[Utils().defSettings.keys.toList()[i]];
29+
if (current.name == profileSwitcher) {
30+
bool isUsersFileExists = isZeroNetUsersFileExists();
31+
if (!isUsersFileExists) return Container();
32+
}
2933
return SettingsCard(
3034
setting: current,
3135
);

0 commit comments

Comments
 (0)