Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[WEEX-642][iOS] fix wxpageRatio not report && report createInstaceCon…
Browse files Browse the repository at this point in the history
…text failed info (#1618)
  • Loading branch information
lucky-chen authored and cxfeng1 committed Oct 9, 2018
1 parent e13b599 commit 0f39d38
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
11 changes: 10 additions & 1 deletion ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,13 @@ - (void)createInstance:(NSString *)instanceIdString
[sdkInstance.apmInstance onStage:KEY_PAGE_STAGES_LOAD_BUNDLE_END];
} else {
sdkInstance.callCreateInstanceContext = [NSString stringWithFormat:@"instanceId:%@\noptions:%@\ndata:%@", instanceIdString, newOptions, data];
//add instanceId to weexContext ,if fucn createInstanceContext failure ,then we will know which instance has problem (exceptionhandler)
self.jsBridge.javaScriptContext[@"wxExtFuncInfo"]= @{
@"func":@"createInstanceContext",
@"arg":@"start",
@"instanceId":sdkInstance.instanceId?:@"unknownId"
};
__weak typeof(self) weakSelf = self;
[self callJSMethod:@"createInstanceContext" args:@[instanceIdString, newOptions, data?:@[]] onContext:nil completion:^(JSValue *instanceContextEnvironment) {
if (sdkInstance.pageName) {
if (@available(iOS 8.0, *)) {
Expand All @@ -466,6 +473,7 @@ - (void)createInstance:(NSString *)instanceIdString
// Fallback
}
}
weakSelf.jsBridge.javaScriptContext[@"wxExtFuncInfo"]= nil;

NSMutableArray* allKeys = nil;

Expand Down Expand Up @@ -558,7 +566,8 @@ - (void)createInstance:(NSString *)instanceIdString
[sdkInstance.apmInstance onStage:KEY_PAGE_STAGES_LOAD_BUNDLE_END];
NSDictionary* funcInfo = @{
@"func":@"createInstance",
@"arg":@"start"
@"arg":@"start",
@"instanceId":sdkInstance.instanceId?:@"unknownId"
};
sdkInstance.instanceJavaScriptContext.javaScriptContext[@"wxExtFuncInfo"]= funcInfo;
if ([NSURL URLWithString:sdkInstance.pageName] || sdkInstance.scriptURL) {
Expand Down
3 changes: 1 addition & 2 deletions ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ - (void)setFrame:(CGRect)frame
CGFloat screenHeight = [[UIScreen mainScreen] bounds].size.height;
if (screenHeight>0) {
CGFloat pageRatio = frame.size.height/screenHeight *100;
pageRatio = pageRatio>100?100:pageRatio;
[self.apmInstance setStatistic:KEY_PAGE_STATS_BODY_RATIO withValue:pageRatio];
self.apmInstance.wxPageRatio = pageRatio>100?100:pageRatio;
}
WXPerformBlockOnMainThread(^{
if (_rootView) {
Expand Down
1 change: 1 addition & 0 deletions ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ extern NSString* const VALUE_ERROR_CODE_DEFAULT;
@property (nonatomic, assign) BOOL isStartRender;
@property (nonatomic,assign) BOOL hasRecordFirstInterationView;
@property (nonatomic, assign) BOOL isDownLoadFailed;
@property (nonatomic,assign) double wxPageRatio;

#pragma mark - basic method

Expand Down
1 change: 1 addition & 0 deletions ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ - (void) startRecord:(NSString*) instanceId
[self setProperty:KEY_PROPERTIES_ERROR_CODE withValue:VALUE_ERROR_CODE_DEFAULT];
[self setProperty:KEY_PAGE_PROPERTIES_JSLIB_VERSION withValue:[WXAppConfiguration JSFrameworkVersion]?:@"unknownJSFrameworkVersion"];
[self setProperty:KEY_PAGE_PROPERTIES_WEEX_VERSION withValue:WX_SDK_VERSION];
[self setStatistic:KEY_PAGE_STATS_BODY_RATIO withValue:self.wxPageRatio];

//for apm protocl
//iOS/Android we default recycle img when imgView disapper form screen
Expand Down

0 comments on commit 0f39d38

Please sign in to comment.