Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Android app - Plugins - uses or overrides a deprecated API #1

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
735bb68
upgrade to null-safe platform_plugin_interface dep
avioli Apr 28, 2021
2a5131a
let pub get do its thing
avioli Apr 28, 2021
478841a
extract linter rules from pedantic 1.11.0; remove pedantic dep
avioli Apr 28, 2021
27c3d5e
add note where the base code is
avioli Apr 28, 2021
36434f0
add attribution
avioli Apr 28, 2021
42c8fc8
remove travis stats since config is too outdated
avioli Apr 28, 2021
e997af9
update readme to not null-safety API changes
avioli Apr 28, 2021
feb20e2
update readmes to point to the pub page
avioli Apr 28, 2021
22b1e1d
update to not-use pre-release sdk version; remove upper version bound…
avioli Apr 28, 2021
5118b93
bump lower bound version of flutter as per pub publish note
avioli Apr 28, 2021
c910c09
allow catch-all filter with scheme-only
avioli Apr 28, 2021
4e770d4
add note to only handle initial link once
avioli Apr 28, 2021
954403e
add malformed url example
avioli Apr 28, 2021
8cda6f3
simplify example code to handle initial link only once; add malformed…
avioli Apr 28, 2021
2aaec35
let flutter update ios project
avioli Apr 28, 2021
80f5dda
add uni_links_web to the platforms list
avioli Apr 28, 2021
6a59aed
update changelog
avioli Apr 28, 2021
b7e42f7
add screenshot how to add asscoriated domains capability in Xcode
avioli Apr 28, 2021
4a9905f
add steps to add associated-domain capability via Xcode
avioli Apr 28, 2021
58cd78d
bump version to 0.5.0+2; update changelog
avioli Apr 28, 2021
a1d02ae
bring back the metods to get the streams, but mark them as deprecated
avioli Apr 28, 2021
49d0569
version bump to 0.5.1
avioli Apr 28, 2021
7f2a7a3
Added new lines at the end of files. Updated plugin_platform_interfac…
Feb 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 56 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Defines a default set of lint rules enforced for
# projects at Google. For details and rationale,
# see https://github.com/dart-lang/pedantic#enabled-lints.
include: package:pedantic/analysis_options.yaml

analyzer:
errors:
missing_required_param: error
always_require_non_null_named_parameters: false # not needed with nnbd
unnecessary_null_comparison: false # Turned as long as nnbd mix-mode is supported.

strong-mode:
implicit-casts: false
Expand All @@ -14,3 +14,57 @@ analyzer:
linter:
rules:
- prefer_final_locals
# - public_member_api_docs
# copy from package:pedantic/analysis_options.1.11.0.yaml
- always_declare_return_types
- always_require_non_null_named_parameters
- annotate_overrides
- avoid_init_to_null
- avoid_null_checks_in_equality_operators
- avoid_relative_lib_imports
- avoid_return_types_on_setters
- avoid_shadowing_type_parameters
- avoid_single_cascade_in_expression_statements
- avoid_types_as_parameter_names
- await_only_futures
- camel_case_extensions
- curly_braces_in_flow_control_structures
- empty_catches
- empty_constructor_bodies
- library_names
- library_prefixes
- no_duplicate_case_values
- null_closures
- omit_local_variable_types
- prefer_adjacent_string_concatenation
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_contains
- prefer_equal_for_default_values
- prefer_final_fields
- prefer_for_elements_to_map_fromIterable
- prefer_generic_function_type_aliases
- prefer_if_null_operators
- prefer_inlined_adds
- prefer_is_empty
- prefer_is_not_empty
- prefer_iterable_whereType
- prefer_single_quotes
- prefer_spread_collections
- recursive_getters
- slash_for_doc_comments
- sort_child_properties_last
- type_init_formals
- unawaited_futures
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_getters_setters
- unnecessary_new
- unnecessary_null_in_if_null_operators
- unnecessary_this
- unrelated_type_equality_checks
- unsafe_html
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters
- use_rethrow_when_possible
- valid_regexps
Binary file added resources/associated-domains.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 20 additions & 5 deletions uni_links/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
## [0.5.0] - 2020-12-28
## [0.5.1] - 2021-04-28

* Add the `getLinksStream()` and `getUriLinksStream()` methods back (flagged as deprecated) since they were removed.

## [0.5.0+2] - 2021-04-28

* Update README to add steps to add associated-domains entitlement via Xcode. (Need a version change to publish to pub.dev)

## [0.5.0+1] - 2021-04-28

* Add `uni_links_web` to the list of platform definitions.
* Update example app and README to highlight handling of the initial link.

## [0.5.0] - 2021-04-28

**Breaking changes**
Due to the migration to null safety, some APIs have changed. These changes mainly involve functions changing into getters, and types becoming explicitly nullable.
The changes to the example package are a good example of how to upgrade to this version.
* Support null safety.
* Migrate to the federated plugin architecture, paving the way for Web support in the future.
Due to the migration to null safety, some APIs have changed. These changes mainly involve functions changing into getters, and types becoming explicitly nullable.

The changes to the example package are a good example of how to upgrade to this version.

* Support null safety. (@hacker1024)
* Migrate to the federated plugin architecture, paving the way for Web support in the future. (@hacker1024)

## [0.4.0] - 2020-05-10

Expand Down
40 changes: 35 additions & 5 deletions uni_links/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Uni Links

