Skip to content

Commit

Permalink
A less elegant solution of omchiii#8
Browse files Browse the repository at this point in the history
  • Loading branch information
Foldblade committed Mar 15, 2022
1 parent bc65c0d commit 9668146
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 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
Expand Down
6 changes: 6 additions & 0 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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',
),
),
);
Expand Down
9 changes: 9 additions & 0 deletions lib/src/model_viewer_plus_mobile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -74,6 +75,13 @@ class ModelViewerState extends State<ModelViewer> {
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://")) {
Expand Down Expand Up @@ -245,3 +253,4 @@ class ModelViewerState extends State<ModelViewer> {
return await File(path).readAsBytes();
}
}

3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 9668146

Please sign in to comment.