Skip to content

Commit

Permalink
rename apk
Browse files Browse the repository at this point in the history
remove toast at first
  • Loading branch information
hongui committed Mar 2, 2023
1 parent c0f96b7 commit 289f79a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
35 changes: 18 additions & 17 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
plugins{
import java.text.SimpleDateFormat

plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id("com.google.devtools.ksp") version "1.8.0-1.0.8"
Expand All @@ -22,39 +24,38 @@ android {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationVariants.all { variant ->
variant.outputs.all {
output ->
def name = "${variant.applicationId}_${variant.getVersionName()}_${new SimpleDateFormat('yyyy_MM_dd_HH_mm').format(System.currentTimeMillis())}.apk"
outputFileName = name
}
}
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
jniLibs {
excludes += ['META-INF/*']
}
resources {
excludes += ['META-INF/*']
}
}

namespace 'com.mob.lee.fastair'
}

task clearAssets(type: Delete){
def path="${projectDir}/src/main/assets"
def target=fileTree(dir: path,exclude:['about.html','help.html'])
delete(target,"$path/app")
task clearAssets(type: Delete) {
def path = "${projectDir}/src/main/assets"
def target = fileTree(dir: path, exclude: ['about.html', 'help.html'])
delete(target, "$path/app")
}

task frontEnd(type:Exec){
task frontEnd(type: Exec) {
dependsOn(clearAssets)
workingDir("${rootDir}/FastSvelte")
commandLine('npm.cmd','run','build')
commandLine('npm.cmd', 'run', 'build')
}

task toAssets(type: Copy){
def path="${projectDir}/src/main/assets"
task toAssets(type: Copy) {
def path = "${projectDir}/src/main/assets"
dependsOn(frontEnd)
from("${rootDir}/FastSvelte/build")
into(path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class HomeViewModel : AppViewModel() {
fragment,
Manifest.permission.MANAGE_EXTERNAL_STORAGE
) {
fragment.requireContext().errorToast(R.string.no_permission_to_scan)
if(!it) {
fragment.requireContext().errorToast(R.string.no_permission_to_scan)
}
}
}.setNegativeButton(R.string.exit) { _, _ ->
fragment.mParent?.finish()
Expand All @@ -60,7 +62,7 @@ class HomeViewModel : AppViewModel() {
} else {
withPermission(
fragment,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
action = { hasPermission ->
if (hasPermission) {
fetch(fragment.context)
Expand Down

0 comments on commit 289f79a

Please sign in to comment.