Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Release

on:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
publish:
permissions:
id-token: write # Required for authentication using OIDC
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1

tag:
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Tag
run: |
sudo git config --global user.name 'Jake'
sudo git config --global user.email 'jakemor@users.noreply.github.com'
sudo git pull
echo "\n\n\n- - - - - VERSION - - - - -\n\n\n"
VERSION=$(grep '^version:' pubspec.yaml | awk '{ print $2 }')
echo $VERSION
echo "\n\n\n- - - - - END VERSION - - - - -\n\n\n"
sudo git tag -a "$VERSION" -m "tags with latest version"
sudo git push --tags || true
sudo git checkout -b "release/$VERSION"
sudo git push -u origin "release/$VERSION"

slack:
needs: tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Parse version
id: version
run: |
VERSION=$(grep '^version:' pubspec.yaml | awk '{ print $2 }')
echo "VERSION=$VERSION"
echo "::set-output name=prop::$VERSION"
- name: Determine prerelease status
id: prerelease
run: |
VERSION=${{ steps.version.outputs.prop }}
if [[ "$VERSION" == *"-alpha"* || "$VERSION" == *"-beta"* || "$VERSION" == *"-rc"* ]]; then
echo "::set-output name=status::true"
else
echo "::set-output name=status::false"
fi
- name: Send Slack message
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"text": "Please create a new Flutter release! https://github.com/superwall/Superwall-Flutter/releases/new?tag=${{ steps.version.outputs.prop }}&prerelease=${{ steps.prerelease.outputs.status }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

The changelog for `Superwall`. Also see the [releases](https://github.com/superwall/Superwall-Flutter/releases) on GitHub.

## 2.2.2

### Fixes

- Fixes issue with paywall presentation handlers not working.

## 2.2.1

### Fixes
Expand Down
18 changes: 14 additions & 4 deletions ios/Classes/PaywallPresentationHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import Foundation
final class PaywallPresentationHandlerHost {
private let flutterHandler: PPaywallPresentationHandlerGenerated
let handler: PaywallPresentationHandler
private let placement: String
private let cleanupCallback: (String) -> Void

init(flutterHandler: PPaywallPresentationHandlerGenerated) {
init(flutterHandler: PPaywallPresentationHandlerGenerated, placement: String, cleanupCallback: @escaping (String) -> Void) {
self.flutterHandler = flutterHandler

self.placement = placement
self.cleanupCallback = cleanupCallback
handler = PaywallPresentationHandler()

handler.onPresent { [weak self] paywallInfo in
Expand All @@ -34,8 +37,12 @@ final class PaywallPresentationHandlerHost {
self?.flutterHandler.onDismiss(
paywallInfo: paywallInfo.pigeonify(),
paywallResult: pResult,
completion: { result in
// NO-OP
completion: { [weak self] result in
if paywallInfo.closeReason != .none {
if let self = self {
self.cleanupCallback(self.placement)
}
}
}
)
}
Expand Down Expand Up @@ -65,6 +72,9 @@ final class PaywallPresentationHandlerHost {
reason: pReason,
completion: { result in
// NO-OP
if let self = self {
self.cleanupCallback(self.placement)
}
}
)
}
Expand Down
11 changes: 10 additions & 1 deletion ios/Classes/SuperwallHost.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Combine
final class SuperwallHost : NSObject, PSuperwallHostApi {
private let flutterBinaryMessenger: FlutterBinaryMessenger
private var streamHandler: SubscriptionStatusStreamHandlerImpl?
private var presentationHandlers: [String: PaywallPresentationHandlerHost] = [:]

init(flutterBinaryMessenger: FlutterBinaryMessenger) {
self.flutterBinaryMessenger = flutterBinaryMessenger
Expand Down Expand Up @@ -254,7 +255,15 @@ final class SuperwallHost : NSObject, PSuperwallHostApi {
binaryMessenger: self.flutterBinaryMessenger,
messageChannelSuffix: placement
)
presentationHandler = PaywallPresentationHandlerHost(flutterHandler: flutterHandler).handler
let handlerHost = PaywallPresentationHandlerHost(
flutterHandler: flutterHandler,
placement: placement,
cleanupCallback: { [weak self] placement in
self?.presentationHandlers.removeValue(forKey: placement)
}
)
presentationHandlers[placement] = handlerHost
presentationHandler = handlerHost.handler
} else {
presentationHandler = nil
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: superwallkit_flutter
description: "Remotely configure every aspect of your paywall and double your revenue."
version: 2.2.1
version: 2.2.2
homepage: "https://superwall.com"

environment:
Expand Down