Commit 2d1d9f12 authored by shigemi miura's avatar shigemi miura

iPhone iOS18対応 Tabが押せない不具合修正

iPad Sheetが使えない不具合修正
parent af4a98e1
......@@ -958,10 +958,14 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Sailassist/Pods-Sailassist-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Sailassist/Pods-Sailassist-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Sailassist/Pods-Sailassist-frameworks.sh\"\n";
......@@ -1295,12 +1299,15 @@
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UIRequiresFullScreen = YES;
INFOPLIST_KEY_UIStatusBarStyle = "";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.5;
MARKETING_VERSION = 1.0.3;
OTHER_SWIFT_FLAGS = "-D CANARY -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist.canary;
......@@ -1338,12 +1345,15 @@
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UIRequiresFullScreen = YES;
INFOPLIST_KEY_UIStatusBarStyle = "";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.5;
MARKETING_VERSION = 1.0.3;
OTHER_SWIFT_FLAGS = "-D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist;
......@@ -1524,12 +1534,15 @@
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UIRequiresFullScreen = YES;
INFOPLIST_KEY_UIStatusBarStyle = "";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.5;
MARKETING_VERSION = 1.0.3;
OTHER_SWIFT_FLAGS = "-D QC -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist.qc;
......
......@@ -22,7 +22,7 @@ struct MapInformation: View {
.cornerRadius(3)
}
.padding(.top, 100)
.padding(.trailing, 200)
.padding(.trailing, positionLocation())
VStack {
ForEach(ngaData.ngaArea.map{ $0.1 }.filter{ $0.passingCnt > 0 }, id: \.name) { nga in
Text("Entering NGA \(nga.name)")
......@@ -44,6 +44,15 @@ struct MapInformation: View {
}
return location
}
func positionLocation() -> CGFloat {
var yPos: CGFloat = 200
if UIDevice.current.userInterfaceIdiom == .pad {
yPos = 900
}
return yPos
}
}
#Preview {
......
......@@ -454,15 +454,36 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, ObservableObject {
let tabWindow = PassThroughWindow(windowScene: scene)
tabWindow.rootViewController = tabBarController
tabWindow.isHidden = false
self.tabWindow = tabWindow
}
}
class PassThroughWindow: UIWindow{
// override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
// guard let view = super.hitTest(point, with: event) else { return nil}
// return rootViewController?.view == view ? nil : view
// }
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
guard let view = super.hitTest(point, with: event) else { return nil}
return rootViewController?.view == view ? nil : view
let view = super.hitTest(point, with: event)
if let view = view {
print("Hit test view: \(view), at point: \(point)")
print("View hierarchy: \(type(of: view)) -> \(view.superview)")
} else {
print("Hit test view: nil, at point: \(point)")
}
// rootViewController?.view がヒットしても、子ビューがある場合は透過しない
if rootViewController?.view == view {
// 子ビューが存在する場合はタッチイベントを処理
if rootViewController?.view.subviews.contains(where: { $0.frame.contains(point) }) == true {
return view
}
print("Background was hit, passing through")
return nil
}
return view
}
}
......
......@@ -12,15 +12,21 @@ enum Tab: String, CaseIterable{
case chat = "tab_chat"
case alert = "tab_notification"
case menu = "tab_menu"
var title: String{
""
switch self {
case .map: return "Map"
case .chat: return "Chat"
case .alert: return "Alert"
case .menu: return "Menu"
}
}
}
struct MainTabView: View {
@EnvironmentObject var selectedTabModel: SelectedTabModel
@EnvironmentObject private var sceneDelegate: SceneDelegate
@ObservedObject var location = SharingData.location
@State var isSignout = false
init() {
......@@ -29,7 +35,6 @@ struct MainTabView: View {
UITabBar.appearance().scrollEdgeAppearance = appearance
UITabBar.appearance().standardAppearance = appearance
SharingData.location.focusOwnShip = true
// EcaCoordinatesTable().setEcaData()
}
var body: some View {
......@@ -37,74 +42,104 @@ struct MainTabView: View {
@State var isTabShow: Bool = sceneDelegate.tabWindow != nil
@State var isTaskSel: Bool = selectedTabModel.activeTab == .map
TabView(selection: $selectedTabModel.activeTab){
if SharingData.my.isCommunication {
ChatView()
.tag(Tab.chat)
}
ZStack(alignment: .bottom) {
TabView(selection: $selectedTabModel.activeTab){
ZStack {
MapRepresentable()
MapInformation()
}
.ignoresSafeArea()
.tag(Tab.map)
ZStack {
MapRepresentable()
MapInformation()
}
.ignoresSafeArea()
.tag(Tab.map)
if SharingData.my.isCommunication {
ChatView()
.tag(Tab.chat)
}
NotificationView()
.tag(Tab.alert)
NotificationView()
.tag(Tab.alert)
MenuView(isSignout: $isSignout)
.tag(Tab.menu)
MenuView(isSignout: $isSignout)
.tag(Tab.menu)
}
// .hideNativeTabBar()
.sheet(isPresented: .constant(isTaskSel && isTabShow), content: {
MenuTaskView()
.zIndex(0)
.presentationDragIndicator(.hidden)
.presentationDetents([.height(150), .medium, .fraction(0.99)]) //Seetの高さを設定する
.presentationCornerRadius(15)
.presentationBackgroundInteraction(.enabled(upThrough: .medium))
.presentationBackground(ColorSet.BackgroundSecondary.color)
.interactiveDismissDisabled() //Seetを閉じられなくする
})
}
.hideNativeTabBar()
// .sheet(isPresented: .constant(isTaskSel && isTabShow && SharingData.my.isFuelSwitchTask), content: {
.sheet(isPresented: .constant(isTaskSel && isTabShow), content: {
MenuTaskView()
.zIndex(0)
.presentationDragIndicator(.hidden)
.presentationDetents([.height(150), .medium, .fraction(0.99)])
.presentationCornerRadius(15)
.presentationBackgroundInteraction(.enabled(upThrough: .medium))
.presentationBackground(ColorSet.BackgroundSecondary.color)
.interactiveDismissDisabled()
})
} else if UIDevice.current.userInterfaceIdiom == .pad {
@State var isPopover: Bool = selectedTabModel.isPoppver
ZStack(alignment: .bottom) {
TabView(selection: $selectedTabModel.activeTab) {
ZStack {
MapRepresentable()
MapInformation()
}
.ignoresSafeArea(edges: .top) // 上部の安全領域を無視
.padding(.bottom, 50) // タブバーの高さ分を調整
.tag(Tab.map)
TabView(selection: $selectedTabModel.activeTab){
if SharingData.my.isCommunication {
ChatView()
.tag(Tab.chat)
}
if SharingData.my.isCommunication {
ChatView()
.padding(.bottom, 50)
.tag(Tab.chat)
}
NotificationView()
.padding(.bottom, 50)
.tag(Tab.alert)
ZStack {
MapRepresentable()
MapInformation()
MenuView(isSignout: $isSignout)
.padding(.bottom, 50)
.tag(Tab.menu)
}
.ignoresSafeArea()
.tag(Tab.map)
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
}
}
}
}
NotificationView()
.tag(Tab.alert)
class MenuWindowManager {
static let shared = MenuWindowManager()
private var window: UIWindow?
MenuView(isSignout: $isSignout)
.tag(Tab.menu)
}
.hideNativeTabBar()
// .popover(isPresented: .constant(isPopover && SharingData.my.isFuelSwitchTask), attachmentAnchor: .point(.bottom)) {
.popover(isPresented: .constant(isPopover), attachmentAnchor: .point(.bottom)) {
MenuTaskView()
.presentationCompactAdaptation(.popover)
.zIndex(0)
.frame(minWidth: 500, maxHeight: 500)
.aspectRatio(contentMode: .fit)
.presentationCornerRadius(15)
.presentationBackgroundInteraction(.enabled(upThrough: .medium))
.presentationBackground(ColorSet.BackgroundSecondary.color)
.interactiveDismissDisabled()
}
func showMenuView<Content: View>(_ content: Content, frame: CGRect) {
guard window == nil else { return }
let hostingController = UIHostingController(rootView: content)
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
var rFrame = frame
rFrame.size.height -= 20
let newWindow = UIWindow(windowScene: windowScene)
newWindow.rootViewController = hostingController
newWindow.windowLevel = .alert + 1
newWindow.backgroundColor = UIColor.clear
newWindow.makeKeyAndVisible()
newWindow.alpha = 0.8
newWindow.frame = rFrame
newWindow.layer.cornerRadius = 15
newWindow.layer.masksToBounds = true
self.window = newWindow
}
}
func hideMenuView() {
guard let window = window else { return }
window.isHidden = true
window.rootViewController = nil
window.removeFromSuperview()
self.window = nil
}
}
struct CustomTabBar: View {
......@@ -118,98 +153,87 @@ struct CustomTabBar: View {
@ObservedObject var pushHistory = SharingData.pushHistory
@State var isSignalrRestert = false
@State var isMenuTaskViewVisible = false
var body: some View {
VStack(spacing: 0){
Divider()
HStack(spacing: 0){
ForEach(Tab.allCases, id: \.rawValue) { tab in
Button(action: {
selectedTabModel.activeTab = tab
if tab == .map {
selectedTabModel.isPoppver.toggle()
//iPhoneは船に移動 iPadはMenu表示
if UIDevice.current.userInterfaceIdiom == .phone {
location.focusOwnShip = true
VStack{
ZStack(alignment: .bottomTrailing) {
if !SharingData.my.isCommunication && tab == Tab.chat {
Image("tab_chat_Invalid")
.font(.title2)
.onTapGesture {
handleTabSelection(tab)
print("Image for \(tab.rawValue) tapped")
}
} else {
Image(selectedTabModel.activeTab == tab ? tab.rawValue + "_selected" : tab.rawValue)
.font(.title2)
.onTapGesture {
handleTabSelection(tab)
print("Image for \(tab.rawValue) tapped")
}
}
} else if tab == .chat {
let message = GetMessage()
message.start()
message.readNotification()
message.checkUnreadMessages()
selectedTabModel.isPoppver = false
} else {
selectedTabModel.isPoppver = false
}
}, label: {
VStack{
ZStack(alignment: .bottomTrailing) {
if !SharingData.my.isCommunication && tab == Tab.chat {
Image("tab_chat_Invalid")
.font(.title2)
} else {
Image(selectedTabModel.activeTab == tab ? tab.rawValue + "_selected" : tab.rawValue)
.font(.title2)
}
//チャットTab上の既読マーク
if tab == Tab.chat {
if message.viewCnt != 0 {
if message.viewCnt < 10 {
Ellipse()
.fill(Color.red)
.frame(width: 12, height: 12)
.overlay(
Text(String(message.viewCnt))
.font(FontStyle.VersionText.font)
.foregroundColor(.white)
)
} else {
Ellipse()
.fill(Color.red)
.frame(width: 12, height: 12)
.overlay(
Text("-")
.font(FontStyle.VersionText.font)
.foregroundColor(.white)
)
}
//チャットTab上の既読マーク
if tab == Tab.chat {
if message.viewCnt != 0 {
if message.viewCnt < 10 {
Ellipse()
.fill(Color.red)
.frame(width: 12, height: 12)
.overlay(
Text(String(message.viewCnt))
.font(FontStyle.VersionText.font)
.foregroundColor(.white)
)
} else {
Ellipse()
.fill(Color.red)
.frame(width: 12, height: 12)
.overlay(
Text("-")
.font(FontStyle.VersionText.font)
.foregroundColor(.white)
)
}
}
}
if tab == Tab.alert {
if pushHistory.viewCnt != 0 {
if pushHistory.viewCnt < 10 {
Ellipse()
.fill(Color.red)
.frame(width: 12, height: 12)
.overlay(
Text(String(pushHistory.viewCnt))
.font(FontStyle.VersionText.font)
.foregroundColor(.white)
)
} else {
Ellipse()
.fill(Color.red)
.frame(width: 12, height: 12)
.overlay(
Text("-")
.font(FontStyle.VersionText.font)
.foregroundColor(.white)
)
}
if tab == Tab.alert {
if pushHistory.viewCnt != 0 {
if pushHistory.viewCnt < 10 {
Ellipse()
.fill(Color.red)
.frame(width: 12, height: 12)
.overlay(
Text(String(pushHistory.viewCnt))
.font(FontStyle.VersionText.font)
.foregroundColor(.white)
)
} else {
Ellipse()
.fill(Color.red)
.frame(width: 12, height: 12)
.overlay(
Text("-")
.font(FontStyle.VersionText.font)
.foregroundColor(.white)
)
}
}
}
Text(tab.title)
.font(.caption)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.contentShape(.rect)
})
Text(tab.title)
.font(.caption)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.contentShape(Rectangle())
}
}
.frame(height: 50)
......@@ -262,6 +286,64 @@ struct CustomTabBar: View {
}
}
/**
* タブが選択されたときの処理
*/
private func handleTabSelection(_ tab: Tab) {
selectedTabModel.activeTab = tab
if tab == .map {
selectedTabModel.isPoppver.toggle()
// iPhoneは船に移動、iPadはMenu表示
if UIDevice.current.userInterfaceIdiom == .phone {
location.focusOwnShip = true
} else {
if isMenuTaskViewVisible {
MenuWindowManager.shared.hideMenuView()
} else {
mapFunctionsView()
}
isMenuTaskViewVisible.toggle()
}
} else if tab == .chat {
let message = GetMessage()
message.start()
message.readNotification()
message.checkUnreadMessages()
selectedTabModel.isPoppver = false
if UIDevice.current.userInterfaceIdiom == .pad {
MenuWindowManager.shared.hideMenuView()
isMenuTaskViewVisible = false
}
} else {
selectedTabModel.isPoppver = false
if UIDevice.current.userInterfaceIdiom == .pad {
MenuWindowManager.shared.hideMenuView()
isMenuTaskViewVisible = false
}
}
}
private func mapFunctionsView() {
let screenBounds = UIScreen.main.bounds
let menuTaskViewWidth: CGFloat = 400
let menuTaskViewHeight: CGFloat = 300
let menuTaskViewOffset: CGFloat = 80
let menuTaskViewX: CGFloat = 10
let menuTaskViewY = screenBounds.height - menuTaskViewHeight - menuTaskViewOffset
MenuWindowManager.shared.showMenuView(
MenuTaskView()
.frame(width: menuTaskViewWidth, height: menuTaskViewHeight)
.background(ColorSet.BackgroundSecondary.color)
.cornerRadius(15),
frame: CGRect(x: menuTaskViewX, y: menuTaskViewY, width: menuTaskViewWidth, height: menuTaskViewHeight)
)
}
/**
* Warninngモードレスポンス
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment