-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix-deprecation-warning-for-button-ios-856'
- Loading branch information
Showing
10 changed files
with
147 additions
and
284 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// CGSize+Helpers.swift | ||
// MullvadVPN | ||
// | ||
// Created by Mojgan on 2024-10-10. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
extension CGSize { | ||
// Function to deduct insets from CGSize | ||
func deducting(insets: NSDirectionalEdgeInsets) -> CGSize { | ||
let newWidth = width - (insets.leading + insets.trailing) | ||
let newHeight = height - (insets.top + insets.bottom) | ||
return CGSize(width: newWidth, height: newHeight) | ||
} | ||
} |
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,29 @@ | ||
// | ||
// UIImage+Helpers.swift | ||
// MullvadVPN | ||
// | ||
// Created by Mojgan on 2024-10-10. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
extension UIImage { | ||
// Function to resize image while keeping aspect ratio | ||
func resizeImage(targetSize: CGSize) -> UIImage { | ||
let widthRatio = targetSize.width / size.width | ||
let heightRatio = targetSize.height / size.height | ||
let scaleFactor = min(widthRatio, heightRatio) | ||
|
||
// Calculate new size based on the scale factor | ||
let newSize = CGSize(width: size.width * scaleFactor, height: size.height * scaleFactor) | ||
let renderer = UIGraphicsImageRenderer(size: newSize) | ||
|
||
// Render the new image | ||
let resizedImage = renderer.image { _ in | ||
draw(in: CGRect(origin: .zero, size: newSize)) | ||
} | ||
|
||
return resizedImage.withRenderingMode(renderingMode) | ||
} | ||
} |
21 changes: 0 additions & 21 deletions
21
ios/MullvadVPN/UI appearance/NSDirectionalEdgeInsets+Helpers.swift
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.