-
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.
- Loading branch information
Showing
15 changed files
with
596 additions
and
180 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,16 @@ | ||
// | ||
// Color.swift | ||
// MullvadVPN | ||
// | ||
// Created by Jon Petersson on 2024-12-06. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
extension Color { | ||
/// Returns the color darker by the given percent (in range from 0..1) | ||
func darkened(by percent: CGFloat) -> Color? { | ||
UIColor(self).darkened(by: percent)?.color | ||
} | ||
} |
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
48 changes: 48 additions & 0 deletions
48
ios/MullvadVPN/View controllers/Tunnel/FeatureIndicators/ActivityIndicator.swift
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,48 @@ | ||
// | ||
// ActivityIndicator.swift | ||
// MullvadVPN | ||
// | ||
// Created by Jon Petersson on 2024-12-10. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct CustomProgressView: View { | ||
var style: Style | ||
@State private var angle: Double = 0 | ||
|
||
var body: some View { | ||
Image(.iconSpinner) | ||
.resizable() | ||
.frame(width: style.size.width, height: style.size.height) | ||
.rotationEffect(.degrees(angle)) | ||
.onAppear { | ||
withAnimation(Animation.linear(duration: 0.6).repeatForever(autoreverses: false)) { | ||
angle = 360 | ||
} | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
CustomProgressView(style: .large) | ||
.background(UIColor.secondaryColor.color) | ||
} | ||
|
||
extension CustomProgressView { | ||
enum Style { | ||
case small, medium, large | ||
|
||
var size: CGSize { | ||
switch self { | ||
case .small: | ||
CGSize(width: 16, height: 16) | ||
case .medium: | ||
CGSize(width: 20, height: 20) | ||
case .large: | ||
CGSize(width: 60, height: 60) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.