Skip to content

Commit

Permalink
Release 1.5.2 (218)
Browse files Browse the repository at this point in the history
  • Loading branch information
denis15yo committed Jan 24, 2024
1 parent 1e582f2 commit 5e026b1
Show file tree
Hide file tree
Showing 392 changed files with 19,254 additions and 7,542 deletions.
1 change: 1 addition & 0 deletions .github/workflows/beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
BAZEL_USER_ROOT: /private/var/tmp/_bazel_telegram
BUILD_WORKING_DIR: /Users/telegram/build-working-dir
BUNDLE_ID: app.nicegram
GOOGLE_APPLICATION_CREDENTIALS_BASE64: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }}
KEYCHAIN_NAME: ${{ secrets.KEYCHAIN_NAME }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.SIGN_REPO_DECRYPT_PASSWORD }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ jobs:
BAZEL_USER_ROOT: /private/var/tmp/_bazel_telegram
BUILD_WORKING_DIR: /Users/telegram/build-working-dir
BUNDLE_ID: app.nicegram
GOOGLE_APPLICATION_CREDENTIALS_BASE64: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }}
KEYCHAIN_NAME: ${{ secrets.KEYCHAIN_NAME }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.SIGN_REPO_DECRYPT_PASSWORD }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ ci/Gemfile.lock
ci/fastlane-env.sh
ci/working_dir
.build
Telegram/Telegram-iOS/FirebaseRemoteConfigDefaults.plist
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ public class FirebaseRemoteConfigService {
let settings = RemoteConfigSettings()
settings.minimumFetchInterval = cacheDuration
remoteConfig.configSettings = settings

remoteConfig.setDefaults(
fromPlist: "FirebaseRemoteConfigDefaults"
)
}

// MARK: - Public Functions
Expand Down
3 changes: 1 addition & 2 deletions Nicegram/NGStealthMode/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ swift_library(
"Sources/**/*.swift",
]),
deps = [
"//Nicegram/NGStrings:NGStrings",
"//submodules/AccountContext:AccountContext",
"//submodules/TelegramUIPreferences:TelegramUIPreferences",
"@swiftpkg_nicegram_assistant_ios//:Sources_FeatPremium",
"@swiftpkg_nicegram_assistant_ios//:Sources_NGCore",
],
visibility = [
"//visibility:public",
Expand Down
72 changes: 22 additions & 50 deletions Nicegram/NGStealthMode/Sources/NGStealthMode.swift
Original file line number Diff line number Diff line change
@@ -1,70 +1,42 @@
import AccountContext
import FeatPremium
import NGCore
import NGStrings
import TelegramUIPreferences

public struct NGStealthMode {
private static var stealthModeSubscription: Any?
}
public struct NGStealthMode {}

public extension NGStealthMode {
static func initialize(
sharedContext: SharedAccountContext
) {
guard #available(iOS 13.0, *) else {
return
}

let getPremiumStatusUseCase = PremiumContainer.shared.getPremiumStatusUseCase()

stealthModeSubscription = $stealthModeEnabled
.combineLatest(getPremiumStatusUseCase.hasPremiumOnDevicePublisher())
.map { stealthModeEnabled, hasPremium in
stealthModeEnabled && hasPremium
}
.sink { [weak sharedContext] useStealthMode in
guard let sharedContext else {
return
}

let _ = updateExperimentalUISettingsInteractively(accountManager: sharedContext.accountManager, { settings in
var settings = settings
settings.skipReadHistory = useStealthMode
return settings
}).start()
}
}

static func isStealthModeEnabled() -> Bool {
if #available(iOS 13.0, *) {
stealthModeEnabled
} else {
false
}
}

static func setStealthModeEnabled(_ enabled: Bool) {
if #available(iOS 13.0, *) {
stealthModeEnabled = enabled
maybeDisableStealthMode(
sharedContext: sharedContext
)
}
}
}

public extension NGStealthMode {
struct Resources {}
}
public extension NGStealthMode.Resources {
static func toggleTitle() -> String {
l("StealthMode.Toggle")
}
}