[![Travis' Continuous Integration build status](https://api.travis-ci.org/avioli/uni_links.svg?branch=master)](https://travis-ci.org/avioli/uni_links)

A Flutter plugin project to help with App/Deep Links (Android) and
Universal Links and Custom URL schemes (iOS).

Expand All @@ -22,6 +20,15 @@ especiallly for App/Universal Links (the https scheme).
To use the plugin, add `uni_links` as a
[dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).

**0.5.0 Breaking changes**

Due to the migration to [null safety](https://dart.dev/null-safety), some APIs have changed. These changes
mainly involve functions changing into getters, and types becoming
explicitly nullable.

The changes to the example package are a good example of how to upgrade to
this version.


### Permission

Expand Down Expand Up @@ -120,8 +127,8 @@ You need to declare at least one of the two.
--

For **Universal Links** you need to add or create a
`com.apple.developer.associated-domains` entitlement - either through Xcode or
by editing (or creating and adding to Xcode) `ios/Runner/Runner.entitlements`
`com.apple.developer.associated-domains` entitlement - either through Xcode
(see below) or by editing (or creating and adding to Xcode) `ios/Runner/Runner.entitlements`
file.

```xml
Expand All @@ -141,6 +148,17 @@ file.

This allows for your app to be started from `https://YOUR_HOST` links.

**Creating the entitlements file in Xcode**:

- Open up Xcode by double-clicking on your `ios/Runner.xcworkspace` file.
- Go to the Project navigator (Cmd+1) and select the `Runner` root item at the very top.
- Select the `Runner` target and then the `Signing & Capabilities` tab.
- Click the `+ Capability` (plus) button to add a new capability.
- Type 'associated domains` and select the item.
- Double-click the first item in the Domains list and change it from `webcredentials:example.com` to: `applinks:` + your host (ex: my-fancy-domain.com).
- A file called `Runner.entitlements` will be created and added to the project.
- Done. [Here's a screenshot](https://github.com/avioli/uni_links/blob/master/resources/associated-domains.png).

For more information, read Apple's guide for
[Universal Links](https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html).

Expand Down Expand Up @@ -188,10 +206,17 @@ There are two ways your app will recieve a link - from cold start and brought
from the background. More on these after the example usage in
[More about app start from a link](#more-about-app-start-from-a-link).

**ATTENTION**: `getInitialLink`/`getInitialUri` should be handled *ONLY ONCE*
in your app's lifetime, since it is not meant to change throughout your app's
life.

### Initial Link (String)

Returns the link that the app was started with, if any.

You should handle this very early in your app's life and handle it only once.
Feel free to read the value as many times as you wish, but only handle it once.

```dart
import 'dart:async';
import 'dart:io';
Expand Down Expand Up @@ -221,6 +246,9 @@ import 'package:flutter/services.dart' show PlatformException;

Same as the `getInitialLink`, but converted to a `Uri`.

NOTE: You should handle this very early in your app's life and _handle_ it only
once.

```dart
// Uri parsing may fail, so we use a try/catch FormatException.
try {
Expand Down Expand Up @@ -289,7 +317,7 @@ import 'package:uni_links/uni_links.dart';
// ... check initialUri

// Attach a listener to the stream
_sub = getUriLinksStream().listen((Uri? uri) {
_sub = uriLinkStream.listen((Uri? uri) {
// Use the uri and warn the user, if it is not correct
}, onError: (err) {
// Handle exception by warning the user their action did not succeed
Expand Down Expand Up @@ -331,6 +359,7 @@ Assuming you've installed Android Studio (with the SDK platform tools):
adb shell 'am start -W -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "unilinks://host/path/subpath"'
adb shell 'am start -W -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "unilinks://example.com/path/portion/?uid=123&token=abc"'
adb shell 'am start -W -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "unilinks://example.com/?arr%5b%5d=123&arr%5b%5d=abc&addr=1%20Nowhere%20Rd&addr=Rand%20City%F0%9F%98%82"'
adb shell 'am start -W -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "unilinks://@@malformed.invalid.url/path?"'
```

If you don't have [`adb`](https://developer.android.com/studio/command-line/adb)
Expand Down Expand Up @@ -362,6 +391,7 @@ Assuming you've got Xcode already installed:
/usr/bin/xcrun simctl openurl booted "unilinks://host/path/subpath"
/usr/bin/xcrun simctl openurl booted "unilinks://example.com/path/portion/?uid=123&token=abc"
/usr/bin/xcrun simctl openurl booted "unilinks://example.com/?arr%5b%5d=123&arr%5b%5d=abc&addr=1%20Nowhere%20Rd&addr=Rand%20City%F0%9F%98%82"
/usr/bin/xcrun simctl openurl booted "unilinks://@@malformed.invalid.url/path?"
```

If you've got `xcrun` (or `simctl`) in your path, you could invoke it directly.
Expand Down
9 changes: 9 additions & 0 deletions uni_links/example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Deep links -->
<!-- Scheme+host filter -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
Expand All @@ -40,6 +41,7 @@
android:scheme="unilinks"
android:host="example.com" />
</intent-filter>
<!-- Scheme+host+pathPrefix filter -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
Expand All @@ -49,6 +51,13 @@
android:host="host"
android:pathPrefix="/path/subpath" />
</intent-filter>
<!-- Scheme-only filter -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="unilinks" />
</intent-filter>
</activity>
<activity
android:name=".EmbeddingV1Activity"
Expand Down
18 changes: 0 additions & 18 deletions uni_links/example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
0AEE6D748E9CC9AB029D97F9 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -205,21 +204,6 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
0AEE6D748E9CC9AB029D97F9 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
134EF81ADC7F4219C56850F9 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -303,7 +287,6 @@
/* Begin XCBuildConfiguration section */
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
Expand Down Expand Up @@ -360,7 +343,6 @@
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions uni_links/example/lib/generated_plugin_registrant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Generated file. Do not edit.
//

// ignore_for_file: lines_longer_than_80_chars

import 'package:uni_links_web/uni_links_web.dart';

import 'package:flutter_web_plugins/flutter_web_plugins.dart';
Expand Down
Loading