-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: android OnNewIntent not fired on first app launch
- Loading branch information
Showing
6 changed files
with
54 additions
and
13 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
11 changes: 11 additions & 0 deletions
11
android/src/main/java/expo/modules/shareintent/ExpoShareIntentPackage.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,11 @@ | ||
package expo.modules.shareintent | ||
|
||
import android.content.Context | ||
import expo.modules.core.interfaces.Package | ||
import expo.modules.core.interfaces.ReactActivityLifecycleListener | ||
|
||
class ExpoShareIntentPackage : Package { | ||
override fun createReactActivityLifecycleListeners(activityContext: Context): List<ReactActivityLifecycleListener> { | ||
return listOf(ExpoShareIntentReactActivityLifecycleListener(activityContext)) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...d/src/main/java/expo/modules/shareintent/ExpoShareIntentReactActivityLifecycleListener.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,18 @@ | ||
package expo.modules.shareintent | ||
|
||
import android.app.Activity | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.content.pm.ShortcutManager | ||
import android.os.Build | ||
import android.os.Bundle | ||
import android.util.Log | ||
import expo.modules.core.interfaces.ReactActivityLifecycleListener | ||
|
||
|
||
class ExpoShareIntentReactActivityLifecycleListener(activityContext: Context) : ReactActivityLifecycleListener { | ||
|
||
override fun onCreate(activity: Activity?, savedInstanceState: Bundle?) { | ||
ExpoShareIntentSingleton.intent = activity?.intent | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
android/src/main/java/expo/modules/shareintent/ExpoShareIntentSingleton.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,14 @@ | ||
package expo.modules.shareintent | ||
|
||
import android.content.Intent | ||
import expo.modules.core.interfaces.SingletonModule | ||
|
||
object ExpoShareIntentSingleton : SingletonModule { | ||
|
||
override fun getName(): String { | ||
return "ExpoShareIntent" | ||
} | ||
|
||
// member to store the initial launch intent | ||
var intent: Intent? = null | ||
} |
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