Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 03eb7ea4
由
cgx
编写于
2022-12-06 14:54:06 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
优化版本号比较逻辑(2.2和2.2.0比较等)
1 个父辈
bf09503b
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
83 行增加
和
4 行删除
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
DreamSleep/DreamSleep/Basement/DSConfig/PrefixHeader.pch
DreamSleep/DreamSleep/Basement/Utils/DSTools.h
DreamSleep/DreamSleep/Basement/Utils/DSTools.m
DreamSleep/DreamSleep/Class/HomeModule/Home/Controller/HomeViewController.m
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
查看文件 @
03eb7ea
...
@@ -119,6 +119,7 @@
...
@@ -119,6 +119,7 @@
D062A09E281838B800B4F48A /* FeedbackRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D062A09D281838B800B4F48A /* FeedbackRequestModel.m */; };
D062A09E281838B800B4F48A /* FeedbackRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D062A09D281838B800B4F48A /* FeedbackRequestModel.m */; };
D062A0A128183FE000B4F48A /* FeedbackDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = D062A0A028183FE000B4F48A /* FeedbackDetailController.m */; };
D062A0A128183FE000B4F48A /* FeedbackDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = D062A0A028183FE000B4F48A /* FeedbackDetailController.m */; };
D06381A428D012420074515B /* SleepStoryController.m in Sources */ = {isa = PBXBuildFile; fileRef = D06381A328D012420074515B /* SleepStoryController.m */; };
D06381A428D012420074515B /* SleepStoryController.m in Sources */ = {isa = PBXBuildFile; fileRef = D06381A328D012420074515B /* SleepStoryController.m */; };
D0674B1C293F19FC00E485F2 /* DSTools.m in Sources */ = {isa = PBXBuildFile; fileRef = D0674B1B293F19FC00E485F2 /* DSTools.m */; };
D0691E01287FB330008BFFAB /* XLCircle.m in Sources */ = {isa = PBXBuildFile; fileRef = D0691DFE287FB330008BFFAB /* XLCircle.m */; };
D0691E01287FB330008BFFAB /* XLCircle.m in Sources */ = {isa = PBXBuildFile; fileRef = D0691DFE287FB330008BFFAB /* XLCircle.m */; };
D0691E02287FB331008BFFAB /* XLCircleProgress.m in Sources */ = {isa = PBXBuildFile; fileRef = D0691DFF287FB330008BFFAB /* XLCircleProgress.m */; };
D0691E02287FB331008BFFAB /* XLCircleProgress.m in Sources */ = {isa = PBXBuildFile; fileRef = D0691DFF287FB330008BFFAB /* XLCircleProgress.m */; };
D0691E05287FEA04008BFFAB /* SleepReadyRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0691E04287FEA04008BFFAB /* SleepReadyRequestModel.m */; };
D0691E05287FEA04008BFFAB /* SleepReadyRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0691E04287FEA04008BFFAB /* SleepReadyRequestModel.m */; };
...
@@ -552,6 +553,8 @@
...
@@ -552,6 +553,8 @@
D062A0A028183FE000B4F48A /* FeedbackDetailController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FeedbackDetailController.m; sourceTree = "<group>"; };
D062A0A028183FE000B4F48A /* FeedbackDetailController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FeedbackDetailController.m; sourceTree = "<group>"; };
D06381A228D012420074515B /* SleepStoryController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SleepStoryController.h; sourceTree = "<group>"; };
D06381A228D012420074515B /* SleepStoryController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SleepStoryController.h; sourceTree = "<group>"; };
D06381A328D012420074515B /* SleepStoryController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SleepStoryController.m; sourceTree = "<group>"; };
D06381A328D012420074515B /* SleepStoryController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SleepStoryController.m; sourceTree = "<group>"; };
D0674B1A293F19FC00E485F2 /* DSTools.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DSTools.h; sourceTree = "<group>"; };
D0674B1B293F19FC00E485F2 /* DSTools.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DSTools.m; sourceTree = "<group>"; };
D0691DFD287FB330008BFFAB /* XLCircleProgress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLCircleProgress.h; sourceTree = "<group>"; };
D0691DFD287FB330008BFFAB /* XLCircleProgress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLCircleProgress.h; sourceTree = "<group>"; };
D0691DFE287FB330008BFFAB /* XLCircle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLCircle.m; sourceTree = "<group>"; };
D0691DFE287FB330008BFFAB /* XLCircle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLCircle.m; sourceTree = "<group>"; };
D0691DFF287FB330008BFFAB /* XLCircleProgress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLCircleProgress.m; sourceTree = "<group>"; };
D0691DFF287FB330008BFFAB /* XLCircleProgress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLCircleProgress.m; sourceTree = "<group>"; };
...
@@ -2062,6 +2065,8 @@
...
@@ -2062,6 +2065,8 @@
D0B5ECD927F2F410003EDFE3 /* Utils */ = {
D0B5ECD927F2F410003EDFE3 /* Utils */ = {
isa = PBXGroup;
isa = PBXGroup;
children = (
children = (
D0674B1A293F19FC00E485F2 /* DSTools.h */,
D0674B1B293F19FC00E485F2 /* DSTools.m */,
D0A75112282E493D00589B0E /* Singleton.h */,
D0A75112282E493D00589B0E /* Singleton.h */,
D0AE1E3328281B6F008CEF27 /* TimerProxy.h */,
D0AE1E3328281B6F008CEF27 /* TimerProxy.h */,
D0AE1E3428281B6F008CEF27 /* TimerProxy.m */,
D0AE1E3428281B6F008CEF27 /* TimerProxy.m */,
...
@@ -3057,6 +3062,7 @@
...
@@ -3057,6 +3062,7 @@
D07A4B27280E9BAA00BA0EC0 /* AccountController.m in Sources */,
D07A4B27280E9BAA00BA0EC0 /* AccountController.m in Sources */,
D062A09E281838B800B4F48A /* FeedbackRequestModel.m in Sources */,
D062A09E281838B800B4F48A /* FeedbackRequestModel.m in Sources */,
D0B836F828F1232F006E76C0 /* ComReplyModel.m in Sources */,
D0B836F828F1232F006E76C0 /* ComReplyModel.m in Sources */,
D0674B1C293F19FC00E485F2 /* DSTools.m in Sources */,
D0B0B4D429092D3500FBE6E2 /* EvaluateCell.m in Sources */,
D0B0B4D429092D3500FBE6E2 /* EvaluateCell.m in Sources */,
D0A72E3F282B89AD00EED7BE /* DSHomeView.m in Sources */,
D0A72E3F282B89AD00EED7BE /* DSHomeView.m in Sources */,
D01814E8280020F900583D4E /* CWPageControl.m in Sources */,
D01814E8280020F900583D4E /* CWPageControl.m in Sources */,
...
@@ -3233,7 +3239,7 @@
...
@@ -3233,7 +3239,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepDebug.entitlements;
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1
4
;
CURRENT_PROJECT_VERSION = 1
5
;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
...
@@ -3316,7 +3322,7 @@
...
@@ -3316,7 +3322,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/DreamSleep.entitlements;
CODE_SIGN_ENTITLEMENTS = DreamSleep/DreamSleep.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1
4
;
CURRENT_PROJECT_VERSION = 1
5
;
DEFINES_MODULE = YES;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
ENABLE_BITCODE = NO;
ENABLE_BITCODE = NO;
...
@@ -3459,7 +3465,7 @@
...
@@ -3459,7 +3465,7 @@
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepBeta.entitlements;
CODE_SIGN_ENTITLEMENTS = DreamSleep/Basement/DSConfig/DreamSleepBeta.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1
4
;
CURRENT_PROJECT_VERSION = 1
5
;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
DEVELOPMENT_TEAM = 4NDZ6UX8PW;
...
...
DreamSleep/DreamSleep/Basement/DSConfig/PrefixHeader.pch
查看文件 @
03eb7ea
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#ifndef PrefixHeader_pch
#ifndef PrefixHeader_pch
#define PrefixHeader_pch
#define PrefixHeader_pch
#import "DSTools.h"
#import "DSConstUtil.h"
#import "DSConstUtil.h"
#import "ServerAPIUtil.h"
#import "ServerAPIUtil.h"
#import "AdaptationUtil.h"
#import "AdaptationUtil.h"
...
...
DreamSleep/DreamSleep/Basement/Utils/DSTools.h
0 → 100644
查看文件 @
03eb7ea
//
// DSTools.h
// DreamSleep
//
// Created by peter on 2022/12/6.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// 常用工具类
@interface
DSTools
:
NSObject
/// 版本号比较
/// @param first first
/// @param second second
/// 1:first > second;-1:first < second;0:first = second
+
(
int
)
versionCompare
:(
NSString
*
)
first
second
:(
NSString
*
)
second
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Basement/Utils/DSTools.m
0 → 100644
查看文件 @
03eb7ea
//
// DSTools.m
// DreamSleep
//
// Created by peter on 2022/12/6.
//
#import "DSTools.h"
@implementation
DSTools
+
(
int
)
versionCompare
:(
NSString
*
)
first
second
:(
NSString
*
)
second
{
NSArray
*
versions1
=
[
first
componentsSeparatedByString
:
@"."
];
NSArray
*
versions2
=
[
second
componentsSeparatedByString
:
@"."
];
NSMutableArray
*
ver1Array
=
[
NSMutableArray
arrayWithArray
:
versions1
];
NSMutableArray
*
ver2Array
=
[
NSMutableArray
arrayWithArray
:
versions2
];
// 确定最大数组
NSInteger
a
=
(
ver1Array
.
count
>
ver2Array
.
count
)
?
ver1Array
.
count
:
ver2Array
.
count
;
// 补成相同位数数组
if
(
ver1Array
.
count
<
a
)
{
for
(
NSInteger
j
=
ver1Array
.
count
;
j
<
a
;
j
++
)
{
[
ver1Array
addObject
:
@"0"
];
}
}
else
{
for
(
NSInteger
j
=
ver2Array
.
count
;
j
<
a
;
j
++
)
{
[
ver2Array
addObject
:
@"0"
];
}
}
// 比较版本号
return
[
self
compareArray1
:
ver1Array
andArray2
:
ver2Array
];;
}
+
(
int
)
compareArray1
:(
NSMutableArray
*
)
array1
andArray2
:(
NSMutableArray
*
)
array2
{
for
(
int
i
=
0
;
i
<
array2
.
count
;
i
++
)
{
NSInteger
a
=
[[
array1
objectAtIndex
:
i
]
integerValue
];
NSInteger
b
=
[[
array2
objectAtIndex
:
i
]
integerValue
];
if
(
a
>
b
)
{
// array1大于array2
return
1
;
}
else
if
(
a
<
b
)
{
// array1小于array2
return
-
1
;
}
}
// array1等于array2
return
0
;
}
@end
DreamSleep/DreamSleep/Class/HomeModule/Home/Controller/HomeViewController.m
查看文件 @
03eb7ea
...
@@ -371,7 +371,7 @@
...
@@ -371,7 +371,7 @@
if
(
requestModel
.
resCode
==
DSResCodeSuccess
)
{
if
(
requestModel
.
resCode
==
DSResCodeSuccess
)
{
self
.
update_Way
=
requestModel
.
update_Way
;
self
.
update_Way
=
requestModel
.
update_Way
;
// 本地版本 < 服务器版本
// 本地版本 < 服务器版本
if
([
DS
AppVersion
compare
:
requestModel
.
version_Num
options
:
NSNumericSearch
]
==
NSOrderedAscending
)
{
if
([
DS
Tools
versionCompare
:
DSAppVersion
second
:
requestModel
.
version_Num
]
==
-
1
)
{
// 服务器返回的是选择更新并且1天内未弹框
// 服务器返回的是选择更新并且1天内未弹框
if
(
self
.
update_Way
==
1
&&
[
self
isNeedShowUpdateBox
])
{
if
(
self
.
update_Way
==
1
&&
[
self
isNeedShowUpdateBox
])
{
[
self
.
updateBox
showWithVersionNum
:
requestModel
.
version_Num
content
:
requestModel
.
version_Content
isForce
:
NO
];
[
self
.
updateBox
showWithVersionNum
:
requestModel
.
version_Num
content
:
requestModel
.
version_Content
isForce
:
NO
];
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论