Skip to content

Commit

Permalink
Routing 问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yanue committed Jul 18, 2024
1 parent 151c445 commit 2bf5b11
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 153 deletions.
2 changes: 2 additions & 0 deletions V2rayU/ConfigWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ class ConfigWindowController: NSWindowController, NSWindowDelegate, NSTabViewDel
self.serversTableView.reloadData()
// selected current row
self.serversTableView.selectRowIndexes(NSIndexSet(index: V2rayServer.count() - 1) as IndexSet, byExtendingSelection: false)

menuController.showServers()
}
break

Expand Down
7 changes: 4 additions & 3 deletions V2rayU/MainMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class MenuController: NSObject, NSMenuDelegate {

// hide new version
newVersionItem.isHidden = true

showRouting()

// windowWillClose Notification
NotificationCenter.default.addObserver(self, selector: #selector(configWindowWillClose(notification:)), name: NSWindow.willCloseNotification, object: nil)
Expand Down Expand Up @@ -130,13 +132,12 @@ class MenuController: NSObject, NSMenuDelegate {
configWindow.reloadData()
}
}
showRouting()
}

func showRouting() {
DispatchQueue.global().async {
let rules = V2rayRoutings.all()
print("showRouting", rules)
// print("showRouting", rules)
let sumMenus = NSMenu()
// add Routing... menu and click event is goRouting
let routingMenuItem = NSMenuItem()
Expand Down Expand Up @@ -165,7 +166,7 @@ class MenuController: NSObject, NSMenuDelegate {
}
sumMenus.addItem(menuItem)
}
print("showRouting", sumMenus)
// print("showRouting", sumMenus)
// 假设 routingMenu 已经连接并且有一个子菜单
DispatchQueue.main.async {
self.routingMenu.submenu = sumMenus
Expand Down
Loading

0 comments on commit 2bf5b11

Please sign in to comment.