Skip to content

Commit

Permalink
core: Add configurations in example
Browse files Browse the repository at this point in the history
  • Loading branch information
llfbandit committed Dec 2, 2020
1 parent 17d80cc commit eaff243
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 24 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.2.0
* Add configurations in example.

## 0.1.0+2
* Update README.md.

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Android App Links, Deep Links, iOs Universal Links and Custom URL schemes handler.

This plugin allows you to:
- catch HTTPS URLs to open your app instead of the browser (App Links / Universal Links).
- catch custom schemes to open your app (Deep Links / Custom URL schemes).
- catch HTTPS URLs to open your app instead of the browser (App Link / Universal Link).
- catch custom schemes to open your app (Deep Link / Custom URL scheme).

## Getting Started

Expand Down Expand Up @@ -43,7 +43,7 @@ Android notes:
- Intent action is filtered by `Intent.ACTION_VIEW` (for now).

- By default, flutter Activity is set with `android:launchMode="singleTop"`.
This is perfectly fine and expected, but this launches another instance of your app, specifically for the requested view.
This is perfectly fine and expected, but this launches another instance of your app, specifically for the requested view.
If you don't want this behaviour, you can set `android:launchMode="singleInstance"` in your `AndroidManifest.xml` and avoid another flutter warmup.

## Tests
Expand Down
19 changes: 19 additions & 0 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">

<!-- App Link sample -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="www.example.com" />
<data android:scheme="https" />
</intent-filter>

<!-- Deep Link sample -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Add optional android:host to distinguish your app
from others in case of conflicting scheme name -->
<data android:scheme="app" android:host="open.my.app" />
</intent-filter>


<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
Expand Down
16 changes: 16 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Custom URL scheme sample -->
<key>CFBundleURLTypes</key>
<array>
<dict>
<!-- Your scheme -->
<key>CFBundleURLSchemes</key>
<array>
<string>app</string>
</array>
<!-- Optional URL to distinguish your app from others
in case of conflicting scheme name -->
<key>CFBundleURLName</key>
<string>open.my.app</string>
</dict>
</array>
<!-- END Custom URL scheme sample -->
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
Expand Down
11 changes: 11 additions & 0 deletions example/ios/Runner/Runner.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Universal Link sample -->
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:www.example.com</string>
</array>
</dict>
</plist>
32 changes: 13 additions & 19 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
import 'package:flutter/material.dart';

///////////////////////////////////////////////////////////////////////////////
/// This example does nothing.
///
/// Please take a look at:
/// - example/android/app/main/AndroidManifest.xml for Android.
///
/// - example/ios/Runner/Runner.entitlements for Universal Link sample.
/// - example/ios/Runner/Info.plist for Custom URL scheme sample.
///////////////////////////////////////////////////////////////////////////////
void main() {
runApp(MyApp());
}

class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';

@override
void initState() {
super.initState();
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Running on: $_platformVersion\n'),
),
appBar: AppBar(title: const Text('Plugin example app')),
body: Center(child: Text('Foo')),
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.0+2"
version: "0.2.0"
async:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: app_links
description: Android App Links, Deep Links, iOs Universal Links and Custom URL schemes handler for Flutter.
version: 0.1.0+2
version: 0.2.0
homepage: https://github.com/llfbandit/app_links

environment:
Expand Down

0 comments on commit eaff243

Please sign in to comment.