Skip to content

Commit

Permalink
Merge pull request #1 from Myzel394/first-improvements
Browse files Browse the repository at this point in the history
First improvements
  • Loading branch information
Myzel394 authored Apr 26, 2024
2 parents 4a499b8 + 5a53d57 commit f71f849
Show file tree
Hide file tree
Showing 450 changed files with 9,129 additions and 10,361 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://editorconfig.org/
# This configuration is used by ktlint when spotless invokes it

[*.{kt,kts}]
ij_kotlin_allow_trailing_comma=true
ij_kotlin_allow_trailing_comma_on_call_site=true
ktlint_function_naming_ignore_when_annotated_with=Composable, Test
34 changes: 34 additions & 0 deletions .github/actions/prepare-keystore/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Prepare KeyStore
description: Write the KeyStore file and properties to disk

inputs:
signingStorePassword:
description: 'The password for the KeyStore'
required: true
signingKeyPassword:
description: 'The password for the Key'
required: true
signingKeyAlias:
description: 'The alias for the Key'
required: true
keyStoreBase64:
description: 'The KeyStore file encoded as base64'
required: true

runs:
using: composite
steps:
- name: Write Keystore file 🗄️
id: android_keystore
uses: timheuer/[email protected]
with:
fileName: key.jks
encodedString: ${{ inputs.keyStoreBase64 }}

- name: Write Keystore properties 🗝️
shell: bash
run: |
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > key.properties
echo "storePassword=${{ inputs.signingStorePassword }}" >> key.properties
echo "keyPassword=${{ inputs.signingKeyPassword }}" >> key.properties
echo "keyAlias=${{ inputs.signingKeyAlias }}" >> key.properties
31 changes: 31 additions & 0 deletions .github/workflows/build-testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build and push debug app

on:
pull_request:

jobs:
debug-builds:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: gradle/wrapper-validation-action@v2

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: "adopt"
java-version: 21
cache: "gradle"

- name: Run tests
run: ./gradlew test

- name: Compile
run: ./gradlew assembleDebug

- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: numberhub-app-debug-apks
path: app/build/outputs/apk/fdroid/debug/app-*-debug.apk
52 changes: 52 additions & 0 deletions .github/workflows/release-app-github.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and publish app

on:
release:
types: [ published ]

jobs:
release-app-github:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: gradle/wrapper-validation-action@v2

- name: Write KeyStore 🗝️
uses: ./.github/actions/prepare-keystore
with:
signingStorePassword: ${{ secrets.SIGNING_STORE_PASSWORD }}
signingKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
signingKeyAlias: ${{ secrets.SIGNING_KEY_ALIAS }}
keyStoreBase64: ${{ secrets.KEYSTORE }}

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 21
cache: 'gradle'

- name: Build APKs 📱
run: ./gradlew assembleRelease

- name: Build AABs 📱
run: ./gradlew bundleRelease

