-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Refactor data scratch-orientation
- Loading branch information
Piotr Adamczyk
committed
Apr 19, 2021
1 parent
f5f61c1
commit dc9d085
Showing
33 changed files
with
177 additions
and
48 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
test_runner/src/main/kotlin/ftl/adapter/GoogleOrientationFetch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package ftl.adapter | ||
|
||
import ftl.adapter.google.toApiModel | ||
import ftl.api.Orientation | ||
import ftl.api.Platform | ||
import ftl.client.google.AndroidCatalog | ||
import ftl.ios.IosCatalog | ||
|
||
object GoogleOrientationFetch : | ||
Orientation.Fetch, | ||
(String, Platform) -> List<Orientation> by { projectId, platform -> | ||
when (platform) { | ||
Platform.ANDROID -> AndroidCatalog.supportedOrientations(projectId).toApiModel() | ||
Platform.IOS -> IosCatalog.supportedOrientations(projectId).toApiModel() | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
test_runner/src/main/kotlin/ftl/adapter/google/OrientationsAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ftl.adapter.google | ||
|
||
import ftl.api.Orientation | ||
import com.google.testing.model.Orientation as GoogleApiOrientation | ||
|
||
internal fun List<GoogleApiOrientation>.toApiModel(): List<Orientation> = map { googleApiOrientation -> | ||
Orientation( | ||
id = googleApiOrientation.id ?: UNABLE, | ||
name = googleApiOrientation.name ?: UNABLE, | ||
tags = googleApiOrientation.tags ?: emptyList() | ||
) | ||
} | ||
|
||
private const val UNABLE = "[Unable to fetch]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package ftl.api | ||
|
||
import ftl.adapter.GoogleOrientationFetch | ||
|
||
val fetchOrientation: Orientation.Fetch get() = GoogleOrientationFetch | ||
|
||
data class Orientation( | ||
val id: String, | ||
val name: String, | ||
val tags: List<String>, | ||
) { | ||
interface Fetch : (String, Platform) -> List<Orientation> | ||
} | ||
|
||
enum class Platform { | ||
ANDROID, | ||
IOS | ||
} |
2 changes: 1 addition & 1 deletion
2
test_runner/src/main/kotlin/ftl/args/PrepareAndroidCommonConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
test_runner/src/main/kotlin/ftl/args/ValidateAndroidArgs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
test_runner/src/main/kotlin/ftl/domain/DescribeAndroidLocales.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
test_runner/src/main/kotlin/ftl/domain/DescribeAndroidModels.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
test_runner/src/main/kotlin/ftl/domain/DescribeAndroidVersions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 9 additions & 2 deletions
11
test_runner/src/main/kotlin/ftl/domain/ListAndroidOrientations.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
package ftl.domain | ||
|
||
import flank.common.logLn | ||
import ftl.android.AndroidCatalog | ||
import ftl.api.Platform | ||
import ftl.api.fetchOrientation | ||
import ftl.args.AndroidArgs | ||
import ftl.environment.common.toCliTable | ||
import java.nio.file.Paths | ||
|
||
interface ListAndroidOrientations { | ||
val configPath: String | ||
} | ||
|
||
operator fun ListAndroidOrientations.invoke() { | ||
logLn(AndroidCatalog.supportedOrientationsAsTable(AndroidArgs.loadOrDefault(Paths.get(configPath)).project)) | ||
logLn( | ||
fetchOrientation( | ||
AndroidArgs.loadOrDefault(Paths.get(configPath)).project, | ||
Platform.ANDROID | ||
).toCliTable() | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 10 additions & 2 deletions
12
test_runner/src/main/kotlin/ftl/domain/ListIosOrientations.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
package ftl.domain | ||
|
||
import flank.common.logLn | ||
import ftl.api.Platform | ||
import ftl.api.fetchOrientation | ||
import ftl.args.IosArgs | ||
import ftl.ios.IosCatalog | ||
import ftl.environment.common.toCliTable | ||
import java.nio.file.Paths | ||
|
||
interface ListIosOrientations { | ||
var configPath: String | ||
} | ||
|
||
operator fun ListIosOrientations.invoke() { | ||
logLn(IosCatalog.supportedOrientationsAsTable(IosArgs.loadOrDefault(Paths.get(configPath)).project)) | ||
// TODO move toCliTable() to presentation layer during refactor of presentation after #1728 | ||
logLn( | ||
fetchOrientation( | ||
IosArgs.loadOrDefault(Paths.get(configPath)).project, | ||
Platform.IOS | ||
).toCliTable() | ||
) | ||
} |
4 changes: 2 additions & 2 deletions
4
test_runner/src/main/kotlin/ftl/environment/NetworkConfigurationCatalog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
test_runner/src/main/kotlin/ftl/environment/common/ListOrientations.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
test_runner/src/main/kotlin/ftl/reports/outcome/BillableMinutes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.