Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,21 @@ fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md
fastlane/readme.md

# iOS / Xcode
iosApp/Pods/
iosApp/Podfile.lock
iosApp/iosApp.xcworkspace/
iosApp/iosApp.xcodeproj/project.xcworkspace/
iosApp/iosApp.xcodeproj/xcuserdata/
iosApp/iosApp/xcuserdata/
iosApp/iosApp/*.xcbkptlist
iosApp/iosApp/*.xcuserstate
*.xcuserstate
*.xcuserdata
.DS_Store

# KMP / CocoaPods generated
shared/shared.podspec
shared/build/cocoapods/
12 changes: 1 addition & 11 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
Third-Party Notices

This project includes the EvalEx library.

Author and License
Copyright 2012-2023 by Udo Klimaschewski

Thanks to all who contributed to this project: Contributors

The software is licensed under the Apache License, Version 2.0 (see LICENSE file).

The power of operator (^) implementation was copied from Stack Overflow. Thanks to Gene Marin.
The SQRT() function implementation was taken from the book The Java Programmers Guide To Numerical Computing (Ronald Mak, 2002).
No third-party notices at this time.
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<img src="img/Screenshot_20251221_194853.png" alt="Screenshot_20251221_194853" width="49%">
<img src="img/Screenshot_20251221_194853.png" alt="Android screenshot" width="49%">
<img src="img/ios_screenshot.png" alt="iOS screenshot" width="49%">

# simple-calculator
A simple android calculator created in collaboration with the UI design of [Andrea Chiara De Santis](https://www.behance.net/andydesa) and the power of the [EvalEx](https://github.com/uklimaschewski/EvalEx) library created by [Udo Klimaschewski](https://github.com/uklimaschewski)
A simple calculator built with Compose Multiplatform and a shared Kotlin core, created in collaboration with the UI design of [Andrea Chiara De Santis](https://www.behance.net/andydesa).

* Made in [Kotlin](https://kotlinlang.org/)
* Designed Using [Jetpack Compose](https://developer.android.com/jetpack/compose)
Expand All @@ -10,6 +11,7 @@ A simple android calculator created in collaboration with the UI design of [Andr
* Dependency injection via [Hilt](https://developer.android.com/training/dependency-injection/hilt-android)
* Calculation history persisted with [DataStore](https://developer.android.com/topic/libraries/architecture/datastore)
* History panel with recall and clear actions
* iOS app bootstrapped with CocoaPods and Compose Multiplatform

## Architecture overview
```mermaid
Expand All @@ -27,5 +29,25 @@ sequenceDiagram
VM-->>UI: invalidExpressionEvents (SharedFlow)
```

## iOS setup (simulator)
Prereqs: Xcode, CocoaPods, and JDK 17.

1) Generate the shared podspec and dummy framework:
```
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
./gradlew :shared:podspec :shared:generateDummyFramework
```

2) Install pods:
```
cd iosApp
pod install
```

3) Open `iosApp/iosApp.xcworkspace` and run a simulator.

If Xcode reports a sandbox error for CocoaPods scripts, disable user script sandboxing in Build Settings
for both the `iosApp` target and the `Pods-iosApp` target, then clean and rebuild.

## Third-party licenses
See `NOTICE` for third-party attribution and license details.
4 changes: 1 addition & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ android {

dependencies {

implementation project(':shared')
implementation 'androidx.core:core-ktx:1.13.1'

implementation platform('androidx.compose:compose-bom:2024.06.00')
Expand All @@ -68,7 +69,6 @@ dependencies {
implementation "androidx.constraintlayout:constraintlayout:$constraint_layout_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1'
implementation 'androidx.datastore:datastore-preferences:1.1.1'
implementation 'com.google.code.gson:gson:2.11.0'
implementation 'com.google.dagger:hilt-android:2.51.1'
kapt 'com.google.dagger:hilt-compiler:2.51.1'
androidTestImplementation platform('androidx.compose:compose-bom:2024.06.00')
Expand All @@ -79,8 +79,6 @@ dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.ezylang:EvalEx:3.5.0'

testImplementation 'junit:junit:4.13.2'
testImplementation 'io.mockk:mockk:1.13.11'
testImplementation 'androidx.arch.core:core-testing:2.2.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import com.google.gson.Gson
import zurche.simplecalculator.calculator.data.DataStoreHistoryRepository
import zurche.simplecalculator.calculator.data.HistoryRepository
import zurche.simplecalculator.calculator.engine.CalculatorEngine
import javax.inject.Singleton

private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(
Expand All @@ -37,8 +37,8 @@ abstract class AppModule {

@Provides
@Singleton
fun provideGson(): Gson {
return Gson()
fun provideCalculatorEngine(): CalculatorEngine {
return CalculatorEngine()
}
}
}

This file was deleted.

Loading