2 |
3 | 
4 |
5 | # NzHelper
6 |
7 | [](https://www.gnu.org/licenses/gpl-3.0.html)
8 | [](https://github.com/bug-bit/NzHelper)
9 |

10 | [](https://github.com/bug-bit/NzHelper/releases)
11 |

12 |
13 | 一个简单、高效、易用的打飞机记录工具,帮助你科学管理✈️生活
14 |
15 |
16 |
17 | ---
18 |
19 | ## 说明
20 | > 在 GitHub 点击 ⭐ Star 以支持我在空余时间继续开发
21 | > 祝愿所有给本项目Star的小伙伴牛子长度翻倍!
22 |
23 | - 本项目参考了以下开源项目:
24 | - [DickHelper](https://github.com/zzzdajb/DickHelper)
25 |
26 |
27 | ## 贡献
28 | 欢迎提交 issue 或 pull request 以改进本项目。
29 |
30 | ---
31 |
32 | ## Star History
33 |
34 | [](https://star-history.com/#bug-bit/NzHelper&Timeline)
35 |
36 | ## 许可协议
37 |
38 | 本项目基于 GNU 通用公共许可证 第3版(GPLv3)进行授权。
39 | 详情请查阅 [LICENSE](LICENSE) 文件。
40 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | build/
--------------------------------------------------------------------------------
/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | alias(libs.plugins.android.application)
3 | alias(libs.plugins.kotlin.android)
4 | alias(libs.plugins.kotlin.compose)
5 | }
6 |
7 | fun getGitCommitCount(): Int {
8 | return try {
9 | val process = ProcessBuilder("git", "rev-list", "--count", "HEAD")
10 | .redirectErrorStream(true)
11 | .start()
12 | process.inputStream.bufferedReader().readText().trim().toInt()
13 | } catch (_: Exception) {
14 | 1 // fallback
15 | }
16 | }
17 |
18 | fun getGitShortHash(): String {
19 | return try {
20 | val process = ProcessBuilder("git", "rev-parse", "--short", "HEAD")
21 | .redirectErrorStream(true)
22 | .start()
23 | process.inputStream.bufferedReader().readText().trim()
24 | } catch (_: Exception) {
25 | "unknown"
26 | }
27 | }
28 |
29 | android {
30 | namespace = "me.neko.nzhelper"
31 | compileSdk = 36
32 |
33 | defaultConfig {
34 | applicationId = "me.neko.nzhelper"
35 | minSdk = 26
36 | targetSdk = 36
37 |
38 | val commitCount = getGitCommitCount()
39 | val gitHash = getGitShortHash()
40 |
41 | versionCode = getGitCommitCount()
42 | versionName = "0.0.13-alpha.r$commitCount.$gitHash"
43 |
44 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
45 | }
46 |
47 | buildTypes {
48 | release {
49 | isMinifyEnabled = true
50 | isShrinkResources = true // 移除无用资源
51 | proguardFiles(
52 | getDefaultProguardFile("proguard-android-optimize.txt"),
53 | "proguard-rules.pro"
54 | )
55 | }
56 | }
57 | compileOptions {
58 | sourceCompatibility = JavaVersion.VERSION_11
59 | targetCompatibility = JavaVersion.VERSION_11
60 | }
61 | kotlin {
62 | compilerOptions {
63 | jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11)
64 | }
65 | }
66 | buildFeatures {
67 | compose = true
68 | buildConfig = true
69 | }
70 |
71 | // 构建时的包名
72 | android.applicationVariants.all {
73 | outputs.all {
74 | if (this is com.android.build.gradle.internal.api.ApkVariantOutputImpl) {
75 | val config = project.android.defaultConfig
76 | val versionName = config.versionName
77 | this.outputFileName = "NzHelper_v${versionName}.apk"
78 | }
79 | }
80 | }
81 |
82 | }
83 |
84 | dependencies {
85 |
86 | implementation(libs.androidx.core.ktx)
87 | implementation(libs.androidx.lifecycle.runtime.ktx)
88 | implementation(libs.androidx.activity.compose)
89 | implementation(platform(libs.androidx.compose.bom))
90 | implementation(libs.androidx.ui)
91 | implementation(libs.androidx.ui.graphics)
92 | implementation(libs.androidx.ui.tooling.preview)
93 | implementation(libs.androidx.material3)
94 | implementation(libs.androidx.navigation.compose)
95 | implementation(libs.gson)
96 | implementation(libs.okhttp)
97 | implementation(libs.moshi)
98 | implementation(libs.moshi.kotlin)
99 | testImplementation(libs.junit)
100 | androidTestImplementation(libs.androidx.junit)
101 | androidTestImplementation(libs.androidx.espresso.core)
102 | androidTestImplementation(platform(libs.androidx.compose.bom))
103 | androidTestImplementation(libs.androidx.ui.test.junit4)
104 | debugImplementation(libs.androidx.ui.tooling)
105 | debugImplementation(libs.androidx.ui.test.manifest)
106 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
23 | # Keep OkHttp3 classes
24 | -dontwarn okhttp3.**
25 | -keep class okhttp3.** { *; }
26 | -keep interface okhttp3.** { *; }
27 |
28 | # 保留所有 Moshi codegen 生成的 JsonAdapter 类
29 | -keep class *JsonAdapter {
30 |