Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a map for virtual beacons #340

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ android {
dependencies {
compile project(':react-native-linear-gradient')
compile project(':magnet-scanner-android')
compile project(':reactnativemapboxgl')
Copy link
Collaborator

@wilsonpage wilsonpage Nov 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why we don't use default react-native MapView?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default map component is iOS only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I tried the react-native-maps by Airbnb that the React Native team recommends, but it ended up being a massive mess to set up and configure and it isn't even compatible with our Google Play Service version. So falling back to mapbox was the best solution.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, do you have any more info on the google-play-services issue?

compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.facebook.react:react-native:+' // From node_modules
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
android:name=".notifications.NotificationService"
android:enabled="true"
android:exported="false"/>
<service android:name="com.mapbox.mapboxsdk.telemetry.TelemetryService" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's for mapbox telemetry. This is part of the settings process. I'm not sure if deactivating it can have side effects.
From a purely user standpoint the telemetry can be deactivated through the map interface.
Do you want me to enquire it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do, I'm afraid of what legal reasons we will need to add in our side in order to use this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update?


<receiver android:name=".notifications.ReceiverNotificationDelete"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ public void onItemFound(MagnetScannerItem item) {
WritableMap data = Arguments.createMap();
data.putString("url", item.getUrl());
data.putDouble("distance", item.getDistance());
if (item.getLatitude() != null && item.getLongitude() != null) {
data.putDouble("latitude", item.getLatitude());
data.putDouble("longitude", item.getLongitude());
}
emit("magnetscanner:itemfound", data);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.idehub.GoogleAnalyticsBridge.GoogleAnalyticsBridgePackage;
import com.mapbox.reactnativemapboxgl.ReactNativeMapboxGLPackage;

import java.util.Arrays;
import java.util.List;
Expand All @@ -28,7 +30,9 @@ protected boolean getUseDeveloperSupport() {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new GoogleAnalyticsBridgePackage(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funky rebase issues?

new LinearGradientPackage(),
new ReactNativeMapboxGLPackage(),
new MyAppPackage()
);
}
Expand Down
Binary file added android/app/src/main/res/drawable-mdpi/ic_place.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/src/main/res/drawable-xhdpi/ic_place.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
include ':magnet-scanner-android'
project(':magnet-scanner-android').projectDir = new File(rootProject.projectDir, '../node_modules/magnet-scanner-android')
include ':reactnativemapboxgl'
project(':reactnativemapboxgl').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mapbox-gl/android')
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"about": "https://trymagnet.org",
"privacy": "https://trymagnet.org/privacy/",
"feedback": "https://trymagnet.org/#contact"
}
},
"mapboxAccessToken": "pk.eyJ1IjoiZ21hcnR5IiwiYSI6ImNpdm1lanB1azAwNm8yb3A0OXZ6bmUxM2oifQ.i2HycDMBdPoatAB-ONR6FQ"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this out of settings.

},

"itemExpires": 60000,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file added ios/3rdparty/Mapbox.framework/Compass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ios/3rdparty/Mapbox.framework/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ios/3rdparty/Mapbox.framework/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions ios/3rdparty/Mapbox.framework/Headers/MGLAccountManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#import <Foundation/Foundation.h>

#import "MGLTypes.h"

NS_ASSUME_NONNULL_BEGIN

/**
The MGLAccountManager object provides a global way to set a Mapbox API access
token.
*/
@interface MGLAccountManager : NSObject

#pragma mark Authorizing Access

/**
Set the
<a href="https://www.mapbox.com/help/define-access-token/">Mapbox access token</a>
to be used by all instances of MGLMapView in the current application.

Mapbox-hosted vector tiles and styles require an API access token, which you
can obtain from the
<a href="https://www.mapbox.com/studio/account/tokens/">Mapbox account page</a>.
Access tokens associate requests to Mapbox’s vector tile and style APIs with
your Mapbox account. They also deter other developers from using your styles
without your permission.

@param accessToken A Mapbox access token. Calling this method with a value of
`nil` has no effect.

@note You must set the access token before attempting to load any Mapbox-hosted
style. Therefore, you should generally set it before creating an instance of
MGLMapView. The recommended way to set an access token is to add an entry to
your application’s Info.plist file with the key `MGLMapboxAccessToken` and
the type String. Alternatively, you may call this method from your
application delegate’s `-applicationDidFinishLaunching:` method.
*/
+ (void)setAccessToken:(nullable NSString *)accessToken;

