Skip to content
This repository was archived by the owner on Feb 27, 2025. It is now read-only.

Install Airbridge SDK and Migrate from Firebase Dynamic Links#3

Open
dsa28s wants to merge 1 commit intomainfrom
feature/install-airbridge-sdk-a1xp765cl81w
Open

Install Airbridge SDK and Migrate from Firebase Dynamic Links#3
dsa28s wants to merge 1 commit intomainfrom
feature/install-airbridge-sdk-a1xp765cl81w

Conversation

@dsa28s
Copy link
Copy Markdown

@dsa28s dsa28s commented Oct 22, 2024

Install Airbridge SDK and Migrate from Firebase Dynamic Links

This PR installs the Airbridge SDK and migrates the app from using Firebase Dynamic Links to Airbridge Deeplinks.

Changes

  • Added Airbridge SDK dependency
  • Initialized Airbridge SDK in DuckeeApplication
  • Removed Firebase Dynamic Links related code and dependencies
  • Implemented Airbridge Deeplinks handling in MainActivity
  • Updated AndroidManifest.xml to support Airbridge Deeplinks
  • Updated Deeplink format

Important Notes

  • The Deeplink format has changed from Firebase Dynamic Links to Airbridge Deeplinks:
    • Old format: https://duckee.page.link/...
    • New format: duckee://...
  • Examples of new Deeplink formats:
    • Recipe: duckee://recipe/123
    • Detail: duckee://detail/abc-def-ghi
    • Explore: duckee://explore
    • Collection: duckee://collection
    • Sign In: duckee://signin

Action Required

  • Update all existing Deeplinks in marketing materials and documentation to reflect the new format.
  • Test the app thoroughly to ensure all Deeplink functionalities are working as expected with the new Airbridge implementation.

Testing

Please test the following scenarios:

  1. App installation and initialization
  2. Deeplink handling for all supported paths
  3. Deferred Deeplink handling
  4. General app functionality to ensure no regressions

If you encounter any issues or have any questions, please don't hesitate to comment on this PR.

Comment on lines +41 to +69
<!-- Airbridge deeplinks -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="duckee.abr.ge"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="duckee.page.link"
android:host="duckee.airbridge.io"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="duckee" />
</intent-filter>
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated the AndroidManifest.xml to include Airbridge deeplink schemes and hosts. This configuration is crucial for the app to intercept and handle Airbridge deeplinks correctly. Without these intent filters, the app won't be able to respond to Airbridge deeplinks.

Comment on lines +121 to +129
private fun handleAirbridgeDeeplink() {
Airbridge.handleDeeplink(intent) { deeplink ->
handleDeeplink(deeplink)
}

Airbridge.handleDeferredDeeplink { deeplink ->
deeplink?.let { handleDeeplink(it) }
}
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Implemented Airbridge deeplink handling logic. This code is called when the app is launched or resumed via a deeplink, and navigates the user to the appropriate screen. The navigation controller is used to move to the screen corresponding to the deeplink URL.

Comment on lines +131 to 168
private fun handleDeeplink(deeplink: Uri) {
val path = deeplink.path ?: return
when {
path.startsWith("/recipe/") -> {
val recipePattern = "/recipe/(\\d+)".toRegex()
val matchResult = recipePattern.find(path)
matchResult?.let { result ->
val recipeId = result.groupValues[1]
navigationController?.navigateToRecipeScreen(recipeId)
}
}

path.startsWith("/detail/") -> {
val detailPattern = "/detail/([\\w-]+)".toRegex()
val matchResult = detailPattern.find(path)
matchResult?.let { result ->
val detailId = result.groupValues[1]
navigationController?.navigateToDetailScreen(detailId)
}
}
.addOnFailureListener(this) { e ->
Timber.tag("[DuckeeMainActivity]").w(e, "getDynamicLink:onFailure")

path == "/explore" -> {
navigationController?.navigateToExploreTab()
}

path == "/collection" -> {
navigationController?.navigateToCollectionTab()
}

path == "/signin" -> {
navigationController?.navigateToSignInScreen()
}

else -> {
Timber.tag("[DuckeeMainActivity]").w("Unhandled deep link path: $path")
}
}
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Refactored the deeplink handling logic to support both Airbridge deeplinks and deferred deeplinks. This change ensures that the app can handle various types of deeplinks, including those that might be triggered after the app is installed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant