Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
万
万科
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
张杰
万科
Commits
46151da3
Commit
46151da3
authored
Dec 26, 2015
by
Achilles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
版本检查 。
parent
c4916672
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
2 deletions
+68
-2
ICRSystemViewController.m
.../view_iPhone/templates/settings/ICRSystemViewController.m
+68
-2
No files found.
vanke/view_iPhone/templates/settings/ICRSystemViewController.m
View file @
46151da3
...
...
@@ -15,6 +15,7 @@
#import "ICRAppMacro.h"
#import "AppDelegate.h"
#import "GEToast.h"
#import "VankeVersionAPI.h"
#import "VankeCommonModel.h"
#define TAG_ACTION_SHEET_EXIT 0
...
...
@@ -23,6 +24,7 @@
@property
(
strong
,
nonatomic
)
IBTTableViewInfo
*
m_tableViewInfo
;
@property
(
weak
,
nonatomic
)
ICRSystemHeaderView
*
m_tableHeader
;
@property
(
strong
,
nonatomic
)
NSString
*
upgradeUrl
;
@end
@implementation
ICRSystemViewController
...
...
@@ -190,8 +192,7 @@ ON_DID_APPEAR( signal )
}
-
(
void
)
onCheckNewVersion
:
(
__unused
id
)
sender
{
// TODO
[
GEToast
showWithText
:
@"当前已经是最新版本了"
bottomOffset
:
45
.
0
f
duration
:
1
.
0
f
];
[
self
checkNewVersion
];
}
-
(
void
)
confirmToLogout
{
...
...
@@ -232,4 +233,69 @@ ON_DID_APPEAR( signal )
}
}
-
(
void
)
checkNewVersion
{
[
VankeVersionAPI
cancel
];
VankeVersionAPI
*
api
=
[
VankeVersionAPI
api
];
@weakify
(
api
);
@weakify
(
self
);
api
.
whenSucceed
=
^
{
@normalize
(
api
);
@normalize
(
self
);
if
(
api
.
succeed
)
{
[
GEToast
hideProgress
];
if
(
nil
==
api
.
serverResp
)
{
api
.
failed
=
YES
;
}
else
{
VersionResponse
*
resp
=
(
VersionResponse
*
)
api
.
serverResp
;
[
self
performSelector
:
@selector
(
tryToUpdate
:)
withObject
:
resp
];
}
}
};
api
.
whenFailed
=
^
{
[
GEToast
hideProgress
];
[
GEToast
showWithText
:
@"当前已经是最新版本了"
bottomOffset
:
45
.
0
f
duration
:
1
.
0
f
];
};
[
GEToast
showProgress
:
self
.
view
];
[
api
send
];
}
-
(
void
)
tryToUpdate
:
(
VersionResponse
*
)
resp
{
VersionNumber
*
newVersion
=
[
resp
newVersion
];
if
(
nil
==
newVersion
)
{
[
GEToast
showWithText
:
@"当前已经是最新版本了"
bottomOffset
:
45
.
0
f
duration
:
1
.
0
f
];
}
else
{
INFO
(
@"发现新版本: %@"
,
[
newVersion
toString
]);
self
.
upgradeUrl
=
resp
.
data
.
url
;
NSString
*
msg
=
[
NSString
stringWithFormat
:
@"发现新版本: %@, 请前往下载!"
,
[
newVersion
toString
]];
if
([
resp
isForceUpdate
])
{
UIAlertView
*
alertV
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"新版本告知"
message
:
msg
delegate
:
self
cancelButtonTitle
:
nil
otherButtonTitles
:
@"去下载"
,
nil
];
alertV
.
tag
=
1001
;
[
alertV
show
];
}
else
{
UIAlertView
*
alertV
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"新版本告知"
message
:
msg
delegate
:
self
cancelButtonTitle
:
@"下次再说"
otherButtonTitles
:
@"去下载"
,
nil
];
alertV
.
tag
=
1002
;
[
alertV
show
];
}
}
}
-
(
void
)
alertView
:
(
UIAlertView
*
)
alertView
clickedButtonAtIndex
:
(
NSInteger
)
buttonIndex
{
if
(
alertView
.
tag
==
1001
)
{
[[
UIApplication
sharedApplication
]
openURL
:[
NSURL
URLWithString
:
self
.
upgradeUrl
]];
}
else
if
(
alertView
.
tag
==
1002
)
{
if
(
buttonIndex
==
1
)
{
[[
UIApplication
sharedApplication
]
openURL
:[
NSURL
URLWithString
:
self
.
upgradeUrl
]];
}
else
{
// TODO
}
}
}
@end
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