Skip to content

Commit

Permalink
fix compile issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pmtkh committed Aug 16, 2022
1 parent 9a0e9c3 commit 279242d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/android/com/adobe/phonegap/push/FCMService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ class FCMService : FirebaseMessagingService() {
var requestCode = random.nextInt()
val contentIntent = PendingIntent.getActivity(
this,
requestCode,FCMService
requestCode,
notificationIntent,
PendingIntent.FLAG_UPDATE_CURRENT
)
Expand Down Expand Up @@ -491,7 +491,7 @@ class FCMService : FirebaseMessagingService() {
mBuilder.setContentIntent(contentIntent)
}
val prefs: SharedPreferences = context.getSharedPreferences(
PushPlugin.COM_ADOBE_PHONEGAP_PUSH,
PushConstants.COM_ADOBE_PHONEGAP_PUSH,
Context.MODE_PRIVATE
)
val localIcon = pushSharedPref.getString(PushConstants.ICON, null)
Expand Down
27 changes: 14 additions & 13 deletions src/android/com/adobe/phonegap/push/FullScreenActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import android.os.Bundle
import android.util.Log
import android.view.WindowManager

class FullScreenActivity : Activity(), PushConstants {
@Override
fun onCreate(@Nullable savedInstanceState: Bundle?) {
class FullScreenActivity : Activity() {
public override fun onCreate(savedInstanceState: Bundle?) {
Log.d(LOG_TAG, "onCreate")
super.onCreate(savedInstanceState)
turnScreenOnAndKeyguardOff()
Expand All @@ -22,15 +21,14 @@ class FullScreenActivity : Activity(), PushConstants {

private fun forceMainActivityReload() {
val pm: PackageManager = getPackageManager()
val launchIntent: Intent =
val launchIntent: Intent? =
pm.getLaunchIntentForPackage(getApplicationContext().getPackageName())
launchIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
launchIntent.addFlags(Intent.FLAG_FROM_BACKGROUND)
startActivity(launchIntent)
}

@Override
protected fun onDestroy() {
protected override fun onDestroy() {
super.onDestroy()
turnScreenOffAndKeyguardOn()
}
Expand All @@ -47,18 +45,21 @@ class FullScreenActivity : Activity(), PushConstants {
or WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
)
}
val candidate: Object = getSystemService(Context.KEYGUARD_SERVICE)
val candidate: Any! = getSystemService(Context.KEYGUARD_SERVICE)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && candidate != null) {
val keyguardManager: KeyguardManager = candidate as KeyguardManager
keyguardManager.requestDismissKeyguard(this, object : KeyguardDismissCallback() {
@Override
fun onDismissError() {
val keyguardManager: KeyguardManager? = candidate as KeyguardManager
keyguardManager.requestDismissKeyguard(this, object : KeyguardManager.KeyguardDismissCallback() {
override fun onDismissCancelled() {
super.onDismissCancelled()
Log.d("keygurd", "canceled")
}

override fun onDismissError() {
super.onDismissError()
Log.d(LOG_TAG, "onDismissError")
}

@Override
fun onDismissSucceeded() {
override fun onDismissSucceeded() {
super.onDismissSucceeded()
Log.d(LOG_TAG, "onDismissSucceeded")
}
Expand Down

0 comments on commit 279242d

Please sign in to comment.