Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
红
红星美凯龙管理在线APP IOS
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
张杰
红星美凯龙管理在线APP IOS
Commits
c8f43cb9
Commit
c8f43cb9
authored
Dec 02, 2015
by
admin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
版本更新
parent
e4100e20
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
5 deletions
+65
-5
LoginViewController.m
...Classes/Module/Login/ViewController/LoginViewController.m
+5
-3
MineViewController.m
...r/Classes/Module/Mine/ViewController/MineViewController.m
+60
-2
No files found.
redstar/Classes/Module/Login/ViewController/LoginViewController.m
View file @
c8f43cb9
...
...
@@ -72,14 +72,15 @@
{
HttpClient
*
httpCilent
=
[[
HttpClient
alloc
]
initWithUrl
:[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kCheckUpdateURL
]];
[
httpCilent
checkAndUpdateCurrentVersionWithCompletion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"检查更新 = %@"
,
response
);
if
(
response
[
@"data"
]
==
nil
&&
response
[
@"data"
]
==
NULL
&&
response
[
@"data"
]
==
[
NSNull
null
])
{
return
;
}
else
{
NSDictionary
*
dict
=
response
[
@"data"
];
NSString
*
newVersion
=
[
NSString
stringWithFormat
:
@"%@"
,
dict
[
@"version"
]];
self
.
jumpURL
=
[
NSString
stringWithFormat
:
@"%@"
,
dict
[
@"url"
]];
NSLog
(
@"newVersion = %@, _jumpURL = %@"
,
newVersion
,
_jumpURL
);
[
self
checkAppUpdate
:
newVersion
];
}
else
{
return
;
}
}];
}
...
...
@@ -93,6 +94,7 @@
if
(
!
[
currentVersion
isEqualToString
:
newVersion
])
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示!"
message
:[
NSString
stringWithFormat
:
@"发现新版本:%@"
,
newVersion
]
delegate
:
self
cancelButtonTitle
:
@"稍后再说"
otherButtonTitles
:
@"前往更新"
,
nil
];
alert
.
delegate
=
self
;
[
alert
show
];
alert
.
tag
=
3058284
;
}
...
...
redstar/Classes/Module/Mine/ViewController/MineViewController.m
View file @
c8f43cb9
...
...
@@ -11,7 +11,9 @@
#import "MineTableFooterView.h"
#define kMineTableViewCell @"mineTableViewCell"
@interface
MineViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
>
#import "HttpClient.h"
@interface
MineViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
,
UIAlertViewDelegate
>
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
titleArray
;
...
...
@@ -20,6 +22,8 @@
@property
(
nonatomic
,
strong
)
MineTableHeaderView
*
headView
;
@property
(
nonatomic
,
strong
)
MineTableFooterView
*
footView
;
@property
(
nonatomic
,
copy
)
NSString
*
jumpURL
;
@end
@implementation
MineViewController
...
...
@@ -44,7 +48,7 @@
self
.
view
.
backgroundColor
=
kSectionBackGroundColor
;
self
.
titleArray
=
[
NSMutableArray
arrayWithObjects
:
@"
修改密码
"
,
@"配置"
,
@"帮助与反馈"
,
@"关于"
,
@"检查版本更新"
,
nil
];
self
.
titleArray
=
[
NSMutableArray
arrayWithObjects
:
@"
配置项目
"
,
@"配置"
,
@"帮助与反馈"
,
@"关于"
,
@"检查版本更新"
,
nil
];
[
self
setupTableView
];
...
...
@@ -95,6 +99,53 @@
[
self
.
tabBarController
dismissViewControllerAnimated
:
YES
completion
:
nil
];
}
#pragma mark - Private Methods
// 获取版本
-
(
void
)
getVersion
{
HttpClient
*
httpCilent
=
[[
HttpClient
alloc
]
initWithUrl
:[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
kCheckUpdateURL
]];
[
httpCilent
checkAndUpdateCurrentVersionWithCompletion
:
^
(
id
response
,
NSError
*
error
)
{
NSLog
(
@"检查更新 = %@"
,
response
);
if
(
response
[
@"data"
]
==
nil
&&
response
[
@"data"
]
==
NULL
&&
response
[
@"data"
]
==
[
NSNull
null
])
{
return
;
}
else
{
NSDictionary
*
dict
=
response
[
@"data"
];
NSString
*
newVersion
=
[
NSString
stringWithFormat
:
@"%@"
,
dict
[
@"version"
]];
self
.
jumpURL
=
[
NSString
stringWithFormat
:
@"%@"
,
dict
[
@"url"
]];
NSLog
(
@"newVersion = %@, _jumpURL = %@"
,
newVersion
,
_jumpURL
);
[
self
checkAppUpdate
:
newVersion
];
}
}];
}
-
(
void
)
checkAppUpdate
:
(
NSString
*
)
newVersion
{
// 获取当前版本
NSDictionary
*
infoDic
=
[[
NSBundle
mainBundle
]
infoDictionary
];
NSString
*
currentVersion
=
[
NSString
stringWithFormat
:
@"%@"
,
infoDic
[
@"CFBundleShortVersionString"
]];
NSLog
(
@"当前版本是:%@"
,
currentVersion
);
if
(
!
[
currentVersion
isEqualToString
:
newVersion
])
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示!"
message
:[
NSString
stringWithFormat
:
@"发现新版本:%@"
,
newVersion
]
delegate
:
self
cancelButtonTitle
:
@"稍后再说"
otherButtonTitles
:
@"前往更新"
,
nil
];
alert
.
delegate
=
self
;
[
alert
show
];
alert
.
tag
=
3058284
;
}
else
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示!"
message
:[
NSString
stringWithFormat
:
@"当前已经是最新版本!"
]
delegate
:
self
cancelButtonTitle
:
nil
otherButtonTitles
:
@"确定"
,
nil
];
[
alert
show
];
}
}
-
(
void
)
alertView
:
(
UIAlertView
*
)
alertView
didDismissWithButtonIndex
:
(
NSInteger
)
buttonIndex
{
if
(
buttonIndex
==
1
&&
alertView
.
tag
==
3058284
)
{
NSString
*
url
=
self
.
jumpURL
;
[[
UIApplication
sharedApplication
]
openURL
:[
NSURL
URLWithString
:
url
]];
}
}
#pragma mark - TableView Delegate/DataSource
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
...
...
@@ -116,6 +167,13 @@
return
cell
;
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
4
)
{
[
self
getVersion
];
}
}
// cell的高度
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
...
...
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