Skip to content

Commit aee0da2

Browse files
committed
Merge branch 'feature/kn-update' into dev
2 parents 13f4981 + f1610e6 commit aee0da2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+139
-5606
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*.perspectivev3
55
*.swp
66
*~.nib
7+
*.hprof
78
.DS_Store
89
.externalNativeBuild
910
.gradle

core/build.gradle

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
plugins {
21-
id 'kotlin-multiplatform' version '1.3.21'
21+
id 'kotlin-multiplatform' version "1.3.72"
2222
}
2323

2424
repositories {
@@ -32,7 +32,11 @@ kotlin {
3232
def iosPreset = isIphone ? presets.iosArm64 : presets.iosX64
3333

3434
fromPreset(iosPreset, 'ios') {
35-
compilations.main.outputKinds('FRAMEWORK')
35+
binaries {
36+
framework {
37+
baseName = "LoopHabitTracker"
38+
}
39+
}
3640
compilations.main {
3741
cinterops {
3842
sqlite3 {
@@ -61,7 +65,7 @@ kotlin {
6165
kotlin { srcDir "src/main/common" }
6266
dependencies {
6367
implementation kotlin('stdlib-common')
64-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.2.0-alpha-2'
68+
implementation "$KX_COROUTINES-core-common:$KX_COROUTINES_VERSION"
6569
}
6670
}
6771

@@ -77,7 +81,7 @@ kotlin {
7781
kotlin { srcDir "src/main/jvm" }
7882
dependencies {
7983
implementation kotlin('stdlib-jdk8')
80-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.0-alpha-2'
84+
implementation "$KX_COROUTINES-core:$KX_COROUTINES_VERSION"
8185
}
8286
}
8387

@@ -94,7 +98,7 @@ kotlin {
9498
kotlin { srcDir "src/main/js" }
9599
dependencies {
96100
implementation kotlin('stdlib-js')
97-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-js:1.2.0-alpha-2'
101+
implementation "$KX_COROUTINES-core-js:$KX_COROUTINES_VERSION"
98102
}
99103
}
100104

@@ -108,36 +112,25 @@ kotlin {
108112
iosMain {
109113
kotlin { srcDir "src/main/ios" }
110114
dependencies {
111-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.2.0-alpha-2'
115+
implementation "$KX_COROUTINES-core-native:$KX_COROUTINES_VERSION"
112116
}
113117
}
114118

115119
iosTest {
116120
kotlin { srcDir "src/test/ios" }
117121
dependencies {
118-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.2.0-alpha-2'
122+
implementation "$KX_COROUTINES-core-native:$KX_COROUTINES_VERSION"
119123
}
120124
}
121125
}
122126

123127
task iosTestCopyResources(type: Copy) {
124-
dependsOn 'linkTestIos'
125128
from 'assets/test/'
126129
from 'assets/main/'
127-
into 'build/bin/ios/testDebugExecutable'
130+
into 'build/bin/ios/debugTest'
128131
}
129132

130-
task iosTest {
131-
dependsOn 'linkTestIos', 'iosTestCopyResources'
132-
group = JavaBasePlugin.VERIFICATION_GROUP
133-
description = "Runs tests on iOS simulator"
134-
135-
doLast {
136-
def emulatorName = "iPhone 8 Plus"
137-
def binary = kotlin.targets.ios.compilations.test.getBinary('EXECUTABLE', 'DEBUG')
138-
exec {
139-
commandLine 'xcrun', 'simctl', 'spawn', emulatorName, binary.absolutePath
140-
}
141-
}
133+
if (project.tasks.findByName('iosTest')) {
134+
iosTest.dependsOn(iosTestCopyResources)
142135
}
143-
}
136+
}

core/gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
KX_COROUTINES_VERSION=1.3.6
2+
KX_COROUTINES=org.jetbrains.kotlinx:kotlinx-coroutines
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Sun Apr 07 10:31:43 CDT 2019
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
43
zipStoreBase=GRADLE_USER_HOME
54
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip

core/src/main/common/org/isoron/platform/io/Log.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,17 @@ interface Log {
3030
*/
3131
class StandardLog : Log {
3232
override fun warn(tag: String, msg: String) {
33-
println(sprintf("W %-20s %s", tag, msg))
33+
val ftag = format("%-20s", tag)
34+
println("W $ftag $msg")
3435
}
3536

3637
override fun info(tag: String, msg: String) {
37-
println(sprintf("I %-20s %s", tag, msg))
38+
val ftag = format("%-20s", tag)
39+
println("I $ftag $msg")
3840
}
3941

4042
override fun debug(tag: String, msg: String) {
41-
println(sprintf("D %-20s %s", tag, msg))
43+
val ftag = format("%-20s", tag)
44+
println("D $ftag $msg")
4245
}
4346
}

core/src/main/common/org/isoron/platform/io/Strings.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@
1919

2020
package org.isoron.platform.io
2121

22-
expect fun sprintf(format: String, vararg args: Any?): String
22+
expect fun format(format: String, arg: String): String
23+
expect fun format(format: String, arg: Int): String
24+
expect fun format(format: String, arg: Double): String

core/src/main/common/org/isoron/uhabits/components/NumberButton.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ import org.isoron.platform.io.*
2424
import kotlin.math.*
2525

2626
fun Double.toShortString(): String = when {
27-
this >= 1e9 -> sprintf("%.1fG", this / 1e9)
28-
this >= 1e8 -> sprintf("%.0fM", this / 1e6)
29-
this >= 1e7 -> sprintf("%.1fM", this / 1e6)
30-
this >= 1e6 -> sprintf("%.1fM", this / 1e6)
31-
this >= 1e5 -> sprintf("%.0fk", this / 1e3)
32-
this >= 1e4 -> sprintf("%.1fk", this / 1e3)
33-
this >= 1e3 -> sprintf("%.1fk", this / 1e3)
34-
this >= 1e2 -> sprintf("%.0f", this)
27+
this >= 1e9 -> format("%.1fG", this / 1e9)
28+
this >= 1e8 -> format("%.0fM", this / 1e6)
29+
this >= 1e7 -> format("%.1fM", this / 1e6)
30+
this >= 1e6 -> format("%.1fM", this / 1e6)
31+
this >= 1e5 -> format("%.0fk", this / 1e3)
32+
this >= 1e4 -> format("%.1fk", this / 1e3)
33+
this >= 1e3 -> format("%.1fk", this / 1e3)
34+
this >= 1e2 -> format("%.0f", this)
3535
this >= 1e1 -> when {
36-
round(this) == this -> sprintf("%.0f", this)
37-
else -> sprintf("%.1f", this)
36+
round(this) == this -> format("%.0f", this)
37+
else -> format("%.1f", this)
3838
}
3939
else -> when {
40-
round(this) == this -> sprintf("%.0f", this)
41-
round(this * 10) == this * 10 -> sprintf("%.1f", this)
42-
else -> sprintf("%.2f", this)
40+
round(this) == this -> format("%.0f", this)
41+
round(this * 10) == this * 10 -> format("%.1f", this)
42+
else -> format("%.2f", this)
4343
}
4444
}
4545

core/src/main/common/org/isoron/uhabits/components/Ring.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Ring(val color: Color,
4747
if(label) {
4848
canvas.setColor(color)
4949
canvas.setFontSize(radius * 0.4)
50-
canvas.drawText(sprintf("%.0f%%", percentage * 100), width / 2, height / 2)
50+
canvas.drawText(format("%.0f%%", percentage * 100), width / 2, height / 2)
5151
}
5252
}
5353
}

core/src/main/common/org/isoron/uhabits/i18n/StringsArabic.kt

Lines changed: 0 additions & 165 deletions
This file was deleted.

0 commit comments

Comments
 (0)