Skip to content

Commit

Permalink
Pushing version 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Matias Dahlin Holst committed Nov 28, 2024
1 parent 5706381 commit da9e28f
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 33 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,23 @@ on:
- '[0-9]+.[0-9]+.[0-9]+*'

jobs:
publish:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.3'
- name: Install dependencies
run: flutter pub get
- name: Analyze
run: flutter analyze
- name: Check Publish Warnings
run: dart pub publish --dry-run
- name: Publish
uses: sakebook/actions-flutter-pub-publisher@v1.4.1
uses: k-paxian/dart-package-publisher@v1.5.1
with:
credential: ${{ secrets.PUB_CREDENTIALS }}
skip_test: true
dry_run: true
credentialJson: ${{ secrets.PUB_CREDENTIALS }}
flutter: true
skipTests: true
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# Changelog

## 4.0.0
See the [main](https://pub.dev/packages/mapsindoors_googlemaps/changelog) package for the changelog.

## 3.1.3
See the [main](https://pub.dev/packages/mapsindoors_googlemaps/changelog) package for the changelog.

## 3.1.2
See the [main](https://pub.dev/packages/mapsindoors_googlemaps/changelog) package for the changelog.

## 3.1.1
See the [main](https://pub.dev/packages/mapsindoors_googlemaps/changelog) package for the changelog.

## 3.1.0
See the [main](https://pub.dev/packages/mapsindoors_googlemaps/changelog) package for the changelog.

## 3.0.2
See the [main](https://pub.dev/packages/mapsindoors_googlemaps/changelog) package for the changelog.

## 3.0.1
See the [main](https://pub.dev/packages/mapsindoors_googlemaps/changelog) package for the changelog.

## 3.0.0
See the [main](https://pub.dev/packages/mapsindoors_googlemaps/changelog) package for the changelog.
25 changes: 20 additions & 5 deletions ios/Classes/MapsIndoorsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class FLNativeView: NSObject, FlutterPlatformView, MPMapControlDelegate, Flutter

private var _GMSView: GMSMapView
private var mapsIndoorsData: MapsIndoorsData
private var args: Any? = nil
private var args: [String: Any]?
private let googleApiKey = Bundle.main.object(forInfoDictionaryKey: "GoogleMapsAPIKey") as? String ?? ""

init(
Expand All @@ -46,10 +46,17 @@ class FLNativeView: NSObject, FlutterPlatformView, MPMapControlDelegate, Flutter
binaryMessenger messenger: FlutterBinaryMessenger?,
mapsIndoorsData: MapsIndoorsData
) {
self.args = args
self.args = args as? [String: Any]
self.mapsIndoorsData = mapsIndoorsData;
GMSServices.provideAPIKey(googleApiKey)
_GMSView = GMSMapView(frame: frame, camera: GMSCameraPosition())

let cameraPosition = if let initialCamPos = self.args?["initialCameraPosition"] as? String, let position = try? JSONDecoder().decode(CameraPosition.self, from: initialCamPos.data(using: .utf8)!) {
Self.makeGMSCameraPosition(cameraPosition: position)
} else {
GMSCameraPosition()
}

_GMSView = GMSMapView(frame: frame, camera: cameraPosition)
super.init()
mapsIndoorsData.mapView = self

Expand All @@ -61,7 +68,7 @@ class FLNativeView: NSObject, FlutterPlatformView, MPMapControlDelegate, Flutter

// To fix an odd bug, where the map center would be in the top left corner of the view.
// It should be the center of the view.
_GMSView.moveCamera(GMSCameraUpdate.setCamera(GMSCameraPosition()))
_GMSView.moveCamera(GMSCameraUpdate.setCamera(cameraPosition))
}

func view() -> UIView {
Expand Down Expand Up @@ -98,6 +105,14 @@ class FLNativeView: NSObject, FlutterPlatformView, MPMapControlDelegate, Flutter
}
_GMSView.moveCamera(update)
}

static func makeGMSCameraPosition(cameraPosition: CameraPosition) -> GMSCameraPosition {
GMSCameraPosition(latitude: CLLocationDegrees(cameraPosition.target.latitude),
longitude: CLLocationDegrees(cameraPosition.target.longitude),
zoom: cameraPosition.zoom,
bearing: CLLocationDirection(floatLiteral: Double(cameraPosition.bearing)),
viewingAngle: Double(cameraPosition.tilt))
}

func makeGMSCameraUpdate(cameraUpdate: CameraUpdate) -> GMSCameraUpdate? {
let update: GMSCameraUpdate
Expand All @@ -121,7 +136,7 @@ class FLNativeView: NSObject, FlutterPlatformView, MPMapControlDelegate, Flutter
guard let position = cameraUpdate.position else {
return nil
}
update = (GMSCameraUpdate.setCamera(GMSCameraPosition(latitude: CLLocationDegrees(cameraUpdate.position!.target.latitude), longitude: CLLocationDegrees(position.target.longitude), zoom: position.zoom, bearing: CLLocationDirection(floatLiteral: Double(position.bearing)), viewingAngle: Double(position.tilt)) ))
update = (GMSCameraUpdate.setCamera(GMSCameraPosition(latitude: CLLocationDegrees(position.target.latitude), longitude: CLLocationDegrees(position.target.longitude), zoom: position.zoom, bearing: CLLocationDirection(floatLiteral: Double(position.bearing)), viewingAngle: Double(position.tilt)) ))
default:
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,39 @@
// Created by Martin Hansen on 21/02/2023.
//

import Foundation
import Flutter
import UIKit
import MapsIndoors
import MapsIndoorsCore
import Foundation
import MapsIndoorsCodable

public class MapControlFloorSelectorChannel: NSObject {
enum Methods: String {
case FSE_onFloorChanged

func call(arguments: [String: Any]?, mapsIndoorsData: MapsIndoorsData, result: @escaping FlutterResult, methodChannel: FlutterMethodChannel?) {
guard let methodChannel else { return }

let runner: (_ arguments: [String: Any]?, _ mapsIndoorsData: MapsIndoorsData, _ result: @escaping FlutterResult, _ methodChannel: FlutterMethodChannel) -> Void

switch self {
case .FSE_onFloorChanged: runner = onFloorChanged
case .FSE_onFloorChanged: runner = onFloorChanged
}

runner(arguments, mapsIndoorsData, result, methodChannel)
}

func onFloorChanged(arguments: [String: Any]?, mapsIndoorsData: MapsIndoorsData, result: @escaping FlutterResult, methodChannel: FlutterMethodChannel) {
guard let floorJson = arguments?["floor"] as? String else {
result(FlutterError(code: "Could not read floor", message: "FSE_onFloorChanged", details: nil))
return
}

guard let floor = try? JSONDecoder().decode(MPFloorCodable.self, from: floorJson.data(using: .utf8)!) else {
result(FlutterError(code: "Could not parse floor", message: "FSE_onFloorChanged", details: nil))
return
do {
let floor = try JSONDecoder().decode(MPFloorCodable.self, from: floorJson.data(using: .utf8)!)
let floorIndex = floor.floorIndex?.intValue ?? 0
mapsIndoorsData.mapControl?.select(floorIndex: floorIndex)
} catch {
result(FlutterError(code: "Could not parse floor", message: "FSE_onFloorChanged", details: error.localizedDescription))
}

let floorIndex = floor.floorIndex?.intValue ?? 0
mapsIndoorsData.mapControl?.select(floorIndex: floorIndex)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class UtilMethodChannel: NSObject {
return
}

guard let venueId = args["venueId"] as? String else {
guard let venueId = args["id"] as? String else {
result(FlutterError(code: "Could not read arguments", message: "UTL_venueHasGraph", details: nil))
return
}
Expand Down
4 changes: 2 additions & 2 deletions ios/mapsindoors_googlemaps_ios.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ Pod::Spec.new do |s|

s.static_framework = true

s.dependency 'MapsIndoorsCodable', "4.6.2"
s.dependency 'MapsIndoorsGoogleMaps', "4.6.2"
s.dependency 'MapsIndoorsCodable', "4.7.0"
s.dependency 'MapsIndoorsGoogleMaps', "4.7.0"
end
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: mapsindoors_googlemaps_ios
description: iOS implementation of the mapsindoors plugin
version: 3.1.3
version: 4.0.0
repository: https://github.com/MapsPeople/mapsindoors_flutter_googlemaps_ios
homepage: https://www.mapsindoors.com/

Expand All @@ -18,7 +18,7 @@ flutter:
dependencies:
flutter:
sdk: flutter
mapsindoors_platform_interface: ^3.1.3
mapsindoors_platform_interface: ^4.0.0

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit da9e28f

Please sign in to comment.