Skip to content

Commit cb12160

Browse files
author
Programistich
committed
[Infrared] Display hub tab when user start application
1 parent 005d36d commit cb12160

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

Flipper/Packages/Core/Sources/Model/Router.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ public class Router: ObservableObject {
1010

1111
public init() {
1212
isFirstLaunch = UserDefaultsStorage.shared.isFirstLaunch
13+
14+
// TODO: Find better way
15+
if isFirstLaunch {
16+
UserDefaultsStorage.shared.showInfraredRemoteTab = false
17+
}
1318
}
1419

1520
public func showWelcomeScreen() {

Flipper/Packages/Core/Sources/Storage/Patform/UserDefaultsStorage.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ public class UserDefaultsStorage {
2020
@UserDefault(key: .hasReaderLog, defaultValue: false)
2121
public var hasReaderLog: Bool
2222

23+
@UserDefault(key: .showInfraredRemoteTab, defaultValue: true)
24+
public var showInfraredRemoteTab: Bool
25+
2326
// MARK: Debug
2427

2528
@UserDefault(key: .isDebugMode, defaultValue: false)
@@ -96,6 +99,7 @@ public extension UserDefaults {
9699
case hasReaderLog = "hasReaderLog"
97100
case showAppsUpdate = "showAppsUpdate"
98101
case hiddenApps = "hiddenApps"
102+
case showInfraredRemoteTab = "showInfraredRemoteTab"
99103

100104
case isDebugMode = "isDebugMode"
101105
case isSyncingDisabled = "isSyncingDisabled"

Flipper/Packages/UI/Sources/Main/MainView.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ struct MainView: View {
1010
@StateObject var tabViewController: TabViewController = .init()
1111

1212
@AppStorage(.selectedTab) var selectedTab: TabView.Tab = .device
13+
@AppStorage(.showInfraredRemoteTab) var showInfraredRemoteTab = true
1314

1415
var body: some View {
1516
VStack(spacing: 0) {
@@ -50,5 +51,11 @@ struct MainView: View {
5051
WidgetCenter.shared.reloadTimelines(ofKind: "LiveWidget")
5152
}
5253
}
54+
.onAppear {
55+
if showInfraredRemoteTab {
56+
selectedTab = .hub
57+
showInfraredRemoteTab = false
58+
}
59+
}
5360
}
5461
}

0 commit comments

Comments
 (0)