Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 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,3 +1,7 @@
## 0.3.0+3

* Implements transaction caching for StoreKit ensuring transactions are delivered to the Flutter client.

## 0.3.0+2

* Internal code cleanup for stricter analysis options.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 50;
objects = {

/* Begin PBXBuildFile section */
Expand All @@ -22,6 +22,7 @@
A5279298219369C600FF69E6 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A5279297219369C600FF69E6 /* StoreKit.framework */; };
A59001A721E69658004A3E5E /* InAppPurchasePluginTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A59001A621E69658004A3E5E /* InAppPurchasePluginTests.m */; };
F67646F82681D9A80048C2EA /* FIAPPaymentQueueDeleteTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F67646F72681D9A80048C2EA /* FIAPPaymentQueueDeleteTests.m */; };
F6995BDD27CF73000050EA78 /* FIATransactionCacheTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F6995BDC27CF73000050EA78 /* FIATransactionCacheTests.m */; };
F78AF3142342BC89008449C7 /* PaymentQueueTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F78AF3132342BC89008449C7 /* PaymentQueueTests.m */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -78,6 +79,7 @@
A59001A821E69658004A3E5E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E4F9651425A612301059769C /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
F67646F72681D9A80048C2EA /* FIAPPaymentQueueDeleteTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FIAPPaymentQueueDeleteTests.m; sourceTree = "<group>"; };
F6995BDC27CF73000050EA78 /* FIATransactionCacheTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FIATransactionCacheTests.m; sourceTree = "<group>"; };
F6E5D5F926131C4800C68BED /* Configuration.storekit */ = {isa = PBXFileReference; lastKnownFileType = text; path = Configuration.storekit; sourceTree = "<group>"; };
F78AF3132342BC89008449C7 /* PaymentQueueTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PaymentQueueTests.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -190,6 +192,7 @@
F78AF3132342BC89008449C7 /* PaymentQueueTests.m */,
688DE35021F2A5A100EA2684 /* TranslatorTests.m */,
F67646F72681D9A80048C2EA /* FIAPPaymentQueueDeleteTests.m */,
F6995BDC27CF73000050EA78 /* FIATransactionCacheTests.m */,
);
path = RunnerTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -254,7 +257,7 @@
isa = PBXProject;
attributes = {
DefaultBuildSystemTypeForWorkspace = Original;
LastUpgradeCheck = 1100;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "The Flutter Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -406,6 +409,7 @@
F67646F82681D9A80048C2EA /* FIAPPaymentQueueDeleteTests.m in Sources */,
6896B34621E9363700D37AEF /* ProductRequestHandlerTests.m in Sources */,
688DE35121F2A5A100EA2684 /* TranslatorTests.m in Sources */,
F6995BDD27CF73000050EA78 /* FIATransactionCacheTests.m in Sources */,
A59001A721E69658004A3E5E /* InAppPurchasePluginTests.m in Sources */,
6896B34C21EEB4B800D37AEF /* Stubs.m in Sources */,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import <XCTest/XCTest.h>

@import in_app_purchase_storekit;

@interface FIATransactionCacheTests : XCTestCase

@end

@implementation FIATransactionCacheTests

- (void)testAddObjectsForNewKey {
NSArray *dummyArray = @[ @1, @2, @3 ];
FIATransactionCache *cache = [[FIATransactionCache alloc] init];
[cache addObjects:dummyArray forKey:TransactionCacheKeyUpdatedTransactions];

XCTAssertEqual(dummyArray, [cache getObjectsForKey:TransactionCacheKeyUpdatedTransactions]);
}

- (void)testAddObjectsForExistingKey {
NSArray *dummyArray = @[ @1, @2, @3 ];
FIATransactionCache *cache = [[FIATransactionCache alloc] init];
[cache addObjects:dummyArray forKey:TransactionCacheKeyUpdatedTransactions];

XCTAssertEqual(dummyArray, [cache getObjectsForKey:TransactionCacheKeyUpdatedTransactions]);

[cache addObjects:@[ @4, @5, @6 ] forKey:TransactionCacheKeyUpdatedTransactions];

NSArray *expected = @[ @1, @2, @3, @4, @5, @6 ];
XCTAssertEqualObjects(expected, [cache getObjectsForKey:TransactionCacheKeyUpdatedTransactions]);
}

- (void)testGetObjectsForNonExistingKey {
FIATransactionCache *cache = [[FIATransactionCache alloc] init];
XCTAssertNil([cache getObjectsForKey:TransactionCacheKeyUpdatedTransactions]);
}

- (void)testRemoveObjectsForNonExistingKey {
FIATransactionCache *cache = [[FIATransactionCache alloc] init];
[cache removeObjectsForKey:TransactionCacheKeyUpdatedTransactions];
}

- (void)testRemoveObjectsForExistingKey {
NSArray *dummyArray = @[ @1, @2, @3 ];
FIATransactionCache *cache = [[FIATransactionCache alloc] init];
[cache addObjects:dummyArray forKey:TransactionCacheKeyUpdatedTransactions];

XCTAssertEqual(dummyArray, [cache getObjectsForKey:TransactionCacheKeyUpdatedTransactions]);

[cache removeObjectsForKey:TransactionCacheKeyUpdatedTransactions];
XCTAssertNil([cache getObjectsForKey:TransactionCacheKeyUpdatedTransactions]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to be safe, it would be good to add something for each key before, and assert that they are all nil after.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, should have done so right away.

}
@end
Loading