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

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

iPad Sheetが使えない不具合修正
parent af4a98e1
...@@ -958,10 +958,14 @@ ...@@ -958,10 +958,14 @@
inputFileListPaths = ( inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Sailassist/Pods-Sailassist-frameworks-${CONFIGURATION}-input-files.xcfilelist", "${PODS_ROOT}/Target Support Files/Pods-Sailassist/Pods-Sailassist-frameworks-${CONFIGURATION}-input-files.xcfilelist",
); );
inputPaths = (
);
name = "[CP] Embed Pods Frameworks"; name = "[CP] Embed Pods Frameworks";
outputFileListPaths = ( outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Sailassist/Pods-Sailassist-frameworks-${CONFIGURATION}-output-files.xcfilelist", "${PODS_ROOT}/Target Support Files/Pods-Sailassist/Pods-Sailassist-frameworks-${CONFIGURATION}-output-files.xcfilelist",
); );
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Sailassist/Pods-Sailassist-frameworks.sh\"\n"; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Sailassist/Pods-Sailassist-frameworks.sh\"\n";
...@@ -1295,12 +1299,15 @@ ...@@ -1295,12 +1299,15 @@
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UIRequiresFullScreen = YES; INFOPLIST_KEY_UIRequiresFullScreen = YES;
INFOPLIST_KEY_UIStatusBarStyle = "";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 16.4; IPHONEOS_DEPLOYMENT_TARGET = 16.4;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 11.5;
MARKETING_VERSION = 1.0.3; MARKETING_VERSION = 1.0.3;
OTHER_SWIFT_FLAGS = "-D CANARY -D COCOAPODS"; OTHER_SWIFT_FLAGS = "-D CANARY -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist.canary; PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist.canary;
...@@ -1338,12 +1345,15 @@ ...@@ -1338,12 +1345,15 @@
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UIRequiresFullScreen = YES; INFOPLIST_KEY_UIRequiresFullScreen = YES;
INFOPLIST_KEY_UIStatusBarStyle = "";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 16.4; IPHONEOS_DEPLOYMENT_TARGET = 16.4;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 11.5;
MARKETING_VERSION = 1.0.3; MARKETING_VERSION = 1.0.3;
OTHER_SWIFT_FLAGS = "-D COCOAPODS"; OTHER_SWIFT_FLAGS = "-D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist; PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist;
...@@ -1524,12 +1534,15 @@ ...@@ -1524,12 +1534,15 @@
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UIRequiresFullScreen = YES; INFOPLIST_KEY_UIRequiresFullScreen = YES;
INFOPLIST_KEY_UIStatusBarStyle = "";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 16.4; IPHONEOS_DEPLOYMENT_TARGET = 16.4;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 11.5;
MARKETING_VERSION = 1.0.3; MARKETING_VERSION = 1.0.3;
OTHER_SWIFT_FLAGS = "-D QC -D COCOAPODS"; OTHER_SWIFT_FLAGS = "-D QC -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist.qc; PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist.qc;
......
...@@ -22,7 +22,7 @@ struct MapInformation: View { ...@@ -22,7 +22,7 @@ struct MapInformation: View {
.cornerRadius(3) .cornerRadius(3)
} }
.padding(.top, 100) .padding(.top, 100)
.padding(.trailing, 200) .padding(.trailing, positionLocation())
VStack { VStack {
ForEach(ngaData.ngaArea.map{ $0.1 }.filter{ $0.passingCnt > 0 }, id: \.name) { nga in ForEach(ngaData.ngaArea.map{ $0.1 }.filter{ $0.passingCnt > 0 }, id: \.name) { nga in
Text("Entering NGA \(nga.name)") Text("Entering NGA \(nga.name)")
...@@ -44,6 +44,15 @@ struct MapInformation: View { ...@@ -44,6 +44,15 @@ struct MapInformation: View {
} }
return location return location
} }
func positionLocation() -> CGFloat {
var yPos: CGFloat = 200
if UIDevice.current.userInterfaceIdiom == .pad {
yPos = 900
}
return yPos
}
} }
#Preview { #Preview {
......
...@@ -454,15 +454,36 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, ObservableObject { ...@@ -454,15 +454,36 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, ObservableObject {
let tabWindow = PassThroughWindow(windowScene: scene) let tabWindow = PassThroughWindow(windowScene: scene)
tabWindow.rootViewController = tabBarController tabWindow.rootViewController = tabBarController
tabWindow.isHidden = false tabWindow.isHidden = false
self.tabWindow = tabWindow self.tabWindow = tabWindow
} }
} }
class PassThroughWindow: UIWindow{ 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? { override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
guard let view = super.hitTest(point, with: event) else { return nil} let view = super.hitTest(point, with: event)
return rootViewController?.view == view ? nil : view
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
} }
} }
......
...@@ -14,13 +14,19 @@ enum Tab: String, CaseIterable{ ...@@ -14,13 +14,19 @@ enum Tab: String, CaseIterable{
case menu = "tab_menu" case menu = "tab_menu"
var title: String{ var title: String{
"" switch self {
case .map: return "Map"
case .chat: return "Chat"
case .alert: return "Alert"
case .menu: return "Menu"
}
} }
} }
struct MainTabView: View { struct MainTabView: View {
@EnvironmentObject var selectedTabModel: SelectedTabModel @EnvironmentObject var selectedTabModel: SelectedTabModel
@EnvironmentObject private var sceneDelegate: SceneDelegate @EnvironmentObject private var sceneDelegate: SceneDelegate
@ObservedObject var location = SharingData.location
@State var isSignout = false @State var isSignout = false
init() { init() {
...@@ -29,7 +35,6 @@ struct MainTabView: View { ...@@ -29,7 +35,6 @@ struct MainTabView: View {
UITabBar.appearance().scrollEdgeAppearance = appearance UITabBar.appearance().scrollEdgeAppearance = appearance
UITabBar.appearance().standardAppearance = appearance UITabBar.appearance().standardAppearance = appearance
SharingData.location.focusOwnShip = true SharingData.location.focusOwnShip = true
// EcaCoordinatesTable().setEcaData()
} }
var body: some View { var body: some View {
...@@ -37,12 +42,8 @@ struct MainTabView: View { ...@@ -37,12 +42,8 @@ struct MainTabView: View {
@State var isTabShow: Bool = sceneDelegate.tabWindow != nil @State var isTabShow: Bool = sceneDelegate.tabWindow != nil
@State var isTaskSel: Bool = selectedTabModel.activeTab == .map @State var isTaskSel: Bool = selectedTabModel.activeTab == .map
ZStack(alignment: .bottom) {
TabView(selection: $selectedTabModel.activeTab){ TabView(selection: $selectedTabModel.activeTab){
if SharingData.my.isCommunication {
ChatView()
.tag(Tab.chat)
}
ZStack { ZStack {
MapRepresentable() MapRepresentable()
MapInformation() MapInformation()
...@@ -50,60 +51,94 @@ struct MainTabView: View { ...@@ -50,60 +51,94 @@ struct MainTabView: View {
.ignoresSafeArea() .ignoresSafeArea()
.tag(Tab.map) .tag(Tab.map)
if SharingData.my.isCommunication {
ChatView()
.tag(Tab.chat)
}
NotificationView() NotificationView()
.tag(Tab.alert) .tag(Tab.alert)
MenuView(isSignout: $isSignout) MenuView(isSignout: $isSignout)
.tag(Tab.menu) .tag(Tab.menu)
} }
.hideNativeTabBar() // .hideNativeTabBar()
// .sheet(isPresented: .constant(isTaskSel && isTabShow && SharingData.my.isFuelSwitchTask), content: {
.sheet(isPresented: .constant(isTaskSel && isTabShow), content: { .sheet(isPresented: .constant(isTaskSel && isTabShow), content: {
MenuTaskView() MenuTaskView()
.zIndex(0) .zIndex(0)
.presentationDragIndicator(.hidden) .presentationDragIndicator(.hidden)
.presentationDetents([.height(150), .medium, .fraction(0.99)]) .presentationDetents([.height(150), .medium, .fraction(0.99)]) //Seetの高さを設定する
.presentationCornerRadius(15) .presentationCornerRadius(15)
.presentationBackgroundInteraction(.enabled(upThrough: .medium)) .presentationBackgroundInteraction(.enabled(upThrough: .medium))
.presentationBackground(ColorSet.BackgroundSecondary.color) .presentationBackground(ColorSet.BackgroundSecondary.color)
.interactiveDismissDisabled() .interactiveDismissDisabled() //Seetを閉じられなくする
}) })
} else if UIDevice.current.userInterfaceIdiom == .pad {
@State var isPopover: Bool = selectedTabModel.isPoppver
TabView(selection: $selectedTabModel.activeTab){
if SharingData.my.isCommunication {
ChatView()
.tag(Tab.chat)
} }
} else if UIDevice.current.userInterfaceIdiom == .pad {
ZStack(alignment: .bottom) {
TabView(selection: $selectedTabModel.activeTab) {
ZStack { ZStack {
MapRepresentable() MapRepresentable()
MapInformation() MapInformation()
} }
.ignoresSafeArea() .ignoresSafeArea(edges: .top) // 上部の安全領域を無視
.padding(.bottom, 50) // タブバーの高さ分を調整
.tag(Tab.map) .tag(Tab.map)
if SharingData.my.isCommunication {
ChatView()
.padding(.bottom, 50)
.tag(Tab.chat)
}
NotificationView() NotificationView()
.padding(.bottom, 50)
.tag(Tab.alert) .tag(Tab.alert)
MenuView(isSignout: $isSignout) MenuView(isSignout: $isSignout)
.padding(.bottom, 50)
.tag(Tab.menu) .tag(Tab.menu)
} }
.hideNativeTabBar() .tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
// .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) class MenuWindowManager {
.aspectRatio(contentMode: .fit) static let shared = MenuWindowManager()
.presentationCornerRadius(15) private var window: UIWindow?
.presentationBackgroundInteraction(.enabled(upThrough: .medium))
.presentationBackground(ColorSet.BackgroundSecondary.color) func showMenuView<Content: View>(_ content: Content, frame: CGRect) {
.interactiveDismissDisabled() 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
} }
} }
...@@ -118,39 +153,30 @@ struct CustomTabBar: View { ...@@ -118,39 +153,30 @@ struct CustomTabBar: View {
@ObservedObject var pushHistory = SharingData.pushHistory @ObservedObject var pushHistory = SharingData.pushHistory
@State var isSignalrRestert = false @State var isSignalrRestert = false
@State var isMenuTaskViewVisible = false
var body: some View { var body: some View {
VStack(spacing: 0){ VStack(spacing: 0){
Divider() Divider()
HStack(spacing: 0){ HStack(spacing: 0){
ForEach(Tab.allCases, id: \.rawValue) { tab in 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
}
} else if tab == .chat {
let message = GetMessage()
message.start()
message.readNotification()
message.checkUnreadMessages()
selectedTabModel.isPoppver = false
} else {
selectedTabModel.isPoppver = false
}
}, label: {
VStack{ VStack{
ZStack(alignment: .bottomTrailing) { ZStack(alignment: .bottomTrailing) {
if !SharingData.my.isCommunication && tab == Tab.chat { if !SharingData.my.isCommunication && tab == Tab.chat {
Image("tab_chat_Invalid") Image("tab_chat_Invalid")
.font(.title2) .font(.title2)
.onTapGesture {
handleTabSelection(tab)
print("Image for \(tab.rawValue) tapped")
}
} else { } else {
Image(selectedTabModel.activeTab == tab ? tab.rawValue + "_selected" : tab.rawValue) Image(selectedTabModel.activeTab == tab ? tab.rawValue + "_selected" : tab.rawValue)
.font(.title2) .font(.title2)
.onTapGesture {
handleTabSelection(tab)
print("Image for \(tab.rawValue) tapped")
}
} }
//チャットTab上の既読マーク //チャットTab上の既読マーク
...@@ -207,9 +233,7 @@ struct CustomTabBar: View { ...@@ -207,9 +233,7 @@ struct CustomTabBar: View {
.font(.caption) .font(.caption)
} }
.frame(maxWidth: .infinity, maxHeight: .infinity) .frame(maxWidth: .infinity, maxHeight: .infinity)
.contentShape(.rect) .contentShape(Rectangle())
})
} }
} }
.frame(height: 50) .frame(height: 50)
...@@ -262,6 +286,64 @@ struct CustomTabBar: View { ...@@ -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モードレスポンス * 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