Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
1
1weather
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
1weather
Commits
8980fc87
Commit
8980fc87
authored
Sep 15, 2021
by
Dmitry Stepanets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on verify subscription
parent
7b9c9f69
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
13 deletions
+23
-13
1Weather/InApps/Configuration.storekit
+17
-8
1Weather/InApps/StoreManager.swift
+4
-2
OneWeatherCore/OneWeatherCore/ModelObjects/Config/Subscriptions/SubscriptionsListConfig.swift
+2
-3
No files found.
1Weather/InApps/Configuration.storekit
View file @
8980fc87
...
...
@@ -60,27 +60,36 @@
"referenceName" : "Premium Subscription Yearly",
"subscriptionGroupID" : "AC6BEB61",
"type" : "RecurringSubscription"
}
]
},
{
"id" : "4BDB84FF",
"localizations" : [
],
"name" : "Premium Subscription (for Pro)",
"subscriptions" : [
{
"adHocOffers" : [
],
"displayPrice" : "1.49",
"familyShareable" : false,
"groupNumber" : 1,
"internalID" : "
06580AD5
",
"internalID" : "
9E811EB0
",
"introductoryOffer" : null,
"localizations" : [
{
"description" : "
Test Description 1W Monthly (Pro)
",
"description" : "",
"displayName" : "1Weather Premium Monthly (Pro)",
"locale" : "en_US"
}
],
"productID" : "com.onelouder.oneweather.subscription.
premium.forPro
",
"productID" : "com.onelouder.oneweather.subscription.
forPro.premium
",
"recurringSubscriptionPeriod" : "P1M",
"referenceName" : "Premium Subscription Monthly (for Pro)",
"subscriptionGroupID" : "
AC6BEB61
",
"subscriptionGroupID" : "
4BDB84FF
",
"type" : "RecurringSubscription"
},
{
...
...
@@ -90,19 +99,19 @@
"displayPrice" : "6.99",
"familyShareable" : false,
"groupNumber" : 1,
"internalID" : "
FE3C47E9
",
"internalID" : "
0EE8019B
",
"introductoryOffer" : null,
"localizations" : [
{
"description" : "
Test Description 1W Yearly (Pro)
",
"description" : "",
"displayName" : "1Weather Premium Yearly (Pro)",
"locale" : "en_US"
}
],
"productID" : "com.onelouder.oneweather.subscription.pr
emium.yearly.forPro
",
"productID" : "com.onelouder.oneweather.subscription.pr
o.premium.yearly
",
"recurringSubscriptionPeriod" : "P1Y",
"referenceName" : "Premium Subscription Yearly (for Pro)",
"subscriptionGroupID" : "
AC6BEB61
",
"subscriptionGroupID" : "
4BDB84FF
",
"type" : "RecurringSubscription"
}
]
...
...
1Weather/InApps/StoreManager.swift
View file @
8980fc87
...
...
@@ -200,13 +200,15 @@ public class StoreManager {
SwiftyStoreKit
.
verifyReceipt
(
using
:
appleValidator
)
{
result
in
switch
result
{
case
.
success
(
let
receipt
):
let
purchaseResult
=
SwiftyStoreKit
.
verifySubscriptions
(
productIds
:
self
.
allSubscriptionIds
,
inReceipt
:
receipt
)
let
purchaseResult
=
SwiftyStoreKit
.
verifySubscriptions
(
ofType
:
.
autoRenewable
,
productIds
:
self
.
allSubscriptionIds
,
inReceipt
:
receipt
)
switch
purchaseResult
{
case
.
purchased
(
let
expiryDate
,
let
items
):
log
.
debug
(
"Verify: purchased subscription (valid until
\(
expiryDate
)
)! Items:
\(
items
)
"
)
self
.
hasSubscription
=
true
self
.
everHadSubscription
=
true
self
.
subscriptionExpirationDate
=
expiryDate
if
let
expDate
=
items
.
first
?
.
subscriptionExpirationDate
{
self
.
subscriptionExpirationDate
=
expDate
}
case
.
expired
(
let
expiryDate
,
let
items
):
log
.
debug
(
"Subscription expired since
\(
expiryDate
)\n\(
items
)\n
"
)
self
.
everHadSubscription
=
true
...
...
OneWeatherCore/OneWeatherCore/ModelObjects/Config/Subscriptions/SubscriptionsListConfig.swift
View file @
8980fc87
...
...
@@ -15,7 +15,6 @@ public struct SubscriptionsListConfig {
public
let
yearlyDiscounted
:
SubscriptionConfig
public
init
(
subscriptionsEnabled
:
Bool
,
monthly
:
SubscriptionConfig
,
yearly
:
SubscriptionConfig
,
monthlyDiscounted
:
SubscriptionConfig
,
yearlyDiscounted
:
SubscriptionConfig
)
{
self
.
subscriptionsEnabled
=
subscriptionsEnabled
self
.
monthly
=
monthly
self
.
yearly
=
yearly
...
...
@@ -27,8 +26,8 @@ public struct SubscriptionsListConfig {
self
.
subscriptionsEnabled
=
true
self
.
monthly
=
SubscriptionConfig
(
productId
:
"com.onelouder.oneweather.subscription.premium"
)
self
.
yearly
=
SubscriptionConfig
(
productId
:
"com.onelouder.oneweather.subscription.premium.yearly"
)
self
.
monthlyDiscounted
=
SubscriptionConfig
(
productId
:
"com.onelouder.oneweather.subscription.
premium.forPro
"
)
self
.
yearlyDiscounted
=
SubscriptionConfig
(
productId
:
"com.onelouder.oneweather.subscription.pr
emium.yearly.forPro
"
)
self
.
monthlyDiscounted
=
SubscriptionConfig
(
productId
:
"com.onelouder.oneweather.subscription.
forPro.premium
"
)
self
.
yearlyDiscounted
=
SubscriptionConfig
(
productId
:
"com.onelouder.oneweather.subscription.pr
o.premium.yearly
"
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment