Skip to content

Commit

Permalink
feat: Update/move URLs for C1 and C3 WPB-9748 (#1718)
Browse files Browse the repository at this point in the history
Co-authored-by: François Benaiteau <netbe@users.noreply.github.com>
  • Loading branch information
KaterinaWire and netbe authored Jul 23, 2024
1 parent 06e1b84 commit 174fe5b
Show file tree
Hide file tree
Showing 35 changed files with 262 additions and 222 deletions.
2 changes: 1 addition & 1 deletion wire-ios-build-assets
21 changes: 19 additions & 2 deletions wire-ios/Configuration/url.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
{
"wireAppOnItunes": "https://geo.itunes.apple.com/us/app/wire/id930944768?mt=8",
"appOnItunes": "https://geo.itunes.apple.com/us/app/wire/id930944768?mt=8",
"support": "https://support.wire.com",
"randomProfilePictureSource": "https://source.unsplash.com/800x800/?landscape"
"searchSupport": "https://support.wire.com/hc",
"website": "https://wire.com",
"emailAlreadyInUse": "https://support.wire.com/hc/articles/115004082129-My-email-address-is-already-in-use-and-I-cannot-create-an-account-What-can-I-do-",
"whyToVerifyFingerprintArticle": "https://support.wire.com/hc/articles/207859815-Why-should-I-verify-my-conversations",
"howToVerifyFingerprintArticle": "https://support.wire.com/hc/articles/207692235-How-can-I-compare-key-fingerprints-",
"privacyPolicy": "https://wire.com/privacy-policy",
"legal": "https://wire.com/legal",
"licenseInformation": "https://start.wire.com/en-us/en-us/terms-of-use-personal-0-0",
"passwordReset": "https://account.wire.com/forgot",
"askSupportArticle": "https://support.wire.com/hc/requests/new",
"reportAbuse": "https://support.wire.com/hc/requests/new",
"wireEnterpriseInfo": "https://wire.com/pricing",
"legalHoldInfo": "https://support.wire.com/hc/articles/360002018278-What-is-legal-hold-",
"guestLinksInfo": "https://support.wire.com/hc/articles/360000574069-Share-a-link-with-a-person-without-a-Wire-account-to-join-a-guest-room-conversation-in-my-team",
"unreachableBackendInfo": "https://support.wire.com/hc/articles/9357718008093-Backend",
"federationInfo": "https://support.wire.com/hc/categories/4719917054365-Federation",
"mlsInfo": "https://support.wire.com/hc/articles/12434725011485-Messaging-Layer-Security-MLS-",
"endToEndIdentityInfo": "https://support.wire.com/hc/articles/9211300150685-End-to-end-identity"
}
31 changes: 1 addition & 30 deletions wire-ios/Wire-iOS Tests/Bundle/URL+WireTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import XCTest
import WireTransport
import WireCommonComponents
@testable import Wire

final class URL_WireTests: XCTestCase {
Expand All @@ -37,38 +38,8 @@ final class URL_WireTests: XCTestCase {
super.tearDown()
}

func testThatWebsiteURLsAreLoadedCorrectly() {
let websiteURL = URL(string: "https://wire.com")!
XCTAssertEqual(be.websiteURL, websiteURL)
XCTAssertEqual(URL.wr_usernameLearnMore, websiteURL.appendingPathComponent("support/username"))
XCTAssertEqual(URL.wr_privacyPolicy, websiteURL.appendingPathComponent("legal"))
XCTAssertEqual(URL.wr_licenseInformation, websiteURL.appendingPathComponent("legal/licenses/embed"))
XCTAssertEqual(URL.wr_cannotDecryptHelp, websiteURL.appendingPathComponent("privacy/error-1"))
XCTAssertEqual(URL.wr_cannotDecryptNewRemoteIDHelp, websiteURL.appendingPathComponent("privacy/error-2"))
XCTAssertEqual(URL.wr_createTeamFeatures, websiteURL.appendingPathComponent("teams/learnmore"))
XCTAssertEqual(URL.wr_emailInUseLearnMore, websiteURL.appendingPathComponent("support/email-in-use"))
XCTAssertEqual(URL.wr_termsOfServicesURL, websiteURL.appendingPathComponent("legal"))
XCTAssertEqual(URL.wr_legal, websiteURL.appendingPathComponent("legal"))
}

func testThatSupportURLsAreLoadedCorrectly() {
let supportURL = URL(string: "https://support.wire.com")!
XCTAssertEqual(WireURL.shared.support, supportURL)
XCTAssertEqual(URL.wr_emailAlreadyInUseLearnMore, supportURL.appendingPathComponent("hc/en-us/articles/115004082129-My-email-address-is-already-in-use-and-I-cannot-create-an-account-What-can-I-do-"))
XCTAssertEqual(URL.wr_askSupport,
supportURL.appendingPathComponent("hc/requests/new"))
XCTAssertEqual(URL.wr_fingerprintLearnMore,
supportURL.appendingPathComponent("hc/articles/207859815-Why-should-I-verify-my-conversations"))
XCTAssertEqual(URL.wr_fingerprintHowToVerify,
supportURL.appendingPathComponent("hc/articles/207692235-How-can-I-compare-key-fingerprints-"))
XCTAssertEqual(URL.wr_reportAbuse,
supportURL.appendingPathComponent("hc/requests/new"))

}

func testThatAccountURLsAreLoadedCorrectly() {
let accountsURL = URL(string: "https://account.wire.com")!
XCTAssertEqual(be.accountsURL, accountsURL)
XCTAssertEqual(URL.wr_passwordReset, accountsURL.appendingPathComponent("forgot"))
}
}
36 changes: 36 additions & 0 deletions wire-ios/Wire-iOS Tests/Bundle/URLsTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// Wire
// Copyright (C) 2024 Wire Swiss GmbH
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//

import XCTest
import WireCommonComponents
@testable import Wire

final class URLsTests: XCTestCase {

func testUrlFileContainsAllKeys() throws {
// Given
guard let fileURL = Bundle.fileURL(for: "url", with: "json") else {
XCTFail("Failed to load url.json file")
return
}

// When / Then
XCTAssertNoThrow(try fileURL.decode(WireURLs.self))
}

}
16 changes: 16 additions & 0 deletions wire-ios/Wire-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
06717E592865179000AF442C /* SemanticColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06717E582865178F00AF442C /* SemanticColors.swift */; };
06717E5C2865183600AF442C /* Stylable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06717E5B2865183600AF442C /* Stylable.swift */; };
06717E5E2865188000AF442C /* SemanticColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06717E582865178F00AF442C /* SemanticColors.swift */; };
0679DEDE2C47C48400044FC7 /* Bundle+WireURLs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0679DED92C46951B00044FC7 /* Bundle+WireURLs.swift */; };
0679DEE12C49729500044FC7 /* URLsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0679DEE02C49729500044FC7 /* URLsTests.swift */; };
067EF352288FCAB700B2659A /* Accessibility.strings in Resources */ = {isa = PBXBuildFile; fileRef = 067EF350288FCAB600B2659A /* Accessibility.strings */; };
067F605D28B8EC8000FCC334 /* DebugCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067F605C28B8EC8000FCC334 /* DebugCommand.swift */; };
0685008126B35E7A00721F80 /* AudioMessageRestrictionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0685008026B35E7A00721F80 /* AudioMessageRestrictionView.swift */; };
Expand Down Expand Up @@ -2104,6 +2106,8 @@
0667FE302384237E00F75F93 /* UICollectionView+SetMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UICollectionView+SetMessage.swift"; sourceTree = "<group>"; };
06717E582865178F00AF442C /* SemanticColors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SemanticColors.swift; sourceTree = "<group>"; };
06717E5B2865183600AF442C /* Stylable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Stylable.swift; sourceTree = "<group>"; };
0679DED92C46951B00044FC7 /* Bundle+WireURLs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+WireURLs.swift"; sourceTree = "<group>"; };
0679DEE02C49729500044FC7 /* URLsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLsTests.swift; sourceTree = "<group>"; };
067EF351288FCAB600B2659A /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Accessibility.strings; sourceTree = "<group>"; };
067EF353288FCABF00B2659A /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Accessibility.strings; sourceTree = "<group>"; };
067EF354288FCAC100B2659A /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Accessibility.strings"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4228,6 +4232,14 @@
path = Image;
sourceTree = "<group>";
};
0679DEDB2C46954F00044FC7 /* Bundle */ = {
isa = PBXGroup;
children = (
0679DED92C46951B00044FC7 /* Bundle+WireURLs.swift */,
);
path = Bundle;
sourceTree = "<group>";
};
0685007F26B35DFC00721F80 /* Restrictions */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -6453,6 +6465,7 @@
8FC85126199245760008B66B /* Helpers */ = {
isa = PBXGroup;
children = (
0679DEDB2C46954F00044FC7 /* Bundle */,
40C69D6E2A8627A700376B1C /* TmpFiles */,
06B3091126AEDC830057AF9E /* UIAlertController */,
064AD4C225DD313C00143D74 /* UIApplication */,
Expand Down Expand Up @@ -7118,6 +7131,7 @@
isa = PBXGroup;
children = (
7CCB8F7E229D67BD005BBC10 /* URL+WireTests.swift */,
0679DEE02C49729500044FC7 /* URLsTests.swift */,
A9E674D924F51A190058FC72 /* WireEmailTests.swift */,
);
path = Bundle;
Expand Down Expand Up @@ -10204,6 +10218,7 @@
BFCF31DD1DA52ECE0039B3DC /* KeyboardHeight.swift in Sources */,
87A752171E002F6C004317DB /* ConversationRootViewController.swift in Sources */,
16A5FDC52154F53F00AEEBBD /* NSAttributedString+MessageFormatting.swift in Sources */,
0679DEDE2C47C48400044FC7 /* Bundle+WireURLs.swift in Sources */,
87CA886E1DDF0075004101B6 /* UserConnectionViewController.swift in Sources */,
87D21AD71D8A98620075AB7A /* AccentColorPickerController.swift in Sources */,
EF883F2E215144B800B440CC /* Analytics+OptOut.swift in Sources */,
Expand Down Expand Up @@ -10502,6 +10517,7 @@
F1C9E3601EAE008C006438D7 /* TestSetup.swift in Sources */,
EFAFCA822133FB59002B31A6 /* ArchivedNavigationBarTests.swift in Sources */,
EFE0439B2149D9CA00BC3079 /* ShareContactsViewControllerSnapshotTests.swift in Sources */,
0679DEE12C49729500044FC7 /* URLsTests.swift in Sources */,
BFC9149B1D181BE7001F068B /* LocationMessageCellTests.swift in Sources */,
E9398D332B5FD58E00C4AFBA /* ConversationSystemMessageMlsSupportSnapshotTests.swift in Sources */,
5EC7C87C21907D94004662AC /* ConversationReplyCellDescriptionTests.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import Foundation
import WireDataModel
import WireCommonComponents

/**
* Handles the change of user data during registration.
Expand Down Expand Up @@ -67,7 +68,7 @@ final class RegistrationIncrementalUserDataChangeHandler: AuthenticationEventHan

private func handleMissingMarketingConsent(with user: UnregisteredUser) -> [AuthenticationCoordinatorAction] {
// Alert Actions
let privacyPolicyAction = AuthenticationCoordinatorAlertAction(title: L10n.Localizable.NewsOffers.Consent.Button.PrivacyPolicy.title, coordinatorActions: [.openURL(URL.wr_privacyPolicy.appendingLocaleParameter)])
let privacyPolicyAction = AuthenticationCoordinatorAlertAction(title: L10n.Localizable.NewsOffers.Consent.Button.PrivacyPolicy.title, coordinatorActions: [.openURL(WireURLs.shared.privacyPolicy)])
let declineAction = AuthenticationCoordinatorAlertAction(title: L10n.Localizable.General.decline, coordinatorActions: [.setMarketingConsent(false)])
let acceptAction = AuthenticationCoordinatorAlertAction(title: L10n.Localizable.General.accept, coordinatorActions: [.setMarketingConsent(true)])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import Foundation
import UIKit
import WireCommonComponents

typealias E2ei = L10n.Localizable.Registration.Signin.E2ei

Expand All @@ -40,7 +41,7 @@ class EnrollE2EIdentityStepDescription: AuthenticationStepDescription {
)
secondaryView = nil
headline = E2ei.title
let details = [E2ei.subtitle, E2ei.learnMore(URL.wr_e2eiLearnMore)].joined(separator: "\n")
let details = [E2ei.subtitle, E2ei.learnMore(WireURLs.shared.endToEndIdentityInfo)].joined(separator: "\n")
subtext = .markdown(from: details, style: .login)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extension UIAlertController {
preferredStyle: .alert)

let privacyPolicyActionHandler: ((UIAlertAction) -> Swift.Void) = { _ in
let browserViewController = BrowserViewController(url: URL.wr_privacyPolicy.appendingLocaleParameter)
let browserViewController = BrowserViewController(url: WireURLs.shared.privacyPolicy)

browserViewController.completion = {
UIAlertController.showNewsletterSubscriptionDialog(over: viewController, completionHandler: completionHandler)
Expand Down Expand Up @@ -98,7 +98,7 @@ private extension AuthenticationCoordinatorAlertAction {

static var privacyPolicy: Self {
Self.init(title: L10n.Localizable.NewsOffers.Consent.Button.PrivacyPolicy.title,
coordinatorActions: [.showLoadingView, .openURL(URL.wr_privacyPolicy.appendingLocaleParameter)])
coordinatorActions: [.showLoadingView, .openURL(WireURLs.shared.privacyPolicy)])
}

static var decline: Self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
import Foundation
import SafariServices
import UIKit
import WireCommonComponents

extension UIAlertController {
static func requestTOSApproval(over controller: UIViewController, forTeamAccount: Bool, completion: @escaping (_ approved: Bool) -> Void) {
let alert = UIAlertController(title: L10n.Localizable.Registration.TermsOfUse.Terms.title,
message: L10n.Localizable.Registration.TermsOfUse.Terms.message,
preferredStyle: .alert)
let viewAction = UIAlertAction(title: L10n.Localizable.Registration.TermsOfUse.Terms.view, style: .default) { [weak controller] _ in
let url = URL.wr_termsOfServicesURL.appendingLocaleParameter

let webViewController: BrowserViewController
webViewController = BrowserViewController(url: url)
webViewController = BrowserViewController(url: WireURLs.shared.legal)
webViewController.completion = { [weak controller] in
if let controller = controller {
UIAlertController.requestTOSApproval(over: controller, forTeamAccount: forTeamAccount, completion: completion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ final class AuthenticationCredentialsViewController: AuthenticationStepControlle

@objc
func forgotPasswordTapped(sender: UIButton) {
actioner?.executeAction(.openURL(.wr_passwordReset))
actioner?.executeAction(.openURL(WireURLs.shared.passwordReset))
}

override func createConstraints() {
Expand Down
136 changes: 136 additions & 0 deletions wire-ios/Wire-iOS/Sources/Helpers/Bundle/Bundle+WireURLs.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
//
// Wire
// Copyright (C) 2024 Wire Swiss GmbH
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//

import Foundation
import WireSystem

/// This struct contains various URLs used in the app. All links are defined in the `url.json` configuration file.
///
/// IMPORTANT: If you change or add a new property to this struct, you will also need to update the corresponding
/// link with the same key in the existing URL configuration files.
/// Failure to do so may cause the application to crash.
struct WireURLs: Codable {

/// Link to the app on the App store.
let appOnItunes: URL

/// Link to the main support page.
let support: URL

/// Link to the help desk support page.
let searchSupport: URL

/// Link to the app's homepage.
let website: URL

/// Shown when the user tries to create an account with an email that is already in use.
/// Links to support page explaining issue and what can be done.
let emailAlreadyInUse: URL

/// Link to an article explaining why a user should verify conversations using fingerprints.
let whyToVerifyFingerprintArticle: URL

/// Link to an article explaining how to manually verify conversations using fingerprints.
let howToVerifyFingerprintArticle: URL

/// Link to the privacy policy page.
let privacyPolicy: URL

/// Link to app's homepage for legal information, e.g terms of use and data processing addendum.
let legal: URL

/// Link to the license information page.
let licenseInformation: URL

/// Link to the password reset page.
let passwordReset: URL

/// Link to the support page where the user can submit a support request for various issues.
let askSupportArticle: URL

/// Link to the support page where a user can report an abuse issue.
let reportAbuse: URL

/// Link to an article explaining the various features of Wire.
let wireEnterpriseInfo: URL

/// Link to an article explaining legal hold.
let legalHoldInfo: URL

/// Link to an article explaining how to create, share, and revoke a group conversation link.
let guestLinksInfo: URL

/// Shown when a user tries to send a message or create a group with users from different backends when one of the backends is not reachable.
/// Links to a support page that explains the issue when one of the backend is offline.
let unreachableBackendInfo: URL

/// Links to a support page explaining what Federation is.
let federationInfo: URL

/// Link to the article about Messaging Layer Security (MLS).
/// Shown in various places (e.g. system messages, warnings, error messages).
let mlsInfo: URL

/// Link to the article about end-to-end identity.
/// Shown in various places (e.g. system messages, warnings, error messages).
let endToEndIdentityInfo: URL

static var shared: WireURLs = {
do {
return try WireURLs(forResource: "url", withExtension: "json")
} catch {
fatalError("\(error)")
}
}()

private init(forResource resource: String, withExtension fileExtension: String) throws {
guard let fileURL = Bundle.fileURL(for: resource, with: fileExtension) else {
throw WireURLsError.fileNotFound
}

self = try fileURL.decode(WireURLs.self)
}

enum CodingKeys: String, CodingKey, CaseIterable {
case appOnItunes
case support
case searchSupport
case website
case emailAlreadyInUse
case whyToVerifyFingerprintArticle
case howToVerifyFingerprintArticle
case privacyPolicy
case legal
case licenseInformation
case passwordReset
case askSupportArticle
case reportAbuse
case wireEnterpriseInfo
case legalHoldInfo
case guestLinksInfo
case unreachableBackendInfo
case federationInfo
case mlsInfo
case endToEndIdentityInfo
}

enum WireURLsError: Error {
case fileNotFound
}

}
Loading

0 comments on commit 174fe5b

Please sign in to comment.