Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ group 'com.zhalkhas.phoenix_native'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.8.0'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -25,6 +25,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
namespace "com.zhalkhas.phoenix_native"
compileSdkVersion 30

compileOptions {
Expand All @@ -47,4 +48,5 @@ android {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.jakewharton:process-phoenix:2.1.2'
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.zhalkhas.phoenix_native

import android.app.Activity
import android.content.Context
import androidx.annotation.NonNull
import com.jakewharton.processphoenix.ProcessPhoenix

import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.embedding.engine.plugins.activity.ActivityAware
Expand All @@ -15,16 +17,20 @@ import io.flutter.plugin.common.MethodChannel.Result
class PhoenixNativePlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
private lateinit var channel: MethodChannel
private var activity: Activity? = null

private lateinit var context: Context

override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
channel = MethodChannel(flutterPluginBinding.binaryMessenger, "phoenix_native")
channel.setMethodCallHandler(this)

context = flutterPluginBinding.applicationContext
}

override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
if (call.method == "restart") {
activity?.recreate()
// activity?.recreate()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove activity related code, without commenting it please? Thanks!

ProcessPhoenix.triggerRebirth(context)

result.success(true)
} else {
result.notImplemented()
Expand Down