-
Notifications
You must be signed in to change notification settings - Fork 133
Add tvOS support #745
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
Open
muralex-e
wants to merge
8
commits into
icerockdev:develop
Choose a base branch
from
muralex-e:tvos-support
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add tvOS support #745
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
be0c4d5
add tvOs source sets to extended convention
muralex-e a401a14
add tvOS source sets to apple main convention
muralex-e 0b468bd
implemented required expect classes and methods for tvOS
muralex-e 01583e6
add missing mocks for tvOS to resources-test project
muralex-e d811f52
refactoring for watchOS and tvoOS source sets in apple main convention
muralex-e 126b8e2
fixed ImageResource implementation for tvOS
muralex-e 6f8a812
added tvOS targets and sourcesets to mpp-librarary in resource-gallery
muralex-e d7518d4
created tvOS app in the resources gallery
muralex-e File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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: 11 additions & 0 deletions
11
resources-test/src/tvosMain/kotlin/dev/icerock/moko/resources/test/MockResourcesFactory.kt
This file contains hidden or 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,11 @@ | ||
| /* | ||
| * Copyright 2024 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
| */ | ||
|
|
||
| package dev.icerock.moko.resources.test | ||
|
|
||
| import dev.icerock.moko.resources.FontResource | ||
| import dev.icerock.moko.resources.ImageResource | ||
|
|
||
| actual fun createImageResourceMock(): ImageResource = ImageResource("") | ||
| actual fun createFontResourceMock(): FontResource = FontResource("") |
26 changes: 26 additions & 0 deletions
26
resources/src/tvosMain/kotlin/dev/icerock/moko/resources/FileResource.tvos.kt
This file contains hidden or 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,26 @@ | ||
| /* | ||
| * Copyright 2024 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
| */ | ||
|
|
||
| package dev.icerock.moko.resources | ||
|
|
||
| import kotlinx.cinterop.CPointer | ||
| import kotlinx.cinterop.ExperimentalForeignApi | ||
| import kotlinx.cinterop.ObjCObjectVar | ||
| import kotlinx.cinterop.UnsafeNumber | ||
| import platform.Foundation.NSError | ||
| import platform.Foundation.NSString | ||
| import platform.Foundation.NSUTF8StringEncoding | ||
| import platform.Foundation.stringWithContentsOfFile | ||
|
|
||
| @OptIn(ExperimentalForeignApi::class, UnsafeNumber::class) | ||
| internal actual fun readContentOfFile( | ||
| filePath: String, | ||
| error: CPointer<ObjCObjectVar<NSError?>>?, | ||
| ): String? { | ||
| return NSString.stringWithContentsOfFile( | ||
| path = filePath, | ||
| encoding = NSUTF8StringEncoding, | ||
| error = error | ||
| ) | ||
| } |
13 changes: 13 additions & 0 deletions
13
resources/src/tvosMain/kotlin/dev/icerock/moko/resources/ImageResource.kt
This file contains hidden or 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,13 @@ | ||
| /* | ||
| * Copyright 2024 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
| */ | ||
|
|
||
| package dev.icerock.moko.resources | ||
|
|
||
| import platform.UIKit.UIImage | ||
|
|
||
| actual class ImageResource(val assetImageName: String) { | ||
| fun toUIImage(): UIImage? { | ||
| return UIImage.imageNamed(name = assetImageName) | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
resources/src/tvosMain/kotlin/dev/icerock/moko/resources/ResourceContainerExt.kt
This file contains hidden or 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,11 @@ | ||
| /* | ||
| * Copyright 2024 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
| */ | ||
|
|
||
| package dev.icerock.moko.resources | ||
|
|
||
| actual fun ResourceContainer<ImageResource>.getImageByFileName(fileName: String): ImageResource? { | ||
| return ImageResource(fileName).let { imgRes -> | ||
| if (imgRes.toUIImage() != null) imgRes else null | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.