├── README.md ├── WeexSDK-Dynamic └── Info.plist ├── WeexSDK.podspec ├── WeexSDK.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ ├── WeexSDK-Dynamic.xcscheme │ ├── WeexSDK.xcscheme │ └── WeexSDKTests.xcscheme ├── WeexSDK ├── Info.plist ├── Resources │ ├── native-bundle-main.js │ ├── weex-main-jsfm.js │ ├── weex-polyfill.js │ ├── weex-rax-api.js │ └── wx_load_error@3x.png └── Sources │ ├── Bridge │ ├── JSContext+Weex.h │ ├── JSContext+Weex.m │ ├── JSValue+Weex.h │ ├── JSValue+Weex.m │ ├── WXBridgeContext.h │ ├── WXBridgeContext.m │ ├── WXBridgeMethod.h │ ├── WXBridgeMethod.m │ ├── WXCallJSMethod.h │ ├── WXCallJSMethod.m │ ├── WXComponentMethod.h │ ├── WXComponentMethod.m │ ├── WXJSCoreBridge.h │ ├── WXJSCoreBridge.m │ ├── WXModuleMethod.h │ ├── WXModuleMethod.m │ ├── WXPolyfillSet.h │ └── WXPolyfillSet.m │ ├── Component │ ├── RecycleList │ │ ├── WXCellSlotComponent.h │ │ ├── WXCellSlotComponent.mm │ │ ├── WXComponent+DataBinding.h │ │ ├── WXComponent+DataBinding.mm │ │ ├── WXJSASTParser.h │ │ ├── WXJSASTParser.mm │ │ ├── WXRecycleListComponent.h │ │ ├── WXRecycleListComponent.mm │ │ ├── WXRecycleListDataManager.h │ │ ├── WXRecycleListDataManager.m │ │ ├── WXRecycleListLayout.h │ │ ├── WXRecycleListLayout.m │ │ ├── WXRecycleListTemplateManager.h │ │ ├── WXRecycleListTemplateManager.m │ │ ├── WXRecycleListUpdateManager.h │ │ └── WXRecycleListUpdateManager.m │ ├── Recycler │ │ ├── WXMultiColumnLayout.h │ │ ├── WXMultiColumnLayout.m │ │ ├── WXRecyclerComponent.h │ │ ├── WXRecyclerComponent.mm │ │ ├── WXRecyclerDataController.h │ │ ├── WXRecyclerDataController.m │ │ ├── WXRecyclerDragController.h │ │ ├── WXRecyclerDragController.m │ │ ├── WXRecyclerUpdateController.h │ │ ├── WXRecyclerUpdateController.m │ │ ├── WXSectionDataController.h │ │ └── WXSectionDataController.m │ ├── WXAComponent.h │ ├── WXAComponent.m │ ├── WXCanvasComponent.h │ ├── WXCanvasComponent.m │ ├── WXCellComponent.h │ ├── WXCellComponent.mm │ ├── WXComponent_internal.h │ ├── WXCycleSliderComponent.h │ ├── WXCycleSliderComponent.mm │ ├── WXDivComponent.h │ ├── WXDivComponent.m │ ├── WXEditComponent.h │ ├── WXEditComponent.mm │ ├── WXEmbedComponent.h │ ├── WXEmbedComponent.m │ ├── WXFooterComponent.h │ ├── WXFooterComponent.m │ ├── WXHeaderComponent.h │ ├── WXHeaderComponent.mm │ ├── WXImageComponent.h │ ├── WXImageComponent.m │ ├── WXIndicatorComponent.h │ ├── WXIndicatorComponent.m │ ├── WXListComponent.h │ ├── WXListComponent.mm │ ├── WXLoadingComponent.h │ ├── WXLoadingComponent.mm │ ├── WXLoadingIndicator.h │ ├── WXLoadingIndicator.m │ ├── WXRefreshComponent.h │ ├── WXRefreshComponent.mm │ ├── WXScrollerComponent.h │ ├── WXScrollerComponent.mm │ ├── WXSliderNeighborComponent.h │ ├── WXSliderNeighborComponent.mm │ ├── WXSwitchComponent.h │ ├── WXSwitchComponent.mm │ ├── WXTextAreaComponent.h │ ├── WXTextAreaComponent.mm │ ├── WXTextComponent.h │ ├── WXTextComponent.mm │ ├── WXTextInputComponent.h │ ├── WXTextInputComponent.m │ ├── WXTransform.h │ ├── WXTransform.m │ ├── WXVideoComponent.h │ ├── WXVideoComponent.m │ ├── WXWebComponent.h │ └── WXWebComponent.m │ ├── Controller │ ├── WXBaseViewController.h │ ├── WXBaseViewController.m │ ├── WXRootViewController.h │ └── WXRootViewController.m │ ├── Debug │ ├── WXDebugTool.h │ └── WXDebugTool.m │ ├── Display │ ├── UIBezierPath+Weex.h │ ├── UIBezierPath+Weex.m │ ├── WXComponent+BoxShadow.h │ ├── WXComponent+BoxShadow.m │ ├── WXComponent+Display.h │ ├── WXComponent+Display.m │ ├── WXDisplayQueue.h │ ├── WXDisplayQueue.m │ ├── WXInnerLayer.h │ ├── WXInnerLayer.m │ ├── WXLayer.h │ ├── WXLayer.m │ ├── WXRoundedRect.h │ └── WXRoundedRect.mm │ ├── Engine │ ├── WXSDKEngine.h │ ├── WXSDKEngine.m │ ├── WXSDKError.h │ └── WXSDKError.m │ ├── Events │ ├── WXComponent+Events.h │ └── WXComponent+Events.m │ ├── Handler │ ├── WXNavigationDefaultImpl.h │ ├── WXNavigationDefaultImpl.m │ ├── WXURLRewriteDefaultImpl.h │ └── WXURLRewriteDefaultImpl.m │ ├── Layout │ ├── WXComponent+Layout.h │ ├── WXComponent+Layout.mm │ ├── WXCoreFlexEnum.h │ ├── WXCoreLayout.cpp │ ├── WXCoreLayout.h │ ├── WXCoreStyle.cpp │ ├── WXCoreStyle.h │ ├── WXScrollerComponent+Layout.h │ └── WXScrollerComponent+Layout.mm │ ├── Loader │ ├── WXResourceLoader.h │ ├── WXResourceLoader.m │ ├── WXWebSocketLoader.h │ └── WXWebSocketLoader.m │ ├── Manager │ ├── WXBridgeManager.h │ ├── WXBridgeManager.m │ ├── WXComponentFactory.h │ ├── WXComponentFactory.m │ ├── WXComponentManager.h │ ├── WXComponentManager.mm │ ├── WXDatePickerManager.h │ ├── WXDatePickerManager.m │ ├── WXExtendCallNativeManager.h │ ├── WXExtendCallNativeManager.m │ ├── WXHandlerFactory.h │ ├── WXHandlerFactory.m │ ├── WXInvocationConfig.h │ ├── WXInvocationConfig.m │ ├── WXModuleFactory.h │ ├── WXModuleFactory.m │ ├── WXRuleManager.h │ ├── WXRuleManager.m │ ├── WXSDKManager.h │ ├── WXSDKManager.m │ ├── WXServiceFactory.h │ ├── WXServiceFactory.m │ ├── WXTracingManager.h │ └── WXTracingManager.m │ ├── Model │ ├── WXComponent+Navigation.h │ ├── WXComponent+Navigation.m │ ├── WXComponent.h │ ├── WXComponent.mm │ ├── WXJSExceptionInfo.h │ ├── WXJSExceptionInfo.m │ ├── WXSDKInstance.h │ ├── WXSDKInstance.m │ ├── WXSDKInstance_performance.h │ ├── WXSDKInstance_performance.m │ └── WXSDKInstance_private.h │ ├── Module │ ├── WXAnimationModule.h │ ├── WXAnimationModule.m │ ├── WXCanvasModule.h │ ├── WXCanvasModule.m │ ├── WXClipboardModule.h │ ├── WXClipboardModule.m │ ├── WXDomModule.h │ ├── WXDomModule.m │ ├── WXGlobalEventModule.h │ ├── WXGlobalEventModule.m │ ├── WXInstanceWrap.h │ ├── WXInstanceWrap.m │ ├── WXLocaleModule.h │ ├── WXLocaleModule.m │ ├── WXMetaModule.h │ ├── WXMetaModule.m │ ├── WXModalUIModule.h │ ├── WXModalUIModule.m │ ├── WXNavigatorModule.h │ ├── WXNavigatorModule.m │ ├── WXPickerModule.h │ ├── WXPickerModule.m │ ├── WXPrerenderManager.h │ ├── WXPrerenderManager.m │ ├── WXStorageModule.h │ ├── WXStorageModule.m │ ├── WXStreamModule.h │ ├── WXStreamModule.m │ ├── WXTimerModule.h │ ├── WXTimerModule.m │ ├── WXTransition.h │ ├── WXTransition.mm │ ├── WXVoiceOverModule.h │ ├── WXVoiceOverModule.m │ ├── WXWebSocketModule.h │ ├── WXWebSocketModule.m │ ├── WXWebViewModule.h │ └── WXWebViewModule.m │ ├── Monitor │ ├── WXAnalyzerCenter+Transfer.h │ ├── WXAnalyzerCenter.h │ ├── WXAnalyzerCenter.m │ ├── WXExceptionUtils.h │ ├── WXExceptionUtils.m │ ├── WXMonitor.h │ └── WXMonitor.m │ ├── Network │ ├── WXResourceRequest.h │ ├── WXResourceRequest.m │ ├── WXResourceRequestHandler.h │ ├── WXResourceRequestHandlerDefaultImpl.h │ ├── WXResourceRequestHandlerDefaultImpl.m │ ├── WXResourceResponse.h │ └── WXResourceResponse.m │ ├── Protocol │ ├── WXAnalyzerProtocol.h │ ├── WXAppMonitorProtocol.h │ ├── WXBridgeProtocol.h │ ├── WXConfigCenterProtocol.h │ ├── WXDestroyProtocol.h │ ├── WXEventModuleProtocol.h │ ├── WXExtendCallNativeProtocol.h │ ├── WXImgLoaderProtocol.h │ ├── WXJSExceptionProtocol.h │ ├── WXModuleProtocol.h │ ├── WXNavigationProtocol.h │ ├── WXNetworkProtocol.h │ ├── WXPageEventNotifyEvent.h │ ├── WXScrollerProtocol.h │ ├── WXTextComponentProtocol.h │ ├── WXTracingProtocol.h │ ├── WXURLRewriteProtocol.h │ └── WXValidateProtocol.h │ ├── Supporting Files │ └── WeexSDK-Prefix.pch │ ├── Utility │ ├── NSArray+Weex.h │ ├── NSArray+Weex.m │ ├── NSObject+WXSwizzle.h │ ├── NSObject+WXSwizzle.m │ ├── NSTimer+Weex.h │ ├── NSTimer+Weex.m │ ├── WXAppConfiguration.h │ ├── WXAppConfiguration.m │ ├── WXAssert.h │ ├── WXAssert.m │ ├── WXBoxShadow.h │ ├── WXBoxShadow.m │ ├── WXConvert.h │ ├── WXConvert.m │ ├── WXDefine.h │ ├── WXDiffUtil.h │ ├── WXDiffUtil.m │ ├── WXLength.h │ ├── WXLength.m │ ├── WXLog.h │ ├── WXLog.m │ ├── WXSimulatorShortcutManager.h │ ├── WXSimulatorShortcutManager.m │ ├── WXThreadSafeCounter.h │ ├── WXThreadSafeCounter.m │ ├── WXThreadSafeMutableArray.h │ ├── WXThreadSafeMutableArray.m │ ├── WXThreadSafeMutableDictionary.h │ ├── WXThreadSafeMutableDictionary.m │ ├── WXType.h │ ├── WXUtility.h │ ├── WXUtility.m │ ├── WXWeakObjectWrapper.h │ └── WXWeakObjectWrapper.m │ ├── View │ ├── WXComponent+PseudoClassManagement.h │ ├── WXComponent+PseudoClassManagement.m │ ├── WXComponent+ViewManagement.h │ ├── WXComponent+ViewManagement.mm │ ├── WXErrorView.h │ ├── WXErrorView.m │ ├── WXRootView.h │ ├── WXRootView.m │ ├── WXView.h │ └── WXView.m │ ├── WebSocket │ └── WXWebSocketHandler.h │ └── WeexSDK.h ├── WeexSDKTests ├── Info.plist ├── TestSupportUtils.h ├── TestSupportUtils.m ├── WXAnimationModuleTests.m ├── WXBridgeMethodTests.m ├── WXComponentTests.m ├── WXConvertTests.m ├── WXFloatCompareTests.m ├── WXInstanceWrapTests.m ├── WXRootViewTests.m ├── WXSDKEngineTests.m ├── WXSDKManagerTests.m ├── WXStorageTests.m ├── WXStreamModuleTests.m ├── WXTestBridgeMethodDummy.h ├── WXTestBridgeMethodDummy.m ├── WXTimerModuleTests.m ├── WXURLRewriteTests.m ├── WeexSDKTests.m ├── dependency │ └── OCMock │ │ ├── NSNotificationCenter+OCMAdditions.h │ │ ├── OCMArg.h │ │ ├── OCMConstraint.h │ │ ├── OCMFunctions.h │ │ ├── OCMLocation.h │ │ ├── OCMMacroState.h │ │ ├── OCMRecorder.h │ │ ├── OCMStubRecorder.h │ │ ├── OCMock.h │ │ └── OCMockObject.h └── testRootView.js ├── WeexSDK_MTL ├── WeexSDK_MTL.h └── WeexSDK_MTL.m └── buildScripts.sh /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/WeexiOSSDK/8e43f8d0699de551c5aba8f3b404f6f9705b69c8/README.md -------------------------------------------------------------------------------- /WeexSDK-Dynamic/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /WeexSDK.podspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | Pod::Spec.new do |s| 3 | 4 | s.name = "WeexSDK" 5 | 6 | s.version = "0.19.0" 7 | 8 | s.summary = "WeexSDK Source ." 9 | 10 | s.description = <<-DESC 11 | A framework for building Mobile cross-platform UI 12 | DESC 13 | 14 | s.homepage = "https://github.com/bmfe/WeexiOSSDK" 15 | s.license = { 16 | :type => 'Copyright', 17 | :text => <<-LICENSE 18 | Alibaba-INC copyright 19 | LICENSE 20 | } 21 | s.authors = { "cxfeng1" => "cxfeng1@gmail.com", 22 | "boboning" => "ningli928@163.com", 23 | "yangshengtao" => "yangshengtao1314@163.com", 24 | "kfeagle" => "sunjjbobo@163.com", 25 | "acton393" => "zhangxing610321@gmail.com" 26 | } 27 | s.platform = :ios 28 | s.ios.deployment_target = '8.0' 29 | s.source = { :git => "https://github.com/bmfe/WeexiOSSDK.git", :tag => s.version.to_s } 30 | s.source_files = 'WeexSDK/Sources/**/*.{h,m,mm,c,cpp}' 31 | s.resources = 'WeexSDK/Resources/*.js', 'WeexSDK/Resources/wx_load_error@3x.png' 32 | 33 | s.user_target_xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => "'$(PODS_ROOT)/WeexSDK'" } 34 | s.requires_arc = true 35 | s.prefix_header_file = 'WeexSDK/Sources/Supporting Files/WeexSDK-Prefix.pch' 36 | s.private_header_files = 'WeexSDK/Sources/Component/RecycleList/WXJSASTParser.h', 37 | 'WeexSDK/Sources/Layout/WXScrollerComponent+Layout.h' 38 | 39 | s.xcconfig = { "OTHER_LINK_FLAG" => '$(inherited) -ObjC'} 40 | 41 | s.frameworks = 'CoreMedia','MediaPlayer','AVFoundation','AVKit','JavaScriptCore', 'GLKit', 'OpenGLES', 'CoreText', 'QuartzCore', 'CoreGraphics' 42 | s.libraries = "stdc++" 43 | 44 | end 45 | -------------------------------------------------------------------------------- /WeexSDK.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WeexSDK/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /WeexSDK/Resources/wx_load_error@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/WeexiOSSDK/8e43f8d0699de551c5aba8f3b404f6f9705b69c8/WeexSDK/Resources/wx_load_error@3x.png -------------------------------------------------------------------------------- /WeexSDK/Sources/Bridge/JSContext+Weex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface JSContext (Weex) 23 | 24 | @property (nonatomic, strong) NSString *instanceId; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Bridge/JSContext+Weex.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "JSContext+Weex.h" 21 | #import 22 | 23 | static NSString *wx_instanceIdKey; 24 | 25 | @implementation JSContext (Weex) 26 | 27 | - (NSString *)instanceId { 28 | return (NSString *)objc_getAssociatedObject(self, &wx_instanceIdKey); 29 | } 30 | 31 | - (void)setInstanceId:(NSString *)instanceId { 32 | objc_setAssociatedObject(self, &wx_instanceIdKey, instanceId, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Bridge/JSValue+Weex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface JSValue (Weex) 23 | 24 | + (JSValue *)wx_valueWithReturnValueFromInvocation:(NSInvocation *)invocation inContext:(JSContext *)context; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Bridge/WXBridgeMethod.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | @class WXSDKInstance; 22 | 23 | @interface WXBridgeMethod : NSObject 24 | 25 | @property (nonatomic, strong, readonly) NSString *methodName; 26 | @property (nonatomic, copy, readonly) NSMutableArray *arguments; 27 | @property (nonatomic, weak, readonly) WXSDKInstance *instance; 28 | 29 | - (instancetype)initWithMethodName:(NSString *)methodName 30 | arguments:(NSArray *)arguments 31 | instance:(WXSDKInstance *)instance; 32 | 33 | - (NSInvocation *)invocationWithTarget:(id)target selector:(SEL)selector; 34 | 35 | @end 36 | 37 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Bridge/WXCallJSMethod.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXBridgeMethod.h" 21 | 22 | @interface WXCallJSMethod : WXBridgeMethod 23 | 24 | - (instancetype)initWithModuleName:(NSString *)moduleName 25 | methodName:(NSString *)methodName 26 | arguments:(NSArray *)arguments 27 | instance:(WXSDKInstance *)instance; 28 | 29 | - (NSDictionary *)callJSTask; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Bridge/WXCallJSMethod.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXCallJSMethod.h" 21 | 22 | @implementation WXCallJSMethod 23 | { 24 | NSString *_moduleName; 25 | } 26 | 27 | - (instancetype)initWithModuleName:(NSString *)moduleName 28 | methodName:(NSString *)methodName 29 | arguments:(NSArray *)arguments 30 | instance:(WXSDKInstance *)instance 31 | { 32 | if (self = [super initWithMethodName:methodName arguments:arguments instance:instance]) { 33 | _moduleName = moduleName; 34 | } 35 | 36 | return self; 37 | } 38 | 39 | - (NSDictionary *)callJSTask 40 | { 41 | return @{@"module":_moduleName ?: @"", 42 | @"method":self.methodName ?: @"", 43 | @"args":self.arguments ?: @[]}; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Bridge/WXComponentMethod.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXBridgeMethod.h" 21 | @class WXComponent; 22 | 23 | @interface WXComponentMethod : WXBridgeMethod 24 | 25 | - (instancetype)initWithComponentRef:(NSString *)ref 26 | methodName:(NSString *)methodName 27 | arguments:(NSArray *)arguments 28 | instance:(WXSDKInstance *)instance; 29 | 30 | - (void)invoke; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Bridge/WXJSCoreBridge.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXBridgeProtocol.h" 21 | 22 | @interface WXJSCoreBridge : NSObject 23 | @property (nonatomic,assign)BOOL multiContext; 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Bridge/WXModuleMethod.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXBridgeMethod.h" 21 | 22 | typedef enum : NSUInteger { 23 | WXModuleMethodTypeSync, 24 | WXModuleMethodTypeAsync, 25 | } WXModuleMethodType; 26 | 27 | @interface WXModuleMethod : WXBridgeMethod 28 | 29 | @property (nonatomic, assign) WXModuleMethodType methodType; 30 | @property (nonatomic, strong, readonly) NSString *moduleName; 31 | @property (nonatomic, strong, readonly) NSDictionary *options; 32 | 33 | - (instancetype)initWithModuleName:(NSString *)moduleName 34 | methodName:(NSString *)methodName 35 | arguments:(NSArray *)arguments 36 | options:(NSDictionary *)options 37 | instance:(WXSDKInstance *)instance; 38 | 39 | - (NSInvocation *)invoke; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Bridge/WXPolyfillSet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | 23 | @protocol WXPolyfillSetJSExports 24 | 25 | + (instancetype)create; 26 | 27 | - (BOOL)has:(id)value; 28 | 29 | - (NSUInteger)size; 30 | 31 | - (void)add:(id)value; 32 | 33 | - (BOOL)delete:(id)value; 34 | 35 | - (void)clear; 36 | 37 | @end 38 | 39 | @interface WXPolyfillSet : NSObject 40 | 41 | @end 42 | 43 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Bridge/WXPolyfillSet.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXPolyfillSet.h" 21 | 22 | @implementation WXPolyfillSet 23 | { 24 | NSMutableSet *_set; 25 | } 26 | 27 | + (instancetype)create 28 | { 29 | WXPolyfillSet *jsSet = [WXPolyfillSet new]; 30 | jsSet->_set = [NSMutableSet set]; 31 | return jsSet; 32 | } 33 | 34 | - (BOOL)has:(id)value 35 | { 36 | return [_set containsObject:value]; 37 | } 38 | 39 | - (NSUInteger)size 40 | { 41 | return _set.count; 42 | } 43 | 44 | - (void)add:(id)value 45 | { 46 | [_set addObject:value]; 47 | } 48 | 49 | - (BOOL)delete:(id)value 50 | { 51 | if ([_set containsObject:value]) { 52 | [_set removeObject:value]; 53 | return YES; 54 | } 55 | 56 | return NO; 57 | } 58 | 59 | - (void)clear 60 | { 61 | [_set removeAllObjects]; 62 | } 63 | 64 | @end 65 | 66 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/RecycleList/WXCellSlotComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXComponent.h" 22 | 23 | static const NSString *WXDefaultRecycleTemplateType = @"default"; 24 | @interface WXCellSlotComponent : WXComponent 25 | 26 | @property (nonatomic, strong) NSString *templateCaseType; 27 | 28 | - (void)updateCellData:(NSDictionary *)data; 29 | 30 | - (void)triggerLayout; 31 | 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/RecycleList/WXComponent+DataBinding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | 22 | static const NSString *WXBindingIdentify = @"@binding"; 23 | static const NSString *WXBindingMatchIdentify = @"[[match]]"; 24 | static const NSString *WXBindingRepeatIdentify = @"[[repeat]]"; 25 | static const NSString *WXBindingOnceIdentify = @"[[once]]"; 26 | static const NSString *WXBindingRepeatExprIdentify = @"@expression"; 27 | static const NSString *WXBindingRepeatIndexIdentify = @"@index"; 28 | static const NSString *WXBindingRepeatLabelIdentify = @"@alias"; 29 | 30 | @interface WXComponent (DataBinding) 31 | @end 32 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/RecycleList/WXRecycleListComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXScrollerComponent.h" 22 | 23 | @class WXRecycleListDataManager; 24 | @class WXRecycleListTemplateManager; 25 | @class WXRecycleListUpdateManager; 26 | 27 | @interface WXRecycleListComponent : WXScrollerComponent 28 | 29 | @property(nonatomic, strong) WXRecycleListDataManager *dataManager; 30 | @property(nonatomic, strong) WXRecycleListTemplateManager *templateManager; 31 | @property(nonatomic, strong) WXRecycleListUpdateManager *updateManager; 32 | 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/RecycleList/WXRecycleListDataManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface WXRecycleListDataManager : NSObject 23 | 24 | - (instancetype)initWithData:(NSArray *)data; 25 | 26 | - (void)updateData:(NSArray *)data; 27 | 28 | - (NSArray *)data; 29 | 30 | - (NSDictionary *)dataAtIndex:(NSInteger)index; 31 | 32 | - (NSInteger)numberOfItems; 33 | 34 | - (NSInteger)numberOfVirtualComponent; 35 | 36 | - (NSDictionary*)virtualComponentDataWithId:(NSString*)componentId; 37 | 38 | - (void)updateVirtualComponentData:(NSString*)componentId data:(NSDictionary*)data; 39 | 40 | - (NSDictionary*)virtualComponentDataWithIndexPath:(NSIndexPath*)indexPath; 41 | 42 | - (NSString*)virtualComponentIdWithIndexPath:(NSIndexPath*)indexPath; 43 | 44 | - (void)deleteVirtualComponentAtIndexPaths:(NSArray*)indexPaths; 45 | @end 46 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/RecycleList/WXRecycleListLayout.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @protocol WXRecycleListLayoutDelegate 23 | 24 | - (BOOL)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout isNeedStickyForIndexPath:(NSIndexPath *)indexPath; 25 | 26 | @end 27 | 28 | @interface WXRecycleListLayout : UICollectionViewFlowLayout 29 | 30 | @property (nonatomic, weak) id delegate; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/RecycleList/WXRecycleListTemplateManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXCellSlotComponent.h" 22 | 23 | @interface WXRecycleListTemplateManager : NSObject 24 | 25 | @property (nonatomic, weak) UICollectionView *collectionView; 26 | 27 | - (void)addTemplate:(WXCellSlotComponent *)component; 28 | 29 | - (WXCellSlotComponent *)dequeueCellSlotWithType:(NSString *)type forIndexPath:(NSIndexPath *)indexPath; 30 | 31 | - (WXCellSlotComponent *)templateWithType:(NSString *)type; 32 | 33 | - (WXCellSlotComponent *)topTemplate; 34 | 35 | - (BOOL)isTemplateRegistered:(NSString *)aTemplate; 36 | 37 | - (NSString *)anyRegisteredTemplate; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/RecycleList/WXRecycleListUpdateManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | 23 | typedef void(^WXRecycleListUpdateCompletion)(BOOL isFinished); 24 | @class WXRecycleListUpdateManager; 25 | 26 | @protocol WXRecycleListUpdateDelegate 27 | 28 | - (void)updateManager:(WXRecycleListUpdateManager *)manager willUpdateData:(id)newData; 29 | 30 | - (void)updateManager:(WXRecycleListUpdateManager *)manager didUpdateData:(id)newData withSuccess:(BOOL)finished; 31 | 32 | @end 33 | 34 | @interface WXRecycleListUpdateManager : NSObject 35 | 36 | @property (nonatomic, weak) UICollectionView *collectionView; 37 | @property (nonatomic, weak) id delegate; 38 | 39 | - (void)reload; 40 | 41 | - (void)updateWithNewData:(NSArray *)newData 42 | oldData:(NSArray *)oldData 43 | completion:(WXRecycleListUpdateCompletion)completion 44 | animation:(BOOL)isAnimated; 45 | 46 | - (void)updateWithAppendingData:(NSArray *)appendingData 47 | oldData:(NSArray *)oldData 48 | completion:(WXRecycleListUpdateCompletion)completion 49 | animation:(BOOL)isAnimated; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXScrollerComponent.h" 21 | 22 | @interface WXRecyclerComponent : WXScrollerComponent 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/Recycler/WXRecyclerDataController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXSectionDataController.h" 22 | 23 | @interface WXRecyclerDataController : NSObject 24 | 25 | @property (nonatomic, strong, readonly) NSArray *sections; 26 | 27 | - (void)updateData:(NSArray *)newData; 28 | 29 | - (NSInteger)numberOfSections; 30 | 31 | - (NSInteger)numberOfItemsInSection:(NSInteger)section; 32 | 33 | - (UIView *)cellForItemAtIndexPath:(NSIndexPath *)indexPath; 34 | 35 | - (CGSize)sizeForItemAtIndexPath:(NSIndexPath *)indexPath; 36 | 37 | - (UIView *)viewForHeaderAtIndexPath:(NSIndexPath *)indexPath; 38 | 39 | - (CGSize)sizeForHeaderAtIndexPath:(NSIndexPath *)indexPath; 40 | 41 | - (BOOL)isStickyForHeaderAtIndexPath:(NSIndexPath *)indexPath; 42 | 43 | - (BOOL)hasHeaderInSection:(NSInteger)section; 44 | 45 | - (NSIndexPath *)indexPathForCell:(WXCellComponent *)cell; 46 | 47 | - (NSUInteger)indexForHeader:(WXHeaderComponent *)header; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/Recycler/WXRecyclerUpdateController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXSectionDataController.h" 22 | @class WXRecyclerUpdateController; 23 | 24 | @protocol WXRecyclerUpdateControllerDelegate 25 | 26 | - (void)updateController:(WXRecyclerUpdateController *)controller willPerformUpdateWithNewData:(NSArray *)newData; 27 | 28 | - (void)updateController:(WXRecyclerUpdateController *)controller didPerformUpdateWithFinished:(BOOL)finished; 29 | 30 | @end 31 | 32 | @interface WXRecyclerUpdateController : NSObject 33 | 34 | @property (nonatomic, weak) id delegate; 35 | 36 | - (void)performUpdatesWithNewData:(NSArray *)newData 37 | oldData:(NSArray *)oldData 38 | view:(UICollectionView *)collectionView; 39 | 40 | - (void)reloadItemsAtIndexPath:(NSIndexPath *)indexPath; 41 | 42 | @end 43 | 44 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/Recycler/WXSectionDataController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXDiffUtil.h" 22 | #import 23 | 24 | @class WXComponent; 25 | @class WXCellComponent; 26 | @class WXHeaderComponent; 27 | 28 | @interface WXSectionDataController : NSObject 29 | 30 | @property (nonatomic, strong) NSArray *cellComponents; 31 | @property (nonatomic, strong) WXHeaderComponent *headerComponent; 32 | @property (nonatomic, strong) WXComponent *footerComponent; 33 | 34 | - (NSInteger)numberOfItems; 35 | 36 | - (UIView *)cellForItemAtIndex:(NSInteger)index; 37 | 38 | - (CGSize)sizeForItemAtIndex:(NSInteger)index; 39 | 40 | - (UIView *)viewForHeaderAtIndex:(NSInteger)index; 41 | 42 | - (CGSize)sizeForHeaderAtIndex:(NSInteger)index; 43 | 44 | - (BOOL)isStickyForHeaderAtIndex:(NSInteger)index; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXAComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | 22 | @interface WXAComponent : WXComponent 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXCanvasComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | #import "WXCanvasModule.h" 22 | #import 23 | 24 | @interface WXCanvasComponent : WXComponent 25 | 26 | - (void) addDrawActions:(NSArray *)actions canvasModule:(WXCanvasModule*)canvasModule; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXCellComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | #import "WXDiffUtil.h" 22 | @class WXCellComponent; 23 | 24 | @protocol WXCellRenderDelegate 25 | 26 | - (float)containerWidthForLayout:(WXCellComponent *)cell; 27 | 28 | - (void)cellDidLayout:(WXCellComponent *)cell; 29 | 30 | - (void)cellDidRendered:(WXCellComponent *)cell; 31 | 32 | - (void)cellDidRemove:(WXCellComponent *)cell; 33 | 34 | - (void)cell:(WXCellComponent *)cell didMoveToIndex:(NSUInteger)index; 35 | 36 | @end 37 | 38 | @interface WXCellComponent : WXComponent 39 | 40 | @property (nonatomic, strong) NSString *scope; 41 | @property (nonatomic, assign) BOOL isRecycle; 42 | @property (nonatomic, assign) BOOL isLayoutComplete; 43 | @property (nonatomic, assign) UITableViewRowAnimation insertAnimation; 44 | @property (nonatomic, assign) UITableViewRowAnimation deleteAnimation; 45 | @property (nonatomic, assign) BOOL keepScrollPosition; 46 | @property (nonatomic, weak) id delegate; 47 | @property (nonatomic, strong) NSString *zIndex; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXCycleSliderComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXComponent.h" 22 | 23 | @class WXIndicatorView; 24 | 25 | @interface WXCycleSliderComponent : WXComponent 26 | 27 | - (void)setIndicatorView:(WXIndicatorView *)indicatorView; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXDivComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | 22 | @interface WXDivComponent : WXComponent 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXDivComponent.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXDivComponent.h" 21 | 22 | @interface WXDivComponent () 23 | @end 24 | 25 | @implementation WXDivComponent 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXEditComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXComponent.h" 22 | #import "WXTextComponentProtocol.h" 23 | #import "WXDatePickerManager.h" 24 | 25 | @interface WXEditComponent : WXComponent 26 | 27 | //attribute 28 | @property (nonatomic, strong) UIColor *placeholderColor; 29 | @property (nonatomic, strong) NSString *placeholderString; 30 | @property (nonatomic, strong) UILabel *placeHolderLabel; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXEmbedComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | #import "WXErrorView.h" 22 | 23 | @interface WXEmbedComponent : WXComponent 24 | 25 | - (void)refreshWeex; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXFooterComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | 22 | @interface WXFooterComponent : WXComponent 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXFooterComponent.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXFooterComponent.h" 21 | 22 | @implementation WXFooterComponent 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXHeaderComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | 22 | @class WXHeaderComponent; 23 | 24 | @protocol WXHeaderRenderDelegate 25 | 26 | - (float)headerWidthForLayout:(WXHeaderComponent *)header; 27 | 28 | - (void)headerDidLayout:(WXHeaderComponent *)header; 29 | 30 | - (void)headerDidRemove:(WXHeaderComponent *)header; 31 | 32 | @end 33 | 34 | @interface WXHeaderComponent : WXComponent 35 | 36 | @property (nonatomic, weak) id delegate; 37 | @property (nonatomic, assign, readonly) BOOL isSticky; 38 | @property (nonatomic, assign, readonly) BOOL keepScrollPosition; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXImageComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | 22 | @interface WXImageComponent : WXComponent 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXListComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXScrollerComponent.h" 21 | 22 | @interface WXListComponent : WXScrollerComponent 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXLoadingComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | 22 | @interface WXLoadingComponent : WXComponent 23 | 24 | - (void)resizeFrame; 25 | - (void)loading; 26 | - (BOOL)displayState; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXLoadingIndicator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | 22 | @interface WXLoadingIndicator : WXComponent 23 | 24 | - (void)start; 25 | - (void)stop; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXRefreshComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | 22 | #define REFRESH_DISTANCE_Y @"dy" 23 | #define REFRESH_PULLINGDISTANCE @"pullingDistance" 24 | #define REFRESH_VIEWHEIGHT @"viewHeight" 25 | 26 | @interface WXRefreshComponent : WXComponent 27 | 28 | - (void)refresh; 29 | 30 | - (BOOL)displayState; 31 | 32 | - (void)pullingdown:(NSDictionary*)param; 33 | 34 | - (void)setIndicatorHidden:(BOOL)hidden; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXScrollerComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXScrollerProtocol.h" 21 | #import "WXComponent.h" 22 | 23 | @interface WXScrollerComponent : WXComponent 24 | 25 | @property (nonatomic, copy) void (^onScroll)(UIScrollView *); 26 | 27 | @property (nonatomic, assign) NSUInteger loadmoreretry; 28 | 29 | @property (nonatomic, assign) CGSize contentSize; 30 | 31 | - (NSUInteger)childrenCountForScrollerLayout; 32 | 33 | - (void)handleAppear; 34 | 35 | - (CGPoint)absolutePositionForComponent:(WXComponent *)component; 36 | 37 | @end 38 | 39 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXSwitchComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | 22 | @interface WXSwitchComponent : WXComponent 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXTextAreaComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXEditComponent.h" 22 | 23 | @interface WXTextAreaComponent : WXEditComponent 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXTextComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | 22 | @interface WXTextComponent : WXComponent 23 | @property (atomic, strong) NSString *text; 24 | 25 | + (void)setRenderUsingCoreText:(BOOL)usingCoreText; 26 | - (BOOL)useCoreText; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXTextInputComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | #import "WXEditComponent.h" 23 | 24 | @interface WXTextInputView : UITextField 25 | @property (nonatomic, assign) UIEdgeInsets border; 26 | @property (nonatomic, assign) UIEdgeInsets padding; 27 | @property (nonatomic, assign) BOOL deleteWords; 28 | @property (nonatomic, strong) NSString *editWords; 29 | @end 30 | 31 | @interface WXTextInputComponent : WXEditComponent 32 | @end 33 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXTransform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | @class WXSDKInstance; 23 | @class WXLength; 24 | 25 | @interface WXTransform : NSObject 26 | 27 | @property (nonatomic, assign, readonly) float rotateAngle; 28 | @property (nonatomic, assign, readonly) float rotateX; 29 | @property (nonatomic, assign, readonly) float rotateY; 30 | @property (nonatomic, assign, readonly) float rotateZ; 31 | @property (nonatomic, strong, readonly) WXLength *translateX; 32 | @property (nonatomic, strong, readonly) WXLength *translateY; 33 | @property (nonatomic, assign, readonly) float scaleX; 34 | @property (nonatomic, assign, readonly) float scaleY; 35 | @property (nonatomic, assign) float perspective; 36 | 37 | - (instancetype)initWithCSSValue:(NSString *)cssValue origin:(NSString *)origin instance:(WXSDKInstance *)instance; 38 | 39 | - (instancetype)initWithNativeTransform:(CATransform3D)transform instance:(WXSDKInstance *)instance; 40 | 41 | - (void)applyTransformForView:(UIView *)view; 42 | 43 | - (void)setTransformOrigin:(NSString *)transformOriginCSS; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXVideoComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | 22 | typedef NS_ENUM(NSInteger, WXPlaybackState) { 23 | WXPlaybackStatePlaying, 24 | WXPlaybackStatePaused, 25 | // WXPlaybackStateStopped, 26 | WXPlaybackStatePlayFinish, 27 | WXPlaybackStateFailed, 28 | }; 29 | 30 | @interface WXVideoView : UIView 31 | 32 | @property (nonatomic, copy) void (^playbackStateChanged)(WXPlaybackState state); 33 | @property (nonatomic, copy) void (^posterClickHandle)(void); 34 | 35 | - (void) setURL:(NSURL*)URL; 36 | - (void) setPosterURL:(NSURL *)posterURL; 37 | 38 | - (void) play; 39 | - (void) pause; 40 | 41 | @end 42 | 43 | @interface WXVideoComponent : WXComponent 44 | 45 | @end 46 | 47 | 48 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Component/WXWebComponent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | 22 | @interface WXWebComponent : WXComponent 23 | 24 | - (void)notifyWebview:(NSDictionary *) data; 25 | 26 | - (void)postMessage:(NSDictionary *) data; 27 | 28 | - (void)reload; 29 | 30 | - (void)goBack; 31 | 32 | - (void)goForward; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Controller/WXBaseViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | /** 23 | * The WXBaseViewController class provides the infrastructure for managing the weex view in your app. It is 24 | * responsible for creating a weex instance or rendering the weex view, for observing the lifecycle of the 25 | * view such as "appear" or "disappear"、"foreground" or "background" etc. You can initialize this controller by 26 | * special bundle URL. 27 | */ 28 | 29 | @interface WXBaseViewController : UIViewController 30 | 31 | /** 32 | * @abstract initializes the viewcontroller with bundle url. 33 | * 34 | * @param sourceURL The url of bundle rendered to a weex view. 35 | * 36 | * @return a object the class of WXBaseViewController. 37 | * 38 | */ 39 | - (instancetype)initWithSourceURL:(NSURL *)sourceURL; 40 | 41 | /** 42 | * @abstract refreshes the weex view in controller. 43 | */ 44 | - (void)refreshWeex; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Controller/WXRootViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | /** 23 | * The WXRootViewController class inherited from UINavigationController class which implements a specialized 24 | * view controller that manages the navigation of hierarchical content. Developing an iOS application, you 25 | * need a series of customer pages which will be render by weex bundle. Sometimes, these pages are embedded in 26 | * viewcontroller. This navigation controller makes it possible to present your page efficiently and makes it 27 | * easier for the user to navigate that content. 28 | */ 29 | 30 | @interface WXRootViewController : UINavigationController 31 | 32 | /** 33 | * @abstract initialize the RootViewController with bundle url. 34 | * 35 | * @param sourceURL The bundle url which can be render to a weex view. 36 | * 37 | * @return a object the class of WXRootViewController. 38 | * 39 | * @discussion initialize this controller in function 'application:didFinishLaunchingWithOptions', and make it as rootViewController of window. In the 40 | * weex application, all page content can be managed by the navigation, such as push or pop. 41 | */ 42 | - (id)initWithSourceURL:(NSURL *)sourceURL; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Debug/WXDebugTool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | 23 | @interface WXDebugTool : NSObject 24 | 25 | + (instancetype)sharedInstance; 26 | 27 | //+ (void)showFPS; 28 | 29 | + (void)setDebug:(BOOL)isDebug; 30 | 31 | + (BOOL)isDebug; 32 | 33 | + (void)setDevToolDebug:(BOOL)isDevToolDebug; 34 | 35 | + (BOOL)isDevToolDebug; 36 | 37 | + (void)setReplacedBundleJS:(NSURL*)url; 38 | 39 | + (NSString*)getReplacedBundleJS; 40 | 41 | + (void)setReplacedJSFramework:(NSURL*)url; 42 | 43 | + (NSString*)getReplacedJSFramework; 44 | 45 | + (BOOL) cacheJsService: (NSString *)name withScript: (NSString *)script withOptions: (NSDictionary *) options; 46 | 47 | + (BOOL) removeCacheJsService: (NSString *)name; 48 | 49 | + (NSDictionary *) jsServiceCache; 50 | 51 | + (BOOL)isRemoteTracing; 52 | 53 | + (void)setRemoteTracing:(BOOL)isRemoteTracing; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Display/UIBezierPath+Weex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface UIBezierPath (Weex) 23 | 24 | + (instancetype)wx_bezierPathWithRoundedRect:(CGRect)rect 25 | topLeft:(CGFloat)topLeftRadius 26 | topRight:(CGFloat)topRightRadius 27 | bottomLeft:(CGFloat)bottomLeftRadius 28 | bottomRight:(CGFloat)bottomRightRadius; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Display/WXComponent+BoxShadow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXComponent.h" 22 | #import "WXBoxShadow.h" 23 | 24 | @interface WXComponent (BoxShadow) 25 | 26 | /** 27 | * @abstract compare boxshadow 28 | * 29 | * @return if not equal return NO, if equal return YES 30 | */ 31 | - (BOOL)equalBoxShadow:(WXBoxShadow *_Nullable)boxShadow withBoxShadow:(WXBoxShadow *_Nullable)compareBoxShadow; 32 | 33 | /** 34 | * @abstract config view Layer with boxshadow, lastboxshadow and originalBoxShadow 35 | * 36 | * @param boxShadow the boxshadow will be set 37 | * 38 | * 39 | */ 40 | - (void)configBoxShadow:(WXBoxShadow *_Nullable)boxShadow; 41 | @end 42 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Display/WXComponent+Display.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | 22 | @interface WXComponent (Display) 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Display/WXDisplayQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | // Global queue for displaying content 23 | @interface WXDisplayQueue : NSObject 24 | 25 | + (void)addBlock:(void(^)(void))block; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Display/WXInnerLayer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | #import 23 | 24 | @interface WXInnerLayer : CAGradientLayer 25 | 26 | @property CGFloat boxShadowRadius; 27 | @property (nonatomic,strong) UIColor *boxShadowColor; 28 | @property CGSize boxShadowOffset; 29 | @property CGFloat boxShadowOpacity; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Display/WXLayer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface WXLayer : CALayer 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Display/WXLayer.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXLayer.h" 21 | #import "WXDefine.h" 22 | #import "WXComponent.h" 23 | #import "WXComponent_internal.h" 24 | 25 | @implementation WXLayer 26 | 27 | - (void)display 28 | { 29 | [self.wx_component _willDisplayLayer:self]; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Display/WXRoundedRect.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | 21 | #import 22 | #import 23 | 24 | @interface WXRadii : NSObject 25 | 26 | @property (nonatomic, assign) CGFloat topLeft; 27 | @property (nonatomic, assign) CGFloat topRight; 28 | @property (nonatomic, assign) CGFloat bottomLeft; 29 | @property (nonatomic, assign) CGFloat bottomRight; 30 | 31 | - (BOOL)hasBorderRadius; 32 | 33 | - (BOOL)radiusesAreEqual; 34 | 35 | @end 36 | 37 | @interface WXRoundedRect : NSObject 38 | 39 | @property (nonatomic, assign) CGRect rect; 40 | @property (nonatomic, strong) WXRadii *radii; 41 | 42 | - (instancetype)initWithRect:(CGRect)rect 43 | topLeft:(CGFloat)topLeft 44 | topRight:(CGFloat)topRight 45 | bottomLeft:(CGFloat)bottomLeft 46 | bottomRight:(CGFloat)bottomRight; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Events/WXComponent+Events.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | #import 22 | 23 | @interface WXComponent (Events) 24 | - (BOOL)gestureShouldStopPropagation:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch; 25 | @end 26 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Handler/WXNavigationDefaultImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXNavigationProtocol.h" 22 | 23 | @interface WXNavigationDefaultImpl : NSObject 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Handler/WXURLRewriteDefaultImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXURLRewriteProtocol.h" 22 | 23 | @interface WXURLRewriteDefaultImpl : NSObject 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Handler/WXURLRewriteDefaultImpl.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXURLRewriteDefaultImpl.h" 21 | #import "WXLog.h" 22 | #import "WXSDKInstance.h" 23 | 24 | 25 | NSString *const WXURLLocalScheme = @"local"; 26 | 27 | @implementation WXURLRewriteDefaultImpl 28 | 29 | - (NSURL *)rewriteURL:(NSString *)url 30 | withResourceType:(WXResourceType)resourceType 31 | withInstance:(WXSDKInstance *)instance 32 | { 33 | NSURL *completeURL = [NSURL URLWithString:url]; 34 | if ([completeURL isFileURL]) { 35 | return completeURL; 36 | } else if ([self isLocalURL:completeURL]) { 37 | NSString *resourceName = [[completeURL host]?:@"" stringByAppendingString:[completeURL path]]; 38 | NSURL *resourceURL = [[NSBundle mainBundle] URLForResource:resourceName withExtension:@""]; 39 | if (!resourceURL) { 40 | WXLogError(@"Invalid local resource URL:%@, no resouce found.", url); 41 | } 42 | 43 | return resourceURL; 44 | } else { 45 | return [instance completeURL:url]; 46 | } 47 | } 48 | 49 | - (BOOL)isLocalURL:(NSURL *)url 50 | { 51 | return[[[url scheme] lowercaseString] isEqualToString:WXURLLocalScheme]; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Layout/WXComponent+Layout.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | #import "WXSDKInstance.h" 22 | #import "WXUtility.h" 23 | #import "WXCoreLayout.h" 24 | 25 | #define FlexUndefined NAN 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | bool flexIsUndefined(float value); 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | @interface WXComponent () 36 | { 37 | @package 38 | #ifdef __cplusplus 39 | WeexCore::WXCoreLayoutNode *_flexCssNode; 40 | #endif // __cplusplus 41 | BOOL _isLayoutDirty; 42 | CGRect _calculatedFrame; 43 | CGPoint _absolutePosition; 44 | WXPositionType _positionType; 45 | } 46 | 47 | /** 48 | * @abstract Return the css node used to layout. 49 | * 50 | * @warning Subclasses must not override this. 51 | */ 52 | #ifdef __cplusplus 53 | @property(nonatomic, readonly, assign) WeexCore::WXCoreLayoutNode *flexCssNode; 54 | #endif 55 | 56 | @end 57 | 58 | @interface WXComponent (Layout) 59 | - (void)_insertChildCssNode:(WXComponent*)subcomponent atIndex:(NSInteger)index; 60 | - (void)_rmChildCssNode:(WXComponent*)subcomponent; 61 | - (NSInteger) getActualNodeIndex:(WXComponent*)subcomponent atIndex:(NSInteger) index; 62 | #ifdef __cplusplus 63 | + (void) recycleNodeOnComponentThread:(WeexCore::WXCoreLayoutNode * ) garbageNode gabRef:(NSString *)ref; 64 | #endif 65 | @end 66 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Layout/WXScrollerComponent+Layout.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXScrollerComponent.h" 21 | #import "WXComponent+Layout.h" 22 | 23 | 24 | @interface WXScrollerComponent () 25 | { 26 | #ifdef __cplusplus 27 | WeexCore::WXCoreLayoutNode *_flexScrollerCSSNode; 28 | #endif 29 | } 30 | @end 31 | 32 | @interface WXScrollerComponent (FlexLayout) 33 | 34 | #ifdef __cplusplus 35 | @property (nonatomic, readonly, assign) WeexCore::WXCoreLayoutNode *flexScrollerCSSNode; 36 | #endif 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Layout/WXScrollerComponent+Layout.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXScrollerComponent+Layout.h" 21 | #import "WXLog.h" 22 | 23 | @implementation WXScrollerComponent (FlexLayout) 24 | 25 | - (WeexCore::WXCoreLayoutNode *)flexScrollerCSSNode{ 26 | return _flexScrollerCSSNode; 27 | } 28 | 29 | - (void)_insertChildCssNode:(WXComponent *)subcomponent atIndex:(NSInteger)index 30 | { 31 | self.flexScrollerCSSNode->addChildAt(subcomponent.flexCssNode, (uint32_t) index); 32 | #ifdef DEBUG 33 | WXLogDebug(@"flexLayout -> ref:%@,subNodeIndex:%ld,childCount:%ld",self.ref,(long)index,_flexScrollerCSSNode->getChildCount()); 34 | #endif 35 | 36 | // WXLogInfo(@"FlexLayout -- P:%@ -> C:%@",self,subcomponent); 37 | } 38 | - (void)_rmChildCssNode:(WXComponent *)subcomponent 39 | { 40 | self.flexScrollerCSSNode->removeChild(subcomponent->_flexCssNode); 41 | #ifdef DEBUG 42 | WXLogDebug(@"flexLayout -> ref:%@ ,scrollerCSSNode->removeChild ,childRef:%@",self.ref,subcomponent.ref); 43 | #endif 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Loader/WXResourceLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXResourceRequest.h" 22 | #import "WXResourceResponse.h" 23 | 24 | 25 | @interface WXResourceLoader : NSObject 26 | 27 | @property (nonatomic, strong) WXResourceRequest *request; 28 | 29 | @property (nonatomic, copy) void (^onDataSent)(unsigned long long /* bytesSent */, unsigned long long /* totalBytesToBeSent */); 30 | @property (nonatomic, copy) void (^onResponseReceived)(const WXResourceResponse *); 31 | @property (nonatomic, copy) void (^onDataReceived)(NSData *); 32 | @property (nonatomic, copy) void (^onFinished)(const WXResourceResponse *, NSData *); 33 | @property (nonatomic, copy) void (^onFailed)(NSError *); 34 | 35 | - (instancetype)initWithRequest:(WXResourceRequest *)request; 36 | 37 | - (void)start; 38 | 39 | - (void)cancel:(NSError **)error; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Loader/WXWebSocketLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface WXWebSocketLoader : NSObject 23 | 24 | @property (nonatomic, copy) void (^onOpen)(void); 25 | @property (nonatomic, copy) void (^onReceiveMessage)(id); 26 | @property (nonatomic, copy) void (^onClose)(NSInteger,NSString *,BOOL); 27 | @property (nonatomic, copy) void (^onFail)(NSError *); 28 | 29 | - (instancetype)initWithUrl:(NSString *)url protocol:(NSString *)protocol; 30 | - (void)open; 31 | - (void)send:(id)data; 32 | - (void)close; 33 | - (void)close:(NSInteger)code reason:(NSString *)reason; 34 | - (void)clear; 35 | @end 36 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Manager/WXDatePickerManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @protocol WXDatePickerManagerDelegate 23 | @optional 24 | - (void)fetchDatePickerValue:(NSString *)value; 25 | @end 26 | 27 | @interface WXDatePickerManager : NSObject 28 | 29 | @property (nonatomic, weak) id delegate; 30 | 31 | -(void)show; 32 | -(void)hide; 33 | -(void)updateDatePicker:(NSDictionary *)attributes; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Manager/WXExtendCallNativeManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface WXExtendCallNativeManager : NSObject 23 | 24 | + (id)sendExtendCallNativeEvent:(NSDictionary *)parameters; 25 | + (void)registerExtendCallNative:(NSString *)name withClass:(Class)clazz; 26 | @end 27 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Manager/WXHandlerFactory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface WXHandlerFactory : NSObject 23 | 24 | /** 25 | * @abstract Register a handler for a given handler instance and specific protocol 26 | * 27 | * @param handler The handler instance to register 28 | * 29 | * @param protocol The protocol to confirm 30 | * 31 | */ 32 | + (void)registerHandler:(id)handler withProtocol:(Protocol *)protocol; 33 | 34 | /** 35 | * @abstract Returns the handler for a given protocol 36 | * 37 | **/ 38 | + (id)handlerForProtocol:(Protocol *)protocol; 39 | 40 | /** 41 | * @abstract Returns the registered handlers. 42 | */ 43 | + (NSDictionary *)handlerConfigs; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Manager/WXInvocationConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | #import "WXBridgeMethod.h" 23 | 24 | @interface WXInvocationConfig : NSObject 25 | 26 | @property (nonatomic, strong) NSString *name; 27 | @property (nonatomic, strong) NSString *clazz; 28 | /** 29 | * The methods map 30 | **/ 31 | @property (nonatomic, strong) NSMutableDictionary *asyncMethods; 32 | @property (nonatomic, strong) NSMutableDictionary *syncMethods; 33 | 34 | - (instancetype)initWithName:(NSString *)name class:(NSString *)clazz; 35 | - (void)registerMethods; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Manager/WXRuleManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | #import "WXThreadSafeMutableDictionary.h" 23 | #import "WXSDKInstance.h" 24 | 25 | @interface WXRuleManager : NSObject 26 | 27 | @property(nonatomic, weak)WXSDKInstance *instance; 28 | 29 | + (WXRuleManager *)sharedInstance; 30 | 31 | - (void)addRule:(NSString *)type rule:(NSDictionary *)rule; 32 | 33 | - (WXThreadSafeMutableDictionary *)getRule:(NSString *)type; 34 | 35 | - (void)removeRule:(NSString *)type rule:(NSDictionary *)rule; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Manager/WXSDKManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXSDKInstance.h" 22 | #import "WXBridgeManager.h" 23 | 24 | @class WXModuleManager; 25 | 26 | @interface WXSDKManager : NSObject 27 | 28 | @property (nonatomic, assign) BOOL multiContext; 29 | 30 | /** 31 | *@abstract Returns sdk manager 32 | */ 33 | + (WXSDKManager *)sharedInstance; 34 | /** 35 | * @abstract Returns bridge manager 36 | **/ 37 | + (WXBridgeManager *)bridgeMgr; 38 | 39 | /** 40 | * @abstract Returns weex instance for specific identifier 41 | **/ 42 | + (WXSDKInstance *)instanceForID:(NSString *)identifier; 43 | 44 | /** 45 | * @abstract Returns weex instance for specific identifier 46 | **/ 47 | + (void)storeInstance:(WXSDKInstance *)instance forID:(NSString *)identifier; 48 | 49 | /** 50 | * @abstract Returns weex instance for specific identifier 51 | **/ 52 | + (void)removeInstanceforID:(NSString *)identifier; 53 | 54 | /** 55 | * @abstract unload 56 | **/ 57 | + (void)unload; 58 | 59 | /** 60 | * @abstract Returns module manager 61 | **/ 62 | + (WXModuleManager *)moduleMgr DEPRECATED_MSG_ATTRIBUTE(); 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Manager/WXServiceFactory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface WXServiceFactory : NSObject 23 | 24 | /** 25 | * @abstract Registers a service for a given name, js code and options 26 | * 27 | * @param name The service name to register 28 | * 29 | * @param options The service options to register 30 | * 31 | * @param serviceScript service js code to invoke 32 | * 33 | * @return script 34 | * 35 | */ 36 | + (NSString *)registerServiceScript:(NSString *)name withRawScript:(NSString *)serviceScript withOptions:(NSDictionary *)options; 37 | 38 | 39 | /** 40 | * @abstract Unregisters a service for a given name 41 | * 42 | * @param name The service name to register 43 | * 44 | * @return script 45 | * 46 | */ 47 | + (NSString *)unregisterServiceScript:(NSString *)name; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Model/WXComponent+Navigation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | #import "WXNavigationProtocol.h" 22 | 23 | @interface WXComponent (Navigation) 24 | 25 | - (void)setNavigationBarHidden:(BOOL)hidden; 26 | 27 | - (void)setNavigationBackgroundColor:(UIColor *)backgroundColor; 28 | 29 | - (void)setNavigationItemWithParam:(NSDictionary *)param position:(WXNavigationItemPosition)position; 30 | 31 | - (void)setNavigationWithStyles:(NSDictionary *)styles; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Model/WXJSExceptionInfo.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXJSExceptionInfo.h" 21 | #import "WXAppConfiguration.h" 22 | #import "WXDefine.h" 23 | 24 | @implementation WXJSExceptionInfo 25 | 26 | - (instancetype)initWithInstanceId:(NSString *)instanceId 27 | bundleUrl:(NSString *)bundleUrl 28 | errorCode:(NSString *)errorCode 29 | functionName:(NSString *)functionName 30 | exception:(NSString *)exception 31 | userInfo:(NSMutableDictionary *)userInfo 32 | { 33 | if (self = [super init]) { 34 | self.instanceId = instanceId; 35 | self.bundleUrl = bundleUrl; 36 | self.errorCode = errorCode; 37 | self.exception = exception; 38 | self.userInfo = userInfo; 39 | self.functionName = functionName; 40 | _jsfmVersion = [WXAppConfiguration JSFrameworkVersion]; 41 | _sdkVersion = WX_SDK_VERSION; 42 | } 43 | return self; 44 | } 45 | 46 | - (NSString *)description { 47 | return [NSString stringWithFormat:@"instanceId:%@ bundleUrl:%@ errorCode:%@ functionName:%@ exception:%@ userInfo:%@ jsfmVersion:%@ sdkVersion:%@", _instanceId?:@"", _bundleUrl?:@"", _errorCode?:@"", _functionName?:@"", _exception?:@"", _userInfo?:@"", _jsfmVersion, _sdkVersion]; 48 | } 49 | @end 50 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXAnimationModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | 23 | @interface WXAnimationModule : NSObject 24 | - (void)animation:(WXComponent *)targetComponent args:(NSDictionary *)args callback:(WXModuleKeepAliveCallback)callback; 25 | @end 26 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXCanvasModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | 23 | @interface WXCanvasModule : NSObject 24 | 25 | - (UIImage *) getImage:(NSString *)imageURL; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXClipboardModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | 23 | @interface WXClipboardModule : NSObject 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXClipboardModule.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXClipboardModule.h" 21 | 22 | @implementation WXClipboardModule 23 | 24 | WX_EXPORT_METHOD(@selector(setString:)) 25 | WX_EXPORT_METHOD(@selector(getString:)) 26 | 27 | - (dispatch_queue_t)targetExecuteQueue { 28 | return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 29 | } 30 | 31 | - (void)setString:(NSString *)content 32 | { 33 | UIPasteboard *clipboard = [UIPasteboard generalPasteboard]; 34 | clipboard.string = (content ? : @""); 35 | } 36 | 37 | - (void)getString:(WXModuleKeepAliveCallback)callback{ 38 | UIPasteboard *clipboard = [UIPasteboard generalPasteboard]; 39 | NSDictionary *result = [@{} mutableCopy]; 40 | if(clipboard.string) 41 | { 42 | [result setValue:clipboard.string forKey:@"data"]; 43 | [result setValue:@"success" forKey:@"result"]; 44 | }else 45 | { 46 | [result setValue:@"" forKey:@"data"]; 47 | [result setValue:@"fail" forKey:@"result"]; 48 | } 49 | if (callback) { 50 | callback(result, NO); 51 | } 52 | 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXDomModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXModuleProtocol.h" 21 | 22 | @interface WXDomModule : NSObject 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXGlobalEventModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | 23 | @interface WXGlobalEventModule : NSObject 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXInstanceWrap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXModuleProtocol.h" 21 | 22 | @interface WXInstanceWrap : NSObject 23 | 24 | - (void)error:(NSInteger)type code:(NSInteger)code info:(NSString *)info; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXLocaleModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | 23 | /** 24 | Provide system language information. 25 | */ 26 | @interface WXLocaleModule : NSObject 27 | @end 28 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXLocaleModule.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXLocaleModule.h" 21 | 22 | @implementation WXLocaleModule 23 | 24 | WX_EXPORT_METHOD_SYNC(@selector(getLanguage:)) 25 | WX_EXPORT_METHOD_SYNC(@selector(getLanguages)) 26 | 27 | /** 28 | Get preferred language of the user 29 | */ 30 | - (NSString *)getLanguage:(WXKeepAliveCallback)callback { 31 | if (callback) { 32 | callback([NSLocale preferredLanguages][0], NO); 33 | } 34 | return [NSLocale preferredLanguages][0]; 35 | } 36 | 37 | /** 38 | Get an array of strings representing the user's preferred languages 39 | */ 40 | - (NSArray *)getLanguages { 41 | return [NSLocale preferredLanguages]; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXMetaModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | 23 | @interface WXMetaModule : NSObject 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXMetaModule.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | #import "WXMetaModule.h" 20 | #import "WXConvert.h" 21 | #import "WXUtility.h" 22 | #import "WXSDKInstance_private.h" 23 | 24 | @implementation WXMetaModule 25 | 26 | @synthesize weexInstance; 27 | 28 | WX_EXPORT_METHOD_SYNC(@selector(setViewport:)) 29 | 30 | - (void)setViewport:(NSDictionary *)viewportArguments 31 | { 32 | CGFloat viewportWidthFloat; 33 | id viewportWidth = viewportArguments[@"width"]; 34 | if ([viewportWidth isKindOfClass:[NSString class]]) { 35 | if ([viewportWidth isEqualToString:@"device-width"]) { 36 | viewportWidthFloat = [WXUtility portraitScreenSize].width; 37 | } else if ([viewportWidth isEqualToString:@"device-height"]) { 38 | viewportWidthFloat = [WXUtility portraitScreenSize].height; 39 | } else { 40 | viewportWidthFloat = [WXConvert CGFloat:viewportWidth]; 41 | } 42 | } else { 43 | viewportWidthFloat = [WXConvert CGFloat:viewportWidth]; 44 | } 45 | 46 | if (viewportWidthFloat > 0) { 47 | self.weexInstance.viewportWidth = viewportWidthFloat; 48 | } 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXModalUIModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | 23 | @interface WXModalUIModule : NSObject 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXNavigatorModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | #import "WXModuleProtocol.h" 23 | 24 | @interface WXNavigatorModule : NSObject 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXPickerModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | 23 | @interface WXPickerModule : NSObject 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXStorageModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXModuleProtocol.h" 21 | 22 | @interface WXStorageModule : NSObject 23 | 24 | - (void)length:(WXModuleCallback)callback; 25 | 26 | - (void)getAllKeys:(WXModuleCallback)callback; 27 | 28 | - (void)setItem:(NSString *)key value:(NSString *)value callback:(WXModuleCallback)callback; 29 | 30 | - (void)setItemPersistent:(NSString *)key value:(NSString *)value callback:(WXModuleCallback)callback; 31 | 32 | - (void)getItem:(NSString *)key callback:(WXModuleCallback)callback; 33 | 34 | - (void)removeItem:(NSString *)key callback:(WXModuleCallback)callback; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXStreamModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | 23 | @interface WXStreamModule : NSObject 24 | 25 | - (void)fetch:(NSDictionary *)options callback:(WXModuleKeepAliveCallback)callback progressCallback:(WXModuleKeepAliveCallback)progressCallback; 26 | - (void)sendHttp:(NSDictionary*)param callback:(WXModuleKeepAliveCallback)callback DEPRECATED_MSG_ATTRIBUTE("Use fetch method instead."); 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXTimerModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | 23 | @interface WXTimerModule : NSObject 24 | 25 | - (NSMutableDictionary *)timers; 26 | 27 | - (void)createTimerWithCallback:(NSString *)callbackID time:(NSTimeInterval)milliseconds target:(id)target selector:(SEL)selector shouldRepeat:(BOOL)shouldRepeat; 28 | 29 | - (void)clearTimeout:(NSString *)callbackID; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXVoiceOverModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | 23 | @interface WXVoiceOverModule : NSObject 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXWebSocketModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | 23 | @interface WXWebSocketModule : NSObject 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Module/WXWebViewModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | #import "WXDomModule.h" 23 | 24 | @interface WXWebViewModule : WXDomModule 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Monitor/WXAnalyzerCenter+Transfer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXSDKInstance.h" 22 | #import "WXMonitor.h" 23 | #import "WXAnalyzerCenter.h" 24 | 25 | @interface WXAnalyzerCenter (Transfer) 26 | 27 | +(void) transDataOnState:(CommitState) timeState withInstaneId:(NSString *)instanceId data:(NSDictionary *)data ; 28 | 29 | + (void) transErrorInfo:(WXJSExceptionInfo *)errorInfo; 30 | 31 | + (BOOL) needTransfer; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Monitor/WXAnalyzerCenter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXAnalyzerProtocol.h" 22 | 23 | @interface WXAnalyzerCenter : NSObject 24 | 25 | +(NSMutableArray *) getAnalyzerList; 26 | 27 | +(void) addWxAnalyzer:(id)handler; 28 | 29 | +(void) rmWxAnalyzer:(id)handler; 30 | 31 | +(void) setOpen:(BOOL)isOpen; 32 | +(BOOL) isOpen; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Monitor/WXExceptionUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXJSExceptionInfo.h" 22 | 23 | @interface WXExceptionUtils : NSObject 24 | 25 | + (void)commitCriticalExceptionRT:(NSString *)instanceId errCode:(NSString *)errCode function:(NSString *)function exception:(NSString *)exception extParams:(NSDictionary *)extParams; 26 | 27 | + (void)commitCriticalExceptionRT:(WXJSExceptionInfo*)jsExceptionInfo; 28 | @end 29 | 30 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Network/WXResourceRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | typedef enum : NSUInteger { 23 | WXResourceTypeMainBundle, 24 | WXResourceTypeServiceBundle, 25 | WXResourceTypeImage, 26 | WXResourceTypeFont, 27 | WXResourceTypeVideo, 28 | WXResourceTypeLink, 29 | WXResourceTypeOthers 30 | } WXResourceType; 31 | 32 | 33 | @interface WXResourceRequest : NSMutableURLRequest 34 | 35 | @property (nonatomic, strong) id taskIdentifier; 36 | @property (nonatomic, assign) WXResourceType type; 37 | 38 | @property (nonatomic, strong) NSString *referrer; 39 | @property (nonatomic, strong) NSString *userAgent; 40 | 41 | + (instancetype)requestWithURL:(NSURL *)url 42 | resourceType:(WXResourceType)type 43 | referrer:(NSString *)referrer 44 | cachePolicy:(NSURLRequestCachePolicy)cachePolicy; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Network/WXResourceRequestHandlerDefaultImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | 21 | #import 22 | #import "WXResourceRequestHandler.h" 23 | 24 | @interface WXResourceRequestHandlerDefaultImpl : NSObject 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Network/WXResourceResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | 21 | #import 22 | 23 | @interface WXResourceResponse : NSHTTPURLResponse 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Network/WXResourceResponse.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | 21 | #import "WXResourceResponse.h" 22 | 23 | @implementation WXResourceResponse 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Protocol/WXAnalyzerProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXAppMonitorProtocol.h" 22 | 23 | #define GROUP_ANALYZER @"WXAnalyzer" 24 | #define MODULE_PERFORMANCE @"WXPerformance" 25 | #define MODULE_ERROR @"WXError" 26 | #define TYPE_MEASURE_REAL @"measure_real_time" 27 | #define TYPE_DIMEN_REAL @"dimen_real_time" 28 | #define TYPE_JS_ERROR @"js" 29 | 30 | @protocol WXAnalyzerProtocol 31 | 32 | 33 | @required 34 | /** 35 | @param value = @{ 36 | @"group":group, 37 | @"module":module, 38 | @"type":type, 39 | @"data":jsonData 40 | }; 41 | */ 42 | - (void)transfer:(NSDictionary *) value; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Protocol/WXConfigCenterProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | @protocol WXConfigCenterProtocol 21 | 22 | /** 23 | get config from config center handler 24 | @param key the key for config 25 | @param defaultValue default value for key if the key is not exist. 26 | @param isDefault whether the value is default value 27 | @return the value for config key 28 | */ 29 | - (id)configForKey:(NSString*)key defaultValue:(id)defaultValue isDefault:(BOOL*)isDefault; 30 | 31 | @optional 32 | /** 33 | get group config from config center handler 34 | @param group the groupName for config 35 | */ 36 | 37 | - (id)configForGroup:(NSString*)group; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Protocol/WXDestroyProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @protocol WXDestroyProtocol 23 | 24 | /** 25 | * @abstract execute unload function before dealloc 26 | */ 27 | - (void)unload; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Protocol/WXEventModuleProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXModuleProtocol.h" 21 | 22 | @protocol WXEventModuleProtocol 23 | 24 | - (void)openURL:(NSString *)url; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Protocol/WXExtendCallNativeProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | 21 | #import 22 | 23 | @protocol WXExtendCallNativeProtocol 24 | 25 | @required 26 | 27 | /** 28 | * @abstract check parameters 29 | * 30 | * @param parameters the checked parameters. 31 | * 32 | * @return YES or NO. 33 | * 34 | */ 35 | + (BOOL)checkParameters:(NSDictionary *)parameters; 36 | 37 | /** 38 | * @abstract excuteCallNative 39 | * 40 | * @param parameters the checked parameters. 41 | * 42 | * @return A value. 43 | * 44 | */ 45 | + (id)excuteCallNative:(NSDictionary *)parameters; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Protocol/WXJSExceptionProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXJSExceptionInfo.h" 21 | 22 | typedef WXJSExceptionInfo WXRuntimeCheckException; 23 | 24 | @protocol WXJSExceptionProtocol 25 | 26 | /** 27 | * report js exception 28 | * 29 | * @param exception WXJSExceptionInfo 30 | */ 31 | 32 | - (void)onJSException:(WXJSExceptionInfo*) exception; 33 | 34 | 35 | @optional 36 | 37 | /** 38 | * report runtime check exception, this is optional for this protocol 39 | */ 40 | - (void)onRuntimeCheckException:(WXRuntimeCheckException*)exception; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Protocol/WXNetworkProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | 23 | __attribute__ ((deprecated("Use WXResourceRequestHandler instead"))) 24 | @protocol WXNetworkProtocol 25 | 26 | /** 27 | * @abstract send request 28 | * 29 | * @param request The URL Request 30 | * 31 | * @param sendDataCallback This block is called periodically to notify the progress. 32 | * 33 | * @param responseCallback This block is called when receiving a response and no further messages will be received until the completion block is called. 34 | * 35 | * @param receiveDataCallback This block is called when data is available. 36 | * 37 | * @param completionCallback This block is called when the last message related to a specific task is sent. 38 | */ 39 | - (id)sendRequest:(NSURLRequest *)request withSendingData:(void (^)(int64_t bytesSent, int64_t totalBytes))sendDataCallback 40 | withResponse:(void (^)(NSURLResponse *response))responseCallback 41 | withReceiveData:(void (^)(NSData *data))receiveDataCallback 42 | withCompeletion:(void (^)(NSData *totalData, NSError *error))completionCallback; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Protocol/WXPageEventNotifyEvent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXJSExceptionInfo.h" 21 | 22 | @protocol WXPageEventNotifyEventProtocol 23 | 24 | - (void)hitTest:(CGPoint)point withEvent:(UIEvent *)event withView:(UIView*)view; 25 | 26 | - (void)notifyScrollEvent:(NSString*)instanceId from:(CGPoint)from to:(CGPoint)to; 27 | 28 | - (void)pageStart:(NSString*)instanceId; 29 | 30 | - (void)pageDestroy:(NSString*)instanceId; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Protocol/WXTextComponentProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | @protocol WXTextComponentProtocol 21 | 22 | @property (nonatomic, strong) NSTextStorage *textStorage; 23 | @property (nonatomic, assign) UIEdgeInsets border; 24 | @property (nonatomic, assign) UIEdgeInsets padding; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Protocol/WXTracingProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXTracingProtocol.h" 21 | #import "WXTracingManager.h" 22 | 23 | @protocol WXTracingProtocol 24 | 25 | - (void)commitTracingInfo:(WXTracingTask *)task; 26 | 27 | - (void)commitTracingSummaryInfo:(NSDictionary *)info; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Protocol/WXURLRewriteProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXResourceRequest.h" 22 | 23 | @class WXSDKInstance; 24 | 25 | #define WX_REWRITE_URL(url, resourceType, instance)\ 26 | do {\ 27 | id rewriteHandler = [WXSDKEngine handlerForProtocol:@protocol(WXURLRewriteProtocol)];\ 28 | if ([rewriteHandler respondsToSelector:@selector(rewriteURL:withResourceType:withInstance:)]) {\ 29 | newURL = [[rewriteHandler rewriteURL:url withResourceType:resourceType withInstance:instance].absoluteString copy];\ 30 | }\ 31 | } while(0); 32 | 33 | 34 | @protocol WXURLRewriteProtocol 35 | 36 | /** 37 | * @abstract rewrite and complete URL 38 | * 39 | * @param url The original URL to be rewritten 40 | * 41 | * @param resourceType resource type which the url is sent for 42 | * 43 | * @param instance related instance 44 | * 45 | * @return a new url 46 | */ 47 | - (NSURL *)rewriteURL:(NSString *)url withResourceType:(WXResourceType)resourceType withInstance:(WXSDKInstance *)instance; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Protocol/WXValidateProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXSDKInstance.h" 22 | 23 | 24 | @interface WXValidateResult : NSObject 25 | 26 | @property(nonatomic,assign)BOOL isSuccess; 27 | @property(nonatomic,strong)NSError* error; 28 | 29 | @end 30 | 31 | @interface WXModuleValidateResult : WXValidateResult 32 | 33 | @end 34 | 35 | @interface WXComponentValidateResult :WXValidateResult 36 | 37 | @property(nonatomic,copy)NSString* replacedComponent; 38 | 39 | @end 40 | 41 | 42 | @protocol WXValidateProtocol 43 | 44 | -(BOOL)needValidate:(NSURL*) bundleUrl; 45 | 46 | -(WXModuleValidateResult *)validateWithWXSDKInstance:(WXSDKInstance *)wxsdkInstance module:(NSString*) moduel method:(NSString *)method args:(NSArray *)args options:(NSDictionary *)options; 47 | 48 | -(WXComponentValidateResult *)validateWithWXSDKInstance:(WXSDKInstance *)wxsdkInstance component:(NSString *)componentName supercomponent:(WXComponent *)supercomponent; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Supporting Files/WeexSDK-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #import 10 | #import "WXDefine.h" 11 | #endif -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/NSArray+Weex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface NSArray (Weex) 23 | 24 | - (id)wx_safeObjectAtIndex:(NSUInteger)index; 25 | 26 | @end 27 | 28 | @interface NSMutableArray (Weex) 29 | 30 | + (id)wx_mutableArrayUsingWeakReferences; 31 | 32 | + (id)wx_mutableArrayUsingWeakReferencesWithCapacity:(NSUInteger)capacity; 33 | + (void)wx_releaseArray:(id)array; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/NSArray+Weex.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "NSArray+Weex.h" 21 | 22 | @implementation NSArray (Weex) 23 | 24 | - (id)wx_safeObjectAtIndex:(NSUInteger)index 25 | { 26 | if (index >= self.count) { 27 | return nil; 28 | } 29 | 30 | return [self objectAtIndex:index]; 31 | } 32 | 33 | @end 34 | 35 | @implementation NSMutableArray (Weex) 36 | 37 | // It's quite ingenius, using a Category to allow the creation of a mutable array that does no retain/release by backing it with a CFArray with proper callbacks.http://stackoverflow.com/questions/4692161/non-retaining-array-for-delegates 38 | + (id)wx_mutableArrayUsingWeakReferences { 39 | return [self wx_mutableArrayUsingWeakReferencesWithCapacity:0]; 40 | } 41 | 42 | + (id)wx_mutableArrayUsingWeakReferencesWithCapacity:(NSUInteger)capacity { 43 | CFArrayCallBacks callbacks = {0, NULL, NULL, CFCopyDescription, CFEqual}; 44 | // We create a weak reference array 45 | return (__bridge id)(CFArrayCreateMutable(0, capacity, &callbacks)); 46 | } 47 | 48 | + (void)wx_releaseArray:(id)array { 49 | 50 | CFBridgingRelease((__bridge CFArrayRef _Nullable)(array)); 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/NSObject+WXSwizzle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | 21 | #import 22 | 23 | @interface NSObject (WXSwizzle) 24 | 25 | + (BOOL)weex_swizzle:(Class)originalClass Method:(SEL)originalSelector withMethod:(SEL)swizzledSelector; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/NSObject+WXSwizzle.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "NSObject+WXSwizzle.h" 21 | #import 22 | 23 | @implementation NSObject (WXSwizzle) 24 | 25 | + (BOOL)weex_swizzle:(Class)originalClass Method:(SEL)originalSelector withMethod:(SEL)swizzledSelector 26 | { 27 | if (!(originalClass && originalSelector && swizzledSelector)) { 28 | return NO; 29 | } 30 | 31 | Class class = [self class]; 32 | 33 | Method originalMethod = class_getInstanceMethod(originalClass, originalSelector); 34 | Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector); 35 | 36 | BOOL didAddMethod = class_addMethod(originalClass, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod)); 37 | 38 | if (didAddMethod) { 39 | class_replaceMethod(class, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); 40 | } else { 41 | method_exchangeImplementations(originalMethod, swizzledMethod); 42 | } 43 | 44 | return YES; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/NSTimer+Weex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface NSTimer (Weex) 23 | 24 | + (NSTimer *)wx_scheduledTimerWithTimeInterval:(NSTimeInterval)interval 25 | block:(void(^)(void))block 26 | repeats:(BOOL)repeats; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/NSTimer+Weex.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "NSTimer+Weex.h" 21 | 22 | @implementation NSTimer (Weex) 23 | 24 | + (NSTimer *)wx_scheduledTimerWithTimeInterval:(NSTimeInterval)interval 25 | block:(void(^)(void))block 26 | repeats:(BOOL)repeats 27 | { 28 | return [self scheduledTimerWithTimeInterval:interval 29 | target:self 30 | selector:@selector(blockInvoke:) 31 | userInfo:[block copy] 32 | repeats:repeats]; 33 | } 34 | 35 | + (void)blockInvoke:(NSTimer*)timer 36 | { 37 | void (^block)(void) = timer.userInfo; 38 | if (block) { 39 | block(); 40 | } 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/WXAssert.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXAssert.h" 21 | #import "WXLog.h" 22 | 23 | void WXAssertInternal(NSString *func, NSString *file, int lineNum, NSString *format, ...) 24 | { 25 | va_list args; 26 | va_start(args, format); 27 | NSString *message = [[NSString alloc] initWithFormat:format arguments:args]; 28 | va_end(args); 29 | 30 | WXLogError(@"%@", message); 31 | [[NSAssertionHandler currentHandler] handleFailureInFunction:func file:file lineNumber:lineNum description:format, message]; 32 | } 33 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/WXBoxShadow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXInnerLayer.h" 22 | 23 | @interface WXBoxShadow : NSObject 24 | 25 | @property(nonatomic,strong,nullable) UIColor *shadowColor; 26 | @property CGSize shadowOffset; 27 | @property CGFloat shadowRadius; 28 | @property BOOL isInset; 29 | @property (nonatomic, strong, nullable)WXInnerLayer *innerLayer; 30 | @property CGFloat shadowOpacity; 31 | 32 | /** 33 | * @abstract get boxshadow from string and adapter phone screen 34 | * 35 | * @param string the boxshadow string 36 | * 37 | * @param scaleFactor the boxshadow set last time 38 | * 39 | * @return A WXBoxShadow object 40 | */ 41 | +(WXBoxShadow *_Nullable)getBoxShadowFromString:(NSString *_Nullable)string scaleFactor:(CGFloat)scaleFactor; 42 | @end 43 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/WXLength.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | typedef enum : NSUInteger { 23 | WXLengthTypeFixed, 24 | WXLengthTypePercent, 25 | WXLengthTypeAuto, 26 | WXLengthTypeNormal 27 | } WXLengthType; 28 | 29 | @interface WXLength : NSObject 30 | 31 | + (instancetype)lengthWithFloat:(float)value type:(WXLengthType)type; 32 | 33 | + (instancetype)lengthWithInt:(int)value type:(WXLengthType)type; 34 | 35 | - (float)valueForMaximum:(float)maximumValue; 36 | 37 | - (int)intValue; 38 | 39 | - (float)floatValue; 40 | 41 | - (BOOL)isEqualToLength:(WXLength *)length; 42 | 43 | - (BOOL)isFixed; 44 | 45 | - (BOOL)isPercent; 46 | 47 | - (BOOL)isAuto; 48 | 49 | - (BOOL)isNormal; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/WXSimulatorShortcutManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | 23 | @interface WXSimulatorShortcutManager : NSObject 24 | 25 | + (void)registerSimulatorShortcutWithKey:(NSString *)key modifierFlags:(UIKeyModifierFlags)flags action:(dispatch_block_t)action; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/WXThreadSafeCounter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | /** 23 | * @abstract a thread-safe counter 24 | */ 25 | @interface WXThreadSafeCounter : NSObject 26 | 27 | @property (atomic, readonly) int32_t value; 28 | 29 | - (int32_t)increase; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/WXThreadSafeCounter.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXThreadSafeCounter.h" 21 | #import 22 | 23 | @implementation WXThreadSafeCounter{ 24 | int32_t _value; 25 | } 26 | 27 | - (int32_t)value 28 | { 29 | return _value; 30 | } 31 | 32 | - (int32_t)increase { 33 | return OSAtomicIncrement32(&_value); 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/WXThreadSafeMutableArray.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | /** 23 | * @abstract Thread safe NSMutableArray 24 | */ 25 | @interface WXThreadSafeMutableArray : NSMutableArray 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/WXThreadSafeMutableDictionary.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | /** 23 | * @abstract Thread safe NSMutableDictionary 24 | */ 25 | @interface WXThreadSafeMutableDictionary : NSMutableDictionary 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/WXWeakObjectWrapper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface WXWeakObjectWrapper : NSObject 23 | 24 | @property (nonatomic, weak, readonly) id weakObject; 25 | 26 | - (id)initWithWeakObject:(id)weakObject; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /WeexSDK/Sources/Utility/WXWeakObjectWrapper.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXWeakObjectWrapper.h" 21 | 22 | @implementation WXWeakObjectWrapper 23 | 24 | - (id)initWithWeakObject:(id)weakObject 25 | { 26 | if (self = [super init]) { 27 | _weakObject = weakObject; 28 | } 29 | 30 | return self; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /WeexSDK/Sources/View/WXComponent+ViewManagement.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXComponent.h" 21 | 22 | @interface WXComponent (ViewManagement) 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDK/Sources/View/WXErrorView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @protocol WXErrorViewDelegate 23 | 24 | - (void)onclickErrorView; 25 | 26 | @end 27 | 28 | @interface WXErrorView : UIView 29 | 30 | @property (nonatomic, weak) id delegate; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /WeexSDK/Sources/View/WXErrorView.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXErrorView.h" 21 | 22 | @implementation WXErrorView 23 | 24 | - (id) initWithFrame:(CGRect)frame 25 | { 26 | self = [super initWithFrame:frame]; 27 | 28 | if (self) { 29 | UIImageView *imageView = [[UIImageView alloc]initWithFrame:self.bounds]; 30 | NSBundle *bundle = [NSBundle bundleForClass:self.class]; 31 | NSString *file = [bundle pathForResource:@"wx_load_error@3x" ofType:@"png"]; 32 | imageView.image = [UIImage imageWithContentsOfFile:file]; 33 | [self addSubview:imageView]; 34 | 35 | UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGesture:)]; 36 | [self addGestureRecognizer:tapRecognizer]; 37 | } 38 | return self; 39 | } 40 | 41 | - (void)tapGesture:(UITapGestureRecognizer *)sender 42 | { 43 | [self.delegate onclickErrorView]; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /WeexSDK/Sources/View/WXRootView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @class WXSDKInstance; 23 | @interface WXRootView : UIView 24 | 25 | @property (nonatomic, weak) WXSDKInstance *instance; 26 | 27 | - (BOOL)isHasEvent; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /WeexSDK/Sources/View/WXRootView.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXRootView.h" 21 | #import "WXSDKInstance.h" 22 | #import "WXPageEventNotifyEvent.h" 23 | #import "WXSDKEngine.h" 24 | 25 | @interface WXRootView() 26 | 27 | @property (nonatomic, assign) BOOL mHasEvent; 28 | 29 | @end 30 | 31 | @implementation WXRootView 32 | 33 | - (void)setFrame:(CGRect)frame 34 | { 35 | BOOL shouldNotifyLayout = NO; 36 | if (_instance.onLayoutChange && !CGRectEqualToRect(self.frame, frame)) { 37 | shouldNotifyLayout = YES; 38 | } 39 | 40 | [super setFrame:frame]; 41 | 42 | if (shouldNotifyLayout && _instance.onLayoutChange) { 43 | _instance.onLayoutChange(self); 44 | } 45 | } 46 | 47 | - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event 48 | { 49 | _mHasEvent = TRUE; 50 | id pageEventNotify = [WXSDKEngine handlerForProtocol:@protocol(WXPageEventNotifyEventProtocol)]; 51 | if ([pageEventNotify respondsToSelector:@selector(hitTest:withEvent:withView:)]){ 52 | [pageEventNotify hitTest:point withEvent:event withView:self]; 53 | } 54 | return [super hitTest:point withEvent:event]; 55 | } 56 | 57 | - (BOOL)isHasEvent 58 | { 59 | return _mHasEvent; 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /WeexSDK/Sources/View/WXView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface WXView : UIView 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDK/Sources/WebSocket/WXWebSocketHandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import "WXModuleProtocol.h" 22 | 23 | @protocol WXWebSocketDelegate 24 | - (void)didOpen; 25 | - (void)didFailWithError:(NSError *)error; 26 | - (void)didReceiveMessage:(id)message; 27 | - (void)didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean; 28 | @end 29 | 30 | @protocol WXWebSocketHandler 31 | 32 | - (void)open:(NSString *)url protocol:(NSString *)protocol identifier:(NSString *)identifier withDelegate:(id)delegate; 33 | - (void)send:(NSString *)identifier data:(NSString *)data; 34 | - (void)close:(NSString *)identifier; 35 | - (void)close:(NSString *)identifier code:(NSInteger)code reason:(NSString *)reason; 36 | - (void)clear:(NSString *)identifier; 37 | @end 38 | -------------------------------------------------------------------------------- /WeexSDKTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /WeexSDKTests/TestSupportUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | 23 | extern bool WXTransform3DApproximateToTransform(CATransform3D a,CATransform3D b); 24 | 25 | extern bool WXRectApproximateToRect(CGRect a,CGRect b); 26 | 27 | @interface TestSupportUtils : NSObject 28 | /** 29 | *设置等待时间 30 | */ 31 | +(void)waitSecs:(NSTimeInterval)secs; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /WeexSDKTests/WXTestBridgeMethodDummy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface WXTestBridgeMethodDummy : NSObject 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDKTests/WXTestBridgeMethodDummy.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WXTestBridgeMethodDummy.h" 21 | 22 | @implementation WXTestBridgeMethodDummy 23 | 24 | - (void)methodWithBOOLArg:(BOOL)arg { 25 | // No implementaion here, just for testing. 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /WeexSDKTests/WeexSDKTests.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface WeexSDKTests : XCTestCase 23 | 24 | @end 25 | 26 | @implementation WeexSDKTests 27 | 28 | - (void)setUp { 29 | [super setUp]; 30 | // Put setup code here. This method is called before the invocation of each test method in the class. 31 | } 32 | 33 | - (void)tearDown { 34 | // Put teardown code here. This method is called after the invocation of each test method in the class. 35 | [super tearDown]; 36 | } 37 | 38 | - (void)testExample { 39 | // This is an example of a functional test case. 40 | // Use XCTAssert and related functions to verify your tests produce the correct results. 41 | } 42 | 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /WeexSDKTests/dependency/OCMock/NSNotificationCenter+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCObserverMockObject; 20 | 21 | 22 | @interface NSNotificationCenter(OCMAdditions) 23 | 24 | - (void)addMockObserver:(OCObserverMockObject *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /WeexSDKTests/dependency/OCMock/OCMArg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMArg : NSObject 20 | 21 | // constraining arguments 22 | 23 | + (id)any; 24 | + (SEL)anySelector; 25 | + (void *)anyPointer; 26 | + (id __autoreleasing *)anyObjectRef; 27 | + (id)isNil; 28 | + (id)isNotNil; 29 | + (id)isEqual:(id)value; 30 | + (id)isNotEqual:(id)value; 31 | + (id)isKindOfClass:(Class)cls; 32 | + (id)checkWithSelector:(SEL)selector onObject:(id)anObject; 33 | + (id)checkWithBlock:(BOOL (^)(id obj))block; 34 | 35 | // manipulating arguments 36 | 37 | + (id *)setTo:(id)value; 38 | + (void *)setToValue:(NSValue *)value; 39 | + (id)invokeBlock; 40 | + (id)invokeBlockWithArgs:(id)first,... NS_REQUIRES_NIL_TERMINATION; 41 | 42 | + (id)defaultValue; 43 | 44 | // internal use only 45 | 46 | + (id)resolveSpecialValues:(NSValue *)value; 47 | 48 | @end 49 | 50 | #define OCMOCK_ANY [OCMArg any] 51 | 52 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) 53 | #define OCMOCK_VALUE(variable) \ 54 | ({ __typeof__(variable) __v = (variable); [NSValue value:&__v withObjCType:@encode(__typeof__(__v))]; }) 55 | #else 56 | #define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(__typeof__(variable))] 57 | #endif 58 | 59 | -------------------------------------------------------------------------------- /WeexSDKTests/dependency/OCMock/OCMConstraint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | 20 | @interface OCMConstraint : NSObject 21 | 22 | + (instancetype)constraint; 23 | - (BOOL)evaluate:(id)value; 24 | 25 | // if you are looking for any, isNil, etc, they have moved to OCMArg 26 | 27 | // try to use [OCMArg checkWith...] instead of the constraintWith... methods below 28 | 29 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject; 30 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue; 31 | 32 | 33 | @end 34 | 35 | @interface OCMAnyConstraint : OCMConstraint 36 | @end 37 | 38 | @interface OCMIsNilConstraint : OCMConstraint 39 | @end 40 | 41 | @interface OCMIsNotNilConstraint : OCMConstraint 42 | @end 43 | 44 | @interface OCMIsNotEqualConstraint : OCMConstraint 45 | { 46 | @public 47 | id testValue; 48 | } 49 | 50 | @end 51 | 52 | @interface OCMInvocationConstraint : OCMConstraint 53 | { 54 | @public 55 | NSInvocation *invocation; 56 | } 57 | 58 | @end 59 | 60 | @interface OCMBlockConstraint : OCMConstraint 61 | { 62 | BOOL (^block)(id); 63 | } 64 | 65 | - (instancetype)initWithConstraintBlock:(BOOL (^)(id))block; 66 | 67 | @end 68 | 69 | 70 | #define CONSTRAINT(aSelector) [OCMConstraint constraintWithSelector:aSelector onObject:self] 71 | #define CONSTRAINTV(aSelector, aValue) [OCMConstraint constraintWithSelector:aSelector onObject:self withValue:(aValue)] 72 | -------------------------------------------------------------------------------- /WeexSDKTests/dependency/OCMock/OCMFunctions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | 20 | #if defined(__cplusplus) 21 | #define OCMOCK_EXTERN extern "C" 22 | #else 23 | #define OCMOCK_EXTERN extern 24 | #endif 25 | 26 | 27 | OCMOCK_EXTERN BOOL OCMIsObjectType(const char *objCType); 28 | -------------------------------------------------------------------------------- /WeexSDKTests/dependency/OCMock/OCMLocation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import "OCMFunctions.h" 19 | 20 | 21 | @interface OCMLocation : NSObject 22 | { 23 | id testCase; 24 | NSString *file; 25 | NSUInteger line; 26 | } 27 | 28 | + (instancetype)locationWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine; 29 | 30 | - (instancetype)initWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine; 31 | 32 | - (id)testCase; 33 | - (NSString *)file; 34 | - (NSUInteger)line; 35 | 36 | @end 37 | 38 | OCMOCK_EXTERN OCMLocation *OCMMakeLocation(id testCase, const char *file, int line); 39 | -------------------------------------------------------------------------------- /WeexSDKTests/dependency/OCMock/OCMMacroState.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCMLocation; 20 | @class OCMRecorder; 21 | @class OCMStubRecorder; 22 | @class OCMockObject; 23 | 24 | 25 | @interface OCMMacroState : NSObject 26 | { 27 | OCMRecorder *recorder; 28 | } 29 | 30 | + (void)beginStubMacro; 31 | + (OCMStubRecorder *)endStubMacro; 32 | 33 | + (void)beginExpectMacro; 34 | + (OCMStubRecorder *)endExpectMacro; 35 | 36 | + (void)beginRejectMacro; 37 | + (OCMStubRecorder *)endRejectMacro; 38 | 39 | + (void)beginVerifyMacroAtLocation:(OCMLocation *)aLocation; 40 | + (void)endVerifyMacro; 41 | 42 | + (OCMMacroState *)globalState; 43 | 44 | - (OCMRecorder *)recorder; 45 | 46 | - (void)switchToClassMethod; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /WeexSDKTests/dependency/OCMock/OCMRecorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCMockObject; 20 | @class OCMInvocationMatcher; 21 | 22 | 23 | @interface OCMRecorder : NSProxy 24 | { 25 | OCMockObject *mockObject; 26 | OCMInvocationMatcher *invocationMatcher; 27 | } 28 | 29 | - (instancetype)init; 30 | - (instancetype)initWithMockObject:(OCMockObject *)aMockObject; 31 | 32 | - (void)setMockObject:(OCMockObject *)aMockObject; 33 | 34 | - (OCMInvocationMatcher *)invocationMatcher; 35 | 36 | - (id)classMethod; 37 | - (id)ignoringNonObjectArgs; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /WeexSDK_MTL/WeexSDK_MTL.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface WeexSDK_MTL : NSObject 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WeexSDK_MTL/WeexSDK_MTL.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #import "WeexSDK_MTL.h" 21 | 22 | @implementation WeexSDK_MTL 23 | 24 | @end 25 | --------------------------------------------------------------------------------