-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b24d754
commit 3ada72c
Showing
15 changed files
with
145 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
val versionName = "1.6.1" | ||
val versionName = "1.6.2" | ||
|
||
plugins { | ||
id("com.android.library") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
OmetriaSDK/src/main/java/com/android/ometriasdk/core/OmetriaConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package com.android.ometriasdk.core | ||
|
||
import android.app.Application | ||
import android.content.Context | ||
|
||
internal class OmetriaConfig( | ||
var apiToken: String, | ||
var application: Application | ||
var application: Context | ||
) { | ||
var enableDebugging: Boolean = false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
OmetriaSDK/src/main/java/com/android/ometriasdk/notification/OmetriaMessagingReceiver.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.android.ometriasdk.notification | ||
|
||
import android.content.BroadcastReceiver | ||
import android.content.Context | ||
import android.content.Intent | ||
import com.android.ometriasdk.core.Ometria | ||
import com.android.ometriasdk.core.Ometria.Companion.clearOldInstance | ||
import com.android.ometriasdk.core.event.OmetriaEventType | ||
import com.android.ometriasdk.core.network.toOmetriaNotificationBody | ||
import com.google.firebase.messaging.RemoteMessage | ||
|
||
/** | ||
* Used as Push notification interceptor. | ||
* This will not replace Firebase's own BroadcastReceiver. | ||
* The purpose of using this BroadcastReceive is to log [OmetriaEventType.NOTIFICATION_RECEIVED] event | ||
* when the app is killed for React Native use-case. | ||
*/ | ||
class OmetriaMessagingReceiver : BroadcastReceiver() { | ||
|
||
override fun onReceive(context: Context?, intent: Intent?) { | ||
val remoteMessage = RemoteMessage(intent?.extras) | ||
|
||
try { | ||
Ometria.instance() | ||
} catch (e: IllegalStateException) { | ||
context?.let { | ||
Ometria.initializeForInternalUsage(context) | ||
|
||
if (Ometria.instance().isReactNativeUsage()) { | ||
val ometriaNotificationBody = remoteMessage.toOmetriaNotificationBody() | ||
val ometriaNotificationContext = ometriaNotificationBody?.context | ||
|
||
ometriaNotificationContext?.let { | ||
Ometria.instance().trackNotificationReceivedEvent(it) | ||
clearOldInstance() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters