Skip to content

Commit

Permalink
Merge branch 'main' into sensors-plus-spm
Browse files Browse the repository at this point in the history
  • Loading branch information
vbuberen authored Oct 15, 2024
2 parents e26ed5c + 8ad1c6d commit 7764000
Show file tree
Hide file tree
Showing 66 changed files with 480 additions and 272 deletions.
162 changes: 0 additions & 162 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,6 @@ updates:
- dependency-name: "*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]

- package-ecosystem: "gradle"
directory: "/packages/android_alarm_manager_plus/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

- package-ecosystem: "gradle"
directory: "/packages/android_alarm_manager_plus/example/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

- package-ecosystem: "pub"
directory: "/packages/android_alarm_manager_plus/example"
schedule:
Expand Down Expand Up @@ -84,24 +66,6 @@ updates:
- dependency-name: "*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]

- package-ecosystem: "gradle"
directory: "/packages/android_intent_plus/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

- package-ecosystem: "gradle"
directory: "/packages/android_intent_plus/example/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

# Battery Plus dependencies updates config

- package-ecosystem: "pub"
Expand Down Expand Up @@ -140,24 +104,6 @@ updates:
- dependency-name: "*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]

- package-ecosystem: "gradle"
directory: "/packages/battery_plus/battery_plus/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

- package-ecosystem: "gradle"
directory: "packages/battery_plus/battery_plus/example/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

# Connectivity Plus dependencies updates config

- package-ecosystem: "pub"
Expand Down Expand Up @@ -196,24 +142,6 @@ updates:
- dependency-name: "*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]

- package-ecosystem: "gradle"
directory: "/packages/connectivity_plus/connectivity_plus/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

- package-ecosystem: "gradle"
directory: "/packages/connectivity_plus/connectivity_plus/example/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

# Device Info Plus dependencies updates config

- package-ecosystem: "pub"
Expand Down Expand Up @@ -252,24 +180,6 @@ updates:
- dependency-name: "*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]

- package-ecosystem: "gradle"
directory: "/packages/device_info_plus/device_info_plus/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

- package-ecosystem: "gradle"
directory: "/packages/device_info_plus/device_info_plus/example/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

# Network Info Plus dependencies updates config

- package-ecosystem: "pub"
Expand Down Expand Up @@ -308,24 +218,6 @@ updates:
- dependency-name: "*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]

- package-ecosystem: "gradle"
directory: "/packages/network_info_plus/network_info_plus/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

- package-ecosystem: "gradle"
directory: "/packages/network_info_plus/network_info_plus/example/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

# Package Info Plus dependencies updates config

- package-ecosystem: "pub"
Expand Down Expand Up @@ -364,24 +256,6 @@ updates:
- dependency-name: "*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]

- package-ecosystem: "gradle"
directory: "/packages/package_info_plus/package_info_plus/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

- package-ecosystem: "gradle"
directory: "/packages/package_info_plus/package_info_plus/example/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

# Sensors Plus dependencies updates config

- package-ecosystem: "pub"
Expand Down Expand Up @@ -420,24 +294,6 @@ updates:
- dependency-name: "*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]

- package-ecosystem: "gradle"
directory: "/packages/sensors_plus/sensors_plus/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

- package-ecosystem: "gradle"
directory: "/packages/sensors_plus/sensors_plus/example/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

# Share Plus dependencies updates config

- package-ecosystem: "pub"
Expand Down Expand Up @@ -475,21 +331,3 @@ updates:
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]

- package-ecosystem: "gradle"
directory: "/packages/share_plus/share_plus/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"

- package-ecosystem: "gradle"
directory: "/packages/share_plus/share_plus/example/android"
schedule:
interval: "monthly"
rebase-strategy: "disabled"
commit-message:
prefix: "chore"
include: "scope"
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ Some things to keep in mind before publishing the release:
1. Switch to `main` branch locally.
2. Run `git pull origin main`.
3. Run `git pull --tags` to make sure all tags are fetched.
4. Create new branch with the signature `release/[year]-[month]-[day]`.
4. Create new branch with the signature `release/[year]-[month]-[day]` and push it without any commits to remote as otherwise Melos would fail to version changes on next steps.
5. Run `melos version --no-git-commit-version` to automatically version packages and update Changelogs.
6. Run `melos publish` to dry run and confirm all packages are publishable.
7. After successful dry run, commit all changes with the signature "chore(release): prepare for release".
8. Run `git push origin [RELEASE BRANCH NAME]` & open pull request for review on GitHub.
9. After successful review and merge of the pull request, switch to main branch locally, & run `git pull origin main`.
10. Run `melos publish --no-dry-run --git-tag-version` to now publish to Pub.dev.
10. Run `melos publish --no-dry-run --git-tag-version` to now publish to pub.dev.
11. Run `git push --tags` to push tags to repository.
2 changes: 1 addition & 1 deletion packages/android_alarm_manager_plus/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dev_dependencies:
sdk: flutter
integration_test:
sdk: flutter
flutter_lints: ^4.0.0
flutter_lints: ^5.0.0

