Skip to content

Commit

Permalink
Several improvements to the onboarding UI
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoreymendez committed Aug 9, 2023
1 parent 385e810 commit caf1e59
Show file tree
Hide file tree
Showing 17 changed files with 341 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,21 @@ extension UserDefaults {
}.eraseToAnyPublisher()
}
}

extension NetworkProtectionUI.OnboardingStatus {
/// The default onboarding status.
///
/// This default is defined in our browser app because it's inherently tied to the specific build-configuration of the browser
/// app:
/// - For AppStore builds the default is asking the user to allow the VPN configuration.
/// - For DeveloperID builds the default is asking the user to allow the System Extension.
///
public static let `default`: OnboardingStatus = {
#if NETP_SYSTEM_EXTENSION
.isOnboarding(step: .userNeedsToAllowExtension)
#else
.isOnboarding(step: .userNeedsToAllowVPNConfiguration)
#endif
}()
}

Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,6 @@ public enum OnboardingStatus: RawRepresentable {

case isOnboarding(step: OnboardingStep)

/// The default onboarding status.
///
/// For AppStore builds the default is asking the user to allow the VPN configuration.
/// For DeveloperID builds the default is asking the user to allow the System Extension.
///
public static let `default`: OnboardingStatus = {
#if NETP_SYSTEM_EXTENSION
.isOnboarding(step: .userNeedsToAllowExtension)
#else
.isOnboarding(step: .userNeedsToAllowVPNConfiguration)
#endif
}()

public init?(rawValue: Int) {
if rawValue == 0 {
self = .completed
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// NetworkProtectionColor.swift
//
// Copyright © 2022 DuckDuckGo. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Foundation
import SwiftUI

extension Color {
/// Convenience initializer to make it easier to use our custom colors.
///
init(_ networkProtectionColor: NetworkProtectionColor) {
self = networkProtectionColor.asColor
}
}

/// NetworkProtectionUI bundled color definitions
///
enum NetworkProtectionColor: String {
case alertBubbleBackground = "AlertBubbleBackground"
case defaultText = "TextColor"
case linkColor = "LinkBlueColor"
case onboardingStepBorder = "OnboardingStepBorderColor"
case onboardingStepBackground = "OnboardingStepBackgroundColor"

var asColor: Color {
Color(rawValue, bundle: .module)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.010",
"blue" : "0x00",
"green" : "0x00",
"red" : "0x00"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.030",
"blue" : "0xFF",
"green" : "0xFF",
"red" : "0xFF"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.090",
"blue" : "0x00",
"green" : "0x00",
"red" : "0x00"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.090",
"blue" : "0xFF",
"green" : "0xFF",
"red" : "0xFF"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "[email protected]",
"filename" : "image 40.pdf",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "vpn-icon@2x 1.png",
"filename" : "image 39.pdf",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "settings-example@2x 2.png",
"filename" : "Mask group.pdf",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit caf1e59

Please sign in to comment.