[Widgets]: Enhanced to isolate operations from multiple views of same widget type

This commit is contained in:
Magesh K
2025-01-11 03:25:25 +05:30
parent f69b293004
commit e29d9f7904
12 changed files with 346 additions and 245 deletions

View 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()
}
}