Skip to content

Commit

Permalink
v 0.8.2
Browse files Browse the repository at this point in the history
  - Updated to Latest ZeroNet Version.
  - Added Dark Theme.
  - Added Other Languages Support.
  - Bug Fixes and Improvements.
  • Loading branch information
canewsin committed Dec 5, 2021
1 parent 400908c commit c9d1602
Show file tree
Hide file tree
Showing 113 changed files with 4,366 additions and 2,784 deletions.
18 changes: 18 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[submodule "android/common_python"]
path = android/common_python
url = https://github.com/canewsin/common_python.git
[submodule "android/nativelibs_python"]
path = android/nativelibs_python
url = https://github.com/canewsin/nativelibs_python.git
[submodule "android/arm_python"]
path = android/arm_python
url = https://github.com/canewsin/arm_python.git
[submodule "android/arm64_python"]
path = android/arm64_python
url = https://github.com/canewsin/arm64_python.git
[submodule "android/x86_64_python"]
path = android/x86_64_python
url = https://github.com/canewsin/x86_64_python.git
[submodule "android/x86_python"]
path = android/x86_python
url = https://github.com/canewsin/x86_python.git
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ZeroNet Mobile
[![Codemagic build status](https://api.codemagic.io/apps/5f755f0647fecf7a4f25751a/5f75609747fecf958ea171b0/status_badge.svg)](https://codemagic.io/apps/5f755f0647fecf7a4f25751a/5f75609747fecf958ea171b0/latest_build)

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/.
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/.

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

`35NgjpB3pzkdHkAPrNh2EMERGxnXgwCb6G`
`1ZeroNetyV5mKY9JF1gsm82TuBXHpfdLX`

ETH :

Expand Down
38 changes: 27 additions & 11 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if (localPropertiesFile.exists()) {
}

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

android {
compileSdkVersion 29
compileSdkVersion 31

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -52,11 +52,16 @@ android {
defaultConfig {
applicationId "in.canews.zeronetmobile"
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

signingConfigs {
release {
Expand All @@ -71,19 +76,24 @@ android {

release {
signingConfig signingConfigs.release
minifyEnabled = false
shrinkResources = false
}

debug {
applicationIdSuffix '.debug'
signingConfig signingConfigs.release
locallyDynamic {
enabled = true
enabled = false
throttleDownloadBy = 1000
}
defaultConfig.ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86_64'
}
}
dynamicFeatures = [":arm64", ":arm", ":common", ":x86", ":x86_64"]
dynamicFeatures = [":arm64", ":arm", ":common", ":x86", ":x86_64",
":arm64_python", ":arm_python", ":common_python", ":x86_python", ":x86_64_python",
":arm64_tor", ":arm_tor", ":x86_tor", ":x86_64_tor"
]


}
Expand All @@ -93,19 +103,25 @@ flutter {
}

dependencies {
def billing_version = "3.0.0"
implementation "com.android.billingclient:billing:$billing_version"
// def billing_version = '4.0.0'
// implementation "com.android.billingclient:billing:$billing_version"

def work_version = "2.7.0"
// Force WorkManager 2.6.0 for transitive dependency
implementation("androidx.work:work-runtime-ktx:$work_version") {
force = true
}

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'
}
10 changes: 6 additions & 4 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove"/>

<!-- android:name=".MyApplication"-->
<application
android:name=".MyApplication"
android:label="ZeroNet"
Expand All @@ -23,12 +23,12 @@
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:requestLegacyExternalStorage="true">
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand All @@ -39,7 +39,9 @@
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<receiver android:name="com.dexterous.flutterlocalnotifications.NotificationActionReceiver" />
<receiver
android:name="com.dexterous.flutterlocalnotifications.NotificationActionReceiver"
android:exported="false" />
<provider
android:name="androidx.core.content.FileProvider"
android:grantUriPermissions="true"
Expand Down
50 changes: 33 additions & 17 deletions android/app/src/main/kotlin/in/canews/zeronetmobile/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ 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")!!
}
}

override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
MethodChannel(flutterEngine?.dartExecutor, CHANNEL).setMethodCallHandler { call, result ->
MethodChannel(flutterEngine.dartExecutor, CHANNEL).setMethodCallHandler { call, result ->
when (call.method) {
"addToHomeScreen" -> addShortcutToHomeScreen(context, result,
call.argument("title"),call.argument("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 @@ -305,6 +305,7 @@ class MainActivity : FlutterActivity() {
tempFile.createNewFile()
inputStream?.toFile(tempFilePath)
resultT?.success(File(tempFilePath).absoluteFile.absolutePath)
Log.e("copyFileToTempPath: ", filename + " copied to " + tempFilePath)
tempFile.deleteOnExit()
}
}
Expand All @@ -328,6 +329,9 @@ class MainActivity : FlutterActivity() {
.intent
shareIntent.data = contentUri
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
shareIntent.putExtra(Intent.EXTRA_TEXT,"Save this file to a Safe place.")
shareIntent.action = Intent.ACTION_SEND
shareIntent.putExtra(Intent.EXTRA_STREAM, contentUri)
shareIntent.putExtra("finishActivityOnSaveCompleted", true)
context.startActivityForResult(Intent.createChooser(
shareIntent, "Backup Users.json File"), SAVE_USERJSON_FILE)
Expand All @@ -338,18 +342,22 @@ class MainActivity : FlutterActivity() {
getArchName()
try {
if (splitInstallManager?.installedModules!!.contains("common")) {
val list = listOf("zeronet_py3.zip", "site_packages_common.zip")
for (item in list) {
getAssetFiles(item)
}
getAssetFiles("zeronet_py3.zip")
}
if (archName != "arm64" && splitInstallManager?.installedModules!!.contains("common_python")) {
getAssetFiles("site_packages_common.zip")
}
if (splitInstallManager?.installedModules!!.contains(archName)) {
val list = listOf("python38_$archName.zip", "site_packages_$archName.zip", "tor_$archName.zip")
for (item in list) {
getAssetFiles(item)
}
getAssetFiles("site_packages_$archName.zip")
}
if (splitInstallManager?.installedModules!!.contains(archName + "_python")) {
getAssetFiles("python38_$archName.zip")
}
if (splitInstallManager?.installedModules!!.contains(archName + "_tor")) {
getAssetFiles("tor_$archName.zip")
}
} catch (e: IOException) {
Log.e("copyAssetsToCache", e.toString())
return false
}
return true
Expand All @@ -358,16 +366,16 @@ class MainActivity : FlutterActivity() {
private fun getAssetFiles(fileName: String) {
val assetManager = createPackageContext(packageName, 0).assets
val assistContent = assetManager.open(fileName)
Log.e("getAssetFiles: ", fileName)
copyFileToTempPath(inputStreamA = assistContent, filename = fileName, path = null)
}

private fun isModuleInstallSupported(): Boolean =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
&& isGooglePlayServicesAvailable(this)
Build.VERSION.SDK_INT <= 30 && isGooglePlayServicesAvailable(this)

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 Expand Up @@ -402,10 +410,15 @@ class MainActivity : FlutterActivity() {
private fun loadAndLaunchModule(name: String, eventSink: EventChannel.EventSink?) {
if (isModuleInstalled(name) == true)
return
val request = SplitInstallRequest.newBuilder()
val builder = SplitInstallRequest.newBuilder()
.addModule("common")
.addModule(name)
.build()
.addModule(name + "_python")
.addModule(name + "_tor")
if (name != "arm64") {
builder.addModule("common_python")
}
val request = builder.build();
splitInstallManager?.startInstall(request)?.addOnSuccessListener { sessionId ->
mSessionId = sessionId
}
Expand Down Expand Up @@ -442,7 +455,10 @@ class MainActivity : FlutterActivity() {
splitInstallManager?.installedModules?.contains(name)

private fun isRequiredModulesInstalled(): Boolean = isModuleInstalled("common") == true &&
isModuleInstalled(archName) == true
((archName == "arm64") || isModuleInstalled("common_python") == true)&&
isModuleInstalled(archName) == true &&
isModuleInstalled(archName + "_python") == true &&
isModuleInstalled(archName + "_tor") == true

private fun uninstallModules() {
val installedModules = splitInstallManager?.installedModules?.toList()
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/xml/file_provider_paths.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<paths>
<cache-path name="cache" path="/" />
<files-path name="files" path="/" />
<files-path name="files" path="ZeroNet-py3/data/" />
<external-files-path name="data" path="/" />
</paths>
File renamed without changes.
9 changes: 3 additions & 6 deletions android/arm/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
apply plugin: 'com.android.dynamic-feature'

android {
compileSdkVersion 29
compileSdkVersion 31


defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"

}

compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

}
Expand Down
3 changes: 3 additions & 0 deletions android/arm/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
xmlns:dist="http://schemas.android.com/apk/distribution"
package="in.canews.zeronetmobile.arm">

<application
android:hasCode="false"/>

<dist:module
dist:instant="false"
dist:title="@string/title_arm">
Expand Down
Binary file removed android/arm/src/main/assets/python38_arm.zip
Binary file not shown.
9 changes: 3 additions & 6 deletions android/arm64/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
apply plugin: 'com.android.dynamic-feature'

android {
compileSdkVersion 29
compileSdkVersion 31


defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"

}

compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

}
Expand Down
3 changes: 3 additions & 0 deletions android/arm64/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
xmlns:dist="http://schemas.android.com/apk/distribution"
package="in.canews.zeronetmobile.arm64">

<application
android:hasCode="false"/>

<dist:module
dist:instant="false"
dist:title="@string/title_arm64">
Expand Down
Binary file removed android/arm64/src/main/assets/python38_arm64.zip
Binary file not shown.
Binary file modified android/arm64/src/main/assets/site_packages_arm64.zip
Binary file not shown.
1 change: 1 addition & 0 deletions android/arm64_tor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
22 changes: 22 additions & 0 deletions android/arm64_tor/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apply plugin: 'com.android.dynamic-feature'

android {
compileSdkVersion 31


defaultConfig {
minSdkVersion 21

}

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':app')
}
Loading

0 comments on commit c9d1602

Please sign in to comment.