Skip to content

Commit

Permalink
Fix linting errors with PreferenceStoreFix and OneSignalImp
Browse files Browse the repository at this point in the history
  • Loading branch information
brismithers authored and jinliu9508 committed Feb 6, 2024
1 parent ed0b572 commit d2bfa75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.onesignal.debug.internal.logging.Logging
import java.io.File

object PreferenceStoreFix {

/**
* Ensure the OneSignal preference store is not using the v4 obfuscated version, if one
* exists.
Expand All @@ -20,15 +19,18 @@ object PreferenceStoreFix {
// up the subscription, we need to copy the shared preferences from the obfuscated
// version to the static "OneSignal" preference name. We only do this
// if there isn't already a "OneSignal" preference store.
val sharedPrefsDir = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
File(context.dataDir, "shared_prefs")
} else {
File(context.filesDir.parentFile, "shared_prefs")
}
val sharedPrefsDir =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
File(context.dataDir, "shared_prefs")
} else {
File(context.filesDir.parentFile, "shared_prefs")
}

val osPrefsFile = File(sharedPrefsDir, "OneSignal.xml")

if (!sharedPrefsDir.exists() || !sharedPrefsDir.isDirectory || osPrefsFile.exists())
if (!sharedPrefsDir.exists() || !sharedPrefsDir.isDirectory || osPrefsFile.exists()) {
return
}

val prefsFileList = sharedPrefsDir.listFiles() ?: return

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.onesignal.internal

import android.content.Context
import android.os.Build
import com.onesignal.IOneSignal
import com.onesignal.common.IDManager
import com.onesignal.common.OneSignalUtils
Expand Down

0 comments on commit d2bfa75

Please sign in to comment.