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

62: Use v2 for getgovroam #66

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Q: How to update the included discovery fallback files?
A: Run these commands:

curl --silent --compressed 'https://discovery.eduroam.app/v2/discovery.json' > geteduroam/discovery.json
curl --silent --compressed 'https://discovery.govroam.app/v2/discovery.json' > getgovroam/discovery.json
curl --silent --compressed 'https://getgovroam.nl/v2/discovery.json' > getgovroam/discovery.json

## License

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-case-paths",
"state" : {
"revision" : "5da6989aae464f324eef5c5b52bdb7974725ab81",
"version" : "1.0.0"
"revision" : "ed7facdd4a361514b46e3bbc6238cd41c84be4ec",
"version" : "1.1.1"
}
},
{
Expand All @@ -50,44 +50,44 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections",
"state" : {
"revision" : "937e904258d22af6e447a0b72c0bc67583ef64a2",
"version" : "1.0.4"
"revision" : "a902f1823a7ff3c9ab2fba0f992396b948eda307",
"version" : "1.0.5"
}
},
{
"identity" : "swift-composable-architecture",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-composable-architecture",
"state" : {
"revision" : "a7c1f799b55ecb418f85094b142565834f7ee7c7",
"version" : "1.2.0"
"revision" : "3f80eb9ed07c16a9f42ac4f23d4dafaa0494568c",
"version" : "1.5.0"
}
},
{
"identity" : "swift-concurrency-extras",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-concurrency-extras",
"state" : {
"revision" : "ea631ce892687f5432a833312292b80db238186a",
"version" : "1.0.0"
"revision" : "bb5059bde9022d69ac516803f4f227d8ac967f71",
"version" : "1.1.0"
}
},
{
"identity" : "swift-custom-dump",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "edd66cace818e1b1c6f1b3349bb1d8e00d6f8b01",
"version" : "1.0.0"
"revision" : "65fc9e2b62727cacfab9fc60d580c284a4b9308c",
"version" : "1.1.1"
}
},
{
"identity" : "swift-dependencies",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-dependencies",
"state" : {
"revision" : "4e1eb6e28afe723286d8cc60611237ffbddba7c5",
"version" : "1.0.0"
"revision" : "63301f4a181ed9aefb46dccef2dfb66466798341",
"version" : "1.1.1"
}
},
{
Expand All @@ -108,6 +108,15 @@
"version" : "0.13.0"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036",
"version" : "509.0.2"
}
},
{
"identity" : "swift-url-routing",
"kind" : "remoteSourceControl",
Expand All @@ -122,8 +131,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swiftui-navigation",
"state" : {
"revision" : "f5bcdac5b6bb3f826916b14705f37a3937c2fd34",
"version" : "1.0.0"
"revision" : "78f9d72cf667adb47e2040aa373185c88c63f0dc",
"version" : "1.2.0"
}
},
{
Expand Down
15 changes: 11 additions & 4 deletions geteduroam/GeteduroamPackage/Sources/Connect/ConnectFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import NotificationClient
import SwiftUI
import XMLCoder

@Reducer
public struct Connect: Reducer {
public init() { }

Expand Down Expand Up @@ -194,6 +195,7 @@ public struct Connect: Reducer {
public enum Alert: Equatable { }
}

@Reducer
public struct Destination: Reducer {
public enum State: Equatable {
case alert(AlertState<AlertAction>)
Expand Down Expand Up @@ -235,6 +237,7 @@ public struct Connect: Reducer {
case missingProfileType
case missingTermsAcceptance(ProviderInfo?)
case missingTokenEndpoint
case missingOAuthInfo
case mobileConfigFailed(ProviderInfo?)
case noValidProviderFound(ProviderInfo?)
case redirectToWebsite(URL?)
Expand All @@ -243,7 +246,7 @@ public struct Connect: Reducer {

var providerInfo: ProviderInfo? {
switch self {
case .missingAuthorizationEndpoint, .missingTokenEndpoint, .missingEAPConfigEndpoint, .missingProfileType, .missingMobileConfigEndpoint, .redirectToWebsite:
case .missingAuthorizationEndpoint, .missingTokenEndpoint, .missingOAuthInfo, .missingEAPConfigEndpoint, .missingProfileType, .missingMobileConfigEndpoint, .redirectToWebsite:
return nil
case let .missingTermsAcceptance(info), let .noValidProviderFound(info), let .eapConfigurationFailed(_, info), let .mobileConfigFailed(info), let .userCancelled(info), let .unknownError(_, info):
return info
Expand All @@ -261,6 +264,9 @@ public struct Connect: Reducer {
case .missingTokenEndpoint:
return NSLocalizedString("Missing information to start authentication.", bundle: .module, comment: "missingTokenEndpoint")

case .missingOAuthInfo:
return NSLocalizedString("Missing information to start authentication.", bundle: .module, comment: "missingOAuthInfo")

case .missingEAPConfigEndpoint:
return NSLocalizedString("Missing information to start configuration.", comment: "missingEAPConfigEndpoint")

Expand Down Expand Up @@ -534,7 +540,7 @@ public struct Connect: Reducer {

}
}
.ifLet(\.$destination, action: /Action.destination) {
.ifLet(\.$destination, action: \.destination) {
Destination()
}
}
Expand Down Expand Up @@ -594,9 +600,10 @@ public struct Connect: Reducer {
let configuration = OIDServiceConfiguration(authorizationEndpoint: authorizationEndpoint, tokenEndpoint: tokenEndpoint)

// Build authentication request
let clientId = "app.eduroam.geteduroam"
guard let clientId = Bundle.main.bundleIdentifier, let redirectURLString = Bundle.main.infoDictionary?["OAuthRedirectURL"] as? String, let redirectURL = URL(string: redirectURLString) else {
throw OrganizationSetupError.missingOAuthInfo
}
let scope = "eap-metadata"
let redirectURL = URL(string: "app.eduroam.geteduroam:/")!
let codeVerifier = OIDAuthorizationRequest.generateCodeVerifier()
let codeChallange = OIDAuthorizationRequest.codeChallengeS256(forVerifier: codeVerifier)
let state = UUID().uuidString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@
}
},
"Connect" : {

"localizations" : {
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Verbind"
}
}
}
},
"CONNECT" : {
"localizations" : {
Expand All @@ -65,16 +72,44 @@
}
},
"Continue" : {

"localizations" : {
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ga verder"
}
}
}
},
"Continue in System Preferences" : {

"localizations" : {
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ga verder in Systeemvoorkeuren"
}
}
}
},
"Continue in System Settings" : {

"localizations" : {
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ga verder in Systeeminstellingen"
}
}
}
},
"Continue to Website" : {

"localizations" : {
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ga verder naar webpagina"
}
}
}
},
"Disagree" : {
"localizations" : {
Expand All @@ -87,7 +122,14 @@
}
},
"Double-click to review the profile and then press the \"Install…\" button to setup the network on your computer." : {

"localizations" : {
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Dubbelklik om het profiel te controleren en druk vervolgens op de \"Installeer\"-knop om het netwerk in te stellen op deze computer."
}
}
}
},
"Failed to connect" : {
"comment" : "Failed to connect",
Expand Down Expand Up @@ -131,10 +173,18 @@
}
},
"Missing information about profile." : {
"comment" : "missingProfileType"
"comment" : "missingProfileType",
"localizations" : {
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Informatie ontbreekt over profiel."
}
}
}
},
"Missing information to start authentication." : {
"comment" : "missingAuthorizationEndpoint\n missingTokenEndpoint",
"comment" : "missingAuthorizationEndpoint\n missingOAuthInfo\n missingTokenEndpoint",
"localizations" : {
"nl" : {
"stringUnit" : {
Expand Down Expand Up @@ -226,7 +276,14 @@
}
},
"Review the profile and then press the \"Install…\" button to setup the network on your computer." : {

"localizations" : {
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Controleeer het profiel en druk vervolgens op de \"Installeer\"-knop om het netwerk in te stellen op deze computer."
}
}
}
},
"Terms of Use" : {
"localizations" : {
Expand Down Expand Up @@ -260,7 +317,14 @@
}
},
"You are redirected to a website.\n\n(url)" : {

"localizations" : {
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Je wordt doorverwezen naar een webpagina.\n\n(url)"
}
}
}
},
"You must agree to the terms of use before you can use this network." : {
"localizations" : {
Expand Down
6 changes: 4 additions & 2 deletions geteduroam/GeteduroamPackage/Sources/Main/MainFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Foundation
import Models
import NotificationClient

@Reducer
public struct Main: Reducer {
public init() { }

Expand Down Expand Up @@ -51,6 +52,7 @@ public struct Main: Reducer {
case tryAgainTapped
}

@Reducer
public struct Destination: Reducer {
public enum State: Equatable {
case connect(Connect.State)
Expand All @@ -67,7 +69,7 @@ public struct Main: Reducer {
}

public var body: some Reducer<State, Action>{
Scope(state: /State.connect, action: /Action.connect) {
Scope(state: \.connect, action: \.connect) {
Connect()
}
}
Expand Down Expand Up @@ -191,7 +193,7 @@ public struct Main: Reducer {
return .none
}
}
.ifLet(\.$destination, action: /Action.destination) {
.ifLet(\.$destination, action: \.destination) {
Destination()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ public struct ProviderInfo: Codable, Equatable {
}

#if DEBUG
public let demoProviderInfo = ProviderInfo(displayName: [.init(language: nil, value: "Demo Provider")], description: [.init(language: "en", value: "English information about the demo provider.")], providerLocations: [.init(latitude: 12, longitude: 34)], providerLogo: nil, termsOfUse: [.init(language: "any", value: "You must behave yourself at all times.")], helpdesk: .init(emailAdress: [.init(language: "any", value: "[email protected]")], webAddress: [.init(language: "nl", value: "https://www.example.com/nl/"), .init(language: "any", value: "https://www.example.com/")], phone: [.init(language: nil, value: "+31551234567")]))
public let demoProviderInfo = ProviderInfo(displayName: [.init(language: nil, value: "Demo Provider")], description: [.init(language: "en", value: "English information about the demo provider.")], providerLocations: [.init(latitude: 12, longitude: 34)], providerLogo: LogoData(value: "data", mime: "mime", encoding: "encoding"), termsOfUse: [.init(language: "any", value: "You must behave yourself at all times.")], helpdesk: .init(emailAdress: [.init(language: "any", value: "[email protected]")], webAddress: [.init(language: "nl", value: "https://www.example.com/nl/"), .init(language: "any", value: "https://www.example.com/")], phone: [.init(language: nil, value: "+31551234567")]))
#endif
2 changes: 2 additions & 0 deletions geteduroam/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<string>1</string>
<key>DiscoveryURL</key>
<string>https://discovery.eduroam.app/v2/</string>
<key>OAuthRedirectURL</key>
<string>app.eduroam.geteduroam:/</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
Expand Down
9 changes: 8 additions & 1 deletion geteduroam/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"sourceLanguage" : "en",
"strings" : {
"geteduroam" : {

"localizations" : {
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "geteduroam"
}
}
}
},
"geteduroam Help" : {
"localizations" : {
Expand Down
2 changes: 1 addition & 1 deletion geteduroam/discovery.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion getgovroam/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
<key>CFBundleVersion</key>
<string>1</string>
<key>DiscoveryURL</key>
<string>https://discovery.govroam.app/v2/</string>
<string>https://getgovroam.nl/v2/</string>
<key>OAuthRedirectURL</key>
<string>app.govroam.getgovroam:/</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
Expand Down
Loading