Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DiDi
DoraemonKit
提交
03193f05
D
DoraemonKit
项目概览
DiDi
/
DoraemonKit
12 个月 前同步成功
通知
166
Star
19623
Fork
3062
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DoraemonKit
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
03193f05
编写于
3月 03, 2020
作者:
Y
yixiangboy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
获取mock列表的时机需要更新
上级
dd78a880
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
55 addition
and
27 deletion
+55
-27
iOS/DoraemonKit/Src/Core/Define/DoraemonDefine.h
iOS/DoraemonKit/Src/Core/Define/DoraemonDefine.h
+1
-1
iOS/DoraemonKit/Src/Core/Manager/DoraemonManager.m
iOS/DoraemonKit/Src/Core/Manager/DoraemonManager.m
+3
-1
iOS/DoraemonKit/Src/Core/Plugin/Platform/Mock/DoraemonMockViewController.m
...rc/Core/Plugin/Platform/Mock/DoraemonMockViewController.m
+38
-16
iOS/DoraemonKit/Src/Core/Plugin/Platform/Mock/Function/DoraemonMockManager.h
.../Core/Plugin/Platform/Mock/Function/DoraemonMockManager.h
+1
-2
iOS/DoraemonKit/Src/Core/Plugin/Platform/Mock/Function/DoraemonMockManager.m
.../Core/Plugin/Platform/Mock/Function/DoraemonMockManager.m
+4
-1
iOS/DoraemonKit/Src/Core/Util/DoraemonNetworkUtil.m
iOS/DoraemonKit/Src/Core/Util/DoraemonNetworkUtil.m
+8
-6
未找到文件。
iOS/DoraemonKit/Src/Core/Define/DoraemonDefine.h
浏览文件 @
03193f05
...
...
@@ -20,7 +20,7 @@
#define DoKitVersion @"3.0.0"
//
#define DoKit_OpenLog
#define DoKit_OpenLog
#ifdef DoKit_OpenLog
#define DoKitLog(...) NSLog(@"%s\n %@ \n\n",__func__,[NSString stringWithFormat:__VA_ARGS__]);
...
...
iOS/DoraemonKit/Src/Core/Manager/DoraemonManager.m
浏览文件 @
03193f05
...
...
@@ -193,7 +193,9 @@ typedef void (^DoraemonPerformanceBlock)(NSDictionary *);
[[
DoraemonStatisticsUtil
shareInstance
]
upLoadUserInfo
];
//拉取最新的mock数据
[[
DoraemonMockManager
sharedInstance
]
queryMockData
];
[[
DoraemonMockManager
sharedInstance
]
queryMockData
:
^
(
int
flag
)
{
DoKitLog
(
@"mock get data, flag == %i"
,
flag
);
}];
//Weex工具的初始化
#if DoraemonWithWeex
...
...
iOS/DoraemonKit/Src/Core/Plugin/Platform/Mock/DoraemonMockViewController.m
浏览文件 @
03193f05
...
...
@@ -10,6 +10,8 @@
#import "DoraemonMockUploadViewController.h"
#import "DoraemonMockAPIViewController.h"
#import "DoraemonMockManager.h"
#import "DoraemonHomeWindow.h"
@interface
DoraemonMockViewController
()
...
...
@@ -20,23 +22,44 @@
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
UITabBarController
*
tabBar
=
[[
UITabBarController
alloc
]
init
];
#if defined(__IPHONE_13_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0)
if
(
@available
(
iOS
13
.
0
,
*
))
{
tabBar
.
tabBar
.
backgroundColor
=
[
UIColor
systemBackgroundColor
];
if
(
UITraitCollection
.
currentTraitCollection
.
userInterfaceStyle
==
UIUserInterfaceStyleDark
)
{
UIView
*
view
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
-
0
.
5
,
CGRectGetWidth
(
tabBar
.
tabBar
.
frame
),
0
.
5
)];
view
.
backgroundColor
=
[
UIColor
doraemon_black_3
];
[
tabBar
.
tabBar
insertSubview
:
view
atIndex
:
0
];
//拉取最新的mock数据
[[
DoraemonMockManager
sharedInstance
]
queryMockData
:
^
(
int
flag
)
{
NSString
*
toast
=
nil
;
if
(
flag
==
1
)
{
//toast = @"数据更新成功";
toast
=
nil
;
}
else
if
(
flag
==
2
){
toast
=
@"数据更新失败"
;
}
else
if
(
flag
==
3
){
toast
=
@"pId为空 更新失败"
;
}
}
else
{
#endif
tabBar
.
tabBar
.
backgroundColor
=
[
UIColor
whiteColor
];
#if defined(__IPHONE_13_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0)
}
#endif
DoKitLog
(
@"mock get data, flag == %i"
,
flag
);
[
self
renderUI
];
if
(
toast
.
length
>
0
)
{
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
.
5
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
[
DoraemonToastUtil
showToastBlack
:
toast
inView
:[
DoraemonHomeWindow
shareInstance
]];
});
}
}];
}
-
(
void
)
renderUI
{
UITabBarController
*
tabBar
=
[[
UITabBarController
alloc
]
init
];
#if defined(__IPHONE_13_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0)
if
(
@available
(
iOS
13
.
0
,
*
))
{
tabBar
.
tabBar
.
backgroundColor
=
[
UIColor
systemBackgroundColor
];
if
(
UITraitCollection
.
currentTraitCollection
.
userInterfaceStyle
==
UIUserInterfaceStyleDark
)
{
UIView
*
view
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
-
0
.
5
,
CGRectGetWidth
(
tabBar
.
tabBar
.
frame
),
0
.
5
)];
view
.
backgroundColor
=
[
UIColor
doraemon_black_3
];
[
tabBar
.
tabBar
insertSubview
:
view
atIndex
:
0
];
}
}
else
{
#endif
tabBar
.
tabBar
.
backgroundColor
=
[
UIColor
whiteColor
];
#if defined(__IPHONE_13_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0)
}
#endif
UIViewController
*
vc1
=
[[
DoraemonMockAPIViewController
alloc
]
init
];
UINavigationController
*
nav1
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
vc1
];
...
...
@@ -56,7 +79,6 @@
tabBar
.
modalPresentationStyle
=
UIModalPresentationFullScreen
;
[
self
.
navigationController
presentViewController
:
tabBar
animated
:
NO
completion
:
nil
];
}
@end
iOS/DoraemonKit/Src/Core/Plugin/Platform/Mock/Function/DoraemonMockManager.h
浏览文件 @
03193f05
...
...
@@ -27,8 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
@property
(
nonatomic
,
copy
)
NSString
*
uploadState
;
//上传信息选中的状态
@property
(
nonatomic
,
copy
)
NSString
*
uploadSearchText
;
//上传信息的搜索关键字
-
(
void
)
queryMockData
;
-
(
void
)
queryMockData
:(
void
(
^
)(
int
flag
))
block
;
-
(
BOOL
)
needMock
:(
NSURLRequest
*
)
request
;
...
...
iOS/DoraemonKit/Src/Core/Plugin/Platform/Mock/Function/DoraemonMockManager.m
浏览文件 @
03193f05
...
...
@@ -56,7 +56,7 @@
}
}
-
(
void
)
queryMockData
{
-
(
void
)
queryMockData
:(
void
(
^
)(
int
flag
))
block
{
NSString
*
pId
=
[
DoraemonManager
shareInstance
].
pId
;
if
(
pId
&&
pId
.
length
>
0
)
{
NSDictionary
*
params
=
@{
...
...
@@ -114,11 +114,14 @@
weakSelf
.
upLoadArray
=
uploadArray
;
weakSelf
.
groups
=
groups
;
[
self
handleData
];
block
(
1
);
}
error
:^
(
NSError
*
_Nonnull
error
)
{
DoKitLog
(
@"error == %@"
,
error
);
block
(
2
);
}];
}
else
{
DoKitLog
(
@"请求接口列表必须保证pId不为空"
);
block
(
3
);
}
}
...
...
iOS/DoraemonKit/Src/Core/Util/DoraemonNetworkUtil.m
浏览文件 @
03193f05
...
...
@@ -72,12 +72,14 @@
NSURLSessionConfiguration
*
config
=
[
NSURLSessionConfiguration
defaultSessionConfiguration
];
NSURLSession
*
session
=
[
NSURLSession
sessionWithConfiguration
:
config
delegate
:[
self
shareInstance
]
delegateQueue
:
queue
];
NSURLSessionDataTask
*
dataTask
=
[
session
dataTaskWithRequest
:
request
completionHandler
:
^
(
NSData
*
_Nullable
data
,
NSURLResponse
*
_Nullable
response
,
NSError
*
_Nullable
error
)
{
if
(
error
)
{
errorAction
(
error
);
}
else
{
NSDictionary
*
dic
=
[
NSJSONSerialization
JSONObjectWithData
:
data
options
:
NSJSONReadingMutableContainers
error
:
nil
];
successAction
(
dic
);
}
dispatch_async
(
dispatch_get_main_queue
(),
^
{
if
(
error
)
{
errorAction
(
error
);
}
else
{
NSDictionary
*
dic
=
[
NSJSONSerialization
JSONObjectWithData
:
data
options
:
NSJSONReadingMutableContainers
error
:
nil
];
successAction
(
dic
);
}
});
}];
[
dataTask
resume
];
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录