Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UserNotifications

import OneSignal
import OneSignalFramework

class NotificationService: UNNotificationServiceExtension {

Expand All @@ -14,29 +14,14 @@ class NotificationService: UNNotificationServiceExtension {
self.bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)

if let bestAttemptContent = bestAttemptContent {
//If your SDK version is < 3.5.0 uncomment and use this code:
/*
OneSignal.didReceiveNotificationExtensionRequest(self.receivedRequest, with: self.bestAttemptContent)
contentHandler(bestAttemptContent)
*/

/* DEBUGGING: Uncomment the 2 lines below to check this extension is excuting
Note, this extension only runs when mutable-content is set
Setting an attachment or action buttons automatically adds this */
//OneSignal.setLogLevel(.LL_VERBOSE, visualLevel: .LL_NONE)
//bestAttemptContent.body = "[Modified] " + bestAttemptContent.body

OneSignal.didReceiveNotificationExtensionRequest(self.receivedRequest, with: bestAttemptContent, withContentHandler: self.contentHandler)
}
}

override func serviceExtensionTimeWillExpire() {
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
OneSignal.serviceExtensionTimeWillExpireRequest(self.receivedRequest, with: self.bestAttemptContent)
contentHandler(bestAttemptContent)
}
}

}
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ end

target 'OneSignalNotificationServiceExtension' do
use_frameworks!
pod 'OneSignalXCFramework', '>= 3.4.3', '< 4.0'
pod 'OneSignalXCFramework', '>= 5.0.0', '< 5.1'
end
68 changes: 53 additions & 15 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,57 @@ PODS:
- app_links (0.0.1):
- Flutter
- Flutter (1.0.0)
- onesignal_flutter (3.4.2):
- onesignal_flutter (5.0.3):
- Flutter
- OneSignalXCFramework (= 3.11.4)
- OneSignalXCFramework (3.11.4):
- OneSignalXCFramework/OneSignalCore (= 3.11.4)
- OneSignalXCFramework/OneSignalExtension (= 3.11.4)
- OneSignalXCFramework/OneSignalOutcomes (= 3.11.4)
- OneSignalXCFramework/OneSignalCore (3.11.4)
- OneSignalXCFramework/OneSignalExtension (3.11.4):
- OneSignalXCFramework (= 5.0.2)
- OneSignalXCFramework (5.0.2):
- OneSignalXCFramework/OneSignalComplete (= 5.0.2)
- OneSignalXCFramework/OneSignal (5.0.2):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalExtension
- OneSignalXCFramework/OneSignalNotifications
- OneSignalXCFramework/OneSignalOSCore
- OneSignalXCFramework/OneSignalOutcomes
- OneSignalXCFramework/OneSignalOutcomes (3.11.4):
- OneSignalXCFramework/OneSignalUser
- OneSignalXCFramework/OneSignalComplete (5.0.2):
- OneSignalXCFramework/OneSignal
- OneSignalXCFramework/OneSignalInAppMessages
- OneSignalXCFramework/OneSignalLocation
- OneSignalXCFramework/OneSignalCore (5.0.2)
- OneSignalXCFramework/OneSignalExtension (5.0.2):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalOutcomes
- OneSignalXCFramework/OneSignalInAppMessages (5.0.2):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalNotifications
- OneSignalXCFramework/OneSignalOSCore
- OneSignalXCFramework/OneSignalOutcomes
- OneSignalXCFramework/OneSignalUser
- OneSignalXCFramework/OneSignalLocation (5.0.2):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalNotifications
- OneSignalXCFramework/OneSignalOSCore
- OneSignalXCFramework/OneSignalUser
- OneSignalXCFramework/OneSignalNotifications (5.0.2):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalExtension
- OneSignalXCFramework/OneSignalOutcomes
- OneSignalXCFramework/OneSignalOSCore (5.0.2):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalOutcomes (5.0.2):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalUser (5.0.2):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalNotifications
- OneSignalXCFramework/OneSignalOSCore
- OneSignalXCFramework/OneSignalOutcomes
- path_provider_ios (0.0.1):
- Flutter
- pay_ios (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- Stripe (23.1.1):
- StripeApplePay (= 23.1.1)
- StripeCore (= 23.1.1)
Expand Down Expand Up @@ -64,9 +98,10 @@ DEPENDENCIES:
- app_links (from `.symlinks/plugins/app_links/ios`)
- Flutter (from `Flutter`)
- onesignal_flutter (from `.symlinks/plugins/onesignal_flutter/ios`)
- OneSignalXCFramework (< 4.0, >= 3.4.3)
- OneSignalXCFramework (< 5.1, >= 5.0.0)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- pay_ios (from `.symlinks/plugins/pay_ios/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- stripe_ios (from `.symlinks/plugins/stripe_ios/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)
Expand Down Expand Up @@ -94,6 +129,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider_ios/ios"
pay_ios:
:path: ".symlinks/plugins/pay_ios/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
stripe_ios:
:path: ".symlinks/plugins/stripe_ios/ios"
url_launcher_ios:
Expand All @@ -102,12 +139,13 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"

SPEC CHECKSUMS:
app_links: ab4ba54d10a13d45825336bc9707b5eadee81191
app_links: 5ef33d0d295a89d9d16bb81b0e3b0d5f70d6c875
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
onesignal_flutter: bd3bc654bc632e7d6cc8d219a7caebf0592c63e5
OneSignalXCFramework: 45932e3c1e659e1485bfd765e0543d7f30cc737b
onesignal_flutter: fa2984cb96f6aba3646dfef4d27abbcc94f382dc
OneSignalXCFramework: d47a350b15e106a5dc310e3f97867e28dad6589e
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
pay_ios: 8c7beb9c61d885f3f51b61f75f8793023fc8843a
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
Stripe: ff389e265eeffb891b871b62b2fa644e30e69338
stripe_ios: 728603d6aa71a76f00dd05e202cba7d5b357a4be
StripeApplePay: 4413b4f21c0206094df20775aa5e8e063b9c8b5d
Expand All @@ -120,6 +158,6 @@ SPEC CHECKSUMS:
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f

PODFILE CHECKSUM: 0d520eff7fceb6733c0076a09d72e275f08c0896
PODFILE CHECKSUM: f18ac15cbfad62a6089d3f382a82c9f1d788dd09

COCOAPODS: 1.11.3
COCOAPODS: 1.14.2
11 changes: 7 additions & 4 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -213,9 +213,9 @@
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
674136C72935303200AADD5E /* Embed Foundation Extensions */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
F4952FC84F1A56B8BE85106F /* [CP] Embed Pods Frameworks */,
674136C72935303200AADD5E /* Embed Foundation Extensions */,
);
buildRules = (
);
Expand Down Expand Up @@ -311,20 +311,23 @@
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -335,7 +338,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
};
A1028669E3CBE2CD4CE1F058 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
Expand Down
4 changes: 2 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ void main() async {
await Stripe.instance.applySettings();

//Remove this method to stop OneSignal Debugging
OneSignal.shared.setLogLevel(OSLogLevel.verbose, OSLogLevel.none);
OneSignal.shared.setAppId(onesignalAppId);
OneSignal.Debug.setLogLevel(OSLogLevel.verbose);
OneSignal.initialize(onesignalAppId);

runApp(const MyApp());
}
Expand Down
1 change: 0 additions & 1 deletion lib/screens/auth/auth_screen.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/material.dart';
import 'package:supabase_flutter/supabase_flutter.dart';

