* [iOS] add miss environment information
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/b8726367 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/b8726367 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/b8726367 Branch: refs/heads/master Commit: b8726367624602359408fdeee5523e75f291887d Parents: b100148 Author: acton393 <[email protected]> Authored: Tue Dec 12 17:28:19 2017 +0800 Committer: acton393 <[email protected]> Committed: Wed Dec 20 17:44:28 2017 +0800 ---------------------------------------------------------------------- ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b8726367/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m index 46a9dc7..c9ae7dd 100644 --- a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m +++ b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m @@ -1,4 +1,4 @@ -/* + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -448,7 +448,14 @@ _Pragma("clang diagnostic pop") \ JSContext *globalContex = ([(JSContext*)weakSelf.jsBridge valueForKey:@"jsContext"]); if (bundleType) { - [self callJSMethod:@"createInstanceContext" args:@[instanceIdString, @{@"bundleType":bundleType}, data?:@[]] onContext:globalContex completion:^(JSValue *instanceContextEnvironment) { + NSMutableDictionary *newOptions = [options mutableCopy]; + if (!options) { + newOptions = [NSMutableDictionary new]; + } else { + [newOptions addEntriesFromDictionary:@{@"env":[WXUtility getEnvironment]}]; + newOptions[@"bundleType"] = bundleType; + } + [self callJSMethod:@"createInstanceContext" args:@[instanceIdString, newOptions, data?:@[]] onContext:globalContex completion:^(JSValue *instanceContextEnvironment) { WXSDKInstance *sdkInstance = [WXSDKManager instanceForID:instanceIdString]; JSContextGroupRef contextGroup = JSContextGetGroup([globalContex JSGlobalContextRef]); JSClassDefinition classDefinition = kJSClassDefinitionEmpty; @@ -648,7 +655,9 @@ _Pragma("clang diagnostic pop") \ } WXLogDebug(@"Calling JS... method:%@, args:%@", method, args); JSValue *value = [[context globalObject] invokeMethod:method withArguments:args]; - complection(value); + if (complection) { + complection(value); + } } else { newArg = [args mutableCopy]; if (complection) {
