Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Adding a different channel for staging DAU process ping
Browse files Browse the repository at this point in the history
  • Loading branch information
soner-yuksel committed Oct 30, 2023
1 parent ea63f22 commit 4db04be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
15 changes: 9 additions & 6 deletions Sources/Growth/DAU.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ public class DAU {
public static let defaultWoiDate = "2016-01-04"

private static let apiVersion = 1
private static let baseUrl = "https://laptop-updates.brave.com/\(apiVersion)/usage/ios?platform=ios"

private static var baseUrl: String {
get {
let domain = AppConstants.buildChannel == .debug || AppConstants.buildChannel == .enterprise
? "https://laptop-updates.brave.com/"
: "https://laptop-updates.bravesoftware.com/"

return "\(domain)\(apiVersion)/usage/ios?platform=ios"
}
}
/// Number of seconds that determins when a user is "active"
private let pingRefreshDuration = 5.minutes

Expand Down Expand Up @@ -59,11 +67,6 @@ public class DAU {
/// Sends ping to server and returns a boolean whether a timer for the server call was scheduled.
/// A user needs to be active for a certain amount of time before we ping the server.
@discardableResult public func sendPingToServer() -> Bool {
if AppConstants.buildChannel == .debug || AppConstants.buildChannel == .enterprise {
Logger.module.info("Development build detected, no server ping.")
return false
}

guard Preferences.DAU.sendUsagePing.value else {
Logger.module.debug("DAU ping disabled by the user.")
return false
Expand Down
6 changes: 0 additions & 6 deletions Tests/GrowthTests/DAUTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,6 @@ class DAUTests: XCTestCase {
XCTAssertEqual(singleDigitTest.mondayOfCurrentWeekFormatted, "2019-02-04")
}

func testNoPingOnDevelopmentBuild() {
XCTAssertTrue(AppConstants.buildChannel == .debug)

let dau = DAU()
XCTAssertFalse(dau.sendPingToServer())
}

func testMigratingInvalidWeekOfInstallPref() throws {
// (stored, fixed)
Expand Down

0 comments on commit 4db04be

Please sign in to comment.