diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f4528e..0ea583d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.1.5] - 2022-03-15 + +### Changed + +- `lib/src/model_viewer_plus_mobile.dart` + - Fix [#11](https://github.com/omchiii/model_viewer_plus.dart/issues/11), add `gestureRecognizers` + - A less elegant solution of [#8](https://github.com/omchiii/model_viewer_plus.dart/issues/8), open usdz file by [url_launcher](https://pub.dev/packages/url_launcher) in SFSafariViewController. + ## [1.1.4] - 2022-03-14 ### Changed diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index fa6ea45..140a074 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,20 +1,26 @@ PODS: - Flutter (1.0.0) + - url_launcher_ios (0.0.1): + - Flutter - webview_flutter_wkwebview (0.0.1): - Flutter DEPENDENCIES: - Flutter (from `Flutter`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`) EXTERNAL SOURCES: Flutter: :path: Flutter + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" webview_flutter_wkwebview: :path: ".symlinks/plugins/webview_flutter_wkwebview/ios" SPEC CHECKSUMS: Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a + url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de webview_flutter_wkwebview: 005fbd90c888a42c5690919a1527ecc6649e1162 PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c diff --git a/example/lib/main.dart b/example/lib/main.dart index 6042ac8..38057f9 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -20,6 +20,7 @@ class MyApp extends StatelessWidget { arModes: ['scene-viewer', 'webxr', 'quick-look'], autoRotate: true, cameraControls: true, + iosSrc: 'https://modelviewer.dev/shared-assets/models/Astronaut.usdz', ), ), ); diff --git a/lib/src/model_viewer_plus_mobile.dart b/lib/src/model_viewer_plus_mobile.dart index 4711eb5..f7c4f8c 100644 --- a/lib/src/model_viewer_plus_mobile.dart +++ b/lib/src/model_viewer_plus_mobile.dart @@ -13,6 +13,7 @@ import 'package:android_intent_plus/flag.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart' show rootBundle; import 'package:android_intent_plus/android_intent.dart' as android_content; +import 'package:url_launcher/url_launcher.dart'; import 'package:webview_flutter/webview_flutter.dart'; import 'html_builder.dart'; @@ -74,6 +75,13 @@ class ModelViewerState extends State { navigationDelegate: (final NavigationRequest navigation) async { print('>>>> ModelViewer wants to load: <${navigation.url}>'); // DEBUG if (!Platform.isAndroid) { + if(Platform.isIOS && navigation.url == widget.iosSrc) { + await launch( + navigation.url, + forceSafariVC: true, + ); + return NavigationDecision.prevent; + } return NavigationDecision.navigate; } if (!navigation.url.startsWith("intent://")) { @@ -245,3 +253,4 @@ class ModelViewerState extends State { return await File(path).readAsBytes(); } } + diff --git a/pubspec.yaml b/pubspec.yaml index adff4b2..bb54c80 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ # See: https://dart.dev/tools/pub/pubspec name: model_viewer_plus -version: 1.1.4 +version: 1.1.5 description: >- A Flutter widget for rendering interactive 3D models in the glTF and GLB formats. @@ -16,6 +16,7 @@ dependencies: sdk: flutter android_intent_plus: ^3.1.1 webview_flutter: ^3.0.1 + url_launcher: ^6.0.20 dev_dependencies: flutter_test: sdk: flutter