Skip to content

Commit

Permalink
Add reset button to settings dialog (#32)
Browse files Browse the repository at this point in the history
* Add reset button to settings dialog

* Fix default value

* update gradle version

* update docker image

* fix lint issues
  • Loading branch information
EwuUwe authored Feb 22, 2025
1 parent 70d79d7 commit a037cf9
Show file tree
Hide file tree
Showing 19 changed files with 348 additions and 379 deletions.
60 changes: 11 additions & 49 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
/* calculated from git commits to give sequential integers */

def getGitVersion() {
def process = "git rev-list --count HEAD".execute()
def text = process.text
if (text == "") {
println('git executeable might be unavailable!')
return -1
} else {
return text.toInteger()
}
plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}

def googleVer = getGitVersion()


def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -22,32 +13,13 @@ if (localPropertiesFile.exists()) {
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}


apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
namespace "com.iyox.wormhole"
compileSdkVersion flutter.compileSdkVersion
Expand All @@ -66,23 +38,17 @@ android {
}

kotlinOptions {
jvmTarget = '1.8'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
jvmTarget = JavaVersion.VERSION_1_8
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.iyox.wormhole"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 21
//targetSdkVersion flutter.targetSdkVersion
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}

signingConfigs {
Expand All @@ -107,18 +73,14 @@ flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

[
Debug : null,
Profile: '--release',
Release: '--release'
].each {
def taskPostfix = it.key
def profileMode = it.value
tasks.whenTaskAdded { task ->
tasks.configureEach { task ->
if (task.name == "javaPreCompile$taskPostfix") {
task.dependsOn "cargoBuild$taskPostfix"
}
Expand Down
21 changes: 0 additions & 21 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
buildscript {
ext.kotlin_version = '1.8.21'
if(project.hasProperty("nixMavenRepo")) {
repositories {
maven { url = nixMavenRepo }
}
} else {
repositories {
google()
mavenCentral()
}
}

dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
//classpath "com.android.tools.lint:lint-gradle:30.3.1"
//classpath "com.android.tools.build:aapt2-proto:7.0.0-beta04-7396180"
}
}

allprojects {
if(project.hasProperty("nixMavenRepo")) {
repositories {
Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
30 changes: 22 additions & 8 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.2.1" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}

include ":app"
17 changes: 10 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
FROM ghcr.io/cirruslabs/flutter:3.22.2
FROM ghcr.io/cirruslabs/flutter:3.27.3

ENV ANDROID_NDK_VERSION 23.1.7779620
ENV ANDROID_NDK_VERSION 25.1.8937393
ENV PATH="/root/.cargo/bin:$PATH"


RUN yes | sdkmanager "ndk;$ANDROID_NDK_VERSION"
RUN yes | sdkmanager "cmake;3.18.1"
RUN yes | sdkmanager "build-tools;30.0.3"
RUN yes | sdkmanager "build-tools;33.0.1"
RUN yes | sdkmanager "platforms;android-35"
RUN yes | sdkmanager "platforms;android-34"
RUN yes | sdkmanager "platforms;android-33"
RUN yes | sdkmanager "platforms;android-32"
RUN yes | sdkmanager "platforms;android-31"

RUN echo "INPUT(-lunwind)" > /opt/android-sdk-linux/ndk/$ANDROID_NDK_VERSION/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/12.0.8/lib/linux/aarch64/libgcc.a
RUN echo "INPUT(-lunwind)" > /opt/android-sdk-linux/ndk/$ANDROID_NDK_VERSION/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/12.0.8/lib/linux/arm/libgcc.a
RUN echo "INPUT(-lunwind)" > /opt/android-sdk-linux/ndk/$ANDROID_NDK_VERSION/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/12.0.8/lib/linux/i386/libgcc.a
RUN echo "INPUT(-lunwind)" > /opt/android-sdk-linux/ndk/$ANDROID_NDK_VERSION/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/12.0.8/lib/linux/x86_64/libgcc.a
RUN echo "INPUT(-lunwind)" > /opt/android-sdk-linux/ndk/$ANDROID_NDK_VERSION/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.6/lib/linux/aarch64/libgcc.a
RUN echo "INPUT(-lunwind)" > /opt/android-sdk-linux/ndk/$ANDROID_NDK_VERSION/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.6/lib/linux/arm/libgcc.a
RUN echo "INPUT(-lunwind)" > /opt/android-sdk-linux/ndk/$ANDROID_NDK_VERSION/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.6/lib/linux/i386/libgcc.a
RUN echo "INPUT(-lunwind)" > /opt/android-sdk-linux/ndk/$ANDROID_NDK_VERSION/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.6/lib/linux/x86_64/libgcc.a

RUN apt update && apt install -y \
build-essential \
Expand All @@ -31,7 +34,7 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y \
&& . "$HOME/.cargo/env" \
&& rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android \
&& rustup install 1.75.0 \
&& rustup default 1.75.0 \
#&& rustup default 1.78.0 \
&& echo "export ANDROID_NDK_HOME=/opt/android-sdk-linux/ndk/$ANDROID_NDK_VERSION" >> $HOME/.bashrc \
&& cargo install cargo-ndk

Expand Down
20 changes: 10 additions & 10 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
description = "Flutter 3.10.0";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/master";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
Expand Down Expand Up @@ -36,10 +36,10 @@

rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./native/rust-toolchain.toml;

ndkVersion = "23.1.7779620";
ndkVersion = "25.1.8937393";
androidComposition = pkgs.androidenv.composeAndroidPackages {
buildToolsVersions = ["34.0.0" "30.0.3"];
platformVersions = ["34" "33" "32" "31" "30" "28"];
buildToolsVersions = ["34.0.0" "30.0.3" "33.0.1"];
platformVersions = ["35" "34" "33" "32" "31" "30" "28"];
abiVersions = ["armeabi-v7a" "arm64-v8a" "x86" "x86_64"];
includeNDK = true;
ndkVersions = [ndkVersion];
Expand Down Expand Up @@ -67,14 +67,14 @@
FLUTTER_SDK = "${pkgs.flutter}";
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/34.0.0/aapt2";
LD_LIBRARY_PATH = "${PWD}/build/linux/x64/debug/bundle/lib/:${PWD}/build/linux/x64/release/bundle/lib/:${PWD}/apps/onyx/build/linux/x64/profile/bundle/lib/";
ANDROID_JAVA_HOME = "${pkgs.jdk.home}";
ANDROID_JAVA_HOME = "${pkgs.jdk17.home}";
#ANDROID_NDK = "${androidSdk}/libexec/android-sdk/ndk/${ndkVersion}";
buildInputs = [
act
rustToolchain
flutter
androidSdk
zenity
zenity
fastlane
cargo-ndk
];
Expand Down Expand Up @@ -106,7 +106,7 @@
FLUTTER_SDK = "${pkgs.flutter}";
LD_LIBRARY_PATH = "./build/linux/x64/debug/bundle/lib/:./build/linux/x64/release/bundle/lib/:${PWD}/apps/onyx/build/linux/x64/profile/bundle/lib/";

ANDROID_JAVA_HOME = "${pkgs.jdk.home}";
ANDROID_JAVA_HOME = "${pkgs.jdk17.home}";

patches = [
./corrosion.patch
Expand All @@ -119,8 +119,7 @@
nativeBuildInputs = [
corrosion
rustPlatform.cargoSetupHook
#cargo
gradle_7
gradle-unwrapped
rustToolchain
copyDesktopItems
cargo-ndk
Expand All @@ -145,12 +144,12 @@
FLUTTER_SDK = "${pkgs.flutter}";
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/34.0.0/aapt2";

ANDROID_JAVA_HOME = "${pkgs.jdk.home}";
ANDROID_JAVA_HOME = "${pkgs.jdk17.home}";

nativeBuildInputs = [
corrosion
rustPlatform.cargoSetupHook
gradle_7
gradle-unwrapped
rustToolchain
cargo-ndk
];
Expand Down
6 changes: 3 additions & 3 deletions lib/pages/qr_code_scanner_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter_zxing/flutter_zxing.dart';
import 'package:vibration/vibration.dart';

class QRScannerPage extends StatefulWidget {
const QRScannerPage({Key? key}) : super(key: key);
const QRScannerPage({super.key});

@override
State<QRScannerPage> createState() => _QRScannerPageState();
Expand Down Expand Up @@ -46,8 +46,8 @@ class _QRScannerPageState extends State<QRScannerPage> {
}

//vibrate
if (await Vibration.hasVibrator() ?? false) {
if (await Vibration.hasAmplitudeControl() ?? false) {
if (await Vibration.hasVibrator()) {
if (await Vibration.hasAmplitudeControl()) {
Vibration.vibrate(duration: 140, amplitude: 2);
} else {
Vibration.vibrate(duration: 1000);
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/receive_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:iyox_wormhole/utils/paths.dart';
import 'package:iyox_wormhole/utils/type_helpers.dart';

class ReceivePage extends StatefulWidget {
const ReceivePage({Key? key}) : super(key: key);
const ReceivePage({super.key});

@override
State<ReceivePage> createState() => _ReceivePageState();
Expand Down Expand Up @@ -35,7 +35,7 @@ class _ReceivePageState extends State<ReceivePage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Padding(
padding: EdgeInsets.fromLTRB(20, 55, 0, 20),
padding: EdgeInsets.fromLTRB(20, 120, 0, 20),
child: Text("Receive Files", style: TextStyle(fontSize: 37)),
),
Container(
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:iyox_wormhole/pages/receive_page.dart';
import 'package:iyox_wormhole/pages/send_page.dart';

class BasePage extends StatefulWidget {
const BasePage({Key? key}) : super(key: key);
const BasePage({super.key});

@override
State<BasePage> createState() => _BasePageState();
Expand Down
Loading

0 comments on commit a037cf9

Please sign in to comment.