Skip to content

Commit

Permalink
v 0.8.1 - beta 3
Browse files Browse the repository at this point in the history
  • Loading branch information
canewsin committed Aug 2, 2021
1 parent efc2be7 commit 6b1810d
Show file tree
Hide file tree
Showing 16 changed files with 432 additions and 341 deletions.
8 changes: 4 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ dependencies {
implementation "com.android.billingclient:billing:$billing_version"

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.gms:play-services-base:17.2.0'
implementation 'com.google.android.gms:play-services-base:17.6.0'

//Duplicate Classes Issue https://stackoverflow.com/a/60492942
implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'

debugImplementation 'com.jeppeman.locallydynamic:locallydynamic-debug:0.3'
releaseImplementation 'com.jeppeman.locallydynamic:locallydynamic:0.3'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// testImplementation 'junit:junit:4.12'
// androidTestImplementation 'androidx.test:runner:1.2.0'
// androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class MainActivity : FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if(intent.getStringExtra("LAUNCH_SHORTCUT_URL") != null) {
mLaunchShortcutUrl = intent.getStringExtra("LAUNCH_SHORTCUT_URL")
mLaunchShortcutUrl = intent.getStringExtra("LAUNCH_SHORTCUT_URL")!!
}
}

Expand Down Expand Up @@ -237,7 +237,7 @@ class MainActivity : FlutterActivity() {
success(msg)
}.onFailure {
if (it is IllegalStateException) {
Log.e("MainActivity>resultSuc>", it.message)
Log.e("MainActivity>resultSuc>", it.message!!)
}
}
}
Expand Down Expand Up @@ -370,7 +370,7 @@ class MainActivity : FlutterActivity() {

private fun isGooglePlayServicesAvailable(activity: Activity?): Boolean {
val googleApiAvailability: GoogleApiAvailability = GoogleApiAvailability.getInstance()
val status: Int = googleApiAvailability.isGooglePlayServicesAvailable(activity)
val status: Int = googleApiAvailability.isGooglePlayServicesAvailable(applicationContext)
if (status != ConnectionResult.SUCCESS) {
// if (googleApiAvailability.isUserResolvableError(status)) {
// googleApiAvailability.getErrorDialog(activity, status, 2404).show()
Expand Down
Binary file modified android/arm64/src/main/assets/site_packages_arm64.zip
Binary file not shown.
4 changes: 1 addition & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
buildscript {
ext.kotlin_version = '1.3.61'
ext.kotlin_version = '1.5.21'
ext.gradle_version = '4.2.0'
repositories {
google()
jcenter()
maven {
url "https://plugins.gradle.org/m2"
}
Expand All @@ -19,7 +18,6 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
}
}

Expand Down
32 changes: 32 additions & 0 deletions lib/core/content/content_db.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
class ContentDb {
bool foreignKeys = false;
Map schema = {};

ContentDb(String path) {
// Db({"db_name": "ContentDb", "tables": {}}, path);
foreignKeys = true;
}

getSchema() {
Map scehma = {};
scehma['db_name'] = 'ContentDb';
schema["version"] = 3;
schema["tables"] = {};
}
}

Map content_db = {};

getContentDb({String path}) {
if (path == null) {
path = "../content.db";
}

var result = content_db.keys.where((element) => path == element).toList();

if (result.isEmpty) {
content_db[path] = ContentDb(path);
content_db[path].init();
return content_db[path];
}
}
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class MyApp extends StatelessWidget {
makeExecHelper().then(
(value) => isExecPermitted = value,
);
if (zeroNetNativeDir.isNotEmpty) saveDataFile();
// createTorDataDir();
firstTime = false;
}
Expand Down
8 changes: 7 additions & 1 deletion lib/models/enums.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:zeronet/others/zeronet_isolate.dart';

import '../imports.dart';

enum ZeroNetStatus {
Expand Down Expand Up @@ -52,7 +54,11 @@ extension ZeroNetStatusExt on ZeroNetStatus {
void onAction() {
switch (this) {
case ZeroNetStatus.NOT_RUNNING:
runZeroNetService(autoStart: true);
printOut('onAction()');
printOut('ZeroNetStatus.NOT_RUNNING');
var autoStart =
(varStore.settings[autoStartZeroNet] as ToggleSetting).value;
runZeroNetService(autoStart: autoStart);
break;
case ZeroNetStatus.RUNNING:
case ZeroNetStatus.RUNNING_WITH_TOR:
Expand Down
7 changes: 3 additions & 4 deletions lib/others/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:get/get.dart';
import 'package:purchases_flutter/purchases_flutter.dart';

import '../imports.dart';
import 'zeronet_isolate.dart';

Directory appPrivDir;
Directory tempDir;
Expand Down Expand Up @@ -93,9 +94,7 @@ init() async {
varStore.isZeroNetInstalled(isZeroNetInstalledm);
checkForAppUpdates();
if (enableZeroNetAddTrackers) await downloadTrackerFiles();
runZeroNetService(
autoStart: (varStore.settings[autoStartZeroNet] as ToggleSetting).value,
);
ZeroNetStatus.NOT_RUNNING.onAction();
}
if (!tempDir.existsSync()) tempDir.createSync(recursive: true);
Purchases.setup("ShCpAJsKdJrAAQawcMQSswqTyPWFMwXb");
Expand Down Expand Up @@ -158,7 +157,7 @@ saveDataFile() {
loadDataFile() {
File f = File(dataDir + '/data.json');
Map m = json.decode(f.readAsStringSync());
print(m);
printOut(m);
zeroNetNativeDir = m['zeroNetNativeDir'];
}

Expand Down
37 changes: 30 additions & 7 deletions lib/others/donation_const.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,34 @@ import 'package:purchases_flutter/purchases_flutter.dart';

import '../imports.dart';

const Map<String, String> donationsAddressMap = {
"BTC(Preferred)": "1eVStCWqLM7hFB1enaoGzAt7T3tsAB41z",
"ETH": "0xa81a32dcce8e5bcb9792daa19ae7f964699ee536",
"UPI(Indian Users)": "pramukesh@upi",
"Liberapay": "https://liberapay.com/canews.in/donate",
var enableExternalDonations = false;
var btcAddress = '1eVStCWqLM7hFB1enaoGzAt7T3tsAB41z';
var ethAddress = '0xa81a32dcce8e5bcb9792daa19ae7f964699ee536';
var upiAddress = 'pramukesh@upi';
var liberaPayAddress = 'https://liberapay.com/canews.in/donate';

void getDonationSettings() {
var dir = Utils.urlZeroNetMob.zeroNetDataPath;
if (Directory(dir).existsSync()) {
var file = File(dir + '/native.decent');
if (file.existsSync()) {
var decode = json.decode(file.readAsStringSync());
var settingsMap = (decode as Map<String, dynamic>)['settings'];
var donations = settingsMap['donations'];
enableExternalDonations = donations['enableExternalDonations'];
btcAddress = donations['btcAddress'];
ethAddress = donations['ethAddress'];
upiAddress = donations['upiAddress'];
liberaPayAddress = donations['liberapayAddress'];
}
}
}

Map<String, String> donationsAddressMap = {
"BTC(Preferred)": btcAddress,
"ETH": ethAddress,
"UPI(Indian Users)": upiAddress,
"Liberapay": liberaPayAddress,
};

const Set<String> kGooglePlayPurchaseOneTimeIds = {
Expand Down Expand Up @@ -64,7 +87,7 @@ void purchasePackage(Package package) async {
if (isPro) {
// Unlock that great "pro" content
}
print(purchaserInfo);
printOut(purchaserInfo);
} on PlatformException catch (e) {
var errorCode = PurchasesErrorHelper.getErrorCode(e);
if (errorCode != PurchasesErrorCode.purchaseCancelledError) {
Expand Down Expand Up @@ -111,7 +134,7 @@ void listenToPurchaseUpdated(List<PurchaseDetails> purchaseDetailsList) {
}

_verifyPurchase(PurchaseDetails purchaseDetails) {
print(purchaseDetails.verificationData.localVerificationData);
printOut(purchaseDetails.verificationData.localVerificationData);
return Future<bool>.value(true);
}

Expand Down
2 changes: 2 additions & 0 deletions lib/others/extensions.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:io';
import 'package:zeronet/imports.dart';

extension FileSystemExtension on FileSystemEntity {
String get name => this.path.replaceFirst(this.parent.path + '/', '');
Expand All @@ -9,6 +10,7 @@ extension CapExtension on String {
String get allInCaps => this.toUpperCase();
String get capitalizeFirstofEach =>
this.split(" ").map((str) => str.inCaps).join(" ");
String get zeroNetDataPath => getZeroNetDataDir().path + '/' + this + '/';
}

extension DynamicExt on dynamic {
Expand Down
2 changes: 1 addition & 1 deletion lib/others/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import '../imports.dart';
debugTime(Function func) {
var start = DateTime.now();
func();
print(DateTime.now().difference(start).inMilliseconds);
printOut(DateTime.now().difference(start).inMilliseconds);
}

printOut(Object object, {int lineBreaks = 0, bool isNative = false}) {
Expand Down
Loading

0 comments on commit 6b1810d

Please sign in to comment.