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

MOB-1817 Environment staging updates #479

Merged
merged 18 commits into from
Jul 4, 2023
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
258 changes: 129 additions & 129 deletions Client.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"location" : "https://github.com/ecosia/ios-core.git",
"state" : {
"branch" : "main",
"revision" : "22dbb1cd3a41557c6741f5f96794a4c2ee6a256a"
"revision" : "7008973ed30a59a616355f821b96952418af69ef"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
buildConfiguration = "BetaDebug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Beta"
buildConfiguration = "Development_TestFlight"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
3 changes: 0 additions & 3 deletions Client/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

appLaunchUtil = AppLaunchUtil(profile: profile)
appLaunchUtil?.setUpPreLaunchDependencies()

// Setup environment
Environment.current = AppConstants.BuildChannel == .release ? .production : .staging

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 💯


// Set up a web server that serves us static content. Do this early so that it is ready when the UI is presented.
webServerUtil = WebServerUtil(profile: profile)
Expand Down
2 changes: 1 addition & 1 deletion Client/Ecosia/Analytics/Analytics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class Analytics {
.userId(User.shared.analyticsId.uuidString)

return Snowplow.createTracker(namespace: namespace,
network: .init(endpoint: Environment.current.snowplow),
network: .init(endpoint: Environment.current.urlProvider.snowplow),
configurations: [trackerConfiguration, subjectConfiguration])!
}

Expand Down
4 changes: 2 additions & 2 deletions Client/Ecosia/Settings/EcosiaSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ final class EcosiaPrivacyPolicySetting: Setting {
}

override var url: URL? {
return Environment.current.privacy
return Environment.current.urlProvider.privacy
}

override func onClick(_ navigationController: UINavigationController?) {
Expand Down Expand Up @@ -161,7 +161,7 @@ final class EcosiaTermsSetting: Setting {
}

override var url: URL? {
return Environment.current.terms
return Environment.current.urlProvider.terms
}

override func onClick(_ navigationController: UINavigationController?) {
Expand Down
10 changes: 5 additions & 5 deletions Client/Ecosia/UI/Impact/YourImpact.Section.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ extension YourImpact {
var url: URL {
switch self {
case .info:
return Environment.current.howEcosiaWorks
return Environment.current.urlProvider.howEcosiaWorks
case .finance:
return Environment.current.financialReports
return Environment.current.urlProvider.financialReports
case .trees:
return Environment.current.trees
return Environment.current.urlProvider.trees
case .faq:
return Environment.current.faq
return Environment.current.urlProvider.faq
case .privacy:
return Environment.current.privacy
return Environment.current.urlProvider.privacy
}
}

Expand Down
2 changes: 1 addition & 1 deletion Client/Ecosia/UI/Impact/YourImpact.swift
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ final class YourImpact: UICollectionViewController, UICollectionViewDelegateFlow
}

@objc private func learnMore(button: UIControl) {
delegate?.yourImpact(didSelectURL: Environment.current.aboutCounter)
delegate?.yourImpact(didSelectURL: Environment.current.urlProvider.aboutCounter)
Analytics.shared.navigation(.open, label: .counter)

dismiss(animated: true) { [weak self] in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ extension BrowserViewController: WKNavigationDelegate {
}

// Ecosia: intercept URL to impact
if Environment.current.isYourImpact(url: url),
if Environment.current.urlProvider.isYourImpact(url: url),
navigationAction.navigationType == .linkActivated {
presentYourImpact()
decisionHandler(.cancel)
Expand Down
10 changes: 7 additions & 3 deletions Client/Frontend/Browser/Tab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -562,14 +562,18 @@ class Tab: NSObject {
return webView.load(readerModeRequest)
}
lastRequest = request

if let url = request.url, url.isFileURL, request.isPrivileged {
return webView.loadFileURL(url, allowingReadAccessTo: url)
}

// Ecosia: updating the request with cookies and auth parameters if needed
var ecosiaUpdatedRequest = request
// Ecosia: inject analytics id
var request = request
request.url = request.url?.ecosified(isIncognitoEnabled: _isPrivate)
return webView.load(request)
ecosiaUpdatedRequest.url = ecosiaUpdatedRequest.url?.ecosified(isIncognitoEnabled: _isPrivate)
// Ecosia: inject auth parameters if needed
ecosiaUpdatedRequest = ecosiaUpdatedRequest.withAuthParameters()
return webView.load(ecosiaUpdatedRequest)
}
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions Client/Frontend/Browser/TabManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class TabManager: NSObject, FeatureFlaggable, TabManagerProtocol {
configuration.setURLSchemeHandler(InternalSchemeHandler(), forURLScheme: InternalURL.scheme)

//Ecosia: inject cookie when config is created to make sure they are present
let cookie = isPrivate ? Cookie.incognito : Cookie.standard
let cookie = isPrivate ? Cookie.makeIncognito() : Cookie.makeStandard()
configuration.websiteDataStore.httpCookieStore.setCookie(cookie)
return configuration
}
Expand Down Expand Up @@ -195,8 +195,8 @@ class TabManager: NSObject, FeatureFlaggable, TabManagerProtocol {
searchSettingsObserver = NotificationCenter.default
.publisher(for: .searchSettingsChanged)
.sink() { [privateConfiguration, configuration] _ in
configuration.websiteDataStore.httpCookieStore.setCookie(Cookie.standard)
privateConfiguration.websiteDataStore.httpCookieStore.setCookie(Cookie.incognito)
configuration.websiteDataStore.httpCookieStore.setCookie(Cookie.makeStandard())
privateConfiguration.websiteDataStore.httpCookieStore.setCookie(Cookie.makeIncognito())
}
}

Expand Down
2 changes: 1 addition & 1 deletion Client/Frontend/Settings/AppSettingsOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ class VersionSetting: Setting {
}

override var title: NSAttributedString? {
return NSAttributedString(string: .init(format: .localized(.version), Bundle.version) + " (\(Environment.current.name))", attributes: [NSAttributedString.Key.foregroundColor: UIColor.theme.tableView.rowText])
return NSAttributedString(string: .init(format: .localized(.version), Bundle.version) + " (\(Environment.current.urlProvider))", attributes: [NSAttributedString.Key.foregroundColor: UIColor.theme.tableView.rowText])
}

public static var appVersion: String {
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ In case the error was due to `xcrun: error: unable to lookup item 'PlatformPath'

*Fix:* Switch the default SDK location by running `sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer`.

#### Build configurations

The app is equipped by two custom Build Configurations for ad-hoc distribution over TestFlight and AppCenter.
The `Development_` prefix added to those two, serves the purpose of picking the correct `Core` module build configuration.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick and clear 👏

If you think it is worth it, could even link to the ADR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only reason I woulnd't want to link it is due to this repo being public and people will land into the 404 Github page 😕 . I know it's widely practiced for Jira tickets for other OSS projects but when it comes to Github repo it may be somewhat unpleasant to find into a README doc 🤔


### CI/CD

Fastlane is used to push builds to the Appstore and to manage our certs and profiles. Follow the [docs](https://docs.fastlane.tools/getting-started/ios/setup/) to install. We recommend to use fastlane with bundler.
Expand Down
6 changes: 3 additions & 3 deletions Storage/DefaultSuggestedSites.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ open class DefaultSuggestedSites {
public static let sites = [
"default": [
SuggestedSiteData(
url: Environment.current.financialReports.absoluteString,
url: Environment.current.urlProvider.financialReports.absoluteString,
bgColor: "0x000000",
imageUrl: "asset://suggestedsites_ecosia-org",
faviconUrl: "asset://defaultFavicon",
trackingId: 0,
title: NSLocalizedString("Financial reports", tableName: "Ecosia", comment: "")
),
SuggestedSiteData(
url: Environment.current.privacy.absoluteString,
url: Environment.current.urlProvider.privacy.absoluteString,
bgColor: "0x000000",
imageUrl: "asset://suggestedsites_ecosia-org",
faviconUrl: "asset://defaultFavicon",
trackingId: 0,
title: NSLocalizedString("Privacy", tableName: "Ecosia", comment: "")
),
SuggestedSiteData(
url: Environment.current.blog.absoluteString,
url: Environment.current.urlProvider.blog.absoluteString,
bgColor: "0x000000",
imageUrl: "asset://suggestedsites_ecosia-org",
faviconUrl: "asset://defaultFavicon",
Expand Down
2 changes: 1 addition & 1 deletion Tests/ClientTests/SearchTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SearchTests: XCTestCase {
XCTAssertEqual(engine.shortName, "Google")

// Test regular search queries.
XCTAssertTrue(engine.searchURLForQuery("foobar")!.absoluteString.hasPrefix("https://www.ecosia.org/search?q=foobar"))
XCTAssertTrue(engine.searchURLForQuery("foobar")!.absoluteString.hasPrefix("https://www.ecosia-staging.xyz/search?q=foobar"))

// Test search suggestion queries.
XCTAssertEqual(engine.suggestURLForQuery("foobar")!.absoluteString, "https://www.google.com/complete/search?client=firefox&q=foobar")
Expand Down
4 changes: 2 additions & 2 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ platform :ios do
scheme: "Ecosia",
project: project,
export_method: "ad-hoc",
configuration: "AppCenter",
configuration: "Development_AppCenter",
export_options: {iCloudContainerEnvironment: 'Development'}
)
appcenter_upload(
Expand All @@ -71,7 +71,7 @@ platform :ios do
gym(
scheme: "Ecosia",
export_method: "app-store",
configuration: "Beta"
configuration: "Development_TestFlight"
)
pilot(
skip_waiting_for_build_processing: true,
Expand Down
Loading