Skip to content

Commit

Permalink
fix rhymelph#50 rhymelph#42 , android example code use new flutter ve…
Browse files Browse the repository at this point in the history
…rsion code.
  • Loading branch information
rhyme committed Mar 14, 2022
1 parent f360a7d commit a1b0737
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 53 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 0.3.7+3
* fixed Are you missing a call to unregisterReceiver().
## 0.3.7+2
* fixed android 31 notification problem.
## 0.3.7+1
Expand Down
11 changes: 8 additions & 3 deletions android/src/main/java/com/example/r_upgrade/RUpgradePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,20 @@ public RUpgradePlugin() {
}

private RUpgradePlugin(Activity activity, BinaryMessenger messenger, StoragePermissions.PermissionsRegistry permissionsRegistry) {
initPlugin(activity, messenger, permissionsRegistry);
}

private void initPlugin(Activity activity, BinaryMessenger messenger, StoragePermissions.PermissionsRegistry permissionsRegistry) {
_channel = new MethodChannel(messenger, PLUGIN_METHOD_NAME);
upgradeManager = new UpgradeManager(activity, _channel,new StoragePermissions(),permissionsRegistry);
upgradeManager = new UpgradeManager(activity, _channel, new StoragePermissions(), permissionsRegistry);
_channel.setMethodCallHandler(new RUpgradeMethodCallHandler(upgradeManager));
}

/**
* Plugin registration.
*/
public static void registerWith(final Registrar registrar) {

new RUpgradePlugin(registrar.activity(), registrar.messenger(), new StoragePermissions.PermissionsRegistry() {
@Override
public void addListener(PluginRegistry.RequestPermissionsResultListener handler) {
Expand All @@ -68,13 +73,12 @@ public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {

@Override
public void onAttachedToActivity(@NonNull final ActivityPluginBinding binding) {
new RUpgradePlugin(binding.getActivity(), flutterPluginBinding.getBinaryMessenger(), new StoragePermissions.PermissionsRegistry() {
initPlugin(binding.getActivity(), flutterPluginBinding.getBinaryMessenger(), new StoragePermissions.PermissionsRegistry() {
@Override
public void addListener(PluginRegistry.RequestPermissionsResultListener handler) {
binding.addRequestPermissionsResultListener(handler);
}
});

}

@Override
Expand All @@ -93,6 +97,7 @@ public void onDetachedFromActivity() {
flutterPluginBinding.getApplicationContext().stopService(intent);
if (upgradeManager != null) {
upgradeManager.dispose();
upgradeManager = null;
}
if (_channel != null) {
_channel.setMethodCallHandler(null);
Expand Down
5 changes: 0 additions & 5 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="r_upgrade_example"
android:icon="@mipmap/ic_launcher">
<activity
Expand All @@ -30,10 +29,6 @@
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
4 changes: 2 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
51 changes: 29 additions & 22 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,56 @@ packages:
dependency: transitive
description:
name: async
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "1.3.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "1.15.0"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "0.1.3"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
flutter:
Expand All @@ -76,28 +76,35 @@ packages:
dependency: "direct main"
description:
name: intl
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "0.17.0"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dev"
source: hosted
version: "0.1.3"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "1.7.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "1.8.0"
r_upgrade:
Expand All @@ -106,7 +113,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.3.7+2"
version: "0.3.7+3"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -116,56 +123,56 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "1.8.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "0.4.3"
version: "0.4.8"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
sdks:
Expand Down
Loading

0 comments on commit a1b0737

Please sign in to comment.