Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
canewsin committed Feb 15, 2022
1 parent 5727401 commit 6da44b5
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 79 deletions.
18 changes: 9 additions & 9 deletions lib/controllers/stringcontroller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,30 +139,30 @@ class StrController extends GetxController {
var openPluginManagerStr = 'Open Plugin Manager'.obs;
var loadPluginStr = 'Load Plugin'.obs;
var zerohelloSiteDesStr = 'Say Hello to ZeroNet, a Dashboard to manage '
'all your ZeroNet Z(S)ites, You can view feed of other zites like '
'posts, comments of other users from ZeroTalk as well for your posts '
'and Stats like Total Requests sent and received from other peers on ZeroNet. '
'all your ZeroNetX Z(S)ites, You can view feed of other zites like '
'posts, comments of other users from ThreadIt as well for your posts '
'and Stats like Total Requests sent and received from other peers on ZeroNetX. '
'You can also pause, clone or favourite, delete Zites from single page.'
.obs;
var zeronetMobileSiteDesStr = 'Forum to report ZeroNet Mobile app issues. '
var zeronetMobileSiteDesStr = 'Forum to report ZeroNetX app issues. '
'Want a new feature in the app, Request a Feature. '
'Facing any Bugs while using the app ? '
'Just report problem here, we will take care of it. '
'Want to Discuss any topic about app development ? '
'Just dive into to this Zite.'
.obs;
var zeroTalkSiteDesStr = 'Need a forum to discuss something, '
'we got covered you here. ZeroTalk fits your need, '
'we got covered you here. ThreadIt fits your need, '
'just post something to get opinion from others on Network. '
'Have some queries ? don\'t hesitate to ask here.'
'Tired of Spam ? Who don\'t! You can mute individual users also.'
.obs;
var zeroblogSiteDesStr = 'Want to Know Where ZeroNet is Going ? '
'ZeroBlog gives you latest changes and improvements '
'made to ZeroNet, including Bug Fixes, '
'Speed Improvements of ZeroNet Core Software. '
'Scribe gives you latest changes and improvements '
'made to ZeroNetX, including Bug Fixes, '
'Speed Improvements of ZeroNetX Core Software. '
'Also Provides varies links to ZeroNet Protocol and '
'how ZeroNet works underhood and much more things to know.'
'how ZeroNetX works underhood and much more things to know.'
.obs;
var zeromailSiteDesStr = 'So you need a mail service, use ZeroMail, '
'fully end-to-end encrypted mail service on ZeroNet, '
Expand Down
19 changes: 7 additions & 12 deletions lib/others/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ class Utils {
static const String urlZeroNetMob = '15UYrA7aXr2Nto1Gg4yWXpY3EAJwafMTNk';
static const String urlTalk = 'Talk.ZeroNetwork.bit';
static const String btcUrlTalk = '1TaLkFrMwvbNsooF4ioKAY9EuxTBTjipT';
static const String urlBlog = 'Blog.ZeroNetwork.bit';
static const String btcUrlBlog = '1BLogC9LN4oPDcruNz3qo1ysa133E9AGg8';
static const String urlBlog = '1SCribeHs1nz8m3vXipP84oyXUy4nf2ZD';
static const String btcUrlBlog = '1SCribeHs1nz8m3vXipP84oyXUy4nf2ZD';
static const String urlMail = 'Mail.ZeroNetwork.bit';
static const String btcUrlMail = '1MaiL5gfBM1cyb4a8e3iiL8L5gXmoAJu27';
static const String urlMe = 'Me.ZeroNetwork.bit';
Expand All @@ -137,6 +137,11 @@ class Utils {
'url': urlZeroNetMob,
'btcAddress': urlZeroNetMob,
},
'Scribe': {
'description': strController.zeroblogSiteDesStr.value,
'url': urlBlog,
'btcAddress': btcUrlBlog,
},
'ZeroMe': {
'description': strController.zeromeSiteDesStr.value,
'url': urlMe,
Expand All @@ -147,21 +152,11 @@ class Utils {
'url': urlSites,
'btcAddress': btcUrlSites,
},
'ZeroBlog': {
'description': strController.zeroblogSiteDesStr.value,
'url': urlBlog,
'btcAddress': btcUrlBlog,
},
'ZeroMail': {
'description': strController.zeromailSiteDesStr.value,
'url': urlMail,
'btcAddress': btcUrlMail,
},
// 'ZeroTalk': {
// 'description': strController.zeroTalkSiteDesStr.value,
// 'url': urlTalk,
// 'btcAddress': btcUrlTalk,
// },
};

// 'ZeroName': '1Name2NXVi1RDPDgf5617UoW7xA6YrhM9F',
Expand Down
123 changes: 66 additions & 57 deletions lib/others/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,33 +118,35 @@ bindUnZipIsolate() {
bindUnZipIsolate();
return;
}
unZipIsolateBound = true;
_unZipPort.listen((data) {
String name = data[0];
int currentFile = data[1];
int totalFiles = data[2];
var percent = (currentFile / totalFiles) * 100;
if (percent.toInt() % 5 == 0) {
varStore.setLoadingStatus('${strController.installingStr.value} $name');
varStore.setLoadingPercent(percent.toInt());
}
if (percent == 100) {
percentUnZip = percentUnZip + 100;
}
var nooffiles = files(arch).length;
if (percentUnZip == nooffiles * 100) {
if (requiresPatching()) {
var patchFile = File(dataDir + '/$buildNumber.patched');
if (!patchFile.existsSync()) {
patchFile.createSync(recursive: true);
if (!unZipIsolateBound) {
unZipIsolateBound = true;
_unZipPort.listen((data) {
String name = data[0];
int currentFile = data[1];
int totalFiles = data[2];
var percent = (currentFile / totalFiles) * 100;
if (percent.toInt() % 5 == 0) {
varStore.setLoadingStatus('${strController.installingStr.value} $name');
varStore.setLoadingPercent(percent.toInt());
}
if (percent == 100) {
percentUnZip = percentUnZip + 100;
}
var nooffiles = files(arch).length;
if (percentUnZip == nooffiles * 100) {
if (requiresPatching()) {
var patchFile = File(dataDir + '/$buildNumber.patched');
if (!patchFile.existsSync()) {
patchFile.createSync(recursive: true);
}
}
printOut('Installation Completed', isNative: true);
makeExecHelper().then((value) => isExecPermitted = value);
uninstallModules();
check();
}
printOut('Installation Completed', isNative: true);
makeExecHelper().then((value) => isExecPermitted = value);
uninstallModules();
check();
}
});
});
}
}

void _unbindUnZipIsolate() {
Expand Down Expand Up @@ -286,14 +288,15 @@ unZipinBgWin() async {
File item = File(dataDir + sep + 'ZeroNet-win.zip');
var name = item.path.split(sep).last;
zeroNetState = state.INSTALLING;
await compute(
_unzipBytesAsyncWin,
UnzipParams(
name,
item.readAsBytesSync(),
dest: '',
),
);
if (item.existsSync())
await compute(
_unzipBytesAsyncWin,
UnzipParams(
name,
item.readAsBytesSync(),
dest: '',
),
);
check();
}

Expand All @@ -307,32 +310,38 @@ void _unzipBytesAsyncWin(UnzipParams params) async {
}
printOut("UnZippingFiles.......");
var out = dataDir + '/' + params.dest;
Archive archive = ZipDecoder().decodeBytes(params.bytes);
int totalfiles = archive.length;
int i = 0;
for (ArchiveFile file in archive) {
String filename = file.name;
printOut('$out$filename');
i++;
final SendPort send = IsolateNameServer.lookupPortByName(isolateUnZipPort);
send.send([params.item, i, totalfiles]);
String outName = '$out' + filename;
if (file.isFile) {
List<int> data = file.content;
// if (!File(outName).existsSync()) {
File f = File(outName);
if (!f.existsSync())
f
..createSync(recursive: true)
..writeAsBytesSync(data);
// }
} else {
Directory(outName).exists().then((exists) {
if (!exists) Directory(outName)..create(recursive: true);
});
try {
Archive archive = ZipDecoder().decodeBytes(params.bytes);
int totalfiles = archive.length;
int i = 0;
for (ArchiveFile file in archive) {
String filename = file.name;
printOut('$out$filename');
i++;
final SendPort send =
IsolateNameServer.lookupPortByName(isolateUnZipPort);
send.send([params.item, i, totalfiles]);
String outName = '$out' + filename;
if (file.isFile) {
List<int> data = file.content;
// if (!File(outName).existsSync()) {
File f = File(outName);
if (!f.existsSync())
f
..createSync(recursive: true)
..writeAsBytesSync(data);
// }
} else {
Directory(outName).exists().then((exists) {
if (!exists) Directory(outName)..create(recursive: true);
});
}
}
File(installedMetaDir(metaDir.path, params.item))
.createSync(recursive: true);
} catch (e) {
printOut(e.toString());
}
File(installedMetaDir(metaDir.path, params.item)).createSync(recursive: true);
}

void _unzipBytesAsync(UnzipParams params) async {
Expand Down
8 changes: 7 additions & 1 deletion lib/widgets/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class HomePage extends StatelessWidget {
padding: EdgeInsets.only(bottom: 30),
),
ZeroNetStatusWidget(),
if (PlatformExt.isDesktop) SizedBox(height: 8),
ZeroNetUserStatusWidget(),
Padding(
padding: EdgeInsets.only(bottom: 15),
Expand Down Expand Up @@ -334,7 +335,8 @@ class PopularZeroNetSites extends StatelessWidget {
bool isZite1Exists = isZiteExitsLocally(
Utils.initialSites[item1]['btcAddress'],
);
return isZite1Exists ? 0 : 1;
//TODO: Check if this breaks in mobile sorting
return !isZite1Exists ? 0 : 1;
});
}
for (var key in siteKeys) {
Expand Down Expand Up @@ -371,6 +373,10 @@ class PopularZeroNetSites extends StatelessWidget {
),
],
),
if (PlatformExt.isDesktop)
SizedBox(
height: 10,
),
ListView(
shrinkWrap: true,
children: zeroSites,
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class SettingsPage extends StatelessWidget {
child: Column(
children: <Widget>[
ZeroNetAppBar(),
if (PlatformExt.isDesktop) SizedBox(height: 8),
ListView.builder(
physics: BouncingScrollPhysics(),
shrinkWrap: true,
Expand Down

0 comments on commit 6da44b5

Please sign in to comment.