@@ -581,21 +581,6 @@ const _getMapStyle = (input: any): NSURL => {
581581 }
582582} ;
583583
584- function _getTrackingMode ( input : UserLocationCameraMode ) : MGLUserTrackingMode {
585- /*
586- if (input === "FOLLOW") {
587- return MGLUserTrackingMode.Follow;
588- } else if (input === "FOLLOW_WITH_HEADING") {
589- return MGLUserTrackingMode.FollowWithHeading;
590- } else if (input === "FOLLOW_WITH_COURSE") {
591- return MGLUserTrackingMode.FollowWithCourse;
592- } else {
593- return MGLUserTrackingMode.None;
594- }
595- */
596- return MGLUserTrackingMode . None ;
597- }
598-
599584function _getLocation ( loc : MGLUserLocation ) {
600585 if ( loc === null ) {
601586 return null ;
@@ -1775,35 +1760,36 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
17751760 * @todo come up with a reasonable set of cross platform defaults.
17761761 */
17771762 _stringToCameraMode ( mode : UserLocationCameraMode ) : any {
1778- switch ( mode ) {
1779- case ' NONE' :
1763+ switch ( mode ) {
1764+ case " NONE" :
17801765 return MGLUserTrackingMode . None ;
17811766
1782- case 'NONE_COMPASS' :
1783- if ( Trace . isEnabled ( ) ) {
1784- CLog ( CLogTypes . info , '_stringToCameraMode(): NONE_COMPASS unsupported on iOS' ) ;
1785- }
1767+ case "NONE_COMPASS" :
1768+ console . log ( "MapboxView::_stringToCameraMode(): NONE_COMPASS unsupported on iOS" ) ;
17861769 return MGLUserTrackingMode . None ;
17871770
1788- case 'NONE_GPS' :
1789- if ( Trace . isEnabled ( ) ) {
1790- CLog ( CLogTypes . info , '_stringToCameraMode(): NONE_GPS unsupported on iOS' ) ;
1791- }
1771+ case "NONE_GPS" :
1772+ console . log ( "MapboxView::_stringToCameraMode(): NONE_GPS unsupported on iOS" ) ;
17921773 return MGLUserTrackingMode . None ;
17931774
1794- case ' TRACKING' :
1775+ case " TRACKING" :
17951776 return MGLUserTrackingMode . Follow ;
17961777
1797- case ' TRACKING_COMPASS' :
1778+ case " TRACKING_COMPASS" :
17981779 return MGLUserTrackingMode . FollowWithHeading ;
17991780
1800- case ' TRACKING_GPS' :
1781+ case " TRACKING_GPS" :
18011782 // a reasonable approximation.
18021783 return MGLUserTrackingMode . Follow ;
18031784
1804- case ' TRACKING_GPS_NORTH' :
1785+ case " TRACKING_GPS_NORTH" :
18051786 return MGLUserTrackingMode . FollowWithCourse ;
1787+
1788+ default :
1789+ console . log ( `_stringToCameraMode: invalid cameraMode: ${ mode } ` ) ;
18061790 }
1791+
1792+ return MGLUserTrackingMode . None ;
18071793 }
18081794
18091795 _stringToRenderMode ( mode ) : any {
@@ -2676,7 +2662,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
26762662 *
26772663 */
26782664 updateSource ( id : string , options : UpdateSourceOptions , nativeMap ?) {
2679- return new Promise ( ( resolve , reject ) => {
2665+ return new Promise < void > ( ( resolve , reject ) => {
26802666 try {
26812667 const theMap : MGLMapView = nativeMap || this . _mapboxViewInstance ;
26822668 if ( ! theMap ) {
@@ -2695,6 +2681,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
26952681 const nsData : NSData = content . dataUsingEncoding ( NSUTF8StringEncoding ) ;
26962682 const geoJsonShape = MGLShape . shapeWithDataEncodingError ( nsData , NSUTF8StringEncoding ) ;
26972683 ( source as MGLShapeSource ) . shape = geoJsonShape ;
2684+ resolve ( ) ;
26982685 break ;
26992686 default :
27002687 reject ( 'Invalid source type: ' + options [ 'type' ] ) ;
@@ -3108,7 +3095,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
31083095 return ;
31093096 }
31103097
3111- theMap . setUserTrackingModeAnimated ( _getTrackingMode ( options . cameraMode ) , options . animated !== false ) ;
3098+ theMap . setUserTrackingModeAnimated ( this . _stringToCameraMode ( options . cameraMode ) , options . animated !== false ) ;
31123099
31133100 resolve ( ) ;
31143101 } catch ( ex ) {
0 commit comments