Can't test Mapbox-gl due to 'TypeError: map.on is not a function' - mapbox-gl-js

We're using Mapbox in our project for a couple of months now. This project uses Create React App (CRA) with Typescript. As we started, we immediately ran into some problems with testing components > long story short; when we ran tests we got the error "window.URL.createObjectURL is not a function". There was a proposed workaround to mock Mapbox in setupTests.ts which did not work for us.
The question here is: is it us, or something to do with Mapbox? + does anyone know how to get Mapbox tests working?
I've also opened an issue on the Mapbox GitHub page and created a demonstration repository so you can reproduce the error.

Related

How to integrate xBim in Unity?

I have installed xBim using NuGet for unity, and it is working well until I try to use the GeometryEngine to create 3D shapes:
using (IfcStore model = IfcStore.Open(filename, null))
{
var context = new Xbim3DModelContext(model);
context.CreateContext();
}
context.CreateContext(); causes an error. At first I got:
FileNotFoundException: Could not load file or assembly 'Xbim.Geometry.Engine.dll' or one of its dependencies
Which is a bit strange since I did install the geometry engine in NuGet, but then I tried to compile the DLLs for the github project here:
https://github.com/xBimTeam/XbimGeometry
And copied them into the plugins folder. Now I do not get any error message, but Unity will crash to desktop on execution of context.CreateContext();
I have been searching online, but have been unable to find any workaround. Any suggestions are appreciated.
I don't have the answer (currently also trying to use xBim in Unity), but what I found looking throught the topics listed here:
https://github.com/xBimTeam/XbimGeometry/issues?utf8=%E2%9C%93&q=unity+
is that there is not direct solution for this. The workaround, mentioned in a couple of places, is to make the conversion from .ifc to .weBIM in an small external .NET support program. See this:
https://github.com/xBimTeam/XbimGeometry/issues/109
Hope this somewhat helps. If you have another solution I would like to hear it.

React Native with Unity

Does anyone have any experience combining React Native and Unity? I'm looking to start a Unity project that's very UI Heavy and I'm thinking about using React Native to take advantage of its UI capabilities on mobile and web.
I'm curious what the workflow for such an approach would be.
Finally after a lot of trials managed to do this. These are the steps.
1) Using this link, export android project for Gradle.
Select Gradle in the Build Settings window and check the Export Project checkbox.
Click Export and select the destination folder.
2) Import the generated folder in Android studio. Select ok whenever prompted. In this process, you will encounter following issues
2a) Gradle Sync Failed due to org.gradle.api.internal.tasks issues. Resolve using this link
3) Create React Native App using this link
4) Start Integrating Android exported folder inside created react native app using this link. Don't upgrade Gradle as Android studio will ask you again and again. You will encounter following issues. Don't go through "Test Integration" until you are finished with #5 here.
4a) While configuring maven, use this url for maven url "$rootDir/../node_modules/react-native/android" .
4b) While configuring maven, if you encounter problem related to javax.inject:javax.inject". Use this link.
4c) You may also encounter this error "Conflict with dependency 'com.google.code.findbugs:jsr305'". You can solve this link.
4d) During Code integration section of this link, focus on the following section: If you are using a starter kit for React Native, replace the "HelloWorld" string with the one in your index.android.js file (it’s the first argument to the AppRegistry.registerComponent() method). Here you have to replace with project name.
5) Before going through "Test your Integration" section, you have to add code to call MyReactActivity from UnityActivity. This link will help.
6) Go through "Test your Integration" section of link provided in #4. You may encounter following problems.
6a) unable to load script from assets index.android.bundle. Use this link.
6b) could not connect to development server on android. Use this link.
Check my article on Medium
I've shown with an example on How to integrate react native with Unity 3D step by step. My aim was to use the react native within the Unity3D like a module which is quite convenient if you're gonna heavily work on Unity 3D. Hope this helps for someone who comes here later.
I'm unsure as how a Unity game is built for iOS, if it uses Cocoa Touch for rendering its core classes.
If it does, and you have access or ability to render a UIViewController then you can render your React Native application. The only thing you would have to facilitate is setting up communication between the two applications.
Here is an example of rendering a native UI Component inside a React Native app that may help. http://moduscreate.com/leverage-existing-ios-views-react-native-app/
I was curious as well, and created an example project of how to do this for Android: https://github.com/marijnz/unity-react.
If this is a viable option, at least depends on:
How long the project will be running, both React and Unity have to be updated and this gets probably tougher over time.
The amount of sdk's/dependencies the project has.
If you want to do iOS as well.
In general, I'd probably avoid going this way.
Even though the example seems pretty simple now, it was a pain to get to that (as Shaunak's answer already hints at ;))

Installing "Tiled" plugin into Corona Project Manager

I'm only posting out of frustration to be frank...
Spent the past 2 hours now searching for any guides to setting up a "plugin" while using the Corona Project Manager to build my app.
I have absolutely zero coding experience, but i'm learning.
So I am trying to learn to use Tiled to build levels, I downloaded it here: http://www.mapeditor.org/
And I tried to run this sample code as a test/teaching myself: http://developer.coronalabs.com/code/corona-tiled
Running that sample code gave me some errors naturally, reading the debug errors I'm guessing I did not yet install/unpack/setup/integrate Tiled into my app. It's trying to call and read from a few .dlls and such.
So can someone please, kindly please, point me in the right direction to getting this 3rd party tool set up? Any guides or links or even a direct answer here will be much appreciated.
Many thanks waiting eagerly~

Cannot get Google Analytics Plugin to Work with PhoneGap 2.0

I had been using PhoneGap 1.9 for a while and was successfully using the Google Analytics Plugin.
I recently upgraded to PG 2.0 (so that I could use the new Urban Airship plugin) and now my Google Analytics seems to have stopped functioning.
Unfortunately, I think it has something to do with the initialization of the plugin via JavaScript. After some frustration I got my app to finally compile. But, my app pretty much just stops responding after the Google Analytics plugin is initialized in my JavaScript.
I wish I could give you guys some error messages or something, but I am getting no compiler errors and I am getting no JavaScript errors. The app just does not respond when I use the following two lines:
g_objGoogleAnalytics = window.plugins.googleAnalyticsPlugin;
g_objGoogleAnalytics.startTrackerWithAccountID("UA-XXXXXXXX-X");
If I comment these two lines out, everything else in the app works like a charm.
Has anyone got the Google Analytics plugin working under PG 2.0? If so, any advice or steps would be greatly appreciated.
UPDATE: I added some error checking with try/catch and the console log now states "undefined is not an object" whenever I execute the above two lines of code.
I found the answer myself. kieranshaw on github changed the keyword "PhoneGap" to "codova" in the JS file and that seemed to mix the issue. You can see the changes here: https://github.com/kieranshaw/phonegap-plugins/commit/cc4424410869912ff278de0228a6c328b1296fbe
Here's a way to implement GA on PG without plug-ins, though there are limitations as indicated in the solution: How to use Google Analytics with Phonegap without a plugin?

Trouble with core-plot example folder (examples not working)

The examples are not working for me, why?
It tells me loadDocSet.scpt => Shell Script Invocation Error.
I have build an own example in my project and it works, but I can't open the examples.
The Linking and everything else for the configuration of core plot is done well.
Googled that problem but didn't find a solution till now.
It sounds like you're trying to build the documentation set instead of the proper application or framework target. In Xcode, make sure your build scheme is set to CPTTestApp-iPhone or whatever the example application is that you need to build, and not Documentation.
Based on the latest version in the Mercurial repository, the sample applications compile just fine for me when the scheme is set as I describe above.