flutter:
uses-material-design: true
2 changes: 1 addition & 1 deletion packages/android_alarm_manager_plus/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^4.0.0
flutter_lints: ">=4.0.0 <6.0.0"

flutter:
plugin:
Expand Down
19 changes: 19 additions & 0 deletions packages/android_intent_plus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,25 @@ of integers or strings.
> ACTION_VIEW intents for Android, however this intent plugin also allows
> clients to set extra parameters for the intent.
### Querying activities
`canResolveActivity()` and `getResolvedActivity()` can be used to query whether an activity can handle an intent,
or get the details of the activity that can handle the intent.

```dart
final intent = AndroidIntent(
action: 'action_view',
data: Uri.encodeFull('http://'),
);
// can this intent be handled by an activity
final canHandleIntent = await intent.canResolveActivity();
// get the details of the activity that will handle this intent
final details = await intent.getResolvedActivity();
print(details.packageName); // prints com.google.chrome
```

## Android 11 package visibility

Android 11 introduced new permissions for package visibility.
Expand Down
4 changes: 2 additions & 2 deletions packages/android_intent_plus/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ android {
}

dependencies {
implementation 'androidx.annotation:annotation:1.8.1'
implementation 'androidx.annotation:annotation:1.8.2'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:5.12.0'
testImplementation 'org.mockito:mockito-core:5.13.0'
testImplementation 'androidx.test:core:1.6.1'
testImplementation 'org.robolectric:robolectric:4.13'
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;

/** Forms and launches intents. */
public final class IntentSender {
Expand Down Expand Up @@ -102,6 +105,41 @@ boolean canResolveActivity(Intent intent) {
return packageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null;
}

/**
* Get the default activity that will resolve the intent
*
* <p>This will fail to create and send the intent if {@code applicationContext} hasn't been set *
* at the time of calling.
*
* <p>This currently only supports resolving activities.
*
* @param intent Fully built intent.
* @return Whether the package manager found {@link android.content.pm.ResolveInfo} using its
* {@link PackageManager#resolveActivity(Intent, int)} method.
* @see #buildIntent(String, Integer, String, Uri, Bundle, String, ComponentName, String)
*/
@Nullable
Map<String, Object> getResolvedActivity(Intent intent) {
if (applicationContext == null) {
Log.wtf(TAG, "Trying to resolve an activity before the applicationContext was initialized.");
return null;
}

final PackageManager packageManager = applicationContext.getPackageManager();
ResolveInfo resolveInfo =
packageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);

if (resolveInfo != null) {
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("activityName", resolveInfo.activityInfo.name);
resultMap.put("packageName", resolveInfo.activityInfo.packageName);
resultMap.put("appName", resolveInfo.loadLabel(packageManager));
return resultMap;
}

return null;
}

/** Caches the given {@code activity} to use for {@link #send}. */
void setActivity(@Nullable Activity activity) {
this.activity = activity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
result.success(null);
} else if ("canResolveActivity".equalsIgnoreCase(call.method)) {
result.success(sender.canResolveActivity(intent));
} else if ("getResolvedActivity".equalsIgnoreCase(call.method)) {
result.success(sender.getResolvedActivity(intent));
} else {
result.notImplemented();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@
flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.INTERNET"/>

<queries>
<intent>
<action android:name="android.intent.action.VIEW"/>
<data android:scheme="http"/>
</intent>
<intent>
<action android:name="android.intent.action.VIEW"/>
<data android:scheme="https"/>
</intent>
</queries>

<application
android:name="${applicationName}"
Expand Down
Loading

0 comments on commit 7764000

Please sign in to comment.