- name: Upload APKs 🚀
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
files: app/build/outputs/apk/fdroid/release/*.apk

- name: Upload APKs bundles 🚀
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
files: app/build/outputs/bundle/fdroidRelease/*.aab
42 changes: 42 additions & 0 deletions .run/spotlessApply.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!--
~ Unitto is a calculator for Android
~ Copyright (c) 2024 Elshan Agaev
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->

<component name="ProjectRunConfigurationManager">
<configuration default="false" name="spotlessApply" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--init-script gradle/init.gradle.kts --no-configuration-cache" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="spotlessApply" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>
42 changes: 42 additions & 0 deletions .run/spotlessCheck.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!--
~ Unitto is a calculator for Android
~ Copyright (c) 2024 Elshan Agaev
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->

<component name="ProjectRunConfigurationManager">
<configuration default="false" name="spotlessCheck" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--init-script gradle/init.gradle.kts --no-configuration-cache" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="spotlessCheck" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>
67 changes: 9 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,63 +7,14 @@
<img src="./fastlane/metadata/android/en-US/images/phoneScreenshots/slide5.png" width="19%" />
</p>

# 📲 Download
## Notice

<p align="middle">
<a href="https://play.google.com/store/apps/details?id=com.sadellie.unitto"><img alt="Google Play" src="./content/gplay.svg" height="60"></a>
<a href="https://f-droid.org/packages/com.sadellie.unitto"><img alt="F-Droid" src="./content/fdroid.svg" height="60"/></a>
<a href="https://github.com/sadellie/unitto/releases/latest"><img alt="GitHub" src="./content/github.svg" height="60"/></a>
</p>

Prefer _Google Play_

# 💁‍♀️ Contribute
<p align="middle">
<img src="./content/based.png" width="97%" />
</p>

<p align="middle">
<a href="https://poeditor.com/join/project/T4zjmoq8dx"><img alt="Translate" src="./content/translate.svg" height="60"/></a>
<a href="https://github.com/sadellie/unitto/issues/new"><img alt="Issues" src="./content/issue.svg" height="60"/></a>
<a href="https://github.com/sadellie/unitto/discussions/new/choose"><img alt="Discussions" src="./content/discussion.svg" height="60"/></a>
</p>

## 👩‍💻 Do NOT contribute code
1. I do **NOT** need any help in code.
2. Hard forks and alterations of Unitto are **NOT** welcomed. Use a _Fork_ button so that commits' author is not lost.

# ⚠ Security
Read [this](https://github.com/sadellie/unitto/wiki/Security).

<sup>TL;DR: the app is legit, no cap fr fr</sup>

## 🤖 Custom ROM developers
Leave.

## 🤓 Nerds

<details>
<summary>Benchmarks and Baseline profile</summary>

```
Pixel 8 - 14
StartupBenchmark_startupPrecompiledWithBaselineProfile
timeToInitialDisplayMs min 183.5, median 219.9, max 247.3
StartupBenchmark_startupWithoutPreCompilation
timeToInitialDisplayMs min 223.6, median 328.0, max 663.8
StartupBenchmark_startupWithPartialCompilationAndDisabledBaselineProfile
timeToInitialDisplayMs min 264.8, median 308.0, max 376.1
StartupBenchmark_startupFullyPrecompiled
timeToInitialDisplayMs min 314.4, median 336.9, max 388.3
```
</details>

## 🔎 Additional
Terms and Conditions: https://sadellie.github.io/unitto/terms

Privacy Policy: https://sadellie.github.io/unitto/privacy
This app was originally created by [sadellie](https://github.com/sadellie).
Unfortunately, it has been archived on March 1st, 2024 (https://github.com/sadellie/unitto)
without any notice or explanation.
Since there has been no activity from sadellie on GitHub since then, I guess
they are not actively working on projects anymore.

FAQ: https://sadellie.github.io/unitto/faq
I will maintain this app, but I do not plan to add new features.
I don't have enough time to do that, but you are welcome to contribute.
I will review and merge your pull requests.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ plugins {
}

android {
namespace = "com.sadellie.unitto"
namespace = "app.myzel394.numberhub"
compileSdk = 34

defaultConfig {
applicationId = "com.sadellie.unitto"
applicationId = "app.myzel394.numberhub"
minSdk = 21
targetSdk = 34
versionCode = libs.versions.versionCode.get().toInt()
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="com.sadellie.unitto"
android:host="app.myzel394.numberhub"
android:scheme="app" />
</intent-filter>
</activity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package com.sadellie.unitto
package app.myzel394.numberhub

import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
Expand All @@ -37,14 +37,14 @@ import androidx.compose.ui.platform.LocalContext
import androidx.navigation.NavGraph.Companion.findStartDestination
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import com.sadellie.unitto.core.ui.common.NavigationDrawer
import com.sadellie.unitto.core.ui.common.rememberDrawerState
import com.sadellie.unitto.core.ui.model.DrawerItem
import com.sadellie.unitto.core.ui.pushDynamicShortcut
import com.sadellie.unitto.core.ui.theme.DarkThemeColors
import com.sadellie.unitto.core.ui.theme.LightThemeColors
import com.sadellie.unitto.core.ui.theme.TypographySystem
import com.sadellie.unitto.data.model.userprefs.AppPreferences
import app.myzel394.numberhub.core.ui.common.NavigationDrawer
import app.myzel394.numberhub.core.ui.common.rememberDrawerState
import app.myzel394.numberhub.core.ui.model.DrawerItem
import app.myzel394.numberhub.core.ui.pushDynamicShortcut
import app.myzel394.numberhub.core.ui.theme.DarkThemeColors
import app.myzel394.numberhub.core.ui.theme.LightThemeColors
import app.myzel394.numberhub.core.ui.theme.TypographySystem
import app.myzel394.numberhub.data.model.userprefs.AppPreferences
import io.github.sadellie.themmo.Themmo
import io.github.sadellie.themmo.ThemmoController
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -76,14 +76,14 @@ internal fun ComponentActivity.App(prefs: AppPreferences?) {
dynamicThemeEnabled = prefs.enableDynamicTheme,
amoledThemeEnabled = prefs.enableAmoledTheme,
customColor = prefs.customColor.toColor(),
monetMode = prefs.monetMode
monetMode = prefs.monetMode,
)
}

Themmo(
themmoController = themmoController,
typography = TypographySystem,
animationSpec = tween(250)
animationSpec = tween(250),
) {
val backgroundColor = MaterialTheme.colorScheme.background
val isDarkThemeEnabled = remember(backgroundColor) { backgroundColor.luminance() < 0.5f }
Expand All @@ -92,7 +92,8 @@ internal fun ComponentActivity.App(prefs: AppPreferences?) {
modifier = Modifier,
state = drawerState,
gesturesEnabled = gesturesEnabled,
tabs = DrawerItem.main,
mainTabs = DrawerItem.main,
additionalTabs = DrawerItem.additional,
currentDestination = navBackStackEntry?.destination?.route,
onItemClick = { destination ->
drawerScope.launch { drawerState.close() }
Expand All @@ -112,10 +113,9 @@ internal fun ComponentActivity.App(prefs: AppPreferences?) {
navController = navController,
themmoController = it,
startDestination = prefs.startingScreen,
rpnMode = prefs.rpnMode,
openDrawer = { drawerScope.launch { drawerState.open() } }
openDrawer = { drawerScope.launch { drawerState.open() } },
)
}
},
)

DisposableEffect(isDarkThemeEnabled) {
Expand Down
Loading

0 comments on commit f71f849

Please sign in to comment.