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

[ios_platform_images] migrate objC to swift #4847

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ad9ed35
[ios_platform_images] migrate objC to swift
Mairramer Sep 5, 2023
e5545bc
pump version
Mairramer Sep 5, 2023
cf21182
added some tests
Mairramer Sep 6, 2023
008d5d3
update tests
Mairramer Sep 8, 2023
e422e78
Merge branch 'main' into ios_platform_images_swift_migration
Mairramer Sep 8, 2023
b0122cf
fix format
Mairramer Sep 8, 2023
54b9b92
Merge branch 'main' into ios_platform_images_swift_migration
Mairramer Sep 9, 2023
6c29139
Merge branch 'main' into ios_platform_images_swift_migration
Mairramer Sep 10, 2023
f3ce031
improve code
Mairramer Sep 11, 2023
100202a
rollback comment
Mairramer Sep 11, 2023
97dc083
pump version
Mairramer Sep 11, 2023
1a28d20
Merge branch 'main' into ios_platform_images_swift_migration
Mairramer Sep 13, 2023
8da12bd
rollback implementation
Mairramer Sep 13, 2023
50ce448
rollback original logic
Mairramer Sep 14, 2023
59d7b6d
fix logic
Mairramer Sep 14, 2023
17a369e
rollback logic
Mairramer Sep 14, 2023
cfbf55f
Merge branch 'main' into ios_platform_images_swift_migration
Mairramer Sep 14, 2023
101c190
fix test
Mairramer Sep 14, 2023
1d2969b
fix test
Mairramer Sep 14, 2023
372ce11
fix scaled image and migrate tests
Mairramer Oct 13, 2023
523a277
Merge remote-tracking branch 'origin/main' into ios_platform_images_s…
Mairramer Oct 13, 2023
aef7985
migrate pigeon to swift
Mairramer Oct 13, 2023
78cbc82
format code
Mairramer Oct 13, 2023
45d185d
fix build script
Mairramer Oct 13, 2023
a9a4879
improves
Mairramer Oct 13, 2023
364be83
update readme
Mairramer Oct 13, 2023
aae7a29
rollback objC test
Mairramer Oct 17, 2023
cbbc208
fix test import
Mairramer Oct 17, 2023
ac54592
improves
Mairramer Oct 17, 2023
3e66718
improve test
Mairramer Oct 17, 2023
71f2589
fix test
Mairramer Oct 17, 2023
e2d9a9a
Merge branch 'main' into ios_platform_images_swift_migration
Mairramer Oct 17, 2023
3324ccd
rollback
Mairramer Oct 17, 2023
e370d61
update readme
Mairramer Oct 17, 2023
b25d574
Revert whitespace change in podfile
stuartmorgan Oct 20, 2023
5d03976
TODO style fix
stuartmorgan Oct 20, 2023
eaf7c90
Re-add DEFINES_MODULE
stuartmorgan Oct 20, 2023
139e125
Merge branch 'main' into ios_platform_images_swift_migration
stuartmorgan Oct 20, 2023
6ea1fc0
Merge branch 'main' into ios_platform_images_swift_migration
Mairramer Oct 20, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,22 @@ class IosPlatformImagesTests: XCTestCase {
}

func testResolveURL() {
let resourceName = "textfile"
let extensionName: String? = nil
do {
let url = try plugin.resolveUrl(resourceName: resourceName, extension: extensionName)
let url = try plugin.resolveUrl(resourceName: "textfile", extension: nil)
XCTAssertNotNil(url)
XCTAssertTrue(url!.contains(resourceName))
XCTAssertTrue(url?.contains("textfile") ?? false)
Mairramer marked this conversation as resolved.
Show resolved Hide resolved
} catch {
XCTFail("Error while resolving URL: \(error)")
}
}

func testResolveURLNotFound() {
let resourceName = "notFound"
let extensionName: String? = nil
do {
let url = try plugin.resolveUrl(resourceName: resourceName, extension: extensionName)
let url = try plugin.resolveUrl(resourceName: "notFound", extension: nil)
XCTAssertNil(url)
} catch {
XCTFail("Error while resolving URL: \(error)")
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import UIKit
///
/// Note: We don't yet support images from package dependencies (ex.
/// `AssetImage('icons/heart.png', package: 'my_icons')`).

public static func flutterImageWithName(_ name: String) -> UIImage? {
let filename = (name as NSString).lastPathComponent
let path = (name as NSString).deletingLastPathComponent
Mairramer marked this conversation as resolved.
Show resolved Hide resolved

for screenScale in stride(from: Int(UIScreen.main.scale), to: 1, by: -1) {
//TODO(hellohuanlin): This should be fixed, because it's path uses double slash.
let key = FlutterDartProject.lookupKey(forAsset: "\(path)/\(screenScale).0x/\(filename)")
if let image = UIImage(named: key, in: Bundle.main, compatibleWith: nil) {
return image
Expand Down