Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Sailassist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CpjJwWHV
Sailassist
Commits
883a1faf
Commit
883a1faf
authored
Dec 28, 2023
by
shigemi miura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
バージョンアップ処理
parent
41876a5c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
32 deletions
+45
-32
AppVersionModel.swift
Seilassist/Sailassist/AppVersionModel.swift
+21
-24
HttpRequestType.swift
Seilassist/Sailassist/Http/HttpRequestType.swift
+4
-4
MapTaskView.swift
Seilassist/Sailassist/Map/Task/View/MapTaskView.swift
+2
-0
MenuGpsSelectView.swift
Seilassist/Sailassist/Menu/View/MenuGpsSelectView.swift
+8
-2
SharingData.swift
Seilassist/Sailassist/SharingData/SharingData.swift
+1
-1
MainTabView.swift
Seilassist/Sailassist/Tab/MainTabView.swift
+9
-1
No files found.
Seilassist/Sailassist/AppVersionModel.swift
View file @
883a1faf
...
@@ -9,7 +9,6 @@ import Foundation
...
@@ -9,7 +9,6 @@ import Foundation
class
AppVersionModel
:
ObservableObject
{
class
AppVersionModel
:
ObservableObject
{
private
var
serverSession
=
ServerSession
()
private
var
serverSession
=
ServerSession
()
let
appVersion
=
Bundle
.
main
.
object
(
forInfoDictionaryKey
:
"CFBundleShortVersionString"
)
let
appVersion
=
Bundle
.
main
.
object
(
forInfoDictionaryKey
:
"CFBundleShortVersionString"
)
func
start
()
{
func
start
()
{
...
@@ -25,7 +24,9 @@ class AppVersionModel: ObservableObject {
...
@@ -25,7 +24,9 @@ class AppVersionModel: ObservableObject {
let
json
=
try
JSONSerialization
.
jsonObject
(
with
:
appData
,
options
:
[
.
allowFragments
])
as?
[
String
:
Any
]
let
json
=
try
JSONSerialization
.
jsonObject
(
with
:
appData
,
options
:
[
.
allowFragments
])
as?
[
String
:
Any
]
guard
let
result
=
(
json
?[
"results"
]
as?
[
Any
])?
.
first
as?
[
String
:
Any
],
guard
let
result
=
(
json
?[
"results"
]
as?
[
Any
])?
.
first
as?
[
String
:
Any
],
let
storeVersion
=
result
[
"version"
]
as?
String
else
{
return
}
let
storeVersion
=
result
[
"version"
]
as?
String
else
{
return
}
print
(
debug
:
"
\(
storeVersion
)
"
)
if
let
app
=
self
.
appVersion
as?
String
{
SharingData
.
my
.
isUpDate
=
storeVersion
.
versionCompare
(
app
)
==
.
orderedDescending
}
}
catch
{
}
catch
{
print
(
error
)
print
(
error
)
}
}
...
@@ -44,27 +45,23 @@ class AppVersionModel: ObservableObject {
...
@@ -44,27 +45,23 @@ class AppVersionModel: ObservableObject {
}
}
serverSession
.
getJson
(
req_url
,
completion
:
completion
)
serverSession
.
getJson
(
req_url
,
completion
:
completion
)
}
}
}
// func appVersionCheck() {
/**
// guard let info = Bundle.main.infoDictionary,
* Version番号比較
// let appVersion = info["CFBundleShortVersionString"] as? String,
* メジャーバージョン・マイナーバージョン・リビジョンバージョン
// let identifier = info["CFBundleIdentifier"] as? String,
* マイナーバージョン以上が変更された場合
// let url = URL(string: "https://itunes.apple.com/lookup?bundleId=\(identifier)") else { return }
*/
//
extension
String
{
// let task = URLSession.shared.dataTask(with: url) { (data, response, error) in
func
versionCompare
(
_
otherVersion
:
String
)
->
ComparisonResult
{
// guard let data = data else { return }
let
delimiter
=
"."
// do {
var
versionComponents
=
self
.
components
(
separatedBy
:
delimiter
)
// let json = try JSONSerialization.jsonObject(with: data, options: [.allowFragments]) as? [String: Any]
var
otherComponents
=
otherVersion
.
components
(
separatedBy
:
delimiter
)
// guard let result = (json?["results"] as? [Any])?.first as? [String: Any],
// let storeVersion = result["version"] as? String else { return }
versionComponents
[
2
]
=
"0"
//
otherComponents
[
2
]
=
"0"
// if appVersion != storeVersion {
// // appVersion と storeVersion が異なっている時に実行したい処理を記述
return
versionComponents
.
joined
(
separator
:
delimiter
)
// }
.
compare
(
otherComponents
.
joined
(
separator
:
delimiter
),
options
:
.
numeric
)
// } catch let error {
}
// print(error)
// }
// }
// task.resume()
// }
}
}
Seilassist/Sailassist/Http/HttpRequestType.swift
View file @
883a1faf
...
@@ -29,10 +29,10 @@ enum HttpRequestType : String {
...
@@ -29,10 +29,10 @@ enum HttpRequestType : String {
case
GetManualUrl
=
"https://ssv-canary-web.azurewebsites.net/api/constantdata/manual?filter=SailAssist"
case
GetManualUrl
=
"https://ssv-canary-web.azurewebsites.net/api/constantdata/manual?filter=SailAssist"
case
ContactPage
=
"https://www.jmarinecloud.com/eng/contact.php?type=ssv_mobile"
case
ContactPage
=
"https://www.jmarinecloud.com/eng/contact.php?type=ssv_mobile"
case
ApachLicens
=
"https://raw.githubusercontent.com/Azure/azure-notificationhubs-ios/main/LICENSE"
case
ApachLicens
=
"https://raw.githubusercontent.com/Azure/azure-notificationhubs-ios/main/LICENSE"
case
AppStore
=
"https://apps.apple.com/jp/app/ssv-mobile/id1434022656"
//
case AppStore = "https://apps.apple.com/jp/app/ssv-mobile/id1434022656"
case
AppInfo
=
"https://itunes.apple.com/lookup?bundleId=com.jrc.tacmi"
//
case AppInfo = "https://itunes.apple.com/lookup?bundleId=com.jrc.tacmi"
//
case AppStore = "https://apps.apple.com/jp/app/sail-assist/id6473762428"
case
AppStore
=
"https://apps.apple.com/jp/app/sail-assist/id6473762428"
//
case AppInfo = "https://itunes.apple.com/lookup?bundleId=com.jrc.sailassist"
case
AppInfo
=
"https://itunes.apple.com/lookup?bundleId=com.jrc.sailassist"
}
}
#elseif QC
#elseif QC
enum
HttpRequestType
:
String
{
enum
HttpRequestType
:
String
{
...
...
Seilassist/Sailassist/Map/Task/View/MapTaskView.swift
View file @
883a1faf
...
@@ -83,6 +83,8 @@ struct MapTaskView: View {
...
@@ -83,6 +83,8 @@ struct MapTaskView: View {
.
frame
(
height
:
55
)
.
frame
(
height
:
55
)
}
}
.
onAppear
{
.
onAppear
{
let
appVersionModel
=
AppVersionModel
()
appVersionModel
.
start
()
EcaCoordinatesTable
()
.
setEcaData
()
EcaCoordinatesTable
()
.
setEcaData
()
}
}
.
alert
(
""
,
isPresented
:
$
eca
.
isShowEcaAlert
)
{
.
alert
(
""
,
isPresented
:
$
eca
.
isShowEcaAlert
)
{
...
...
Seilassist/Sailassist/Menu/View/MenuGpsSelectView.swift
View file @
883a1faf
...
@@ -28,13 +28,20 @@ struct MenuGpsSelectView: View {
...
@@ -28,13 +28,20 @@ struct MenuGpsSelectView: View {
var
body
:
some
View
{
var
body
:
some
View
{
VStack
{
VStack
{
MenuTitleView
(
path
:
$
path
,
title
:
MenuPath
.
Setting
.
title
)
MenuTitleView
(
path
:
$
path
,
title
:
MenuPath
.
Setting
.
title
)
ForEach
(
GpsSelect
.
allCases
,
id
:\
.
rawValue
){
content
in
ForEach
(
GpsSelect
.
allCases
,
id
:\
.
rawValue
){
content
in
SelectContentView
(
selected
:
$
selected
,
content
:
content
)
SelectContentView
(
selected
:
$
selected
,
content
:
content
)
}
}
Spacer
()
Spacer
()
}
}
.
background
(
ColorSet
.
BackgroundPrimary
.
color
)
.
background
(
ColorSet
.
BackgroundPrimary
.
color
)
.
onAppear
{
if
Preferences
.
LocationType
==
0
{
selected
=
.
Mobile
}
else
{
selected
=
.
Cloud
}
}
}
}
struct
SelectContentView
:
View
{
struct
SelectContentView
:
View
{
...
@@ -76,7 +83,6 @@ struct MenuGpsSelectView: View {
...
@@ -76,7 +83,6 @@ struct MenuGpsSelectView: View {
}
}
}
}
}
}
}
}
#Preview {
#Preview {
...
...
Seilassist/Sailassist/SharingData/SharingData.swift
View file @
883a1faf
...
@@ -28,7 +28,7 @@ class SharingData{
...
@@ -28,7 +28,7 @@ class SharingData{
@Published
var
shipName
:
String
=
""
@Published
var
shipName
:
String
=
""
@Published
var
imo
:
Int
=
0
@Published
var
imo
:
Int
=
0
@Published
var
mmsi
:
Int
=
0
@Published
var
mmsi
:
Int
=
0
@Published
var
company
:
String
=
"JRC Co.,Ltd"
@Published
var
isUpDate
:
Bool
=
false
@Published
var
ecaStatus
:
EcaState
?
@Published
var
ecaStatus
:
EcaState
?
...
...
Seilassist/Sailassist/Tab/MainTabView.swift
View file @
883a1faf
...
@@ -23,7 +23,6 @@ enum Tab: String, CaseIterable{
...
@@ -23,7 +23,6 @@ enum Tab: String, CaseIterable{
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
my
=
SharingData
.
my
@State
var
isSignout
=
false
@State
var
isSignout
=
false
@State
var
isLogin
=
false
@State
var
isLogin
=
false
...
@@ -69,6 +68,8 @@ struct MainTabView: View {
...
@@ -69,6 +68,8 @@ struct MainTabView: View {
struct
CustomTabBar
:
View
{
struct
CustomTabBar
:
View
{
@EnvironmentObject
private
var
selectedTabModel
:
SelectedTabModel
@EnvironmentObject
private
var
selectedTabModel
:
SelectedTabModel
@State
var
isLocationAlert
=
false
@State
var
isLocationAlert
=
false
@Environment(\.openURL)
var
openURL
@ObservedObject
var
my
=
SharingData
.
my
var
body
:
some
View
{
var
body
:
some
View
{
VStack
(
spacing
:
0
){
VStack
(
spacing
:
0
){
...
@@ -116,6 +117,13 @@ struct CustomTabBar: View {
...
@@ -116,6 +117,13 @@ struct CustomTabBar: View {
}
message
:
{
}
message
:
{
Text
(
"To use ECA,set the permission to use location information to ALWAYS."
)
Text
(
"To use ECA,set the permission to use location information to ALWAYS."
)
}
}
.
alert
(
"Update"
,
isPresented
:
$
my
.
isUpDate
)
{
Button
(
"Go to app page"
){
openURL
(
URL
(
string
:
HttpRequestType
.
AppStore
.
rawValue
)
!
)
}
}
message
:
{
Text
(
"A new version of this app is available."
)
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment