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
} }
} }
......
...@@ -12,15 +12,21 @@ enum Tab: String, CaseIterable{ ...@@ -12,15 +12,21 @@ enum Tab: String, CaseIterable{
case chat = "tab_chat" case chat = "tab_chat"
case alert = "tab_notification" case alert = "tab_notification"
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,74 +42,104 @@ struct MainTabView: View { ...@@ -37,74 +42,104 @@ 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
TabView(selection: $selectedTabModel.activeTab){ ZStack(alignment: .bottom) {
if SharingData.my.isCommunication { TabView(selection: $selectedTabModel.activeTab){
ChatView() ZStack {
.tag(Tab.chat) MapRepresentable()
} MapInformation()
}
.ignoresSafeArea()
.tag(Tab.map)
ZStack { if SharingData.my.isCommunication {
MapRepresentable() ChatView()
MapInformation() .tag(Tab.chat)
} }
.ignoresSafeArea()
.tag(Tab.map)
NotificationView() NotificationView()
.tag(Tab.alert) .tag(Tab.alert)
MenuView(isSignout: $isSignout) MenuView(isSignout: $isSignout)
.tag(Tab.menu) .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 { } 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 {
if SharingData.my.isCommunication { ChatView()
ChatView() .padding(.bottom, 50)
.tag(Tab.chat) .tag(Tab.chat)
} }
NotificationView()
.padding(.bottom, 50)
.tag(Tab.alert)
ZStack { MenuView(isSignout: $isSignout)
MapRepresentable() .padding(.bottom, 50)
MapInformation() .tag(Tab.menu)
} }
.ignoresSafeArea() .tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
.tag(Tab.map) }
}
}
}
NotificationView() class MenuWindowManager {
.tag(Tab.alert) static let shared = MenuWindowManager()
private var window: UIWindow?
MenuView(isSignout: $isSignout) func showMenuView<Content: View>(_ content: Content, frame: CGRect) {
.tag(Tab.menu) guard window == nil else { return }
}
.hideNativeTabBar() let hostingController = UIHostingController(rootView: content)
// .popover(isPresented: .constant(isPopover && SharingData.my.isFuelSwitchTask), attachmentAnchor: .point(.bottom)) { if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
.popover(isPresented: .constant(isPopover), attachmentAnchor: .point(.bottom)) { var rFrame = frame
MenuTaskView() rFrame.size.height -= 20
.presentationCompactAdaptation(.popover)
.zIndex(0) let newWindow = UIWindow(windowScene: windowScene)
.frame(minWidth: 500, maxHeight: 500) newWindow.rootViewController = hostingController
.aspectRatio(contentMode: .fit) newWindow.windowLevel = .alert + 1
.presentationCornerRadius(15) newWindow.backgroundColor = UIColor.clear
.presentationBackgroundInteraction(.enabled(upThrough: .medium)) newWindow.makeKeyAndVisible()
.presentationBackground(ColorSet.BackgroundSecondary.color) newWindow.alpha = 0.8
.interactiveDismissDisabled() 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 { struct CustomTabBar: View {
...@@ -118,98 +153,87 @@ struct CustomTabBar: View { ...@@ -118,98 +153,87 @@ 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: { VStack{
selectedTabModel.activeTab = tab ZStack(alignment: .bottomTrailing) {
if tab == .map { if !SharingData.my.isCommunication && tab == Tab.chat {
selectedTabModel.isPoppver.toggle() Image("tab_chat_Invalid")
//iPhoneは船に移動 iPadはMenu表示 .font(.title2)
if UIDevice.current.userInterfaceIdiom == .phone { .onTapGesture {
location.focusOwnShip = true 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上の既読マーク //チャットTab上の既読マーク
if tab == Tab.chat { if tab == Tab.chat {
if message.viewCnt != 0 { if message.viewCnt != 0 {
if message.viewCnt < 10 { if message.viewCnt < 10 {
Ellipse() Ellipse()
.fill(Color.red) .fill(Color.red)
.frame(width: 12, height: 12) .frame(width: 12, height: 12)
.overlay( .overlay(
Text(String(message.viewCnt)) Text(String(message.viewCnt))
.font(FontStyle.VersionText.font) .font(FontStyle.VersionText.font)
.foregroundColor(.white) .foregroundColor(.white)
) )
} else { } else {
Ellipse() Ellipse()
.fill(Color.red) .fill(Color.red)
.frame(width: 12, height: 12) .frame(width: 12, height: 12)
.overlay( .overlay(
Text("-") Text("-")
.font(FontStyle.VersionText.font) .font(FontStyle.VersionText.font)
.foregroundColor(.white) .foregroundColor(.white)
) )
}
} }
} }
}
if tab == Tab.alert { if tab == Tab.alert {
if pushHistory.viewCnt != 0 { if pushHistory.viewCnt != 0 {
if pushHistory.viewCnt < 10 { if pushHistory.viewCnt < 10 {
Ellipse() Ellipse()
.fill(Color.red) .fill(Color.red)
.frame(width: 12, height: 12) .frame(width: 12, height: 12)
.overlay( .overlay(
Text(String(pushHistory.viewCnt)) Text(String(pushHistory.viewCnt))
.font(FontStyle.VersionText.font) .font(FontStyle.VersionText.font)
.foregroundColor(.white) .foregroundColor(.white)
) )
} else { } else {
Ellipse() Ellipse()
.fill(Color.red) .fill(Color.red)
.frame(width: 12, height: 12) .frame(width: 12, height: 12)
.overlay( .overlay(
Text("-") Text("-")
.font(FontStyle.VersionText.font) .font(FontStyle.VersionText.font)
.foregroundColor(.white) .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) .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