@available(iOS 13.0, *)
private extension NGStealthMode {
@UserDefaultsValue(
key: "stealthModeEnabled",
key: "ngStealthModeWasDisabled",
defaultValue: false
)
static var stealthModeEnabled: Bool
static var stealthModeWasDisabled

static func maybeDisableStealthMode(
sharedContext: SharedAccountContext
) {
guard !stealthModeWasDisabled else {
return
}

let _ = updateExperimentalUISettingsInteractively(accountManager: sharedContext.accountManager, { settings in
var settings = settings
settings.skipReadHistory = false
return settings
}).start()

stealthModeWasDisabled = true
}
}
2 changes: 1 addition & 1 deletion Nicegram/NGUI/Sources/NicegramSettingsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import class NGCoreUI.SharedLoadingView
import NGEnv
import NGWebUtils
import NGAiChatUI
import NGCardUI
import FeatCardUI
import NGAppCache
import NGCore
import var NGCoreUI.strings
Expand Down
23 changes: 1 addition & 22 deletions Nicegram/NGUI/Sources/PremiumController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import ItemListUI
import AccountContext
import TelegramNotices
import NGData
import NGStealthMode
import NGStrings

private struct SelectionState: Equatable {
Expand Down Expand Up @@ -48,7 +47,6 @@ private enum premiumControllerSection: Int32 {
case manageFilters
case other
case speechToText
case stealthMode
case test
}

Expand Down Expand Up @@ -85,8 +83,6 @@ private enum PremiumControllerEntry: ItemListNodeEntry {
case ignoretr(PresentationTheme, String)

case useOpenAi(Bool)

case stealthMode(Bool)

var section: ItemListSectionId {
switch self {
Expand All @@ -104,8 +100,6 @@ private enum PremiumControllerEntry: ItemListNodeEntry {
return premiumControllerSection.test.rawValue
case .useOpenAi:
return premiumControllerSection.speechToText.rawValue
case .stealthMode:
return premiumControllerSection.stealthMode.rawValue
}

}
Expand Down Expand Up @@ -138,8 +132,6 @@ private enum PremiumControllerEntry: ItemListNodeEntry {
return 12000
case .useOpenAi:
return 13000
case .stealthMode:
return 14000
case .testButton:
return 999999
}
Expand Down Expand Up @@ -239,14 +231,7 @@ private enum PremiumControllerEntry: ItemListNodeEntry {
} else {
return false
}
case let .stealthMode(lhsValue):
if case let .stealthMode(rhsValue) = rhs, lhsValue == rhsValue {
return true
} else {
return false
}
}

}

static func <(lhs: PremiumControllerEntry, rhs: PremiumControllerEntry) -> Bool {
Expand Down Expand Up @@ -309,10 +294,6 @@ private enum PremiumControllerEntry: ItemListNodeEntry {
}
}
})
case let .stealthMode(value):
return ItemListSwitchItem(presentationData: presentationData, title: NGStealthMode.Resources.toggleTitle(), value: value, enabled: true, sectionId: self.section, style: .blocks, updated: { value in
NGStealthMode.setStealthModeEnabled(value)
})
}
}
}
Expand All @@ -330,8 +311,6 @@ private func premiumControllerEntries(presentationData: PresentationData, useOpe
entries.append(.ignoretr(theme, l("Premium.IgnoreTranslate.Title", locale)))

entries.append(.useOpenAi(useOpenAi))

entries.append(.stealthMode(NGStealthMode.isStealthModeEnabled()))

#if DEBUG
entries.append(.testButton(theme, "TEST"))
Expand Down Expand Up @@ -379,7 +358,7 @@ public func premiumController(context: AccountContext) -> ViewController {
.publisher()
.map { $0 == .openAi }
.toSignal()
.setNoError()
.skipError()
} else {
useOpenAiSignal = .single(false)
}
Expand Down
15 changes: 15 additions & 0 deletions Nicegram/NGWrap/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")

swift_library(
name = "NGWrap",
module_name = "NGWrap",
srcs = glob([
"Sources/**/*.swift",
]),
deps = [

],
visibility = [
"//visibility:public",
],
)
Loading

0 comments on commit 5e026b1

Please sign in to comment.