Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
X
xffruit
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
张杰
xffruit
Commits
f66ab4d8
Commit
f66ab4d8
authored
Oct 28, 2015
by
zhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
f29bab24
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
132 additions
and
23 deletions
+132
-23
ICRAppDelegate.m
XFFruit/AppDelegate/ICRAppDelegate.m
+80
-12
ICRHTTPController.h
XFFruit/Controllers/HTTPController/ICRHTTPController.h
+4
-1
ICRHTTPController.m
XFFruit/Controllers/HTTPController/ICRHTTPController.m
+42
-2
Info.plist
XFFruit/Info.plist
+6
-8
No files found.
XFFruit/AppDelegate/ICRAppDelegate.m
View file @
f66ab4d8
...
...
@@ -10,9 +10,14 @@
#import "ICRAppViewControllerManager.h"
#import "ICRURLProtocol.h"
#import "BMKMapManager.h"
#import "ICRHTTPController.h"
@interface
ICRAppDelegate
()
@property
(
strong
,
nonatomic
)
BMKMapManager
*
mapManager
;
@property
(
strong
,
nonatomic
)
NSString
*
version
;
//本地版本号
@property
(
strong
,
nonatomic
)
NSString
*
severVersion
;
//服务器版本号
@property
(
strong
,
nonatomic
)
NSString
*
severUrl
;
//Ipa下载地址
@property
(
assign
,
nonatomic
)
BOOL
severForceUpdate
;
//强制更新
@end
...
...
@@ -32,38 +37,101 @@
[
self
setupBMKMapMgr
];
_m_appViewControllerMgr
=
[
ICRAppViewControllerManager
getAppViewControllerManager
];
#pragma 版本更新
//
[self enterpriseUpdate];
[
self
enterpriseUpdate
];
[
self
.
window
makeKeyAndVisible
];
return
YES
;
}
#pragma mark enterprise alertView 企业版提示
-
(
void
)
enterpriseUpdate
{
NSString
*
currentVersion
=
[[[
NSBundle
mainBundle
]
infoDictionary
]
objectForKey
:
@"CFBundleShortVersionString"
];
NSString
*
path
=
[[
NSBundle
mainBundle
]
pathForResource
:
@"Info"
ofType
:
@"plist"
];
NSDictionary
*
content
=
[
NSDictionary
dictionaryWithContentsOfFile
:
path
];
NSString
*
version
=
[
content
valueForKey
:
@"CFBundleVersion"
]
;
self
.
version
=
version
;
// 获取服务器更新信息
[
self
getDataFromServer
];
}
//请求服务器更新信息
-
(
void
)
getDataFromServer
{
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
if
(
data
)
{
NSInteger
success
=
[
data
[
@"success"
]
integerValue
];
NSString
*
message
=
data
[
@"message"
]
;
if
(
success
==
1
)
{
NSDictionary
*
dictData
=
data
[
@"data"
];
NSString
*
serverVeision
=
[
dictData
objectForKey
:
@"version"
];
NSString
*
serverUrl
=
[
dictData
objectForKey
:
@"url"
];
BOOL
forceUpdate
=
[
dictData
objectForKey
:
@"forceUpdate"
];
self
.
severVersion
=
serverVeision
;
self
.
severUrl
=
serverUrl
;
self
.
severForceUpdate
=
forceUpdate
;
[
strongSelf
comperVersion
];
}
else
{
[
IBTLoadingView
showTips
:
message
];
}
}
else
{
[
IBTLoadingView
showTips
:
@" 无记录 "
];
}
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
};
[
IBTLoadingView
showProgressLabel
:
@"正在加载..."
];
[[
ICRHTTPController
sharedController
]
getVeisionIdWithType
:
@"ipa"
success
:
succ
failure
:
fail
];
}
//比较版本号及是否下载
-
(
void
)
comperVersion
{
NSComparisonResult
comResult
=
[
self
p_compareVersions
:
self
.
version
betweenVersion2
:
self
.
severVersion
];
NSComparisonResult
comResult
=
[
self
p_compareVersions
:
currentVersion
betweenVersion2
:
@"后台返回的app版本"
];
//_versionModel.ClientVersion];
if
(
comResult
==
NSOrderedAscending
)
{
//299企业版的更新 @"有新的版本可供下载"
UIAlertView
*
alertV
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"新版本"
message
:
@""
delegate
:
self
cancelButtonTitle
:
@"下次再说"
otherButtonTitles
:
@"去下载"
,
nil
];
//_versionModel.UpgradeRemark
// alertV.tag = alertVEnterprise;
// [alertV show];
// NSOrderedAscending self.version<self.severVersion
// NSOrderedDescending self.version>self.severVersion
// NSOrderedSame self.version==self.severVersion
if
(
self
.
severForceUpdate
)
{
//强制更新
UIAlertView
*
alertV
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"新版本告知"
message
:
@"有新版本发布请您下载最新版本"
delegate
:
self
cancelButtonTitle
:
nil
otherButtonTitles
:
@"去下载"
,
nil
];
alertV
.
tag
=
1001
;
[
alertV
show
];
}
else
{
UIAlertView
*
alertV
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"新版本告知"
message
:
@"有新版本发布请您下载最新版本"
delegate
:
self
cancelButtonTitle
:
@"下次再说"
otherButtonTitles
:
@"去下载"
,
nil
];
//
alertV
.
tag
=
1002
;
[
alertV
show
];
}
}
else
{
[
IBTLoadingView
showProgressLabel
:
@"暂无新版本"
];
}
}
-
(
void
)
alertView
:
(
UIAlertView
*
)
alertView
clickedButtonAtIndex
:
(
NSInteger
)
buttonIndex
{
if
(
buttonIndex
==
1
)
{
[[
UIApplication
sharedApplication
]
openURL
:[
NSURL
URLWithString
:
@"app下载的url"
]];
if
(
alertView
.
tag
==
1001
)
{
[[
UIApplication
sharedApplication
]
openURL
:[
NSURL
URLWithString
:
self
.
severUrl
]];
}
else
if
(
alertView
.
tag
==
1002
)
{
if
(
buttonIndex
==
1
)
{
[[
UIApplication
sharedApplication
]
openURL
:[
NSURL
URLWithString
:
self
.
severUrl
]];
}
}
}
//比较版本号
-
(
NSComparisonResult
)
p_compareVersions
:
(
NSString
*
)
version1
betweenVersion2
:
(
NSString
*
)
version2
{
...
...
XFFruit/Controllers/HTTPController/ICRHTTPController.h
View file @
f66ab4d8
...
...
@@ -405,7 +405,10 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
-
(
void
)
saveReceiptAndReceiveWithData
:(
id
)
data
success
:(
void
(
^
)(
id
))
succ
failure
:(
void
(
^
)(
id
))
fail
;
//版本更新
-
(
void
)
getVeisionIdWithType
:(
NSString
*
)
type
success
:(
void
(
^
)(
id
))
succ
failure
:(
void
(
^
)(
id
))
fail
;
@end
...
...
XFFruit/Controllers/HTTPController/ICRHTTPController.m
View file @
f66ab4d8
...
...
@@ -129,8 +129,8 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
//收货单
XFFHttp_SaveRctinfo
,
XFFHttp_SaveReceipt
,
//版本更新
XFFHttp_getVersionId
};
...
...
@@ -243,6 +243,8 @@ static NSString * const ICRHTTPInterface[] = {
//收货
[
XFFHttp_SaveRctinfo
]
=
@"transfer/save_rctinfo"
,
[
XFFHttp_SaveReceipt
]
=
@"transfer/receipt"
,
[
XFFHttp_getVersionId
]
=
@"ipapk"
,
};
static
NSString
*
const
ICRAttachmentTypeValue
[]
=
{
...
...
@@ -2916,5 +2918,43 @@ acceptTypeJson:YES
success
:
success
failure
:
failure
];
}
//版本更新
-
(
void
)
getVeisionIdWithType
:
(
NSString
*
)
type
success
:
(
void
(
^
)(
id
))
succ
failure
:
(
void
(
^
)(
id
))
fail
{
if
(
!
type
)
{
if
(
fail
)
{
fail
(
[[
self
class
]
ErrorWithMsg
:
ERROR_PARAMETER
code
:
0
]
);
}
return
;
}
void
(
^
success
)(
AFHTTPRequestOperation
*
operation
,
id
responseObject
)
=
^
(
AFHTTPRequestOperation
*
operation
,
id
responseObject
)
{
CLog
(
@"%@"
,
responseObject
);
if
(
succ
)
{
succ
(
responseObject
);
}
};
void
(
^
failure
)(
AFHTTPRequestOperation
*
operation
,
NSError
*
error
)
=
^
(
AFHTTPRequestOperation
*
operation
,
NSError
*
error
)
{
CLog
(
@"%@"
,
error
);
if
(
fail
)
{
fail
(
error
);
}
};
NSString
*
urlStr
=
[[[
self
class
]
UrlForPluginHTTPAction
:
XFFHttp_getVersionId
]
stringByAppendingFormat
:
@"?type=%@"
,
type
];
NSString
*
encodeUrlStr
=
[
urlStr
stringByAddingPercentEscapesUsingEncoding
:
NSUTF8StringEncoding
];
[
self
GET
:
encodeUrlStr
parameters
:
nil
needToken
:
NO
acceptTypeJson
:
YES
success
:
success
failure
:
failure
];
}
@end
XFFruit/Info.plist
View file @
f66ab4d8
...
...
@@ -2,11 +2,6 @@
<
!
D
O
C
TYP
E
plist
PU
B
LI
C
"-//
A
ppl
e
//
D
T
D
PLIST
1
.
0
//
E
N"
"http://www.
a
ppl
e
.
c
om/
D
T
D
s/Prop
e
rtyList-
1
.
0
.
d
t
d
"
>
<
plist
v
e
rsion="
1
.
0
"
>
<
d
i
c
t
>
<
k
e
y
>
NSAppTransportSecurity
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
NSAllowsArbitraryLoads
<
/k
e
y
>
<
tru
e
/
>
<
/
d
i
c
t
>
<
k
e
y
>
CFBundleDevelopmentRegion
<
/k
e
y
>
<
string
>
en
<
/string
>
<
k
e
y
>
CFBundleExecutable
<
/k
e
y
>
...
...
@@ -19,12 +14,15 @@
<
string
>
$
(
PRODUCT_NAME
)<
/string
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
APPL
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
1.0
<
/string
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
string
>
????
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
1
<
/string
>
<
string
>
1.0.2
<
/string
>
<
k
e
y
>
NSAppTransportSecurity
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
NSAllowsArbitraryLoads
<
/k
e
y
>
<
tru
e
/
>
<
/
d
i
c
t
>
<
k
e
y
>
NSLocationWhenInUseUsageDescription
<
/k
e
y
>
<
string
><
/string
>
<
k
e
y
>
UILaunchStoryboardName
<
/k
e
y
>
...
...
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