Skip to content

Renamed project from 'flutter_geolocator' to 'geolocator' #7

New issue

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

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

Already on GitHub? # to your account

Merged
merged 2 commits into from
Jun 11, 2018
Merged
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [WIP] Flutter Geolocator Plugin
# Flutter Geolocator Plugin

A Flutter plugin which provides easy access to the platform specific location services ([FusedLocationProviderClient](https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderClient) on Android and [CLLocationManager](https://developer.apple.com/documentation/corelocation/cllocationmanager) on iOS).

Expand All @@ -17,7 +17,7 @@ To use this plugin, add `flutter_geolocator` as a [dependency in your pubspec.ya

On Android you'll need to add the `ACCESS_COARSE_LOCATION` and `ACCESS_FINE_LOCATION` permissions to your Android Manifest. Todo so open the AndroidManifest.xml file and add the following two lines as direct children of the `<manifest>` tag:

```
``` xml
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
```
Expand All @@ -26,14 +26,14 @@ On Android you'll need to add the `ACCESS_COARSE_LOCATION` and `ACCESS_FINE_LOCA

On iOS you'll need to add the `NSLocationWhenInUseUsageDescription` to your Info.plist file in order to access the device's location. Simply open your Info.plist file and add the following:

```
``` xml
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs access to location when open.</string>
```

If you would like to access the device's location when your App is running in the background, you should also add the `NSLocationAlwaysAndWhenInUseUsageDescription` (if your App support iOS 10 or earlier you should also add the key `NSLocationAlwaysUsageDescription`) key to your Info.plist file:

```
``` xml
<key>NSLocationAlwaysUsageDescription</key>
<string>This app needs access to location when in the background.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
Expand Down
6 changes: 6 additions & 0 deletions android/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin"/>
</classpath>
23 changes: 23 additions & 0 deletions android/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>flutter_geolocator</name>
<comment>Project geolocator created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions android/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
connection.project.dir=
eclipse.preferences.version=1
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group 'com.baseflow.fluttergeolocator'
group 'com.baseflow.flutter'
version '1.0-SNAPSHOT'

buildscript {
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.baseflow.fluttergeolocator">
package="com.baseflow.flutter">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baseflow.fluttergeolocator;
package com.baseflow.flutter;

import android.Manifest;
import android.content.IntentSender;
Expand Down Expand Up @@ -34,9 +34,9 @@
import java.util.Map;

/**
* FlutterGeolocatorPlugin
* GeolocatorPlugin
*/
public class FlutterGeolocatorPlugin implements MethodCallHandler, EventChannel.StreamHandler {
public class GeolocatorPlugin implements MethodCallHandler, EventChannel.StreamHandler {

private static final String LOG_TAG = "baseflow.com/geolocator";
private static final String METHOD_CHANNEL_NAME = "flutter.baseflow.com/geolocator/methods";
Expand All @@ -55,7 +55,7 @@ public class FlutterGeolocatorPlugin implements MethodCallHandler, EventChannel.
private EventChannel.EventSink mEventSink;
private Result mResult;

private FlutterGeolocatorPlugin(PluginRegistry.Registrar registrar){
private GeolocatorPlugin(PluginRegistry.Registrar registrar){
this.mRegistrar = registrar;

mFusedLocationClient = LocationServices.getFusedLocationProviderClient(mRegistrar.activity());
Expand All @@ -76,7 +76,7 @@ private FlutterGeolocatorPlugin(PluginRegistry.Registrar registrar){
* Plugin registration.
*/
public static void registerWith(Registrar registrar) {
FlutterGeolocatorPlugin geolocatorPlugin = new FlutterGeolocatorPlugin(registrar);
GeolocatorPlugin geolocatorPlugin = new GeolocatorPlugin(registrar);

final MethodChannel methodChannel = new MethodChannel(registrar.messenger(), METHOD_CHANNEL_NAME);
final EventChannel eventChannel = new EventChannel(registrar.messenger(), EVENT_CHANNEL_NAME);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baseflow.fluttergeolocator;
package com.baseflow.flutter;

import android.location.Location;
import android.os.Build;
Expand Down
17 changes: 17 additions & 0 deletions example/android/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>android</name>
<comment>Project android created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions example/android/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
connection.project.dir=
eclipse.preferences.version=1
6 changes: 6 additions & 0 deletions example/android/app/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
23 changes: 23 additions & 0 deletions example/android/app/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>app</name>
<comment>Project app created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
connection.project.dir=..
eclipse.preferences.version=1
4 changes: 2 additions & 2 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/flutter_geolocator/flutter_geolocator.framework",
"${BUILT_PRODUCTS_DIR}/geolocator/geolocator.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_geolocator.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/geolocator.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down
6 changes: 3 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_geolocator/flutter_geolocator.dart';
import 'package:flutter_geolocator/models/position.dart';
import 'package:geolocator/geolocator.dart';
import 'package:geolocator/models/position.dart';

void main() => runApp(new MyApp());

Expand All @@ -13,7 +13,7 @@ class MyApp extends StatefulWidget {
}

class _MyAppState extends State<MyApp> {
FlutterGeolocator _geolocator = new FlutterGeolocator();
Geolocator _geolocator = new Geolocator();
Position _position;
StreamSubscription<Position> _positionSubscription;

Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: flutter_geolocator_example
description: Demonstrates how to use the flutter_geolocator plugin.
name: geolocator_example
description: Demonstrates how to use the geolocator plugin.

dependencies:
flutter:
Expand All @@ -13,7 +13,7 @@ dev_dependencies:
flutter_test:
sdk: flutter

flutter_geolocator:
geolocator:
path: ../

# For information on the generic Dart part of this file, see the
Expand Down
2 changes: 1 addition & 1 deletion example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:flutter_geolocator_example/main.dart';
import 'package:geolocator_example/main.dart';

void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
Expand Down
11 changes: 11 additions & 0 deletions geolocator.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"folders": [
{
"path": "example"
},
{
"path": "."
}
],
"settings": {}
}
4 changes: 0 additions & 4 deletions ios/Classes/FlutterGeolocatorPlugin.h

This file was deleted.

8 changes: 0 additions & 8 deletions ios/Classes/FlutterGeolocatorPlugin.m

This file was deleted.

4 changes: 4 additions & 0 deletions ios/Classes/GeolocatorPlugin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#import <Flutter/Flutter.h>

@interface GeolocatorPlugin : NSObject<FlutterPlugin>
@end
8 changes: 8 additions & 0 deletions ios/Classes/GeolocatorPlugin.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#import "GeolocatorPlugin.h"
#import <geolocator/geolocator-Swift.h>

@implementation GeolocatorPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
[SwiftGeolocatorPlugin registerWithRegistrar:registrar];
}
@end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Flutter
import UIKit
import CoreLocation

public class SwiftFlutterGeolocatorPlugin: NSObject, FlutterStreamHandler, FlutterPlugin, CLLocationManagerDelegate {
public class SwiftGeolocatorPlugin: NSObject, FlutterStreamHandler, FlutterPlugin, CLLocationManagerDelegate {
private static let METHOD_CHANNEL_NAME = "flutter.baseflow.com/geolocator/methods"
private static let EVENT_CHANNEL_NAME = "flutter.baseflow.com/geolocator/events"

Expand All @@ -13,7 +13,7 @@ public class SwiftFlutterGeolocatorPlugin: NSObject, FlutterStreamHandler, Flutt
public static func register(with registrar: FlutterPluginRegistrar) {
let methodChannel = FlutterMethodChannel(name: METHOD_CHANNEL_NAME, binaryMessenger: registrar.messenger())
let eventsChannel = FlutterEventChannel(name: EVENT_CHANNEL_NAME, binaryMessenger: registrar.messenger())
let instance = SwiftFlutterGeolocatorPlugin()
let instance = SwiftGeolocatorPlugin()

registrar.addMethodCallDelegate(instance, channel: methodChannel)
eventsChannel.setStreamHandler(instance)
Expand Down
10 changes: 5 additions & 5 deletions ios/flutter_geolocator.podspec → ios/geolocator.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'flutter_geolocator'
s.name = 'geolocator'
s.version = '0.0.1'
s.summary = 'Geolocation plugin for Flutter (based on the excellent Geolocator plugin for Xamarin by James Montemagno)'
s.summary = 'Geolocation plugin for Flutter'
s.description = <<-DESC
Geolocation plugin for Flutter (based on the excellent Geolocator plugin for Xamarin by James Montemagno)
Geolocation plugin for Flutter
DESC
s.homepage = 'http://example.com'
s.homepage = 'http://github.com/BaseflowIT/flutter-geolocator'
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => 'email@example.com' }
s.author = { 'Baseflow' => 'hello@baseflow.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
Expand Down
10 changes: 5 additions & 5 deletions lib/flutter_geolocator.dart → lib/geolocator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ import 'package:meta/meta.dart';
import 'models/position.dart';

/// Provides easy access to the platform specific location services (CLLocationManager on iOS and FusedLocationProviderClient on Android)
class FlutterGeolocator {
factory FlutterGeolocator() {
class Geolocator {
factory Geolocator() {
if (_instance == null) {
final MethodChannel methodChannel =
const MethodChannel('flutter.baseflow.com/geolocator/methods');
final EventChannel eventChannel =
const EventChannel('flutter.baseflow.com/geolocator/events');
_instance = new FlutterGeolocator.private(methodChannel, eventChannel);
_instance = new Geolocator.private(methodChannel, eventChannel);
}
return _instance;
}

@visibleForTesting
FlutterGeolocator.private(this._methodChannel, this._eventChannel);
Geolocator.private(this._methodChannel, this._eventChannel);

static FlutterGeolocator _instance;
static Geolocator _instance;

final MethodChannel _methodChannel;
final EventChannel _eventChannel;
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: flutter_geolocator
description: Geolocation plugin for Flutter (based on the excellent Geolocator plugin for Xamarin by James Montemagno)
name: geolocator
description: Geolocation plugin for Flutter
version: 0.0.1
author: Baseflow
homepage: https://baseflow.com
Expand All @@ -19,8 +19,8 @@ dev_dependencies:
# The following section is specific to Flutter.
flutter:
plugin:
androidPackage: com.baseflow.fluttergeolocator
pluginClass: FlutterGeolocatorPlugin
androidPackage: com.baseflow.flutter
pluginClass: GeolocatorPlugin

# To add assets to your plugin package, add an assets section, like this:
# assets:
Expand Down
8 changes: 4 additions & 4 deletions test/geolocator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import 'dart:async';
import 'package:async/async.dart';
import 'package:flutter/services.dart';
import 'package:mockito/mockito.dart';
import 'package:flutter_geolocator/flutter_geolocator.dart';
import 'package:flutter_geolocator/models/position.dart';
import 'package:geolocator/geolocator.dart';
import 'package:geolocator/models/position.dart';
import 'package:test/test.dart';

void main() {
MockMethodChannel _methodChannel;
MockEventChannel _eventChannel;
FlutterGeolocator _geolocator;
Geolocator _geolocator;

const Map<String, double> _mockPosition = const <String, double> {
'latitude' : 52.561270,
Expand Down Expand Up @@ -73,7 +73,7 @@ void main() {
setUp(() {
_methodChannel = new MockMethodChannel();
_eventChannel = new MockEventChannel();
_geolocator = new FlutterGeolocator.private(_methodChannel, _eventChannel);
_geolocator = new Geolocator.private(_methodChannel, _eventChannel);
});

test('Retrieve the current position', () async {
Expand Down
2 changes: 1 addition & 1 deletion test/position_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flutter_geolocator/models/position.dart';
import 'package:geolocator/models/position.dart';
import 'package:test/test.dart';

void main() {
Expand Down