Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup #547

Merged
merged 4 commits into from
Nov 30, 2023
Merged
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
insert_final_newline=true

[*.{kt,kts}]
ij_kotlin_imports_layout=*,^
ij_kotlin_allow_trailing_comma=true
ij_kotlin_allow_trailing_comma_on_call_site=true
indent_size=4
ktlint_standard_filename=disabled
ktlint_standard_spacing-between-declarations-with-annotations=disabled
ktlint_standard_trailing-comma-on-call-site=disabled
ktlint_standard_trailing-comma-on-declaration-site=disabled
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.cru.godtools.shared.tool.parser.expressions

import org.cru.godtools.shared.tool.state.State
import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertEquals
Expand All @@ -9,6 +8,7 @@ import kotlin.test.assertNotNull
import kotlin.test.assertNull
import kotlin.test.assertTrue
import kotlin.test.fail
import org.cru.godtools.shared.tool.state.State

class ExpressionTest {
private val state = State()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.cru.godtools.shared.tool.parser.xml

import android.util.Xml
import org.xmlpull.v1.XmlPullParser.FEATURE_PROCESS_NAMESPACES
import java.io.InputStream
import org.xmlpull.v1.XmlPullParser.FEATURE_PROCESS_NAMESPACES

abstract class AndroidXmlPullParserFactory : XmlPullParserFactory() {
protected abstract suspend fun openFile(fileName: String): InputStream?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.cru.godtools.shared.tool.parser.model

import org.junit.Test
import kotlin.test.assertEquals
import org.junit.Test

class AndroidButtonTest {
@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.cru.godtools.shared.tool.parser.model

import org.junit.Test
import kotlin.test.assertEquals
import org.junit.Test

class AndroidCardTest {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package org.cru.godtools.shared.tool.parser.model
import android.graphics.Color
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.github.ajalt.colormath.model.RGB
import kotlin.test.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import kotlin.test.assertEquals

@RunWith(AndroidJUnit4::class)
class AndroidColorTest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.cru.godtools.shared.tool.parser.model

import org.junit.Test
import kotlin.test.assertEquals
import org.junit.Test

class AndroidImageTest {
@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.cru.godtools.shared.tool.parser.model

import org.junit.Test
import kotlin.test.assertEquals
import org.junit.Test

class AndroidMultiselectTest {
@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.cru.godtools.shared.tool.parser.model

import org.junit.Test
import kotlin.test.assertEquals
import org.junit.Test

class AndroidTextTest {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package org.cru.godtools.shared.tool.parser.model

import android.view.Gravity
import androidx.test.ext.junit.runners.AndroidJUnit4
import kotlin.test.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import kotlin.test.assertEquals

@RunWith(AndroidJUnit4::class)
class TextAlignGravityTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package org.cru.godtools.shared.tool.parser

import deezer.kustomexport.KustomExport
import io.github.aakira.napier.Napier
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.js.JsName
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.withContext
import org.ccci.gto.support.androidx.annotation.RestrictTo
Expand All @@ -10,9 +13,6 @@ import org.cru.godtools.shared.tool.parser.internal.FileNotFoundException
import org.cru.godtools.shared.tool.parser.model.Manifest
import org.cru.godtools.shared.tool.parser.xml.XmlPullParserException
import org.cru.godtools.shared.tool.parser.xml.XmlPullParserFactory
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.js.JsName

@KustomExport
open class ManifestParser(private val parserFactory: XmlPullParserFactory, val defaultConfig: ParserConfig) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package org.cru.godtools.shared.tool.parser

import kotlin.experimental.ExperimentalObjCRefinement
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.js.JsName
import kotlin.native.HiddenFromObjC
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import org.cru.godtools.shared.tool.parser.model.DEFAULT
import org.cru.godtools.shared.tool.parser.model.DeviceType
import org.cru.godtools.shared.tool.parser.model.Version
import org.cru.godtools.shared.tool.parser.model.Version.Companion.toVersion
import kotlin.experimental.ExperimentalObjCRefinement
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.js.JsName
import kotlin.native.HiddenFromObjC

@JsExport
@OptIn(ExperimentalJsExport::class, ExperimentalObjCRefinement::class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package org.cru.godtools.shared.tool.parser.model

import kotlin.experimental.ExperimentalObjCRefinement
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.js.JsName
import kotlin.native.HiddenFromObjC
import org.ccci.gto.support.androidx.annotation.RestrictTo
import org.ccci.gto.support.androidx.annotation.RestrictToScope
import org.cru.godtools.shared.tool.parser.model.AnalyticsEvent.Companion.parseAnalyticsEvents
import org.cru.godtools.shared.tool.parser.model.AnalyticsEvent.Trigger
import org.cru.godtools.shared.tool.parser.xml.XmlPullParser
import org.cru.godtools.shared.tool.parser.xml.parseChildren
import kotlin.experimental.ExperimentalObjCRefinement
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.js.JsName
import kotlin.native.HiddenFromObjC

private const val XML_SECTION = "section"
private const val XML_SECTION_HEADER = "header"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package org.cru.godtools.shared.tool.parser.model

import io.github.aakira.napier.Napier
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.js.JsName
import org.ccci.gto.support.androidx.annotation.RestrictTo
import org.ccci.gto.support.androidx.annotation.RestrictToScope
import org.cru.godtools.shared.tool.parser.internal.DeprecationException
Expand All @@ -10,9 +13,6 @@ import org.cru.godtools.shared.tool.parser.util.REGEX_SEQUENCE_SEPARATOR
import org.cru.godtools.shared.tool.parser.xml.XmlPullParser
import org.cru.godtools.shared.tool.parser.xml.parseChildren
import org.cru.godtools.shared.tool.state.State
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.js.JsName

private const val TAG = "XmlAnalyticsEvent"

Expand Down Expand Up @@ -123,7 +123,8 @@ class AnalyticsEvent : BaseModel {
ADOBE,
@Deprecated("Since v0.9.1, we no longer use AppsFlyer.")
APPSFLYER,
FACEBOOK, FIREBASE,
FACEBOOK,
FIREBASE,
@Deprecated("Since v0.8.2, we no longer use Snowplow.")
SNOWPLOW,
USER;
Expand All @@ -147,7 +148,11 @@ class AnalyticsEvent : BaseModel {
ReplaceWith("CLICKED", "org.cru.godtools.shared.tool.parser.model.AnalyticsEvent.Trigger.CLICKED")
)
SELECTED,
VISIBLE, HIDDEN, CLICKED, DEFAULT, UNKNOWN;
VISIBLE,
HIDDEN,
CLICKED,
DEFAULT,
UNKNOWN;

internal companion object {
fun String.toTrigger() = when (this) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package org.cru.godtools.shared.tool.parser.model

import kotlin.experimental.ExperimentalObjCRefinement
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.js.JsName
import kotlin.native.HiddenFromObjC
import org.ccci.gto.support.androidx.annotation.RestrictTo
import org.ccci.gto.support.androidx.annotation.RestrictToScope
import org.ccci.gto.support.androidx.annotation.VisibleForTesting
import org.cru.godtools.shared.common.model.Uri
import org.cru.godtools.shared.tool.parser.ParserConfig.Companion.FEATURE_ANIMATION
import org.cru.godtools.shared.tool.parser.xml.XmlPullParser
import org.cru.godtools.shared.tool.parser.xml.skipTag
import kotlin.experimental.ExperimentalObjCRefinement
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.js.JsName
import kotlin.native.HiddenFromObjC

private const val XML_RESOURCE = "resource"
private const val XML_LOOP = "loop"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
package org.cru.godtools.shared.tool.parser.model

import io.github.aakira.napier.Napier
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName
import org.ccci.gto.support.androidx.annotation.RestrictTo
import org.ccci.gto.support.androidx.annotation.RestrictToScope
import org.ccci.gto.support.androidx.annotation.VisibleForTesting
Expand All @@ -18,10 +22,6 @@ import org.cru.godtools.shared.tool.parser.model.Dimension.Companion.toDimension
import org.cru.godtools.shared.tool.parser.model.Dimension.Pixels
import org.cru.godtools.shared.tool.parser.model.Gravity.Companion.toGravityOrNull
import org.cru.godtools.shared.tool.parser.xml.XmlPullParser
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName

private const val XML_COLOR = "color"
private const val XML_TYPE = "type"
Expand Down Expand Up @@ -170,7 +170,9 @@ class Button : Content, HasAnalyticsEvents, Clickable {
// endregion HasAnalyticsEvents

internal enum class Type {
EVENT, URL, UNKNOWN;
EVENT,
URL,
UNKNOWN;

internal companion object {
val DEFAULT = UNKNOWN
Expand All @@ -184,7 +186,9 @@ class Button : Content, HasAnalyticsEvents, Clickable {
}

enum class Style {
CONTAINED, OUTLINED, UNKNOWN;
CONTAINED,
OUTLINED,
UNKNOWN;

internal companion object {
fun String.toButtonStyle() = when (this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

package org.cru.godtools.shared.tool.parser.model

import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName
import org.ccci.gto.support.androidx.annotation.RestrictTo
import org.ccci.gto.support.androidx.annotation.RestrictToScope
import org.cru.godtools.shared.common.model.Uri
import org.cru.godtools.shared.tool.parser.ParserConfig.Companion.FEATURE_CONTENT_CARD
import org.cru.godtools.shared.tool.parser.xml.XmlPullParser
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName

@JsExport
@OptIn(ExperimentalJsExport::class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
package org.cru.godtools.shared.tool.parser.model

import io.github.aakira.napier.Napier
import org.cru.godtools.shared.common.model.Uri
import org.cru.godtools.shared.common.model.toUriOrNull
import org.cru.godtools.shared.tool.parser.internal.DeprecationException
import org.cru.godtools.shared.tool.parser.util.hasUriScheme
import org.cru.godtools.shared.tool.parser.util.toAbsoluteUriOrNull
import org.cru.godtools.shared.tool.parser.xml.XmlPullParser
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
Expand All @@ -15,6 +9,12 @@ import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.js.JsName
import kotlin.native.HiddenFromObjC
import org.cru.godtools.shared.common.model.Uri
import org.cru.godtools.shared.common.model.toUriOrNull
import org.cru.godtools.shared.tool.parser.internal.DeprecationException
import org.cru.godtools.shared.tool.parser.util.hasUriScheme
import org.cru.godtools.shared.tool.parser.util.toAbsoluteUriOrNull
import org.cru.godtools.shared.tool.parser.xml.XmlPullParser

private const val XML_EVENTS = "events"
private const val XML_URL = "url"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.cru.godtools.shared.tool.parser.model

import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import org.ccci.gto.support.androidx.annotation.RestrictTo
import org.ccci.gto.support.androidx.annotation.RestrictToScope
import org.ccci.gto.support.androidx.annotation.VisibleForTesting
Expand All @@ -13,8 +15,6 @@ import org.cru.godtools.shared.tool.parser.model.tips.Tip
import org.cru.godtools.shared.tool.parser.model.tips.XMLNS_TRAINING
import org.cru.godtools.shared.tool.parser.util.REGEX_SEQUENCE_SEPARATOR
import org.cru.godtools.shared.tool.parser.xml.XmlPullParser
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport

private const val XML_REQUIRED_FEATURES = "required-features"
private const val XML_REQUIRED_DEVICE_TYPE = "required-device-type"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ private const val XML_DEVICE_TYPE_MOBILE = "mobile"
private const val XML_DEVICE_TYPE_WEB = "web"

enum class DeviceType {
ANDROID, IOS, MOBILE, WEB, UNKNOWN;
ANDROID,
IOS,
MOBILE,
WEB,
UNKNOWN;

internal companion object {
internal val ALL = values().toSet()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.cru.godtools.shared.tool.parser.model

import org.cru.godtools.shared.tool.parser.util.contains
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.native.concurrent.SharedImmutable
import org.cru.godtools.shared.tool.parser.util.contains

@SharedImmutable
private val REGEX_PERCENT = Regex("^(100|[0-9]{1,2}(\\.[0-9]+)?)%$")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.cru.godtools.shared.tool.parser.model

import org.ccci.gto.support.androidx.annotation.VisibleForTesting
import org.cru.godtools.shared.tool.parser.util.REGEX_SEQUENCE_SEPARATOR
import org.cru.godtools.shared.tool.state.State
import kotlin.experimental.ExperimentalObjCRefinement
import kotlin.js.ExperimentalJsExport
import kotlin.js.JsExport
import kotlin.native.HiddenFromObjC
import org.ccci.gto.support.androidx.annotation.VisibleForTesting
import org.cru.godtools.shared.tool.parser.util.REGEX_SEQUENCE_SEPARATOR
import org.cru.godtools.shared.tool.state.State

private const val EVENT_NAMESPACE_FOLLOWUP = "followup"
@VisibleForTesting
Expand Down
Loading
Loading