Merge heron into master (#2636)

diff --git a/Podfile b/Podfile
index 1fd5f3f..1fe726b 100644
--- a/Podfile
+++ b/Podfile
@@ -4,9 +4,9 @@
 
 def common
     pod 'WeexSDK', :path=>'../../'
-
     pod 'WXDevtool','0.20.0'
     pod 'SDWebImage', '3.7.5'
+    pod 'SDWebImage/WebP'
     pod 'SocketRocket', '0.4.2'
     pod 'ATSDK-Weex', '0.0.1',:configurations => ['Debug']
     pod 'BindingX', '1.0.3'
diff --git a/WeexDemo.xcodeproj/project.pbxproj b/WeexDemo.xcodeproj/project.pbxproj
index 0d64451..781aa06 100644
--- a/WeexDemo.xcodeproj/project.pbxproj
+++ b/WeexDemo.xcodeproj/project.pbxproj
@@ -797,7 +797,7 @@
 					"$(PROJECT_DIR)/WeexDemo",
 					"$(PROJECT_DIR)",
 				);
-				GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+				GCC_TREAT_WARNINGS_AS_ERRORS = NO;
 				INFOPLIST_FILE = WeexDemo/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -827,7 +827,7 @@
 					"$(PROJECT_DIR)/WeexDemo",
 					"$(PROJECT_DIR)",
 				);
-				GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+				GCC_TREAT_WARNINGS_AS_ERRORS = NO;
 				INFOPLIST_FILE = WeexDemo/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -847,7 +847,7 @@
 			buildSettings = {
 				BUNDLE_LOADER = "$(TEST_HOST)";
 				INFOPLIST_FILE = WeexDemoTests/Info.plist;
-				IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
 				PRODUCT_BUNDLE_IDENTIFIER = com.taobao.WeexDemoTests;
 				PRODUCT_NAME = "$(TARGET_NAME)";
@@ -860,7 +860,7 @@
 			buildSettings = {
 				BUNDLE_LOADER = "$(TEST_HOST)";
 				INFOPLIST_FILE = WeexDemoTests/Info.plist;
-				IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
 				PRODUCT_BUNDLE_IDENTIFIER = com.taobao.WeexDemoTests;
 				PRODUCT_NAME = "$(TARGET_NAME)";
@@ -888,9 +888,9 @@
 					"COCOAPODS=1",
 					"UITEST=1",
 				);
-				GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+				GCC_TREAT_WARNINGS_AS_ERRORS = NO;
 				INFOPLIST_FILE = "WeexUITestDemo-Info.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
 				MODULE_NAME = NO;
 				OTHER_LDFLAGS = (
@@ -918,9 +918,9 @@
 				);
 				GCC_GENERATE_TEST_COVERAGE_FILES = YES;
 				GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
-				GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+				GCC_TREAT_WARNINGS_AS_ERRORS = NO;
 				INFOPLIST_FILE = "WeexUITestDemo-Info.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
 				MODULE_NAME = NO;
 				OTHER_LDFLAGS = (
diff --git a/WeexDemo/WXDemoViewController.m b/WeexDemo/WXDemoViewController.m
index 1c193f8..c3e321d 100644
--- a/WeexDemo/WXDemoViewController.m
+++ b/WeexDemo/WXDemoViewController.m
@@ -91,6 +91,7 @@
 - (void)viewDidDisappear:(BOOL)animated
 {
     [super viewDidDisappear:animated];
+    [_instance didDisappear];
     [self updateInstanceState:WeexInstanceDisappear];
 }
 
@@ -106,6 +107,7 @@
 - (void)viewWillAppear:(BOOL)animated
 {
     [super viewWillAppear:animated];
+    [_instance willAppear];
     [self setupNaviBar];
     [self setupRightBarItem];
     [self.navigationController setNavigationBarHidden:_showNavigationBar];
@@ -154,6 +156,7 @@
         _instance = [WXPrerenderManager instanceFromUrl:self.url.absoluteString];
     }
     
+    _instance.isMainContainerStack = YES;
     _instance.viewController = self;
     UIEdgeInsets safeArea = UIEdgeInsetsZero;
     
diff --git a/WeexDemo/extend/handler/WXApmGeneratorImpl.h b/WeexDemo/extend/handler/WXApmGeneratorImpl.h
index f18c4c3..c3255e5 100644
--- a/WeexDemo/extend/handler/WXApmGeneratorImpl.h
+++ b/WeexDemo/extend/handler/WXApmGeneratorImpl.h
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 #import <Foundation/Foundation.h>
 #import "WXApmProtocol.h"
 
diff --git a/WeexDemo/extend/handler/WXApmGeneratorImpl.m b/WeexDemo/extend/handler/WXApmGeneratorImpl.m
index fffd213..64c8e25 100644
--- a/WeexDemo/extend/handler/WXApmGeneratorImpl.m
+++ b/WeexDemo/extend/handler/WXApmGeneratorImpl.m
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 #import "WXApmGeneratorImpl.h"
 #import "WXApmImpl.h"
 
diff --git a/WeexDemo/extend/handler/WXApmImpl.h b/WeexDemo/extend/handler/WXApmImpl.h
index 85003e6..5af8752 100644
--- a/WeexDemo/extend/handler/WXApmImpl.h
+++ b/WeexDemo/extend/handler/WXApmImpl.h
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 #import <Foundation/Foundation.h>
 #import "WXApmProtocol.h"
 
diff --git a/WeexDemo/extend/handler/WXApmImpl.m b/WeexDemo/extend/handler/WXApmImpl.m
index 72cc0da..214fb80 100644
--- a/WeexDemo/extend/handler/WXApmImpl.m
+++ b/WeexDemo/extend/handler/WXApmImpl.m
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 
 #import "WXApmImpl.h"
 #import "WXUtility.h"
@@ -121,7 +139,11 @@
                               @"event":self.eventMap
                               };
     NSString* jsonStr = [WXUtility JSONString:InfoMap];
-    NSLog(@"wxApmForInstance :%@",jsonStr);
+    NSLog(@"wxApmForInstance: %@",jsonStr);
+    
+    NSNumber* stageRenderOrigin = self.stageMap[KEY_PAGE_STAGES_RENDER_ORGIGIN];
+    NSNumber* stageInteraction = self.stageMap[KEY_PAGE_STAGES_INTERACTION];
+    NSLog(@"wxApmForInstance interaction time: %lld", [stageInteraction longLongValue] - [stageRenderOrigin longLongValue]);
 }
 
 @end