-
Notifications
You must be signed in to change notification settings - Fork 105
Add Workflows network layer #3300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vegaro
wants to merge
26
commits into
main
Choose a base branch
from
feat/multipage-paywalls-milestone-1-go8
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
6b12219
Add `GetWorkflows` and `GetWorkflow`
vegaro 939f21f
Add typed WorkflowTrigger model to match backend response shape
vegaro 2b01ff3
Fix unknown action crash and use consistent import style
vegaro 2e253b5
PR comments
vegaro c0e8e35
Remove unused uiConfig from WorkflowsListResponse
vegaro e7efbfe
Change PublishedWorkflow.metadata to Map<String, Any>
vegaro 9310914
Remove unused metadata and contentMaxWidth from PublishedWorkflow
vegaro 1427405
add JsonObjectToMapSerializer
vegaro f64f413
Add WorkflowDetailResponse envelope model and hash field
vegaro ca0226c
Simplify Backend.getWorkflow() to return raw envelope
vegaro 8690d2d
Enable signature verification for GetWorkflow endpoint
vegaro 7bacd77
Add WorkflowDetailResolver with CDN hash verification
vegaro cb71b78
Add WorkflowManager to coordinate Backend + WorkflowDetailResolver
vegaro b9a3180
add type paywall
vegaro 8e0e582
fix import
vegaro 980e650
catch IOException
vegaro 724aa86
more imports
vegaro 36ffc5e
feat: add workflow public API and network layer
vegaro 925f940
chore: revert public workflow API from network layer
vegaro 9f3e90f
updates hash to match backend
vegaro cddfcaf
rename to workflowListCallbacks
vegaro a76d1f7
remove getWorkflows from network layer
vegaro 9e5c450
fix import
vegaro 1a6e1d2
throw SignatureVerificationException
vegaro 5795e3f
Merge branch 'main' into feat/multipage-paywalls-milestone-1-go8
vegaro e6e0a7b
remove supression
vegaro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
35 changes: 35 additions & 0 deletions
35
purchases/src/main/kotlin/com/revenuecat/purchases/common/workflows/WorkflowCdnFetcher.kt
This file contains hidden or 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,35 @@ | ||
| @file:OptIn(InternalRevenueCatAPI::class) | ||
|
|
||
| package com.revenuecat.purchases.common.workflows | ||
|
|
||
| import com.revenuecat.purchases.InternalRevenueCatAPI | ||
| import com.revenuecat.purchases.storage.FileRepository | ||
| import kotlinx.coroutines.runBlocking | ||
| import java.io.File | ||
| import java.io.IOException | ||
| import java.net.URL | ||
|
|
||
| /** | ||
| * Fetches compiled workflow JSON from a CDN URL (inject for tests; use [FileCachedWorkflowCdnFetcher] in production). | ||
| */ | ||
| internal fun interface WorkflowCdnFetcher { | ||
| @Throws(IOException::class) | ||
| fun fetchCompiledWorkflowJson(cdnUrl: String): String | ||
| } | ||
|
|
||
| /** | ||
| * Uses [FileRepository] for disk caching. | ||
| */ | ||
| internal class FileCachedWorkflowCdnFetcher( | ||
| private val fileRepository: FileRepository, | ||
| ) : WorkflowCdnFetcher { | ||
|
|
||
| @Throws(IOException::class) | ||
| override fun fetchCompiledWorkflowJson(cdnUrl: String): String { | ||
| val url = URL(cdnUrl) | ||
| return runBlocking { | ||
| val uri = fileRepository.generateOrGetCachedFileURL(url) | ||
| File(uri).readText() | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.