Commit 2f9bf158 authored by sugita mamoru's avatar sugita mamoru

Merge commit '3927140b' into develop

parents 46236c97 3927140b
......@@ -108,6 +108,9 @@
D5CB6F9B2B021C4F00EC2010 /* LocationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5CB6F9A2B021C4F00EC2010 /* LocationViewModel.swift */; };
D5CB6F9F2B0220A700EC2010 /* ErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5CB6F9E2B0220A700EC2010 /* ErrorView.swift */; };
D5CB6FA12B023F7F00EC2010 /* EcaTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5CB6FA02B023F7F00EC2010 /* EcaTask.swift */; };
D5E008742B2ADD3F00C4070A /* MenuManualECDISView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5E008732B2ADD3F00C4070A /* MenuManualECDISView.swift */; };
D5E008762B2ADD5900C4070A /* MenuManualRADARView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5E008752B2ADD5900C4070A /* MenuManualRADARView.swift */; };
D5E008782B2B022200C4070A /* MenuAboutAppView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5E008772B2B022200C4070A /* MenuAboutAppView.swift */; };
D5E03A672B04484D00D65FCE /* SessionTaskList.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5E03A662B04484D00D65FCE /* SessionTaskList.swift */; };
D6BEB5D3598C619546873CFC /* Pods_Sailassist.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C8118E85BA516EF0E884AA5 /* Pods_Sailassist.framework */; };
/* End PBXBuildFile section */
......@@ -148,7 +151,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
020B98102AD8C3140029DE4C /* Sailassist.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sailassist.app; sourceTree = BUILT_PRODUCTS_DIR; };
020B98102AD8C3140029DE4C /* Sail Assist.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Sail Assist.app"; sourceTree = BUILT_PRODUCTS_DIR; };
020B98132AD8C3140029DE4C /* SailassistApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SailassistApp.swift; sourceTree = "<group>"; };
020B98152AD8C3150029DE4C /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
020B98172AD8C3190029DE4C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
......@@ -256,6 +259,9 @@
D5CB6F9A2B021C4F00EC2010 /* LocationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = LocationViewModel.swift; path = Sailassist/LocationViewModel.swift; sourceTree = SOURCE_ROOT; };
D5CB6F9E2B0220A700EC2010 /* ErrorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ErrorView.swift; path = Sailassist/ErrorView.swift; sourceTree = SOURCE_ROOT; };
D5CB6FA02B023F7F00EC2010 /* EcaTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = EcaTask.swift; path = Sailassist/ECA/EcaTask.swift; sourceTree = SOURCE_ROOT; };
D5E008732B2ADD3F00C4070A /* MenuManualECDISView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MenuManualECDISView.swift; path = Sailassist/Menu/View/MenuManualECDISView.swift; sourceTree = SOURCE_ROOT; };
D5E008752B2ADD5900C4070A /* MenuManualRADARView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MenuManualRADARView.swift; path = Sailassist/Menu/View/MenuManualRADARView.swift; sourceTree = SOURCE_ROOT; };
D5E008772B2B022200C4070A /* MenuAboutAppView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MenuAboutAppView.swift; path = Sailassist/Menu/View/MenuAboutAppView.swift; sourceTree = SOURCE_ROOT; };
D5E03A662B04484D00D65FCE /* SessionTaskList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SessionTaskList.swift; path = Sailassist/ServerSession/SessionTaskList.swift; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
......@@ -308,7 +314,7 @@
020B98112AD8C3140029DE4C /* Products */ = {
isa = PBXGroup;
children = (
020B98102AD8C3140029DE4C /* Sailassist.app */,
020B98102AD8C3140029DE4C /* Sail Assist.app */,
020B98202AD8C31A0029DE4C /* SailAssistTests.xctest */,
020B982A2AD8C31A0029DE4C /* SailAssitUITests.xctest */,
);
......@@ -583,6 +589,9 @@
025C27FF2B034A1900BADC49 /* PDFViewer.swift */,
024EDE1A2B0C41E40013BAC8 /* MenuSettingView.swift */,
024EDE1C2B0C42F70013BAC8 /* MenuGpsSelectView.swift */,
D5E008732B2ADD3F00C4070A /* MenuManualECDISView.swift */,
D5E008752B2ADD5900C4070A /* MenuManualRADARView.swift */,
D5E008772B2B022200C4070A /* MenuAboutAppView.swift */,
);
path = View;
sourceTree = "<group>";
......@@ -730,7 +739,7 @@
);
name = Sailassist;
productName = forShip;
productReference = 020B98102AD8C3140029DE4C /* Sailassist.app */;
productReference = 020B98102AD8C3140029DE4C /* Sail Assist.app */;
productType = "com.apple.product-type.application";
};
020B981F2AD8C31A0029DE4C /* SailAssistTests */ = {
......@@ -931,6 +940,7 @@
024EDE1B2B0C41E40013BAC8 /* MenuSettingView.swift in Sources */,
020B98552AD924930029DE4C /* QrCodeScannerView.swift in Sources */,
02CE4D7F2ADE42A9002E79BC /* MenuContentView.swift in Sources */,
D5E008782B2B022200C4070A /* MenuAboutAppView.swift in Sources */,
D5AE351B2AEBA66A00059889 /* ResLogin.swift in Sources */,
D592D5252B0F16CA00B91A1C /* ReqMessage.swift in Sources */,
02CE4D832ADE672B002E79BC /* MapTaskView.swift in Sources */,
......@@ -951,6 +961,7 @@
020B984B2AD915810029DE4C /* QRReadView.swift in Sources */,
02A1DE332AFB654A005BCF55 /* CustomCornerRadius.swift in Sources */,
D545FC762B09C81300F206D0 /* PushNotificationTypes.swift in Sources */,
D5E008742B2ADD3F00C4070A /* MenuManualECDISView.swift in Sources */,
D545FC742B09C74300F206D0 /* AlertManager.swift in Sources */,
020B98692ADD221E0029DE4C /* Preferences.swift in Sources */,
02CD06932AE88970005F8D8F /* ServerSession.swift in Sources */,
......@@ -987,6 +998,7 @@
D5258CA32B036CC500365276 /* SessionGetMessage.swift in Sources */,
D5258C992B0334BF00365276 /* SessionShipStatus.swift in Sources */,
02CE4D872ADF62A7002E79BC /* EcaListView.swift in Sources */,
D5E008762B2ADD5900C4070A /* MenuManualRADARView.swift in Sources */,
D59908C62B19EA70000E13DD /* ResPushHistory.swift in Sources */,
020B986C2ADD3E810029DE4C /* InTextLib.swift in Sources */,
02C3E5D12AFCC16800AF7837 /* ChatTitleView.swift in Sources */,
......@@ -1185,9 +1197,9 @@
MARKETING_VERSION = 0.9;
OTHER_SWIFT_FLAGS = "-D CANARY -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist.canary;
PRODUCT_NAME = "$(TARGET_NAME)";
PRODUCT_NAME = "Sail Assist";
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
......@@ -1228,8 +1240,8 @@
MARKETING_VERSION = 0.9;
OTHER_SWIFT_FLAGS = "-D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
PRODUCT_NAME = "Sail Assist";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
......@@ -1414,8 +1426,8 @@
MARKETING_VERSION = 0.9;
OTHER_SWIFT_FLAGS = "-D QC -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist.qc;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
PRODUCT_NAME = "Sail Assist";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
......
......@@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B980F2AD8C3140029DE4C"
BuildableName = "Sailassist.app"
BuildableName = "Sail Assist.app"
BlueprintName = "Sailassist"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
......@@ -44,7 +44,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B980F2AD8C3140029DE4C"
BuildableName = "Sailassist.app"
BuildableName = "Sail Assist.app"
BlueprintName = "Sailassist"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
......@@ -61,7 +61,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B980F2AD8C3140029DE4C"
BuildableName = "Sailassist.app"
BuildableName = "Sail Assist.app"
BlueprintName = "Sailassist"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
......
......@@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B980F2AD8C3140029DE4C"
BuildableName = "Sailassist.app"
BuildableName = "Sail Assist.app"
BlueprintName = "Sailassist"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
......@@ -44,7 +44,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B980F2AD8C3140029DE4C"
BuildableName = "Sailassist.app"
BuildableName = "Sail Assist.app"
BlueprintName = "Sailassist"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
......@@ -61,7 +61,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B980F2AD8C3140029DE4C"
BuildableName = "Sailassist.app"
BuildableName = "Sail Assist.app"
BlueprintName = "Sailassist"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
LastUpgradeVersion = "1510"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B980F2AD8C3140029DE4C"
BuildableName = "Sailassist.app"
BlueprintName = "Sailassist"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Canary"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B981F2AD8C31A0029DE4C"
BuildableName = "SailAssistTests.xctest"
BlueprintName = "SailAssistTests"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "QC"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
......@@ -39,16 +36,6 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B980F2AD8C3140029DE4C"
BuildableName = "Sailassist.app"
BlueprintName = "Sailassist"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
......@@ -56,19 +43,9 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B980F2AD8C3140029DE4C"
BuildableName = "Sailassist.app"
BlueprintName = "Sailassist"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Canary">
buildConfiguration = "Release">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
......
......@@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B980F2AD8C3140029DE4C"
BuildableName = "Sailassist.app"
BuildableName = "Sail Assist.app"
BlueprintName = "Sailassist"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
......@@ -44,7 +44,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B980F2AD8C3140029DE4C"
BuildableName = "Sailassist.app"
BuildableName = "Sail Assist.app"
BlueprintName = "Sailassist"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
......@@ -61,7 +61,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B980F2AD8C3140029DE4C"
BuildableName = "Sailassist.app"
BuildableName = "Sail Assist.app"
BlueprintName = "Sailassist"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B980F2AD8C3140029DE4C"
BuildableName = "Sailassist.app"
BlueprintName = "Sailassist"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Canary"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Canary"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B980F2AD8C3140029DE4C"
BuildableName = "Sailassist.app"
BlueprintName = "Sailassist"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "020B980F2AD8C3140029DE4C"
BuildableName = "Sailassist.app"
BlueprintName = "Sailassist"
ReferencedContainer = "container:Sailassist.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Canary">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
......@@ -14,8 +14,10 @@ class LoginViewModel: ObservableObject{
struct ContentView: View {
@StateObject private var loginViewModel = LoginViewModel()
@EnvironmentObject private var sceneDelegate: SceneDelegate
let selectedTabModel = SelectedTabModel()
let signalRService = SignalRService()
let locationViewModel = LocationViewModel()
var body: some View {
MainTabView()
......@@ -37,6 +39,7 @@ struct ContentView: View {
selectedTabModel.activeTab = .task
}, content: {
LoginView(isLogin: $loginViewModel.isLogin)
.environmentObject(locationViewModel)
})
}
}
......
......@@ -21,13 +21,19 @@ class LocationViewModel: NSObject, ObservableObject, CLLocationManagerDelegate {
super.init()
}
func requestPermission() {
locationManager.requestAlwaysAuthorization()
func requestPermission() -> (alert: Bool, type: AlertType) {
var alert = false
let type: AlertType = .gpsPermission
locationManager.requestWhenInUseAuthorization()
locationManager.requestAlwaysAuthorization() // バックグラウンド実行中も座標取得する場合はこちら
let status = CLLocationManager().authorizationStatus
switch status {
case .authorizedAlways :
print(debug: "authorizationStatus : .authorizedAlways")
case .notDetermined:
alert = true
print(debug: "authorizationStatus : .notDetermined")
case .restricted:
print(debug: "authorizationStatus : .restricted")
......@@ -41,28 +47,47 @@ class LocationViewModel: NSObject, ObservableObject, CLLocationManagerDelegate {
if status == .authorizedAlways || status == .authorizedWhenInUse {
locationManager.delegate = self
locationManager.allowsBackgroundLocationUpdates = true // バックグラウンド実行中も座標取得する場合、trueにする
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.distanceFilter = 10 //10mぐらい移動したら位置情報取得
locationManager.distanceFilter = 1 //1mぐらい移動したら位置情報取得
locationManager.pausesLocationUpdatesAutomatically = false
locationManager.activityType = .otherNavigation
locationManager.headingFilter = 10.0
locationManager.headingOrientation = .portrait // どこを0度とするか指定
locationManager.startUpdatingLocation()
}
return(alert, type)
}
func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
authorizationStatus = manager.authorizationStatus
}
// エラーハンドル
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
print(debug: error.localizedDescription)
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if let newLocation = locations.last {
print(debug: "called")
if let newLocation = locations.first {
print(debug: "called locationManager")
lastSeenLocation = newLocation
let targetCoordinate : CLLocationCoordinate2D = lastSeenLocation!.coordinate
SharingData.my.gps = targetCoordinate
SharingData.my.setLocation()
if Preferences.LocationType == 0 {
ecaTask.checkEca()
}
}
if Preferences.LocationType == 1 {
let eca = EcaTask()
eca.start()
ecaTask.checkEca()
}
}
......
......@@ -28,9 +28,11 @@ class LoginViewParam: ObservableObject{
@Published var userName: String = ""
}
let TimerInterval = 60.0 * 10.0
struct LoginView: View {
@ObservedObject var scannerViewModel = ScannerViewModel()
@StateObject var locationViewModel = LocationViewModel()
@EnvironmentObject var locationViewModel: LocationViewModel
@Binding var isLogin: Bool
@State var isQrRead: Bool = false
@State var viewMode: LoginViewMode = .SelectType
......@@ -123,6 +125,9 @@ struct LoginView: View {
})
.onAppear() {
LoginCheck()
let result = locationViewModel.requestPermission()
isAlert = result.alert
alertType = result.type
}
.preferredColorScheme(.dark)
}
......@@ -171,7 +176,7 @@ struct LoginView: View {
// let ecaArea = EcaArea()
// ecaArea.start()
timer = Timer.scheduledTimer(withTimeInterval: 30.0, repeats: true) { _ in
timer = Timer.scheduledTimer(withTimeInterval: TimerInterval, repeats: true) { _ in
print(debug: "called timer")
let eca = EcaTask()
eca.start()
......@@ -221,7 +226,7 @@ struct LoginView: View {
// let ecaArea = EcaArea()
// ecaArea.start()
timer = Timer.scheduledTimer(withTimeInterval: 30.0, repeats: true) { _ in
timer = Timer.scheduledTimer(withTimeInterval: TimerInterval, repeats: true) { _ in
print(debug: "called timer")
let eca = EcaTask()
eca.start()
......
......@@ -118,7 +118,7 @@ struct InputIdPassWordView: View {
// let ecaArea = EcaArea()
// ecaArea.start()
timer = Timer.scheduledTimer(withTimeInterval: 30.0, repeats: true) { _ in
timer = Timer.scheduledTimer(withTimeInterval: TimerInterval, repeats: true) { _ in
print(debug: "called timer")
let eca = EcaTask()
eca.start()
......
......@@ -11,13 +11,22 @@ import PDFKit
enum MenuPath: String, Hashable{
case Manual
case ManualECDIS
case ManualECDISBasic
case ManualECDISFunction
case ManualRADAR
case ManualJmarineNeCST
case ManualRADARBasic
case ManualRADARFunction
case ManualAIS
case ManualInmalsatC
case ManualInternationalVHF
case ManualVDR
case Information
case Setting
case GpsSelect
case Help
case AboutApp
case TermsOfUse
case PrivacyStatement
case ContactUs
case SignOut
......@@ -27,10 +36,24 @@ enum MenuPath: String, Hashable{
"Equipment manual"
case .ManualECDIS:
"ECDIS"
case .ManualECDISBasic:
"BasicOperation"
case .ManualECDISFunction:
"Function"
case .ManualRADAR:
"RADAR"
case .ManualJmarineNeCST:
"J-marine NeCST"
case .ManualRADARBasic:
"BasicOperation"
case .ManualRADARFunction:
"Function"
case .ManualAIS:
"AIS"
case .ManualInmalsatC:
"Inmalsat C"
case .ManualInternationalVHF:
"International VHF"
case .ManualVDR:
"VDR"
case .Information:
"Information"
case .Setting:
......@@ -41,6 +64,10 @@ enum MenuPath: String, Hashable{
"Help"
case .AboutApp:
"About this App"
case .TermsOfUse:
"Terms Of Use"
case .PrivacyStatement:
"Privacy Statement"
case .ContactUs:
"Contact Us"
case .SignOut:
......@@ -115,11 +142,20 @@ struct MenuView: View {
}else if goto == .GpsSelect{
MenuGpsSelectView(path: $path)
.navigationBarHidden(true)
}else if goto == .ManualECDIS{
MenuManualECDISView(path: $path)
.navigationBarHidden(true)
}else if goto == .ManualRADAR{
MenuManualRADARView(path: $path)
.navigationBarHidden(true)
}else if goto == .AboutApp{
MenuAboutAppView(path: $path)
.navigationBarHidden(true)
}else{
VStack(spacing: 0) {
MenuTitleView(path: $path, title: goto.title)
if let url = Preferences.ECDISUrl{
if let url = Preferences.ECDISBasicUrl{
PDFViewer(url: url)
}else{
Spacer()
......
//
// MenuAboutAppView.swift
// Sailassist
//
// Created by 三浦薫巳 on 2023/12/14.
//
import SwiftUI
import PDFKit
struct MenuAboutAppView: View {
@Binding var path : [MenuPath]
let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String
var body: some View {
VStack{
MenuTitleView(path: $path, title: MenuPath.AboutApp.title)
HStack {
VStack(alignment: .leading, spacing: 10){
Text("Version")
.font(FontStyle.EmphasisText.font)
.foregroundColor(ColorSet.BodyDescriptiion.color)
#if CANARY
Text("\(version)" + " Canary")
.font(FontStyle.EmphasisText.font)
.foregroundColor(ColorSet.Body.color)
#elseif QC
Text("\(version)" + " QC")
.font(FontStyle.TitleS.font)
.foregroundColor(ColorSet.Body.color)
#else
Text("\(version)")
.font(FontStyle.TitleS.font)
.foregroundColor(ColorSet.Body.color)
#endif
}
.padding(.horizontal, 30)
.padding(.vertical, 17)
Spacer()
}
Divider()
.background(ColorSet.LineColor04.color)
Spacer().frame(height: 50)
Text("Policy")
.font(FontStyle.EmphasisText.font)
.foregroundColor(ColorSet.BodyDescriptiion.color)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.leading, 30)
Divider()
.background(ColorSet.LineColor04.color)
Button{
path.append(.TermsOfUse)
}label: {
MenuContentView(content: .TermsOfUse)
}
Button{
path.append(.PrivacyStatement)
}label: {
MenuContentView(content: .PrivacyStatement)
}
Spacer().frame(height: 50)
Text("Open Source Licenses")
.font(FontStyle.EmphasisText.font)
.foregroundColor(ColorSet.BodyDescriptiion.color)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.leading, 30)
Divider()
.background(ColorSet.LineColor04.color)
Text("Azure Notification Hubs SDK for Apple")
.font(FontStyle.EmphasisText.font)
.foregroundColor(ColorSet.Body.color)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.leading, 30)
Spacer()
}
.background(ColorSet.BackgroundPrimary.color)
}
}
#Preview {
MenuAboutAppView(path: .constant([.AboutApp]))
}
//
// MenuManualECDISView.swift
// Sailassist
//
// Created by 三浦薫巳 on 2023/12/14.
//
import SwiftUI
import PDFKit
struct MenuManualECDISView: View {
@State var isAlert: Bool = false
@Binding var path : [MenuPath]
var body: some View {
VStack{
MenuTitleView(path: $path, title: MenuPath.ManualECDIS.title)
Button{
if Preferences.ECDISBasicUrl != nil{
path.append(.ManualECDISBasic)
}else{
if let url = PDFDownloadManager.main.downloadFile(urlString: "https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf", fileName: "ECDIS.pdf"){
Preferences.ECDISBasicUrl = url
path.append(.ManualECDISBasic)
}else{
isAlert = true
}
}
}label: {
MenuContentView(content: .ManualECDISBasic)
}
Button{
if Preferences.ECDISFunctionUrl != nil{
path.append(.ManualECDISFunction)
}else{
if let url = PDFDownloadManager.main.downloadFile(urlString: "https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf", fileName: "ECDIS.pdf"){
Preferences.ECDISFunctionUrl = url
path.append(.ManualECDISFunction)
}else{
isAlert = true
}
}
}label: {
MenuContentView(content: .ManualECDISFunction)
}
Spacer()
}
.background(ColorSet.BackgroundPrimary.color)
.alert("delete", isPresented: $isAlert) {
Button(role: .destructive) {
} label: {
Text("delete")
}
} message: {
Text("eca delete")
}
}
}
#Preview {
MenuManualECDISView(path: .constant([.ManualECDIS]))
}
//
// MenuManualRADARView.swift
// Sailassist
//
// Created by 三浦薫巳 on 2023/12/14.
//
import SwiftUI
import PDFKit
struct MenuManualRADARView: View {
@State var isAlert: Bool = false
@Binding var path : [MenuPath]
var body: some View {
VStack{
MenuTitleView(path: $path, title: MenuPath.ManualRADAR.title)
Button{
if Preferences.RADARBasicUrl != nil{
path.append(.ManualRADARBasic)
}else{
if let url = PDFDownloadManager.main.downloadFile(urlString: "https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf", fileName: "ECDIS.pdf"){
Preferences.ECDISBasicUrl = url
path.append(.ManualRADARBasic)
}else{
isAlert = true
}
}
}label: {
MenuContentView(content: .ManualRADARBasic)
}
Button{
if Preferences.RADARFunctionUrl != nil{
path.append(.ManualRADARFunction)
}else{
if let url = PDFDownloadManager.main.downloadFile(urlString: "https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf", fileName: "ECDIS.pdf"){
Preferences.RADARFunctionUrl = url
path.append(.ManualRADARFunction)
}else{
isAlert = true
}
}
}label: {
MenuContentView(content: .ManualRADARFunction)
}
Spacer()
}
.background(ColorSet.BackgroundPrimary.color)
.alert("delete", isPresented: $isAlert) {
Button(role: .destructive) {
} label: {
Text("delete")
}
} message: {
Text("eca delete")
}
}
}
#Preview {
MenuManualRADARView(path: .constant([.ManualRADAR]))
}
......@@ -16,16 +16,7 @@ struct MenuManualView: View {
MenuTitleView(path: $path, title: MenuPath.Manual.title)
Button{
if Preferences.ECDISUrl != nil{
path.append(.ManualECDIS)
}else{
if let url = PDFDownloadManager.main.downloadFile(urlString: "https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf", fileName: "ECDIS.pdf"){
Preferences.ECDISUrl = url
path.append(.ManualECDIS)
}else{
isAlert = true
}
}
path.append(.ManualECDIS)
}label: {
MenuContentView(content: .ManualECDIS)
}
......@@ -37,11 +28,65 @@ struct MenuManualView: View {
}
Button{
path.append(.ManualJmarineNeCST)
if Preferences.AISUrl != nil{
path.append(.ManualAIS)
}else{
if let url = PDFDownloadManager.main.downloadFile(urlString: "https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf", fileName: "ECDIS.pdf"){
Preferences.AISUrl = url
path.append(.ManualAIS)
}else{
isAlert = true
}
}
}label: {
MenuContentView(content: .ManualJmarineNeCST)
MenuContentView(content: .ManualAIS)
}
Button{
if Preferences.InmalsatCUrl != nil{
path.append(.ManualInmalsatC)
}else{
if let url = PDFDownloadManager.main.downloadFile(urlString: "https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf", fileName: "ECDIS.pdf"){
Preferences.InmalsatCUrl = url
path.append(.ManualInmalsatC)
}else{
isAlert = true
}
}
}label: {
MenuContentView(content: .ManualInmalsatC)
}
Button{
if Preferences.InternationalVHFUrl != nil{
path.append(.ManualInternationalVHF)
}else{
if let url = PDFDownloadManager.main.downloadFile(urlString: "https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf", fileName: "ECDIS.pdf"){
Preferences.InternationalVHFUrl = url
path.append(.ManualInternationalVHF)
}else{
isAlert = true
}
}
}label: {
MenuContentView(content: .ManualInternationalVHF)
}
Button{
if Preferences.VDRURL != nil{
path.append(.ManualVDR)
}else{
if let url = PDFDownloadManager.main.downloadFile(urlString: "https://samsdbg.jmarinesafety.jp/gps_editor/gps_help.pdf", fileName: "ECDIS.pdf"){
Preferences.VDRURL = url
path.append(.ManualVDR)
}else{
isAlert = true
}
}
}label: {
MenuContentView(content: .ManualVDR)
}
Spacer()
}
.background(ColorSet.BackgroundPrimary.color)
......
......@@ -57,7 +57,14 @@ class Preferences{
@AppStorage(wrappedValue:0, PreferencesKey.TypeInt.LocationType.rawValue) static var LocationType: Int
// func getPreferences(key)
@AppStorage(PreferencesKey.TypeURL.ECDIS.rawValue) static var ECDISUrl: URL?
@AppStorage(PreferencesKey.TypeURL.ECDISBasic.rawValue) static var ECDISBasicUrl: URL?
@AppStorage(PreferencesKey.TypeURL.ECDISFunction.rawValue) static var ECDISFunctionUrl: URL?
@AppStorage(PreferencesKey.TypeURL.RADARBasic.rawValue) static var RADARBasicUrl: URL?
@AppStorage(PreferencesKey.TypeURL.RADARFunction.rawValue) static var RADARFunctionUrl: URL?
@AppStorage(PreferencesKey.TypeURL.AIS.rawValue) static var AISUrl: URL?
@AppStorage(PreferencesKey.TypeURL.InmalsatC.rawValue) static var InmalsatCUrl: URL?
@AppStorage(PreferencesKey.TypeURL.InternationalVHF.rawValue) static var InternationalVHFUrl: URL?
@AppStorage(PreferencesKey.TypeURL.VDR.rawValue) static var VDRURL: URL?
}
......
......@@ -28,11 +28,14 @@ class PreferencesKey{
}
enum TypeURL: String{
case ECDIS
case RADAR
case NeCST
case ECDISBasic
case ECDISFunction
case RADARBasic
case RADARFunction
case AIS
case InmalsatC
case InternationalVHF
case VDR
}
}
......@@ -15,6 +15,7 @@ struct SailassistApp: App {
@State private var isTermsAgree = Preferences.termsAgreeDate != nil
@State private var isPrivAgree = Preferences.privacyPolicyAgreeDate != nil
var body: some Scene {
WindowGroup {
if !isTermsAgree{
......@@ -51,21 +52,21 @@ struct SailassistApp: App {
}
}
class notificationTags: NSObject {
func addTags() {
if Preferences.shipId != 0 {
let shipId = String(Preferences.shipId)
let testTag = "aaa"
let routeTag = "route-" + shipId
let bamTag = "bam-" + shipId
let taskAlertTag = "taskalert-" + shipId
let sailassistTag = "sailassist-" + shipId
MSNotificationHub.addTags([testTag, routeTag, bamTag, taskAlertTag, sailassistTag])
}
}
}
//class notificationTags: NSObject {
// func addTags() {
// if Preferences.shipId != 0 {
// let shipId = String(Preferences.shipId)
// let testTag = "aaa"
// let routeTag = "route-" + shipId
// let bamTag = "bam-" + shipId
// let taskAlertTag = "taskalert-" + shipId
// let sailassistTag = "sailassist-" + shipId
// MSNotificationHub.addTags([testTag, routeTag, bamTag, taskAlertTag, sailassistTag])
// }
// }
//}
class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, MSInstallationLifecycleDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
print(debug: "called")
......@@ -80,17 +81,10 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
MSNotificationHub.setDelegate(self)
MSNotificationHub.start(connectionString: HttpRequestType.ConnectionString.rawValue, hubName: HttpRequestType.HubName.rawValue)
// let notification = notificationTags()
// notification.addTags()
self.addTags()
// let testTag = "aaa"
// MSNotificationHub.addTags([testTag])
}
}
DispatchQueue.main.async {
application.registerForRemoteNotifications()
}
application.registerForRemoteNotifications()
return true
}
......@@ -105,18 +99,19 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
func addTags() {
if Preferences.shipId != 0 {
let shipId = String(Preferences.shipId)
// let shipId = "10000083"
let routeTag = "route-" + shipId
let bamTag = "bam-" + shipId
let taskAlertTag = "taskalert-" + shipId
let sailassistTag = "sailassist-" + shipId
MSNotificationHub.addTags([routeTag, bamTag, taskAlertTag, sailassistTag])
// MSNotificationHub.addTags([routeTag])
MSNotificationHub.addTags([routeTag])
}
}
// Push通知を受信した時(サイレントプッシュ)
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
print(debug: "called")
print(debug: "called \(userInfo)")
// Forward to MSNotificationHub
MSNotificationHub.didReceiveRemoteNotification(userInfo)
......@@ -124,6 +119,18 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
// Complete handling the notificationposition
completionHandler(.noData)
let message = GetMessage()
message.start()
let route = MonitoringRoute()
route.start()
let ecaList = GetEcaList()
ecaList.start()
let pushHistory = GetPushHistory()
pushHistory.start()
// guard let data = userInfo["data"] as? [String: Any],
// let newTitle = data["newTitle"] as? String,
// let newBody = data["newBody"] as? String else {
......
......@@ -53,6 +53,15 @@ class SharingData{
course = 0.0
heading = 0.0
}
@Published var ECDISBasicUrl: URL?
@Published var ECDISFunctionUrl: URL?
@Published var RADARBasicUrl: URL?
@Published var RADARFunctionUrl: URL?
@Published var AISUrl: URL?
@Published var InmalsatCUrl: URL?
@Published var InternationalVHFUrl: URL?
@Published var VDRURL: URL?
}
static var map = Map()
......
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