/**
Returns the
<a href="https://www.mapbox.com/help/define-access-token/">Mapbox access token</a>
in use by instances of MGLMapView in the current application.
*/
+ (nullable NSString *)accessToken;

+ (BOOL)mapboxMetricsEnabledSettingShownInApp __attribute__((deprecated("Telemetry settings are now always shown in the ℹ️ menu.")));

@end

NS_ASSUME_NONNULL_END
61 changes: 61 additions & 0 deletions ios/3rdparty/Mapbox.framework/Headers/MGLAnnotation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import <TargetConditionals.h>

#import "MGLTypes.h"

NS_ASSUME_NONNULL_BEGIN

/**
The `MGLAnnotation` protocol is used to provide annotation-related information
to a map view. To use this protocol, you adopt it in any custom objects that
store or represent annotation data. Each object then serves as the source of
information about a single map annotation and provides critical information,
such as the annotation’s location on the map. Annotation objects do not provide
the visual representation of the annotation but typically coordinate (in
conjunction with the map view’s delegate) the creation of an appropriate
objects to handle the display.

An object that adopts this protocol must implement the `coordinate` property.
The other methods of this protocol are optional.
*/
@protocol MGLAnnotation <NSObject>

#pragma mark Position Attributes

/**
The center point (specified as a map coordinate) of the annotation. (required)
(read-only)
*/
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;

@optional

#pragma mark Title Attributes

/**
The string containing the annotation’s title.

Although this property is optional, if you support the selection of annotations
in your map view, you are expected to provide this property. This string is
displayed in the callout for the associated annotation.
*/
@property (nonatomic, readonly, copy, nullable) NSString *title;

/**
The string containing the annotation’s subtitle.

This string is displayed in the callout for the associated annotation.
*/
@property (nonatomic, readonly, copy, nullable) NSString *subtitle;

#if !TARGET_OS_IPHONE

/** The string containing the annotation’s tooltip. */
@property (nonatomic, readonly, copy, nullable) NSString *toolTip;

#endif

@end

NS_ASSUME_NONNULL_END
44 changes: 44 additions & 0 deletions ios/3rdparty/Mapbox.framework/Headers/MGLAnnotationImage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#import <UIKit/UIKit.h>

#import "MGLTypes.h"

NS_ASSUME_NONNULL_BEGIN

/** The MGLAnnotationImage class is responsible for presenting point-based annotations visually on a map view. Annotation image objects wrap `UIImage` objects and may be recycled later and put into a reuse queue that is maintained by the map view. */
@interface MGLAnnotationImage : NSObject

#pragma mark Initializing and Preparing the Image Object

/**
Initializes and returns a new annotation image object.

@param image The image to be displayed for the annotation.
@param reuseIdentifier The string that identifies that this annotation image is reusable.
@return The initialized annotation image object or `nil` if there was a problem initializing the object.
*/
+ (instancetype)annotationImageWithImage:(UIImage *)image reuseIdentifier:(NSString *)reuseIdentifier;

#pragma mark Getting and Setting Attributes

/** The image to be displayed for the annotation. */
@property (nonatomic, strong, nullable) UIImage *image;

/**
The string that identifies that this annotation image is reusable. (read-only)

You specify the reuse identifier when you create the image object. You use this type later to retrieve an annotation image object that was created previously but which is currently unused because its annotation is not on screen.

If you define distinctly different types of annotations (with distinctly different annotation images to go with them), you can differentiate between the annotation types by specifying different reuse identifiers for each one.
*/
@property (nonatomic, readonly) NSString *reuseIdentifier;

/**
A Boolean value indicating whether the annotation is enabled.

The default value of this property is `YES`. If the value of this property is `NO`, the annotation image ignores touch events and cannot be selected.
*/
@property (nonatomic, getter=isEnabled) BOOL enabled;

@end

NS_ASSUME_NONNULL_END
Loading