generated from element-hq/.github
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#40: Add server selection screen from EI.
- Loading branch information
Showing
32 changed files
with
710 additions
and
40 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
15 changes: 15 additions & 0 deletions
15
...ources/Assets.xcassets/Images/Authentication/Server Selection Icon.imageset/Contents.json
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,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "authentication_server_selection_icon.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...ication/Server Selection Icon.imageset/authentication_server_selection_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
41 changes: 41 additions & 0 deletions
41
ElementX/Sources/Screens/Authentication/AuthenticationIconImage.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,41 @@ | ||
// | ||
// Copyright 2022 New Vector Ltd | ||
// | ||
// 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 SwiftUI | ||
|
||
/// An image that is styled for use as the screen icon in the onboarding flow. | ||
struct AuthenticationIconImage: View { | ||
|
||
let image: ImageAsset | ||
|
||
var body: some View { | ||
Image(image.name) | ||
.resizable() | ||
.renderingMode(.template) | ||
.foregroundColor(.element.accent) | ||
.frame(width: 90, height: 90) | ||
.background(.white, in: Circle().inset(by: 2)) | ||
.accessibilityHidden(true) | ||
} | ||
} | ||
|
||
// MARK: - Previews | ||
|
||
struct AuthenticationIconImage_Previews: PreviewProvider { | ||
static var previews: some View { | ||
AuthenticationIconImage(image: Asset.Images.serverSelectionIcon) | ||
} | ||
} |
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
44 changes: 44 additions & 0 deletions
44
ElementX/Sources/Screens/Authentication/ServerSelection/MockServerSelectionScreenState.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,44 @@ | ||
// | ||
// Copyright 2021 New Vector Ltd | ||
// | ||
// 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 SwiftUI | ||
|
||
enum MockServerSelectionScreenState: CaseIterable { | ||
case matrix | ||
case emptyAddress | ||
case invalidAddress | ||
case nonModal | ||
|
||
/// Generate the view struct for the screen state. | ||
@MainActor var viewModel: ServerSelectionViewModel { | ||
switch self { | ||
case .matrix: | ||
return ServerSelectionViewModel(homeserverAddress: "https://matrix.org", | ||
hasModalPresentation: true) | ||
case .emptyAddress: | ||
return ServerSelectionViewModel(homeserverAddress: "", | ||
hasModalPresentation: true) | ||
case .invalidAddress: | ||
let viewModel = ServerSelectionViewModel(homeserverAddress: "thisisbad", | ||
hasModalPresentation: true) | ||
viewModel.displayError(.footerMessage(ElementL10n.unknownError)) | ||
return viewModel | ||
case .nonModal: | ||
return ServerSelectionViewModel(homeserverAddress: "https://matrix.org", | ||
hasModalPresentation: false) | ||
} | ||
} | ||
} |
Oops, something went wrong.