Skip to content

Commit

Permalink
[MOB-3028] Project fixes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
d4r1091 committed Dec 12, 2024
1 parent d5e80e2 commit 5521edf
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 111 deletions.
103 changes: 55 additions & 48 deletions Client.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/braze-inc/braze-swift-sdk",
"state" : {
"revision" : "2852dfb0e63b68b4bcb804b05bff02609fa1f03c",
"version" : "11.3.0"
"revision" : "fc575bee323c5ce58e0608b0168fdc3ac8727443",
"version" : "11.4.0"
}
},
{
Expand All @@ -27,15 +27,6 @@
"version" : "7.1.1"
}
},
{
"identity" : "fmdb",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ccgus/fmdb",
"state" : {
"revision" : "1227a3fa2b9916bfd75fe380eb45cd210e69e251",
"version" : "2.7.12"
}
},
{
"identity" : "fuzi",
"kind" : "remoteSourceControl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/

import UIKit

import Ecosia

protocol HomepageViewControllerDelegate: AnyObject {
Expand Down
27 changes: 0 additions & 27 deletions Client/Ecosia/Settings/EcosiaDebugSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -262,30 +262,3 @@ final class NewsletterCardDismissSetting: HiddenSetting {
self.settings.tableView.reloadData()
}
}

final class UnleashNewsletterCardSetting: UnleashVariantResetSetting {
override var titleName: String? {
"Newsletter Card"
}

override var unleashEnabled: Bool? {
Unleash.isEnabled(.newsletterCard)
}
}

final class NewsletterCardDismissSetting: HiddenSetting {
override var title: NSAttributedString? {
return NSAttributedString(string: "Debug: Unset Newsletter card dismissed", attributes: [NSAttributedString.Key.foregroundColor: UIColor.legacyTheme.tableView.rowText])
}

override var status: NSAttributedString? {
let attributes = [NSAttributedString.Key.foregroundColor: UIColor.legacyTheme.tableView.rowText]
let hintText = NewsletterCardExperiment.isDismissed ? "dismissed (Click to unset)" : "showing (Nothing to do here)"
return NSAttributedString(string: "Card is currently \(hintText)", attributes: attributes)
}

override func onClick(_ navigationController: UINavigationController?) {
NewsletterCardExperiment.unsetDismissed()
self.settings.tableView.reloadData()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,20 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/

import Foundation
import NotificationCenter

<<<<<<<< HEAD:Ecosia/Braze/APNConsent.swift
struct APNConsent {
public struct APNConsent {
private init() {}

private static var toggleName: Unleash.Toggle.Name {
.apnConsent
========
public struct APNConsentOnLaunchExperiment {
private init() {}

public static var toggleName: Unleash.Toggle.Name {
.apnConsentOnLaunch
>>>>>>>> e5bca0a4d ([MOB-3028] Move Analytics and dependencies to Ecosia framework):Ecosia/Experiments/Unleash/APNConsentOnLaunchExperiment.swift
}

private static var isEnabled: Bool {
// Depends on Braze Integration being enabled - we should make sure targets on Unleash match
Unleash.isEnabled(toggleName) && BrazeIntegrationExperiment.isEnabled
}

<<<<<<<< HEAD:Ecosia/Braze/APNConsent.swift
static func requestIfNeeded() async {
========
public static func requestAPNConsentIfNeeded(delegate: UNUserNotificationCenterDelegate) async {
>>>>>>>> e5bca0a4d ([MOB-3028] Move Analytics and dependencies to Ecosia framework):Ecosia/Experiments/Unleash/APNConsentOnLaunchExperiment.swift
public static func requestIfNeeded() async {
guard isEnabled, BrazeService.shared.notificationAuthorizationStatus == .notDetermined else {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/

import Foundation
import UIKit
import UserNotifications
import BrazeKit
import BrazeUI
import NotificationCenter

final class BrazeService: NSObject {
public final class BrazeService: NSObject {
override private init() {}

private var braze: Braze?
private var userId: String {
User.shared.analyticsId.uuidString
}
public private(set) var notificationAuthorizationStatus: UNAuthorizationStatus?
private(set) var notificationAuthorizationStatus: UNAuthorizationStatus?
private static var apiKey = EnvironmentFetcher.valueFromMainBundleOrProcessInfo(forKey: "BRAZE_API_KEY") ?? ""
public static let shared = BrazeService()

public enum Error: Swift.Error {
enum Error: Swift.Error {
case invalidConfiguration
case generic(description: String)
}
Expand All @@ -27,7 +28,7 @@ final class BrazeService: NSObject {
case newsletterCardClick = "newsletter_card_click"
}

func initialize() async {
public func initialize() async {
do {
try await initBraze(userId: userId)
await refreshAPNRegistrationIfNeeded()
Expand Down
3 changes: 1 addition & 2 deletions Ecosia/Core/FeatureManagement/Unleash/Unleash.Model.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ extension Unleash {

public struct Toggle: Codable, Hashable {
public enum Name: String {
case apnConsentOnLaunch = "mob_ios_apn_consent_on_launch"
case apnConsent = "mob_ios_apn_consent_on_launch_rollout"
case brazeIntegration = "mob_ios_braze_integration"
case configTest = "mob_ios_staging_config"
case seedCounterNTP = "mob_ios_seed_counter_ntp"
case newsletterCard = "mob_ios_newsletter_card"
case onboardingRemove = "mob_ios_onboarding_remove"
}

public let name: String
Expand Down
1 change: 0 additions & 1 deletion EcosiaTests/Analytics/AnalyticsSpyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/

import XCTest
import Core
import Storage
import SnowplowTracker
@testable import Client
Expand Down
2 changes: 1 addition & 1 deletion EcosiaTests/Mocks/MockNewsModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/

import Foundation
import Core
@testable import Ecosia

func createMockNewsModel() throws -> NewsModel? {
let currentTimestamp = Date().timeIntervalSince1970
Expand Down
1 change: 1 addition & 0 deletions EcosiaTests/Mocks/MockUNNotificationSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import Foundation
@testable import Client
@testable import Ecosia

struct MockUNNotificationSettings: AnalyticsUNNotificationSettingsProtocol {
var authorizationStatus: UNAuthorizationStatus
Expand Down

0 comments on commit 5521edf

Please sign in to comment.