mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
build(android): add fdroid distribution flavor
This commit is contained in:
@@ -1,5 +1,30 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
import groovy.json.JsonSlurper
|
||||
|
||||
def resolvePackageVersionName() {
|
||||
def packageJsonFile = file("../../package.json")
|
||||
if (!packageJsonFile.exists()) {
|
||||
return "1.0"
|
||||
}
|
||||
|
||||
return new JsonSlurper().parse(packageJsonFile).version.toString()
|
||||
}
|
||||
|
||||
def versionNameToCode(String versionName) {
|
||||
def stableVersion = versionName.replaceFirst(/^v/, "").split("-")[0]
|
||||
def parts = stableVersion.tokenize(".").collect { part -> part.isInteger() ? part.toInteger() : 0 }
|
||||
|
||||
while (parts.size() < 3) {
|
||||
parts.add(0)
|
||||
}
|
||||
|
||||
return (parts[0] * 10000) + (parts[1] * 100) + parts[2]
|
||||
}
|
||||
|
||||
def resolvedVersionName = "${project.findProperty("APP_VERSION_NAME") ?: resolvePackageVersionName()}"
|
||||
def resolvedVersionCode = Integer.parseInt("${project.findProperty("APP_VERSION_CODE") ?: versionNameToCode(resolvedVersionName)}")
|
||||
|
||||
android {
|
||||
namespace "fivechan.android"
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
@@ -7,8 +32,8 @@ android {
|
||||
applicationId "fivechan.android"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode Integer.parseInt(project.findProperty("APP_VERSION_CODE") ?: "1")
|
||||
versionName "${project.findProperty("APP_VERSION_NAME") ?: "1.0"}"
|
||||
versionCode resolvedVersionCode
|
||||
versionName resolvedVersionName
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
aaptOptions {
|
||||
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
||||
@@ -16,6 +41,15 @@ android {
|
||||
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
|
||||
}
|
||||
}
|
||||
flavorDimensions "distribution"
|
||||
productFlavors {
|
||||
github {
|
||||
dimension "distribution"
|
||||
}
|
||||
fdroid {
|
||||
dimension "distribution"
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package fivechan.android;
|
||||
|
||||
import android.os.Bundle;
|
||||
import com.capacitorjs.plugins.statusbar.StatusBarPlugin;
|
||||
import com.getcapacitor.BridgeActivity;
|
||||
|
||||
public class MainActivity extends BridgeActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
// Custom plugins must be registered before bridge initialization.
|
||||
registerPlugin(FileUploaderPlugin.class);
|
||||
registerPlugin(StatusBarPlugin.class);
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
</manifest>
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
package fivechan.android;
|
||||
|
||||
import android.os.Bundle;
|
||||
import com.getcapacitor.BridgeActivity;
|
||||
import com.capacitorjs.plugins.statusbar.StatusBarPlugin;
|
||||
import com.getcapacitor.BridgeActivity;
|
||||
|
||||
public class MainActivity extends BridgeActivity {
|
||||
@Override
|
||||
@@ -2,7 +2,6 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
||||
Reference in New Issue
Block a user