mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
[Widgets]: Enhanced to isolate operations from multiple views of same widget type
This commit is contained in:
31
AltWidget/Manager/PageInfoManager.swift
Normal file
31
AltWidget/Manager/PageInfoManager.swift
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// PageInfoManager.swift
|
||||
// AltStore
|
||||
//
|
||||
// Created by Magesh K on 11/01/25.
|
||||
// Copyright © 2025 SideStore. All rights reserved.
|
||||
//
|
||||
|
||||
// This is a utility class
|
||||
class PageInfoManager {
|
||||
static var shared = PageInfoManager()
|
||||
private var pageInfoMap: [Int: NavigationEvent] = [:]
|
||||
|
||||
private init() {}
|
||||
|
||||
func setPageInfo(for key: Int, value: NavigationEvent?) {
|
||||
pageInfoMap[key] = value
|
||||
}
|
||||
|
||||
func getPageInfo(for key: Int) -> NavigationEvent? {
|
||||
return pageInfoMap[key]
|
||||
}
|
||||
|
||||
func popPageInfo(for key: Int) -> NavigationEvent? {
|
||||
return pageInfoMap.removeValue(forKey: key)
|
||||
}
|
||||
|
||||
func clearAll() {
|
||||
pageInfoMap.removeAll()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user