Skip to content

Commit

Permalink
feat: update navigation sdk versions (iOS -> 9.1.2, Android -> 6.0.0)…
Browse files Browse the repository at this point in the history
… and min iOS version to 15 (#177)

* Starting with version 6.0.0 of the Navigation SDK for Android, apps must upgrade to Kotlin 2.0. 
* The Android targetSdk is now API level 34.
  • Loading branch information
illuminati1911 authored Oct 15, 2024
1 parent d882837 commit fa9eb88
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 69 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ This repository contains a Flutter plugin that provides a [Google Navigation](ht

| | Android | iOS |
| ------------------------------- | ------- | --------- |
| **Minimum mobile OS supported** | API level 23+ | iOS 14.0+ |
| **Minimum mobile OS supported** | API level 23+ | iOS 15.0+ |

* A Flutter project
* A Google Cloud project
* If you are a Mobility Services developer, you must contact Sales as described in [Mobility services documentation](https://developers.google.com/maps/documentation/transportation-logistics/mobility).
* If you are not a Mobility Services developer, refer to [Setup Google Cloud Project](https://developers.google.com/maps/documentation/navigation/android-sdk/cloud-setup) for instructions.
* An [API key](https://console.cloud.google.com/google/maps-apis/credentials) from the project above
* The API key must be configured for both Android and iOS. Refer to [Android Using Api Keys](https://developers.google.com/maps/documentation/navigation/android-sdk/get-api-key) and [iOS Using Api Keys](https://developers.google.com/maps/documentation/navigation/ios-sdk/get-api-key) respectively for instructions.
* If targeting Android, [Google Play Services](https://developers.google.com/android/guides/overview) installed and enabled
* If targeting Android, [Google Play Services](https://developers.google.com/android/guides/overview) installed and enabled and minimum Kotlin version 2.0
* [Attributions and licensing text](https://developers.google.com/maps/documentation/navigation/android-sdk/set-up-project#include_the_required_attributions_in_your_app) added to your app

> [!IMPORTANT]
Expand Down Expand Up @@ -52,8 +52,8 @@ This repository contains a Flutter plugin that provides a [Google Navigation](ht
1. Add the following lines to the beginning of this Podfile:
```
# Set platform to 14.0 to enable latest Google Maps SDK
platform :ios, '14.0'
# Set platform to 15.0 to enable latest Google Maps SDK
platform :ios, '15.0'
```
3. Add your API key to the Flutter project using [these instructions for the corresponding Android (build.gradle) and iOS (AppDelegate.swift) files](https://developers.google.com/maps/flutter-package/config#step_4_add_your_api_key_to_the_project). The instructions for this step in the google_maps_flutter package documentation apply to the google_navigation_flutter package as well.
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ group 'com.google.maps.flutter.navigation'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.9.0'
ext.kotlin_version = '2.0.0'
repositories {
google()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}

dependencies {
classpath 'com.android.tools.build:gradle:8.1.4'
classpath 'com.android.tools.build:gradle:8.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.ncorti.ktfmt.gradle:plugin:0.15.1'
}
Expand Down Expand Up @@ -77,7 +77,7 @@ android {
}

dependencies {
implementation 'com.google.android.libraries.navigation:navigation:5.1.1'
implementation 'com.google.android.libraries.navigation:navigation:6.0.0'
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation 'io.mockk:mockk:1.13.8'
testImplementation 'junit:junit:4.13.2'
Expand Down
1 change: 0 additions & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ override func application(
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GMSServices.provideAPIKey("YOUR_API_KEY") // REPLACE THIS TEXT WITH YOUR API KEY
GMSServices.setMetalRendererEnabled(true)
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
Expand Down
4 changes: 2 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
// limitations under the License.

buildscript {
ext.kotlin_version = '1.9.0'
ext.kotlin_version = '2.0.0'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:8.2.0'
classpath 'com.android.tools.build:gradle:8.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath("com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1")
}
Expand Down
18 changes: 3 additions & 15 deletions example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#Fri Oct 11 17:27:19 CST 2024
//=limitations under the License.
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
6 changes: 2 additions & 4 deletions example/integration_test/shared.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,8 @@ Future<void> checkTermsAndConditionsAcceptance(

await $.pumpAndSettle();
// Tap accept or cancel.
if (Platform.isAndroid) {
await $.native.tap(Selector(text: 'Yes, I am in'));
} else if (Platform.isIOS) {
await $.native.tap(Selector(text: "YES, I'M IN"));
if (Platform.isAndroid || Platform.isIOS) {
await $.native.tap(Selector(text: "Got It"));
} else {
fail('Unsupported platform: ${Platform.operatingSystem}');
}
Expand Down
46 changes: 20 additions & 26 deletions example/integration_test/t02_session_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,36 +38,30 @@ void main() {
key: key,
onViewCreated: (GoogleNavigationViewController controller) {}));

final List<bool> results = <bool>[true, false, true];
for (final bool result in results) {
/// Reset TOS acceptance.
await GoogleMapsNavigator.resetTermsAccepted();
expect(await GoogleMapsNavigator.areTermsAccepted(), false);
/// Reset TOS acceptance.
await GoogleMapsNavigator.resetTermsAccepted();
expect(await GoogleMapsNavigator.areTermsAccepted(), false);

/// Request native TOS dialog.
final Future<bool> tosAccepted =
GoogleMapsNavigator.showTermsAndConditionsDialog(
'test_title',
'test_company_name',
);

// Tap accept or cancel.
if (Platform.isAndroid) {
await $.native.tap(Selector(text: result ? 'Yes, I am in' : 'Cancel'));
} else if (Platform.isIOS) {
await $.native
.tap(Selector(text: result ? "YES, I'M IN" : 'NO THANKS'));
} else {
fail('Unsupported platform: ${Platform.operatingSystem}');
}
/// Request native TOS dialog.
final Future<bool> tosAccepted =
GoogleMapsNavigator.showTermsAndConditionsDialog(
'test_title',
'test_company_name',
);

// Check that the results match.
await tosAccepted.then((bool accept) {
expect(accept, result);
});
expect(await GoogleMapsNavigator.areTermsAccepted(), result);
// Tap got it.
if (Platform.isAndroid || Platform.isIOS) {
await $.native.tap(Selector(text: 'Got It'));
} else {
fail('Unsupported platform: ${Platform.operatingSystem}');
}

// Check that the results match.
await tosAccepted.then((bool accept) {
expect(accept, true);
});
expect(await GoogleMapsNavigator.areTermsAccepted(), true);

// If terms have already been accepted another call to showTermsAndConditionsDialog()
// should just return true without errors and without showing any dialogs.
expect(await GoogleMapsNavigator.areTermsAccepted(), true);
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '14.0'
platform :ios, '15.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
18 changes: 9 additions & 9 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@
DEVELOPMENT_TEAM = 5LUR69Y2U9;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -691,7 +691,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.google.maps.flutter.navigationExample.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -710,7 +710,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.google.maps.flutter.navigationExample.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -727,7 +727,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.google.maps.flutter.navigationExample.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -752,7 +752,7 @@
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu17;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
Expand Down Expand Up @@ -781,7 +781,7 @@
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu17;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -809,7 +809,7 @@
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu17;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -939,7 +939,7 @@
DEVELOPMENT_TEAM = 5LUR69Y2U9;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -963,7 +963,7 @@
DEVELOPMENT_TEAM = 5LUR69Y2U9;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
1 change: 0 additions & 1 deletion example/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import GoogleNavigation
mapsApiKey = "YOUR_API_KEY"
}
GMSServices.provideAPIKey(mapsApiKey)
GMSServices.setMetalRendererEnabled(true)
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
Expand Down
4 changes: 2 additions & 2 deletions ios/google_navigation_flutter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ A Google Maps Navigation Flutter plugin.
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.dependency 'GoogleNavigation', '5.3.1'
s.platform = :ios, '14.0'
s.dependency 'GoogleNavigation', '9.1.2'
s.platform = :ios, '15.0'
s.static_framework = true

# Flutter.framework does not contain a i386 slice.
Expand Down
2 changes: 2 additions & 0 deletions lib/src/google_navigation_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,8 @@ class GoogleNavigationViewController {
/// such as [MapType.normal], [MapType.satellite], [MapType.terrain],
/// or [MapType.hybrid].
///
/// MapType.terrain does not work during navigation.
///
/// Example usage:
/// ```dart
/// _navigationViewController.changeMapType(MapType.satellite);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/types/navigation_view_types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ enum MapType {
/// Satellite map.
satellite,

/// Terrain map.
/// Terrain map. (Does not work during navigation)
terrain,

/// Hybrid map.
Expand Down

0 comments on commit fa9eb88

Please sign in to comment.