Expand Down
4 changes: 2 additions & 2 deletions lib/screens/auth/login_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class _LoginFormState extends State<LoginForm> {
);
final id = authResponse.user?.id;
if (id != null) {
OneSignal.shared.setExternalUserId(id);
OneSignal.login(id);
}
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
Expand Down Expand Up @@ -85,7 +85,7 @@ class _LoginFormState extends State<LoginForm> {
);
final id = authResponse.user?.id;
if (id != null) {
OneSignal.shared.setExternalUserId(id);
OneSignal.login(id);
}
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
Expand Down
4 changes: 1 addition & 3 deletions lib/screens/auth/profile_form.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
import 'package:onesignal_flutter/onesignal_flutter.dart';
import 'package:supabase_flutter/supabase_flutter.dart';

import '../../widgets/example_scaffold.dart';

class ProfileForm extends StatefulWidget {
const ProfileForm({Key? key}) : super(key: key);
Expand Down Expand Up @@ -35,7 +33,7 @@ class _ProfileFormState extends State<ProfileForm> {
final data = (await Supabase.instance.client
.from('profiles')
.select()
.match({'id': userId}).maybeSingle()) as Map?;
.match({'id': userId}).maybeSingle());
if (data != null) {
setState(() {
_usernameController.text = data['username'];
Expand Down
30 changes: 16 additions & 14 deletions lib/screens/card_payments/custom_card_payment_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import 'package:flutter_stripe/flutter_stripe.dart';
import 'package:http/http.dart' as http;

class CustomCardPaymentScreen extends StatefulWidget {
const CustomCardPaymentScreen({super.key});

@override
_CustomCardPaymentScreenState createState() =>
_CustomCardPaymentScreenState();
Expand All @@ -25,26 +27,26 @@ class _CustomCardPaymentScreenState extends State<CustomCardPaymentScreen> {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Container(
margin: EdgeInsets.all(16),
padding: EdgeInsets.all(12),
margin: const EdgeInsets.all(16),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(8),
),
child: Text(
child: const Text(
'If you don\'t want to or can\'t rely on the CardField you'
' can use the dangerouslyUpdateCardDetails in combination with '
'your own card field implementation. \n\n'
'Please beware that this will potentially break PCI compliance: '
'https://stripe.com/docs/security/guide#validating-pci-compliance')),
Padding(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
child: Row(
children: [
Expanded(
flex: 2,
child: TextField(
decoration: InputDecoration(hintText: 'Number'),
decoration: const InputDecoration(hintText: 'Number'),
onChanged: (number) {
setState(() {
_card = _card.copyWith(number: number);
Expand All @@ -57,7 +59,7 @@ class _CustomCardPaymentScreenState extends State<CustomCardPaymentScreen> {
padding: const EdgeInsets.symmetric(horizontal: 4),
width: 80,
child: TextField(
decoration: InputDecoration(hintText: 'Exp. Year'),
decoration: const InputDecoration(hintText: 'Exp. Year'),
onChanged: (number) {
setState(() {
_card = _card.copyWith(
Expand All @@ -71,7 +73,7 @@ class _CustomCardPaymentScreenState extends State<CustomCardPaymentScreen> {
padding: const EdgeInsets.symmetric(horizontal: 4),
width: 80,
child: TextField(
decoration: InputDecoration(hintText: 'Exp. Month'),
decoration: const InputDecoration(hintText: 'Exp. Month'),
onChanged: (number) {
setState(() {
_card = _card.copyWith(
Expand All @@ -85,7 +87,7 @@ class _CustomCardPaymentScreenState extends State<CustomCardPaymentScreen> {
padding: const EdgeInsets.symmetric(horizontal: 4),
width: 80,
child: TextField(
decoration: InputDecoration(hintText: 'CVC'),
decoration: const InputDecoration(hintText: 'CVC'),
onChanged: (number) {
setState(() {
_card = _card.copyWith(cvc: number);
Expand All @@ -104,10 +106,10 @@ class _CustomCardPaymentScreenState extends State<CustomCardPaymentScreen> {
_saveCard = value;
});
},
title: Text('Save card during payment'),
title: const Text('Save card during payment'),
),
Padding(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
child: LoadingButton(
onPressed: _handlePayPress,
text: 'Pay',
Expand All @@ -125,7 +127,7 @@ class _CustomCardPaymentScreenState extends State<CustomCardPaymentScreen> {
try {
// 1. Gather customer billing information (ex. email)

final billingDetails = BillingDetails(
const billingDetails = BillingDetails(
email: '[email protected]',
phone: '+48888000888',
address: Address(
Expand All @@ -140,7 +142,7 @@ class _CustomCardPaymentScreenState extends State<CustomCardPaymentScreen> {

// 2. Create payment method
final paymentMethod = await Stripe.instance.createPaymentMethod(
params: PaymentMethodParams.card(
params: const PaymentMethodParams.card(
paymentMethodData: PaymentMethodData(
billingDetails: billingDetails,
),
Expand All @@ -167,7 +169,7 @@ class _CustomCardPaymentScreenState extends State<CustomCardPaymentScreen> {
paymentIntentResult['requiresAction'] == null) {
// Payment succedeed

ScaffoldMessenger.of(context).showSnackBar(SnackBar(
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content:
Text('Success!: The payment was confirmed successfully!')));
return;
Expand Down Expand Up @@ -202,7 +204,7 @@ class _CustomCardPaymentScreenState extends State<CustomCardPaymentScreen> {
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text('Error: ${result['error']}')));
} else {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text('Success!: The payment was confirmed successfully!')));
}
}
Expand Down
Loading