Skip to content

Commit c9d1602

Browse files
committed
v 0.8.2
- Updated to Latest ZeroNet Version. - Added Dark Theme. - Added Other Languages Support. - Bug Fixes and Improvements.
1 parent 400908c commit c9d1602

File tree

113 files changed

+4366
-2784
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+4366
-2784
lines changed

.gitmodules

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[submodule "android/common_python"]
2+
path = android/common_python
3+
url = https://github.com/canewsin/common_python.git
4+
[submodule "android/nativelibs_python"]
5+
path = android/nativelibs_python
6+
url = https://github.com/canewsin/nativelibs_python.git
7+
[submodule "android/arm_python"]
8+
path = android/arm_python
9+
url = https://github.com/canewsin/arm_python.git
10+
[submodule "android/arm64_python"]
11+
path = android/arm64_python
12+
url = https://github.com/canewsin/arm64_python.git
13+
[submodule "android/x86_64_python"]
14+
path = android/x86_64_python
15+
url = https://github.com/canewsin/x86_64_python.git
16+
[submodule "android/x86_python"]
17+
path = android/x86_python
18+
url = https://github.com/canewsin/x86_python.git

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ZeroNet Mobile
22
[![Codemagic build status](https://api.codemagic.io/apps/5f755f0647fecf7a4f25751a/5f75609747fecf958ea171b0/status_badge.svg)](https://codemagic.io/apps/5f755f0647fecf7a4f25751a/5f75609747fecf958ea171b0/latest_build)
33

4-
ZeroNet Mobile is an Android Client for [ZeroNet](https://zeronet.io), a platform for decentralized websites using Bitcoin crypto and the BitTorrent network. you can learn more about ZeroNet at https://zeronet.io/.
4+
ZeroNet Mobile is an Android Client for [ZeroNet](https://zeronet.dev), a platform for decentralized websites using Bitcoin crypto and the BitTorrent network. you can learn more about ZeroNet at https://zeronet.dev/.
55

66
[<img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png"
77
alt="Download from Google Play"
@@ -56,7 +56,7 @@ flutter run
5656
## Donate
5757
BTC(Preferred) :
5858

59-
`35NgjpB3pzkdHkAPrNh2EMERGxnXgwCb6G`
59+
`1ZeroNetyV5mKY9JF1gsm82TuBXHpfdLX`
6060

6161
ETH :
6262

android/app/build.gradle

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (localPropertiesFile.exists()) {
77
}
88

99
def versionProperties = new Properties()
10-
def versionPropertiesFile = rootProject.file('version.properties')
10+
def versionPropertiesFile = rootProject.file('../version.properties')
1111
if (versionPropertiesFile.exists()) {
1212
versionPropertiesFile.withReader('UTF-8') { reader ->
1313
versionProperties.load(reader)
@@ -39,7 +39,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
3939
apply plugin: 'com.jeppeman.locallydynamic'
4040

4141
android {
42-
compileSdkVersion 29
42+
compileSdkVersion 31
4343

4444
sourceSets {
4545
main.java.srcDirs += 'src/main/kotlin'
@@ -52,11 +52,16 @@ android {
5252
defaultConfig {
5353
applicationId "in.canews.zeronetmobile"
5454
minSdkVersion 21
55-
targetSdkVersion 29
55+
targetSdkVersion 31
5656
versionCode flutterVersionCode.toInteger()
5757
versionName flutterVersionName
5858
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
5959
}
60+
61+
compileOptions {
62+
sourceCompatibility JavaVersion.VERSION_11
63+
targetCompatibility JavaVersion.VERSION_11
64+
}
6065

6166
signingConfigs {
6267
release {
@@ -71,19 +76,24 @@ android {
7176

7277
release {
7378
signingConfig signingConfigs.release
79+
minifyEnabled = false
80+
shrinkResources = false
7481
}
7582

7683
debug {
7784
applicationIdSuffix '.debug'
7885
signingConfig signingConfigs.release
7986
locallyDynamic {
80-
enabled = true
87+
enabled = false
8188
throttleDownloadBy = 1000
8289
}
8390
defaultConfig.ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86_64'
8491
}
8592
}
86-
dynamicFeatures = [":arm64", ":arm", ":common", ":x86", ":x86_64"]
93+
dynamicFeatures = [":arm64", ":arm", ":common", ":x86", ":x86_64",
94+
":arm64_python", ":arm_python", ":common_python", ":x86_python", ":x86_64_python",
95+
":arm64_tor", ":arm_tor", ":x86_tor", ":x86_64_tor"
96+
]
8797

8898

8999
}
@@ -93,19 +103,25 @@ flutter {
93103
}
94104

95105
dependencies {
96-
def billing_version = "3.0.0"
97-
implementation "com.android.billingclient:billing:$billing_version"
106+
// def billing_version = '4.0.0'
107+
// implementation "com.android.billingclient:billing:$billing_version"
108+
109+
def work_version = "2.7.0"
110+
// Force WorkManager 2.6.0 for transitive dependency
111+
implementation("androidx.work:work-runtime-ktx:$work_version") {
112+
force = true
113+
}
98114

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

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

105121
debugImplementation 'com.jeppeman.locallydynamic:locallydynamic-debug:0.3'
106122
releaseImplementation 'com.jeppeman.locallydynamic:locallydynamic:0.3'
107123

108-
testImplementation 'junit:junit:4.12'
109-
androidTestImplementation 'androidx.test:runner:1.2.0'
110-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
124+
// testImplementation 'junit:junit:4.12'
125+
// androidTestImplementation 'androidx.test:runner:1.2.0'
126+
// androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
111127
}

android/app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
1313
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
1414
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
15+
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove"/>
1516

16-
<!-- android:name=".MyApplication"-->
1717
<application
1818
android:name=".MyApplication"
1919
android:label="ZeroNet"
@@ -23,12 +23,12 @@
2323
tools:ignore="GoogleAppIndexingWarning">
2424
<activity
2525
android:name=".MainActivity"
26+
android:exported="true"
2627
android:launchMode="singleTop"
2728
android:theme="@style/LaunchTheme"
2829
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
2930
android:hardwareAccelerated="true"
30-
android:windowSoftInputMode="adjustResize"
31-
android:requestLegacyExternalStorage="true">
31+
android:windowSoftInputMode="adjustResize">
3232
<intent-filter>
3333
<action android:name="android.intent.action.MAIN"/>
3434
<category android:name="android.intent.category.LAUNCHER"/>
@@ -39,7 +39,9 @@
3939
<meta-data
4040
android:name="flutterEmbedding"
4141
android:value="2" />
42-
<receiver android:name="com.dexterous.flutterlocalnotifications.NotificationActionReceiver" />
42+
<receiver
43+
android:name="com.dexterous.flutterlocalnotifications.NotificationActionReceiver"
44+
android:exported="false" />
4345
<provider
4446
android:name="androidx.core.content.FileProvider"
4547
android:grantUriPermissions="true"

android/app/src/main/kotlin/in/canews/zeronetmobile/MainActivity.kt

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ class MainActivity : FlutterActivity() {
5656
override fun onCreate(savedInstanceState: Bundle?) {
5757
super.onCreate(savedInstanceState)
5858
if(intent.getStringExtra("LAUNCH_SHORTCUT_URL") != null) {
59-
mLaunchShortcutUrl = intent.getStringExtra("LAUNCH_SHORTCUT_URL")
59+
mLaunchShortcutUrl = intent.getStringExtra("LAUNCH_SHORTCUT_URL")!!
6060
}
6161
}
6262

6363
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
6464
GeneratedPluginRegistrant.registerWith(flutterEngine)
65-
MethodChannel(flutterEngine?.dartExecutor, CHANNEL).setMethodCallHandler { call, result ->
65+
MethodChannel(flutterEngine.dartExecutor, CHANNEL).setMethodCallHandler { call, result ->
6666
when (call.method) {
6767
"addToHomeScreen" -> addShortcutToHomeScreen(context, result,
6868
call.argument("title"),call.argument("url"),
@@ -237,7 +237,7 @@ class MainActivity : FlutterActivity() {
237237
success(msg)
238238
}.onFailure {
239239
if (it is IllegalStateException) {
240-
Log.e("MainActivity>resultSuc>", it.message)
240+
Log.e("MainActivity>resultSuc>", it.message!!)
241241
}
242242
}
243243
}
@@ -305,6 +305,7 @@ class MainActivity : FlutterActivity() {
305305
tempFile.createNewFile()
306306
inputStream?.toFile(tempFilePath)
307307
resultT?.success(File(tempFilePath).absoluteFile.absolutePath)
308+
Log.e("copyFileToTempPath: ", filename + " copied to " + tempFilePath)
308309
tempFile.deleteOnExit()
309310
}
310311
}
@@ -328,6 +329,9 @@ class MainActivity : FlutterActivity() {
328329
.intent
329330
shareIntent.data = contentUri
330331
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
332+
shareIntent.putExtra(Intent.EXTRA_TEXT,"Save this file to a Safe place.")
333+
shareIntent.action = Intent.ACTION_SEND
334+
shareIntent.putExtra(Intent.EXTRA_STREAM, contentUri)
331335
shareIntent.putExtra("finishActivityOnSaveCompleted", true)
332336
context.startActivityForResult(Intent.createChooser(
333337
shareIntent, "Backup Users.json File"), SAVE_USERJSON_FILE)
@@ -338,18 +342,22 @@ class MainActivity : FlutterActivity() {
338342
getArchName()
339343
try {
340344
if (splitInstallManager?.installedModules!!.contains("common")) {
341-
val list = listOf("zeronet_py3.zip", "site_packages_common.zip")
342-
for (item in list) {
343-
getAssetFiles(item)
344-
}
345+
getAssetFiles("zeronet_py3.zip")
346+
}
347+
if (archName != "arm64" && splitInstallManager?.installedModules!!.contains("common_python")) {
348+
getAssetFiles("site_packages_common.zip")
345349
}
346350
if (splitInstallManager?.installedModules!!.contains(archName)) {
347-
val list = listOf("python38_$archName.zip", "site_packages_$archName.zip", "tor_$archName.zip")
348-
for (item in list) {
349-
getAssetFiles(item)
350-
}
351+
getAssetFiles("site_packages_$archName.zip")
352+
}
353+
if (splitInstallManager?.installedModules!!.contains(archName + "_python")) {
354+
getAssetFiles("python38_$archName.zip")
355+
}
356+
if (splitInstallManager?.installedModules!!.contains(archName + "_tor")) {
357+
getAssetFiles("tor_$archName.zip")
351358
}
352359
} catch (e: IOException) {
360+
Log.e("copyAssetsToCache", e.toString())
353361
return false
354362
}
355363
return true
@@ -358,16 +366,16 @@ class MainActivity : FlutterActivity() {
358366
private fun getAssetFiles(fileName: String) {
359367
val assetManager = createPackageContext(packageName, 0).assets
360368
val assistContent = assetManager.open(fileName)
369+
Log.e("getAssetFiles: ", fileName)
361370
copyFileToTempPath(inputStreamA = assistContent, filename = fileName, path = null)
362371
}
363372

364373
private fun isModuleInstallSupported(): Boolean =
365-
Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
366-
&& isGooglePlayServicesAvailable(this)
374+
Build.VERSION.SDK_INT <= 30 && isGooglePlayServicesAvailable(this)
367375

368376
private fun isGooglePlayServicesAvailable(activity: Activity?): Boolean {
369377
val googleApiAvailability: GoogleApiAvailability = GoogleApiAvailability.getInstance()
370-
val status: Int = googleApiAvailability.isGooglePlayServicesAvailable(activity)
378+
val status: Int = googleApiAvailability.isGooglePlayServicesAvailable(applicationContext)
371379
if (status != ConnectionResult.SUCCESS) {
372380
// if (googleApiAvailability.isUserResolvableError(status)) {
373381
// googleApiAvailability.getErrorDialog(activity, status, 2404).show()
@@ -402,10 +410,15 @@ class MainActivity : FlutterActivity() {
402410
private fun loadAndLaunchModule(name: String, eventSink: EventChannel.EventSink?) {
403411
if (isModuleInstalled(name) == true)
404412
return
405-
val request = SplitInstallRequest.newBuilder()
413+
val builder = SplitInstallRequest.newBuilder()
406414
.addModule("common")
407415
.addModule(name)
408-
.build()
416+
.addModule(name + "_python")
417+
.addModule(name + "_tor")
418+
if (name != "arm64") {
419+
builder.addModule("common_python")
420+
}
421+
val request = builder.build();
409422
splitInstallManager?.startInstall(request)?.addOnSuccessListener { sessionId ->
410423
mSessionId = sessionId
411424
}
@@ -442,7 +455,10 @@ class MainActivity : FlutterActivity() {
442455
splitInstallManager?.installedModules?.contains(name)
443456

444457
private fun isRequiredModulesInstalled(): Boolean = isModuleInstalled("common") == true &&
445-
isModuleInstalled(archName) == true
458+
((archName == "arm64") || isModuleInstalled("common_python") == true)&&
459+
isModuleInstalled(archName) == true &&
460+
isModuleInstalled(archName + "_python") == true &&
461+
isModuleInstalled(archName + "_tor") == true
446462

447463
private fun uninstallModules() {
448464
val installedModules = splitInstallManager?.installedModules?.toList()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<paths>
22
<cache-path name="cache" path="/" />
3-
<files-path name="files" path="/" />
3+
<files-path name="files" path="ZeroNet-py3/data/" />
44
<external-files-path name="data" path="/" />
55
</paths>
File renamed without changes.

android/arm/build.gradle

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
apply plugin: 'com.android.dynamic-feature'
22

33
android {
4-
compileSdkVersion 29
4+
compileSdkVersion 31
55

66

77
defaultConfig {
88
minSdkVersion 21
9-
targetSdkVersion 29
10-
versionCode 1
11-
versionName "1.0"
129

1310
}
1411

1512
compileOptions {
16-
sourceCompatibility 1.8
17-
targetCompatibility 1.8
13+
sourceCompatibility JavaVersion.VERSION_11
14+
targetCompatibility JavaVersion.VERSION_11
1815
}
1916

2017
}

android/arm/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
xmlns:dist="http://schemas.android.com/apk/distribution"
33
package="in.canews.zeronetmobile.arm">
44

5+
<application
6+
android:hasCode="false"/>
7+
58
<dist:module
69
dist:instant="false"
710
dist:title="@string/title_arm">
-21.3 MB
Binary file not shown.

android/arm64/build.gradle

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
apply plugin: 'com.android.dynamic-feature'
22

33
android {
4-
compileSdkVersion 29
4+
compileSdkVersion 31
55

66

77
defaultConfig {
88
minSdkVersion 21
9-
targetSdkVersion 29
10-
versionCode 1
11-
versionName "1.0"
129

1310
}
1411

1512
compileOptions {
16-
sourceCompatibility 1.8
17-
targetCompatibility 1.8
13+
sourceCompatibility JavaVersion.VERSION_11
14+
targetCompatibility JavaVersion.VERSION_11
1815
}
1916

2017
}

android/arm64/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
xmlns:dist="http://schemas.android.com/apk/distribution"
33
package="in.canews.zeronetmobile.arm64">
44

5+
<application
6+
android:hasCode="false"/>
7+
58
<dist:module
69
dist:instant="false"
710
dist:title="@string/title_arm64">
-21.4 MB
Binary file not shown.
Binary file not shown.

android/arm64_tor/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

android/arm64_tor/build.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apply plugin: 'com.android.dynamic-feature'
2+
3+
android {
4+
compileSdkVersion 31
5+
6+
7+
defaultConfig {
8+
minSdkVersion 21
9+
10+
}
11+
12+
compileOptions {
13+
sourceCompatibility JavaVersion.VERSION_11
14+
targetCompatibility JavaVersion.VERSION_11
15+
}
16+
17+
}
18+
19+
dependencies {
20+
implementation fileTree(dir: 'libs', include: ['*.jar'])
21+
implementation project(':app')
22+
}

0 commit comments

Comments
 (0)